Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

inuke_rw.h

Go to the documentation of this file.
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     // simple C analogue of inuke_reweight.fi : fate_delta_pn
00020   public:
00021     float cex,elas,inel,abs,pp,npp,nnp,npnp,piprod;//npnp called 4n4p in NEUGEN
00022     delta_fate();
00023     void set_abs_fates(float f);// set all absorption fates together
00024     void set_abs_fates(){set_abs_fates(abs);}
00025     std::ostream& print(std::ostream&);
00026         
00027   };
00028   class delta_scale {
00029     // simple C analogue of inuke_reweight.fi: rw_*scale
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   // call inuke_reweight.F : change_fate_probs
00065   // changes fate probabilities in fates_rw (variables rw_*)
00066   // note: this doesn't change the defaults in neugen
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   // calculate the weight for whatever event is in stdhep
00074   // we call the following:
00075   //     call identify_hadronic_system(idx_had,icode_had)
00076   //     call summarise_prenuke(idx_had,icode_had)
00077   //     call fill_shower_ntuple
00078   //
00079   // common /shwr/ ends up filled with weights for each hadron
00080   // function returns the event weight.
00081   double calc_weights();
00082   
00083   // calculate the weights for the entire record
00084   // push them back, in order, onto the vector
00085   // optional verbose output
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   // generate uncorrelated 1 sigma shifts
00104   // one parameter shifted +/- at a time.
00105   // sigmas holds the magnitude of the shifts
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   // utility functions
00114   // generate a vector of scale or fate parameter sets
00115   // from the shifts recorded in the input variable f
00116   // the sets are made by shifting each parameter in f by +/- 1 sigma
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   // get the stdhep index of the hadronic system
00135   int get_idx_had();
00136   // get the radial position inside the nucleus
00137   double get_nucrad(int idx_had);
00138 
00139   // correction factor for uniform density to WS in iron
00140   double unif_to_ws_fe(double r);
00141   
00142 }
00143 
00144 #endif

Generated on Mon Feb 15 11:06:48 2010 for loon by  doxygen 1.3.9.1