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_set
psets

Detailed Description

Definition at line 12 of file NuIntranuke.h.


Constructor & Destructor Documentation

NuIntranuke::NuIntranuke (  ) 

Definition at line 39 of file NuIntranuke.cxx.

References InitReweight().

00040   :fOnlyWriteFidEvents(false),
00041    IsInit(false),
00042    is_pitt_fid(false),
00043    fNRandomSets(0),
00044    nucrad(-1),
00045    wrad(1)
00046 {
00047   this->InitReweight();
00048 }

NuIntranuke::~NuIntranuke (  ) 

Definition at line 50 of file NuIntranuke.cxx.

References nc, and nw.

00051 {
00052   if (nw){delete nw; nw=0;}
00053   if (nc){delete nc; nc=0;}
00054 }


Member Function Documentation

double NuIntranuke::GetFateWeight ( int  ii  ) 
double NuIntranuke::GetIFWeight (  ) 
double NuIntranuke::GetInteractionWeight ( int  ii  ) 
double NuIntranuke::GetNucrad (  ) 

Definition at line 206 of file NuIntranuke.cxx.

References nucrad.

Referenced by NuReco::GetTruthInfo().

00206 {return nucrad;}

int NuIntranuke::GetNwts (  ) 

Definition at line 186 of file NuIntranuke.cxx.

References psets.

Referenced by NuReco::GetTruthInfo().

00186                         { 
00187   return psets.size();
00188 }

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

Definition at line 161 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, sigmas, and inuke_reweight::delta_scale::xsec.

Referenced by InitReweight().

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

float NuIntranuke::GetWeight ( int  index  ) 

Definition at line 204 of file NuIntranuke.cxx.

References inuke_wts.

Referenced by NuReco::GetTruthInfo().

00204 {return inuke_wts[index];}

float * NuIntranuke::GetWeights (  ) 

Definition at line 205 of file NuIntranuke.cxx.

References inuke_wts.

00205 {return inuke_wts;}

double NuIntranuke::GetWrad (  ) 

Definition at line 207 of file NuIntranuke.cxx.

References wrad.

Referenced by NuReco::GetTruthInfo().

00207 {return wrad;}

bool NuIntranuke::InitReweight (  ) 

BEGIN: intranuke reweighting init.

Definition at line 55 of file NuIntranuke.cxx.

References neugen_wrapper::begin_generation(), 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_scale, inuke_reweight::parameter_set::print(), inuke_reweight::parameter_limits::print(), neugen_wrapper::print_configuration(), psets, neugen_config::set_config_no(), sigmas, inuke_reweight::parameter_limits::upper, and wrad.

Referenced by NuIntranuke().

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

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

Definition at line 189 of file NuIntranuke.cxx.

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

00190 {
00191   TClonesArray& thevtTca=(*ntp.thevt);//TruthHelper Event TCA                                                   
00192   const Int_t numthevts=thevtTca.GetEntriesFast();
00193   if (numthevts<=0) {
00194     return false;
00195   }
00196 
00197   const NtpTHEvent& thevt= *dynamic_cast<NtpTHEvent*>(thevtTca[evt.index]);
00198 
00199   TClonesArray& mcTca=(*ntp.mc);
00200   const NtpMCTruth& mc= *(dynamic_cast<NtpMCTruth*>(mcTca[thevt.neumc]));
00201 
00202   return Reweight(&ntp, &mc);
00203 }

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

Definition at line 140 of file NuIntranuke.cxx.

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

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

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


Member Data Documentation

double NuIntranuke::fate_weight [private]

Definition at line 41 of file NuIntranuke.h.

Definition at line 32 of file NuIntranuke.h.

Referenced by InitReweight().

Definition at line 29 of file NuIntranuke.h.

Referenced by Reweight().

Definition at line 42 of file NuIntranuke.h.

float* NuIntranuke::inuke_wts [private]

Definition at line 36 of file NuIntranuke.h.

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

Definition at line 31 of file NuIntranuke.h.

Referenced by Reweight().

Definition at line 30 of file NuIntranuke.h.

Referenced by InitReweight(), and Reweight().

int NuIntranuke::n_inuke_wts [private]

Definition at line 37 of file NuIntranuke.h.

Referenced by InitReweight(), and Reweight().

Definition at line 34 of file NuIntranuke.h.

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

double NuIntranuke::nucrad [private]

Definition at line 39 of file NuIntranuke.h.

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

Definition at line 35 of file NuIntranuke.h.

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

int NuIntranuke::nwts [private]

Definition at line 38 of file NuIntranuke.h.

Definition at line 45 of file NuIntranuke.h.

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

Definition at line 44 of file NuIntranuke.h.

Referenced by GetSigmas(), and InitReweight().

double NuIntranuke::wrad [private]

Definition at line 40 of file NuIntranuke.h.

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


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1