00001 #ifndef INUKE_RW_H
00002 #define INUKE_RW_H
00003 #include <vector>
00004 #include <ostream>
00005
00006
00007 class NtpStRecord;
00008 class NtpMCTruth;
00009
00010
00011 namespace inuke_reweight {
00012 typedef enum inuke_particle{
00013 kPion,
00014 kNucleon,
00015 kOther
00016 } inuke_particle_t;
00017
00018 class delta_fate {
00019
00020 public:
00021 float cex,elas,inel,abs,pp,npp,nnp,npnp,piprod;
00022 delta_fate();
00023 void set_abs_fates(float f);
00024 void set_abs_fates(){set_abs_fates(abs);}
00025 std::ostream& print(std::ostream&);
00026
00027 };
00028 class delta_scale {
00029
00030 public:
00031 float rhonuc,ft,xsec;
00032 delta_scale();
00033 std::ostream& print(std::ostream&);
00034
00035 };
00036
00037 class parameter_set {
00038
00039 public:
00040
00041 inuke_reweight::delta_fate pi_fate;
00042 inuke_reweight::delta_fate pn_fate;
00043 inuke_reweight::delta_scale pi_scale;
00044 inuke_reweight::delta_scale pn_scale;
00045
00046 std::ostream& print(std::ostream&);
00047 double get_par(int ipar);
00048 };
00049
00050 class parameter_limits {
00051
00052 public:
00053 parameter_limits();
00054 parameter_limits(const inuke_reweight::parameter_set& sigmas,
00055 float nsigma);
00056 inuke_reweight::parameter_set upper;
00057 inuke_reweight::parameter_set lower;
00058
00059 std::ostream& print(std::ostream&);
00060
00061 };
00062
00063
00064
00065
00066
00067 void change_fate_probs(const inuke_reweight::delta_fate& ,
00068 const inuke_reweight::inuke_particle_t&);
00069
00070 void change_inter_scales(const inuke_reweight::delta_scale&,
00071 const inuke_reweight::inuke_particle_t&);
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 double calc_weights();
00082
00083
00084
00085
00086 void calc_weights(const NtpStRecord*, std::vector<double>&,
00087 bool verbose=false);
00088
00089 void calc_weights(const NtpStRecord*, const NtpMCTruth*,
00090 const std::vector<inuke_reweight::parameter_set>& v,
00091 std::vector<double>&, double& nucrad, double& wrad,
00092 bool verbose=false);
00093
00094 void test_calc_weights(const char* filename, int entry,
00095 const inuke_reweight::delta_fate& pi_fate,
00096 const inuke_reweight::delta_scale& pi_scale,
00097 const inuke_reweight::delta_fate& pn_fate,
00098 const inuke_reweight::delta_scale& pn_scale);
00099
00100 void test_calc_weights(const char* filename, int entry,
00101 const inuke_reweight::parameter_set& p);
00102
00103
00104
00105
00106 void generate_1sigma_shifts(const inuke_reweight::parameter_set& sigmas,
00107 std::vector<inuke_reweight::parameter_set>& v);
00108
00109 void generate_uncor_shifts(const inuke_reweight::parameter_set& sigmas,
00110 const inuke_reweight::parameter_limits& limits,
00111 inuke_reweight::parameter_set& p);
00112
00113
00114
00115
00116
00117 void get_1sigma_shifts(const inuke_reweight::delta_scale& f,
00118 std::vector<inuke_reweight::delta_scale>& v);
00119
00120 void get_1sigma_shifts(const inuke_reweight::delta_fate& f,
00121 std::vector<inuke_reweight::delta_fate>& v);
00122
00123 void get_uncor_shifts(const inuke_reweight::delta_scale& f,
00124 const inuke_reweight::delta_scale& llim,
00125 const inuke_reweight::delta_scale& ulim,
00126 inuke_reweight::delta_scale& v);
00127
00128
00129 void get_uncor_shifts(const inuke_reweight::delta_fate& f,
00130 const inuke_reweight::delta_fate& llim,
00131 const inuke_reweight::delta_fate& ulim,
00132 inuke_reweight::delta_fate& v);
00133
00134
00135 int get_idx_had();
00136
00137 double get_nucrad(int idx_had);
00138
00139
00140 double unif_to_ws_fe(double r);
00141
00142 }
00143
00144 #endif