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

NuIntranuke Class Reference

#include <NuIntranuke.h>

List of all members.

Public Member Functions

 NuIntranuke ()
 ~NuIntranuke ()
bool RecoReweight (const NtpStRecord &ntp, const NtpSREvent &evt)
int GetNwts ()
float GetWeight (int index)
float * GetWeights ()
double GetNucrad ()
double GetWrad ()
double GetFateWeight (int ii)
double GetInteractionWeight (int ii)
double GetIFWeight ()
bool InitReweight ()
bool Reweight (const NtpStRecord *strecord, const NtpMCTruth *ntpTruth)

Public Attributes

bool fOnlyWriteFidEvents
bool IsInit
bool is_pitt_fid
int fNRandomSets

Private Member Functions

inuke_reweight::parameter_set GetSigmas ()

Private Attributes

neugen_confignc
neugen_wrappernw
float * inuke_wts
int n_inuke_wts
int nwts
double nucrad
double wrad
double fate_weight
double interaction_weight
inuke_reweight::parameter_set sigmas
std::vector< inuke_reweight::parameter_setpsets


Constructor & Destructor Documentation

NuIntranuke::NuIntranuke  ) 
 

Definition at line 33 of file NuIntranuke.cxx.

References InitReweight().

00034   :fOnlyWriteFidEvents(false),
00035    IsInit(false),
00036    is_pitt_fid(false),
00037    fNRandomSets(0),
00038    nucrad(-1),
00039    wrad(1)
00040 {
00041   this->InitReweight();
00042 }

NuIntranuke::~NuIntranuke  ) 
 

Definition at line 44 of file NuIntranuke.cxx.

References nc, and nw.

00045 {
00046   if (nw){delete nw; nw=0;}
00047   if (nc){delete nc; nc=0;}
00048 }


Member Function Documentation

double NuIntranuke::GetFateWeight int  ii  ) 
 

double NuIntranuke::GetIFWeight  ) 
 

double NuIntranuke::GetInteractionWeight int  ii  ) 
 

double NuIntranuke::GetNucrad  ) 
 

Definition at line 200 of file NuIntranuke.cxx.

Referenced by NuReco::GetTruthInfo().

00200 {return nucrad;}

int NuIntranuke::GetNwts  ) 
 

Definition at line 180 of file NuIntranuke.cxx.

References psets.

Referenced by NuReco::GetTruthInfo().

00180                         { 
00181   return psets.size();
00182 }

inuke_reweight::parameter_set NuIntranuke::GetSigmas  )  [private]
 

Definition at line 155 of file NuIntranuke.cxx.

References inuke_reweight::delta_fate::abs, inuke_reweight::delta_fate::cex, inuke_reweight::delta_fate::elas, inuke_reweight::delta_scale::ft, inuke_reweight::delta_fate::inel, inuke_reweight::parameter_set::pi_fate, inuke_reweight::parameter_set::pi_scale, inuke_reweight::delta_fate::piprod, inuke_reweight::parameter_set::pn_fate, inuke_reweight::parameter_set::pn_scale, and inuke_reweight::delta_scale::xsec.

Referenced by InitReweight().

00156 {
00157 
00158     /*                   
00159           sigmas.pi_fate.inel=0.2;
00160           sigmas.pi_fate.abs=0.25;
00161           sigmas.pi_scale.ft=0.5; 
00162           sigmas.pi_scale.xsec=0.1;    
00163           //    sigmas.pn_scale.ft=0.5;
00164           sigmas.pn_scale.xsec=0.1;
00165   */
00166 
00167   inuke_reweight::parameter_set sigmas;
00168   sigmas.pi_fate.elas=0.1;
00169   sigmas.pi_fate.inel=0.4;
00170   sigmas.pi_fate.abs=0.3;
00171   sigmas.pi_fate.cex=0.49;
00172   sigmas.pi_fate.piprod=0.2;
00173   sigmas.pi_scale.xsec=0.1;
00174   sigmas.pn_fate.abs=0.2;
00175   sigmas.pn_fate.piprod=0.2;
00176   sigmas.pn_scale.xsec=0.1;
00177   sigmas.pi_scale.ft=0.5; // apply to both pi and p       
00178   return sigmas;
00179 }

float NuIntranuke::GetWeight int  index  ) 
 

Definition at line 198 of file NuIntranuke.cxx.

References inuke_wts.

Referenced by NuReco::GetTruthInfo().

00198 {return inuke_wts[index];}

float * NuIntranuke::GetWeights  ) 
 

Definition at line 199 of file NuIntranuke.cxx.

00199 {return inuke_wts;}

double NuIntranuke::GetWrad  ) 
 

Definition at line 201 of file NuIntranuke.cxx.

Referenced by NuReco::GetTruthInfo().

00201 {return wrad;}

bool NuIntranuke::InitReweight  ) 
 

BEGIN: intranuke reweighting init.

Definition at line 49 of file NuIntranuke.cxx.

References neugen_wrapper::begin_generation(), inuke_reweight::delta_fate::elas, fNRandomSets, inuke_reweight::delta_scale::ft, inuke_reweight::generate_1sigma_shifts(), inuke_reweight::generate_uncor_shifts(), GetSigmas(), inuke_wts, IsInit, inuke_reweight::parameter_limits::lower, n_inuke_wts, nc, nucrad, nw, inuke_reweight::parameter_set::pi_fate, inuke_reweight::parameter_set::pi_scale, inuke_reweight::parameter_limits::print(), inuke_reweight::parameter_set::print(), neugen_wrapper::print_configuration(), psets, inuke_reweight::delta_fate::set_abs_fates(), neugen_config::set_config_no(), sigmas, inuke_reweight::parameter_limits::upper, and wrad.

Referenced by NuIntranuke().

00049                                {
00050   if(IsInit) return IsInit;
00054 
00055   nucrad=-1.0; // no idea
00056   wrad=1.0;    // no idea
00057   sigmas = GetSigmas();
00058   //  gSystem->Setenv("NEUGEN3_XSEC","MODBYRS5_xsec.dat");
00059   nc = new neugen_config("MODBYRS");
00060   nc->set_config_no(5);
00061   nw= new neugen_wrapper(nc);
00062   nw->print_configuration();
00063   nw->begin_generation();
00064  
00065 
00066   
00067   std::cout<<"Inuke Reweight sigmas: "<<std::endl;
00068   sigmas.print(std::cout);
00069   
00070   
00071     if(fNRandomSets<=0) {
00072       cout<<" Generate 1-Sigma shifts"<<endl;
00073       inuke_reweight::generate_1sigma_shifts(sigmas,psets);    
00074       cout<<"  --- psets size is "<<psets.size()<<endl;
00075       if(psets.size()<=0)  return false;
00076 
00077       for(unsigned int iset=0; iset<psets.size(); iset++){
00078         psets[iset].pi_fate.set_abs_fates();
00079         psets[iset].pn_fate.set_abs_fates();
00080         psets[iset].pn_scale.ft=psets[iset].pi_scale.ft; // pi,pn same Ftime
00081         // correlate change in pn xsec with change in pn elastic fate
00082         if(psets[iset].pn_scale.xsec!=0) {
00083           psets[iset].pn_fate.elas = 2.0*psets[iset].pn_scale.xsec;
00084         }
00085       }
00086     }
00087     else{
00088       inuke_reweight::parameter_limits limits(sigmas,2.0);
00089       limits.upper.pi_scale.ft=0.5;  // special case, 1 sigma, but uniform dist
00090       limits.lower.pi_scale.ft=-0.5;
00091       std::cout<<"Inuke Reweight Limits: "<<std::endl;
00092       limits.print(std::cout);
00093       gRandom->SetSeed(1);
00094       for(int i=0; i<fNRandomSets; i++){
00095         inuke_reweight::parameter_set p;
00096         inuke_reweight::generate_uncor_shifts(sigmas,limits,p);
00097         psets.push_back(p);
00098         cout<<" at "<<i<<endl;
00099       }
00100       // massage parameters
00101       for(int iset=0; iset<fNRandomSets; iset++){
00102         psets[iset].pi_fate.set_abs_fates();
00103         psets[iset].pn_fate.set_abs_fates();
00104         psets[iset].pn_scale.ft=psets[iset].pi_scale.ft; // pi,pn same Ftime
00105         // correlate change in pn xsec with change in pn elastic fate
00106         if(psets[iset].pn_scale.xsec!=0) {
00107           psets[iset].pn_fate.elas = 2.0*psets[iset].pn_scale.xsec;
00108         }
00109       }
00110       
00111       
00112     }
00113     
00114     n_inuke_wts=psets.size();
00115     inuke_wts = new float[n_inuke_wts];
00116     
00117     // save psets
00118     // 9*2 fates + 3*2 scales = 24
00119     //    for(int ipar=0; ipar<24; ipar++){
00120     //  TVectorD* vptr = new TVectorD(n_inuke_wts);
00121       //      inukerw->GetUserInfo()->Add(vptr);
00122     // }
00123     // for(int iset=0; iset<n_inuke_wts; iset++){
00124     //  for(int ipar=0; ipar<24; ipar++){ 
00125     //    TVectorD* vptr =   dynamic_cast<TVectorD*>(inukerw->GetUserInfo()->At(ipar));    
00126     //    (*vptr)[iset]=psets[iset].get_par(ipar);
00127     //  }      
00128     // }     
00129     std::cout<<" Finished with Intranuke Initiation"<<endl;
00130     IsInit =true;
00131   return IsInit;
00132 }

bool NuIntranuke::RecoReweight const NtpStRecord ntp,
const NtpSREvent evt
 

Definition at line 183 of file NuIntranuke.cxx.

References NtpSREvent::index, NtpStRecord::mc, NtpTHEvent::neumc, Reweight(), and NtpStRecord::thevt.

00184 {
00185   TClonesArray& thevtTca=(*ntp.thevt);//TruthHelper Event TCA                                                   
00186   const Int_t numthevts=thevtTca.GetEntriesFast();
00187   if (numthevts<=0) {
00188     return false;
00189   }
00190 
00191   const NtpTHEvent& thevt= *dynamic_cast<NtpTHEvent*>(thevtTca[evt.index]);
00192 
00193   TClonesArray& mcTca=(*ntp.mc);
00194   const NtpMCTruth& mc= *(dynamic_cast<NtpMCTruth*>(mcTca[thevt.neumc]));
00195 
00196   return Reweight(&ntp, &mc);
00197 }

bool NuIntranuke::Reweight const NtpStRecord strecord,
const NtpMCTruth ntpTruth
 

Definition at line 134 of file NuIntranuke.cxx.

References inuke_reweight::calc_weights(), fOnlyWriteFidEvents, inuke_wts, is_pitt_fid, n_inuke_wts, nc, nucrad, nw, psets, neugen_wrapper::reconfigure(), and wrad.

Referenced by NuReco::GetTruthInfo(), and RecoReweight().

00135 {  
00136   if(!IsInit){
00137     cout<<" Initialization was not done"<<endl;
00138     return false;
00139   }
00140   nw->reconfigure(nc);
00141 
00142   if((fOnlyWriteFidEvents && is_pitt_fid==1) || !fOnlyWriteFidEvents){
00143 
00144     std::vector<double> weights(n_inuke_wts,1.0);
00145     inuke_reweight::calc_weights(strecord,ntpTruth,psets,weights,nucrad,wrad,false);
00146     for(unsigned int iwt=0; iwt<weights.size(); iwt++){
00147        inuke_wts[iwt]=weights[iwt];
00148     }
00149     return true;
00150   }
00151   else return false;
00152 }


Member Data Documentation

double NuIntranuke::fate_weight [private]
 

Definition at line 55 of file NuIntranuke.h.

int NuIntranuke::fNRandomSets
 

Definition at line 46 of file NuIntranuke.h.

Referenced by InitReweight().

bool NuIntranuke::fOnlyWriteFidEvents
 

Definition at line 43 of file NuIntranuke.h.

Referenced by Reweight().

double NuIntranuke::interaction_weight [private]
 

Definition at line 56 of file NuIntranuke.h.

float* NuIntranuke::inuke_wts [private]
 

Definition at line 50 of file NuIntranuke.h.

Referenced by GetWeight(), InitReweight(), and Reweight().

bool NuIntranuke::is_pitt_fid
 

Definition at line 45 of file NuIntranuke.h.

Referenced by Reweight().

bool NuIntranuke::IsInit
 

Definition at line 44 of file NuIntranuke.h.

Referenced by InitReweight().

int NuIntranuke::n_inuke_wts [private]
 

Definition at line 51 of file NuIntranuke.h.

Referenced by InitReweight(), and Reweight().

neugen_config* NuIntranuke::nc [private]
 

Definition at line 48 of file NuIntranuke.h.

Referenced by InitReweight(), Reweight(), and ~NuIntranuke().

double NuIntranuke::nucrad [private]
 

Definition at line 53 of file NuIntranuke.h.

Referenced by InitReweight(), and Reweight().

neugen_wrapper* NuIntranuke::nw [private]
 

Definition at line 49 of file NuIntranuke.h.

Referenced by InitReweight(), Reweight(), and ~NuIntranuke().

int NuIntranuke::nwts [private]
 

Definition at line 52 of file NuIntranuke.h.

std::vector<inuke_reweight::parameter_set> NuIntranuke::psets [private]
 

Definition at line 59 of file NuIntranuke.h.

Referenced by GetNwts(), InitReweight(), and Reweight().

inuke_reweight::parameter_set NuIntranuke::sigmas [private]
 

Definition at line 58 of file NuIntranuke.h.

Referenced by InitReweight().

double NuIntranuke::wrad [private]
 

Definition at line 54 of file NuIntranuke.h.

Referenced by InitReweight(), and Reweight().


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:09:53 2010 for loon by  doxygen 1.3.9.1