NueFluxWeightsAna Class Reference

#include <NueFluxWeightsAna.h>

Inheritance diagram for NueFluxWeightsAna:
NueAnaBase

List of all members.

Public Member Functions

 NueFluxWeightsAna (NueFluxWeights &fw)
virtual ~NueFluxWeightsAna ()
void SetDetector (int d)
void SetFluxInfo (NtpMCFluxInfo *q)
void Analyze (int evt, RecRecordImp< RecCandHeader > *st)
void SetKfluk (Kfluk *k)
void SetSKZPCalc (SKZPWeightCalculator *sc, std::string config)

Private Attributes

NueFluxWeightsfNueFluxWeight
int zbeam
int det
NtpMCFluxInfofi
Kflukkfluk
SKZPWeightCalculatorskzpCalc
std::string cfg

Detailed Description

Definition at line 13 of file NueFluxWeightsAna.h.


Constructor & Destructor Documentation

NueFluxWeightsAna::NueFluxWeightsAna ( NueFluxWeights fw  ) 

Definition at line 12 of file NueFluxWeightsAna.cxx.

References cfg.

00012                                                          :
00013   fNueFluxWeight(nuefw),
00014 //  beam(2),
00015   det(1)
00016 {
00017   //   cfg = "PiMinus_CedarDaikon";
00018    cfg = "DetXs";
00019 }

NueFluxWeightsAna::~NueFluxWeightsAna (  )  [virtual]

Definition at line 21 of file NueFluxWeightsAna.cxx.

References Msg::kDebug, and MSG.

00022 {
00023   MSG("NueFluxWeightsAns",Msg::kDebug)<<"in NueFluxWeightsAna destructor"<<endl;
00024 }


Member Function Documentation

void NueFluxWeightsAna::Analyze ( int  evt,
RecRecordImp< RecCandHeader > *  st 
) [virtual]

Implements NueAnaBase.

Definition at line 26 of file NueFluxWeightsAna.cxx.

References NueAnaBase::beam, cfg, det, NueFluxWeights::detectorWeight, fi, NtpMCTruth::flux, fNueFluxWeight, SKZPWeightCalculator::GetBeamWeight(), SKZPWeightCalculator::GetDetWeight(), SntpHelpers::GetEvent2MCIndex(), SntpHelpers::GetMCTruth(), NtpMCTruth::iaction, NtpMCTruth::inu, Msg::kDebug, SKZPWeightCalculator::kEndOfList, Msg::kError, NueFluxWeights::kflukweight, SKZPWeightCalculator::kRunI, Msg::kWarning, MSG, NtpMCTruth::p4neu, NueFluxWeights::RPtotbeamweight, SKZPWeightCalculator::RunPeriodFromInt(), skzpCalc, NueFluxWeights::skzpConfig, NueFluxWeights::skzpShwEnergy, NueFluxWeights::skzpTrkEnergy, NueFluxWeights::totbeamweight, NueFluxWeights::totskzpweight, BeamType::ToZarko(), NtpMCFluxInfo::tptype, NtpMCFluxInfo::tpx, NtpMCFluxInfo::tpy, NtpMCFluxInfo::tpz, and zbeam.

Referenced by NueRecordAna::FillTrue().

00027 {
00028   NtpStRecord *st=dynamic_cast<NtpStRecord *>(srobj);
00029   if(st==0){
00030     MSG("NueFluxWeightsAna",Msg::kError)<<"Trying to do flux reweighting on an event"
00031                                         <<" that comes from a non NtpStRecord"<<endl
00032                                         <<"That's not a good idea"<<endl;
00033     return;
00034   }
00035 
00036   int thn = SntpHelpers::GetEvent2MCIndex(evtn,st);
00037   NtpMCTruth *mcrec = SntpHelpers::GetMCTruth(thn,st);
00038   if(mcrec==0){
00039     return;
00040   }
00041   MSG("NueFluxWeightsAns",Msg::kDebug)<<"in NueFluxWeightsAna::Analyze"<<endl;
00042 
00043   if(fi==0){
00044     MSG("NueFluxWeightsAna",Msg::kWarning)<<"No FluxInfo object set, "
00045                                           <<"using the one from NtpMCTruth"
00046                                           <<" Once the flux files are fixed, "
00047                                           <<"and we no longer need the MuPi trees, "
00048                                           <<"we can comment out this comment"<<endl;
00049     fi=&mcrec->flux;
00050   }
00051 
00052   MSG("NueFluxWeightsAna",Msg::kDebug)<<"starting flux reweight"<<endl;
00053 
00054   double pt = sqrt(fi->tpx*fi->tpx+fi->tpy*fi->tpy);
00055   double pz = 1.*fi->tpz;
00056   int tptype = fi->tptype;
00057   int inu = mcrec->inu; 
00058   int cc_nc = mcrec->iaction;
00059 
00060   float true_enu = mcrec->p4neu[3];
00061 
00062   zbeam = BeamType::ToZarko(beam);
00063   MSG("NueFluxWeightsAna",Msg::kDebug)<<"true_enu "<<true_enu<<" beam (Z) "<<zbeam<<" det "<<det<<endl;
00064   double kflukw = 1.;//kfluk->GetWeight(fi);
00065   fNueFluxWeight.kflukweight = kflukw;
00066 
00067   double newTrackE, newShwE;
00068   double bweight =  skzpCalc->GetBeamWeight(det,zbeam,tptype,pt,pz,true_enu,inu);
00069   double dweight =  skzpCalc->GetDetWeight(cc_nc,true_enu,inu,0,0,newTrackE,newShwE);
00070   
00071   fNueFluxWeight.totbeamweight = bweight;
00072   fNueFluxWeight.totskzpweight = dweight*bweight;
00073   fNueFluxWeight.detectorWeight = dweight;
00074 
00075   fNueFluxWeight.skzpTrkEnergy = 0.0;  //newTrackE;
00076   fNueFluxWeight.skzpShwEnergy = 0.0; //newShwE;
00077   fNueFluxWeight.skzpConfig = cfg;
00078 
00079   for(int rpit=SKZPWeightCalculator::kRunI;rpit<SKZPWeightCalculator::kEndOfList;rpit++){
00080     SKZPWeightCalculator::RunPeriod_t rp = skzpCalc->RunPeriodFromInt(rpit);
00081     double rpw = skzpCalc->GetBeamWeight(det,zbeam,tptype,pt,pz,true_enu,inu,rp);
00082     fNueFluxWeight.RPtotbeamweight.push_back(rpw);
00083   }
00084 
00085 
00086   MSG("NueFluxWeightsAna",Msg::kDebug)<<"alldone with flux reweight "<<fNueFluxWeight.totbeamweight<<endl;
00087 }

void NueFluxWeightsAna::SetDetector ( int  d  )  [inline]

Definition at line 21 of file NueFluxWeightsAna.h.

References det.

Referenced by NueRecordAna::FillTrue().

00021 {det = d;}

void NueFluxWeightsAna::SetFluxInfo ( NtpMCFluxInfo q  )  [inline]

Definition at line 22 of file NueFluxWeightsAna.h.

References fi.

Referenced by NueRecordAna::FillTrue().

00022 {fi=q;}

void NueFluxWeightsAna::SetKfluk ( Kfluk k  )  [inline]

Definition at line 24 of file NueFluxWeightsAna.h.

References kfluk.

Referenced by NueModule::Analyze().

00024 {kfluk=k;}

void NueFluxWeightsAna::SetSKZPCalc ( SKZPWeightCalculator sc,
std::string  config 
) [inline]

Definition at line 25 of file NueFluxWeightsAna.h.

References cfg, and skzpCalc.

Referenced by NueModule::Analyze().

00025 {skzpCalc = sc; cfg = config;};


Member Data Documentation

std::string NueFluxWeightsAna::cfg [private]

Definition at line 36 of file NueFluxWeightsAna.h.

Referenced by Analyze(), NueFluxWeightsAna(), and SetSKZPCalc().

int NueFluxWeightsAna::det [private]

Definition at line 31 of file NueFluxWeightsAna.h.

Referenced by Analyze(), and SetDetector().

Definition at line 33 of file NueFluxWeightsAna.h.

Referenced by Analyze(), and SetFluxInfo().

Definition at line 25 of file NueFluxWeightsAna.h.

Referenced by Analyze().

Definition at line 34 of file NueFluxWeightsAna.h.

Referenced by SetKfluk().

Definition at line 35 of file NueFluxWeightsAna.h.

Referenced by Analyze(), and SetSKZPCalc().

int NueFluxWeightsAna::zbeam [private]

Definition at line 30 of file NueFluxWeightsAna.h.

Referenced by Analyze().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1