NCEventInfo Class Reference

Collection of pointers to analysis ntuple structures, and related functions. More...

#include <NCEventInfo.h>

List of all members.

Classes

struct  INukeHists
 Collection of intranuke histograms. More...

Public Member Functions

 NCEventInfo (const char *beamWeightConfig="Dogwood1_Daikon07_v2")
void DeepCopy (const NCEventInfo *evt)
 Copies the contents of all the ANtp members of evt.
double GetEventVertex (double &x, double &y, double &z) const
double GetEventEnergy (CandShowerHandle::ShowerType_t showerType, bool stoppingBeamMuon) const
double GetTrackEnergy (bool contained=false) const
double GetShowerEnergy (CandShowerHandle::ShowerType_t showerType=CandShowerHandle::kCC) const
double FindNeugenWeight (const bool *useParameters, const std::vector< double > &adjustedValues, bool useMODBYRS3=true, int overrideMODBYRS=0)
double FindCrossSectionWeight (const bool *useParameters, const std::vector< double > &adjustedValues) const
double FindMODBYRSWeight ()
double FindMEGAFitWeight (int beamType=0, NC::RunUtil::ERunType runType=NC::RunUtil::kRunI)
double FindMEGAFitWeightUncertainty (int beamType, NC::RunUtil::ERunType runType, double sigma, SKZPWeightCalculator *skzpcalc)
double CalculateAbsoluteHadronicShiftScale (double trueShowerEnergy, double sigma) const
 Find scale factor to multiply shower energy by.
double FindRecoWeight (const bool *useParameters, const std::vector< double > &adjustedValues) const
 Return the reco weight for this event based on the systematics passed in.
void SetEventWeight (const bool *useParameters, const std::vector< double > &adjustedValues, const NC::OscProb::OscPars *pars, SKZPWeightCalculator *skzpcalc=0, NC::RunUtil::ERunType runType=NC::RunUtil::kRunI, bool useNuE=true, bool useOscProb=true)
 If skzpcalc is null, will use fSKZPWeight.
double GetSKZPWeight () const
 Return the appropriate SKZP weight.
bool FinalEventCheck (ANtpAnalysisInfo *ana=0, ANtpRecoInfo *rec=0) const
 This is a catch all for final cuts on whether an event should be used.
void SetChainBranches (TChain *ch, TString extractionName, bool setTruthBranch)
 Set branches in ch such that FillFromChain will fill our fields.
void FillFromChain (TChain *ch, int entry)
 Fill the pointers in this object from entry of the chain ch.
void SetInfoObjects (ANtpHeaderInfo *headerInfo, ANtpBeamInfo *beamInfo, ANtpEventInfoNC *eventInfo, ANtpTrackInfoNC *trackInfo, ANtpShowerInfoNC *showerInfo, ANtpAnalysisInfo *analysisInfo=0, ANtpRecoInfo *recoInfo=0, ANtpTruthInfoBeam *truthInfo=0)
VldTimeStamp GetTimestamp () const
 Translate the time information in header into a VldTimeStamp.

Public Attributes

ANtpAnalysisInfoanalysis
ANtpBeamInfobeam
ANtpEventInfoNCevent
ANtpHeaderInfoheader
ANtpRecoInforeco_nom
ANtpRecoInforeco
ANtpShowerInfoNCshower
ANtpTrackInfoNCtrack
ANtpTruthInfoBeamtruth

Private Member Functions

void SelectINukeHist (int &offset, int &from, int &to) const
double SimulateShowerOffset (TH2F *offsetHist, double offset) const
void ShiftEnergies (const bool *useParameters, const std::vector< double > &adjustedValues)
double doubleintpow (double a, int b) const
 Efficient pow() for double-to-the-power-int.
double FindTransitionProbability (const NC::OscProb::OscPars *pars, bool useNuE=false) const
 Helper for SetEventWeight.
SKZPWeightCalculatorGetSKZPCalc ()

Private Attributes

SKZPWeightCalculatorfSKZPWeight
std::string fBeamWeightConfig

Static Private Attributes

static INukeHists sfINukeHists

Detailed Description

Collection of pointers to analysis ntuple structures, and related functions.

Definition at line 28 of file NCEventInfo.h.


Constructor & Destructor Documentation

NCEventInfo::NCEventInfo ( const char *  beamWeightConfig = "Dogwood1_Daikon07_v2"  ) 

Definition at line 160 of file NCEventInfo.cxx.

00161   : analysis(0), beam(0), event(0), header(0),
00162     reco_nom(0), reco(0), shower(0), track(0), truth(0),
00163     fSKZPWeight(0),
00164     fBeamWeightConfig(beamWeightConfig)
00165 {
00166 }


Member Function Documentation

double NCEventInfo::CalculateAbsoluteHadronicShiftScale ( double  trueShowerEnergy,
double  sigma 
) const

Find scale factor to multiply shower energy by.

The scale factor given is the sum in quadrature of hadronic modelling and calibration errors.

The modelling errors here are found by fitting a functional form to values eyeballed from slide 6 of DocDB 4309v1

The calibration error is taken from page 5 of DocDB 3941v10

Parameters:
trueShowerEnergy True energy in the shower
sigma Number of sigma to calculate shift at
Returns:
Scale factor to apply to reconstructed shower energy

Definition at line 805 of file NCEventInfo.cxx.

References SQR.

00807 {
00808   const double calibrationError = 5.7;
00809 
00810   assert(trueShowerEnergy >= 0);
00811 
00812   double modellingError = -1;
00813   if(trueShowerEnergy < 0.5) modellingError = 8.2;
00814   else if(trueShowerEnergy < 10) modellingError = 2.7+3.7*TMath::Exp(-.25*trueShowerEnergy);
00815   else modellingError = 3;
00816   assert(modellingError > 0);
00817 
00818   const double totalError = TMath::Sqrt(SQR(calibrationError)+
00819                                         SQR(modellingError));
00820   return 1+.01*totalError*sigma;
00821 }

void NCEventInfo::DeepCopy ( const NCEventInfo evt  ) 

Copies the contents of all the ANtp members of evt.

If memory is already allocated in this object then reuse it. If necessary allocate new memory. If evt has unfilled fields and we have allocated memory, then free it.

Beware of the possibility of memory leaks and other memory problems when using this function. Note that NCEventInfo does not delete its children on destruction.

Definition at line 208 of file NCEventInfo.cxx.

References analysis, beam, COPYFIELD, header, reco, reco_nom, shower, track, and truth.

Referenced by NCExtrapolationModule::AddEventToExtrapolations(), and NCExtrapolationModule::AddShiftedEventToExtrapolations().

00209 {
00210 #define COPYFIELD(fld, typ) \
00211   if(evt->fld){             \
00212     if(!fld) fld = new typ; \
00213     *fld = *evt->fld;       \
00214   }                         \
00215   else{                     \
00216     if(fld) delete fld;     \
00217     fld = 0;                \
00218   }
00219 
00220   COPYFIELD(analysis, ANtpAnalysisInfo);
00221   COPYFIELD(beam,     ANtpBeamInfo);
00222   COPYFIELD(event,    ANtpEventInfoNC);
00223   COPYFIELD(header,   ANtpHeaderInfo);
00224   COPYFIELD(reco,     ANtpRecoInfo);
00225   COPYFIELD(reco_nom, ANtpRecoInfo);
00226   COPYFIELD(shower,   ANtpShowerInfoNC);
00227   COPYFIELD(track,    ANtpTrackInfoNC);
00228   COPYFIELD(truth,    ANtpTruthInfoBeam);
00229 
00230 #undef COPYFIELD
00231 }

double NCEventInfo::doubleintpow ( double  a,
int  b 
) const [private]

Efficient pow() for double-to-the-power-int.

Definition at line 343 of file NCEventInfo.cxx.

00344 {
00345   double ret = 1;
00346   while(b--) ret *= a;
00347   return ret;
00348 }

void NCEventInfo::FillFromChain ( TChain *  ch,
int  entry 
)

Fill the pointers in this object from entry of the chain ch.

You MUST have called SetChainBranches previously with the chain ch. This is needed to ensure that reco_nom and reco both get filled

Definition at line 1425 of file NCEventInfo.cxx.

References reco, and reco_nom.

Referenced by NC::RealDataAdder::AddEventsToExtrapolations(), NC::MockDataAdder::AddEventsToExtrapolations(), NC::FakeDataAdder::AddEventsToExtrapolations(), and NC::SplitFakeDataAdder::AddEventsToExtrapolations().

01426 {
01427   ch->GetEntry(entry);
01428   if(!reco) reco=new ANtpRecoInfo;
01429   *reco=*reco_nom;
01430 }

bool NCEventInfo::FinalEventCheck ( ANtpAnalysisInfo ana = 0,
ANtpRecoInfo rec = 0 
) const

This is a catch all for final cuts on whether an event should be used.

Definition at line 1379 of file NCEventInfo.cxx.

References analysis, header, ANtpAnalysisInfo::isCC, ANtpHeaderInfo::isGoodData, ANtpAnalysisInfo::isNC, reco_nom, and ANtpRecoInfo::trackMomentum.

Referenced by NCExtrapolationModule::FinalEventCheck().

01381 {
01382   if(!ana) ana = analysis;
01383   if(!rec) rec = reco_nom;
01384 
01385   assert(ana && header && rec);
01386 
01387   if(ana->isCC > 0 &&
01388      ana->isNC < 1 &&
01389      rec->trackMomentum > 0)
01390     return false;
01391 
01392   if(!header->isGoodData) return false;
01393 
01394   return true;
01395 }

double NCEventInfo::FindCrossSectionWeight ( const bool *  useParameters,
const std::vector< double > &  adjustedValues 
) const

Definition at line 661 of file NCEventInfo.cxx.

References ANtpTruthInfo::interactionType, NCType::kCC, NCType::kNC, NCType::kNCCrossSection, NCType::kNuBarCrossSection, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, and truth.

00663 {
00664   double weight = 1.;
00665   double trueE = truth->nuEnergy;
00666 
00667   if(useParameters[NCType::kNCCrossSection]
00668      && truth->interactionType == NCType::kNC){
00669     if(trueE <= 10.)
00670       weight = 1. + 0.2*adjustedValues[NCType::kNCCrossSection];
00671     else if(trueE < 100.)
00672       weight = 1. + 0.2*(1. - 0.0111*(trueE-10.))*adjustedValues[NCType::kNCCrossSection];
00673     else
00674       weight = 1.;
00675   }
00676 
00677   if(useParameters[NCType::kNuBarCrossSection]
00678      && truth->interactionType == NCType::kCC
00679      && truth->nuFlavor < 0)
00680     weight *= 1. + adjustedValues[NCType::kNuBarCrossSection];
00681 
00682   return weight;
00683 }

double NCEventInfo::FindMEGAFitWeight ( int  beamType = 0,
NC::RunUtil::ERunType  runType = NC::RunUtil::kRunI 
)

Definition at line 706 of file NCEventInfo.cxx.

References beam, ANtpBeamInfo::beamType, ANtpHeaderInfo::detector, FindMODBYRSWeight(), GetSKZPCalc(), SKZPWeightCalculator::GetWeight(), header, ANtpTruthInfo::interactionType, ReleaseType::IsCarrot(), Msg::kDebug, NC::RunUtil::kRunI, SKZPWeightCalculator::kRunI, SKZPWeightCalculator::kRunII, NC::RunUtil::kRunII, NC::RunUtil::kRunIII, SKZPWeightCalculator::kRunIII, MAXMSG, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, ANtpHeaderInfo::softVersion, SQR, ReleaseType::StringToType(), ANtpTruthInfoBeam::targetParentPX, ANtpTruthInfoBeam::targetParentPY, ANtpTruthInfoBeam::targetParentPZ, ANtpTruthInfoBeam::targetParentType, BeamType::ToZarko(), and truth.

Referenced by MicroDSTMaker::FillRecoInfo().

00707 {
00708   //check if there is a beam object loaded, if so use it to get the beam type,
00709   //otherwise use the passed in int.
00710   int beamt = BeamType::ToZarko((BeamType::BeamType_t)(beamType)); //Use SKZP beam encoding
00711   if(beam) beamt = BeamType::ToZarko((BeamType::BeamType_t)(beam->beamType)); //Use SKZP beam encoding
00712 
00713   SKZPWeightCalculator::RunPeriod_t rp;
00714 
00715   // Bah, converting between conventions
00716   switch(runType){
00717   case NC::RunUtil::kRunI:
00718     rp=SKZPWeightCalculator::kRunI;
00719     break;
00720   case NC::RunUtil::kRunII:
00721     rp=SKZPWeightCalculator::kRunII;
00722     break;
00723   case NC::RunUtil::kRunIII:
00724     rp=SKZPWeightCalculator::kRunIII;
00725     break;
00726   default:
00727     assert(0 && "Unknown run period");
00728     break;
00729   }
00730 
00731   double pt = TMath::Sqrt(SQR(truth->targetParentPX)
00732                           +SQR(truth->targetParentPY));
00733   double emuNew = 0.;
00734   double eshwNew = 0.;
00735   double beamweight = 0.;
00736   double detweight = 0.;
00737   double weightbeam = GetSKZPCalc()->GetWeight(header->detector,
00738                                                beamt,
00739                                                truth->targetParentType,
00740                                                pt,
00741                                                1.*truth->targetParentPZ,
00742                                                truth->interactionType,
00743                                                truth->nuEnergy,
00744                                                truth->nuFlavor,
00745                                                0.,
00746                                                0.,
00747                                                emuNew,
00748                                                eshwNew,
00749                                                beamweight,
00750                                                detweight,
00751                                                rp);
00752 
00753   //only do the MODBYRS weighting if using carrot
00754   double weightMODBYRS = 1.;
00755   const char* mcString = (header->softVersion).Data();
00756   ReleaseType::Release_t mcType = ReleaseType::StringToType(mcString);
00757   if( ReleaseType::IsCarrot(mcType) ) weightMODBYRS = FindMODBYRSWeight();
00758 
00759   MAXMSG("NCEventInfo", Msg::kDebug, 10)
00760     << "MODBYRS3 = " << weightMODBYRS
00761     << " beam = " << weightbeam
00762     << endl;
00763 
00764   return weightMODBYRS*weightbeam;
00765 }

double NCEventInfo::FindMEGAFitWeightUncertainty ( int  beamType,
NC::RunUtil::ERunType  runType,
double  sigma,
SKZPWeightCalculator skzpcalc 
)

Definition at line 769 of file NCEventInfo.cxx.

References ANtpHeaderInfo::detector, SKZPWeightCalculator::GetFluxError(), header, NC::RunUtil::kRunI, SKZPWeightCalculator::kRunI, SKZPWeightCalculator::kRunII, NC::RunUtil::kRunII, NC::RunUtil::kRunIII, SKZPWeightCalculator::kRunIII, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, BeamType::ToZarko(), and truth.

00773 {
00774   assert(header && truth);
00775 
00776   SKZPWeightCalculator::RunPeriod_t rp;
00777 
00778   // Bah, converting between conventions
00779   switch(runType){
00780   case NC::RunUtil::kRunI:
00781     rp=SKZPWeightCalculator::kRunI;
00782     break;
00783   case NC::RunUtil::kRunII:
00784     rp=SKZPWeightCalculator::kRunII;
00785     break;
00786   case NC::RunUtil::kRunIII:
00787     rp=SKZPWeightCalculator::kRunIII;
00788     break;
00789   default:
00790     assert(0 && "Unknown run period");
00791     break;
00792   }
00793 
00794   return skzpcalc->GetFluxError(header->detector,
00795                                 BeamType::ToZarko((BeamType::BeamType_t)(beamType)), //use SKZP enum
00796                                 truth->nuFlavor,
00797                                 truth->nuEnergy,
00798                                 rp,
00799                                 sigma);
00800 }

double NCEventInfo::FindMODBYRSWeight (  ) 

Definition at line 690 of file NCEventInfo.cxx.

References FindNeugenWeight(), NCType::kNumNeugenParameters, and NCType::kParams.

Referenced by FindMEGAFitWeight().

00691 {
00692   vector<double> adjustedValues;
00693   bool useParameters[NCType::kNumNeugenParameters] = {false,};
00694 
00695   for(int i = 0; i < NCType::kNumNeugenParameters; ++i){
00696     adjustedValues.push_back(NCType::kParams[i].defaultVal);
00697   }
00698 
00699   return FindNeugenWeight(useParameters, adjustedValues);
00700 }

double NCEventInfo::FindNeugenWeight ( const bool *  useParameters,
const std::vector< double > &  adjustedValues,
bool  useMODBYRS3 = true,
int  overrideMODBYRS = 0 
)

Definition at line 406 of file NCEventInfo.cxx.

References ANtpTruthInfoBeam::atomicNumber, ANtpTruthInfoBeam::bjorkenX, MCReweight::ComputeWeight(), MCEventInfo::had_fs, ANtpTruthInfoBeam::hadronicFinalState, ANtpTruthInfo::hadronicY, header, MCEventInfo::iaction, MCEventInfo::initial_state, ANtpTruthInfoBeam::initialState, MCReweight::Instance(), ANtpTruthInfo::interactionType, MCEventInfo::inu, MCEventInfo::iresonance, ReleaseType::IsCarrot(), ReleaseType::IsDaikon(), NCType::kCCMA, Msg::kDebug, NCType::kDISFACT, NCType::kkno_r112, NCType::kkno_r112122, NCType::kkno_r113, NCType::kkno_r113123, NCType::kkno_r122, NCType::kkno_r123, NCType::kkno_r132, NCType::kkno_r133, NCType::kkno_r142, NCType::kkno_r143, NCType::kkno_r212, NCType::kkno_r212222, NCType::kkno_r213, NCType::kkno_r213223, NCType::kkno_r222, NCType::kkno_r223, NCType::kma_qe, NCType::kma_res, NCType::kParams, Msg::kWarning, MAXMSG, MSG, MCEventInfo::nucleus, ANtpTruthInfo::nuDCosX, ANtpTruthInfo::nuDCosY, ANtpTruthInfo::nuDCosZ, MCEventInfo::nuE, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, MCEventInfo::nuPx, MCEventInfo::nuPy, MCEventInfo::nuPz, ANtpTruthInfoBeam::q2, MCEventInfo::q2, MCReweight::ResetAllReweightConfigs(), ANtpTruthInfoBeam::resonanceCode, Registry::Set(), ANtpHeaderInfo::softVersion, ReleaseType::StringToType(), MCEventInfo::tarE, ANtpTruthInfo::targetEnergy, ANtpTruthInfo::targetPX, ANtpTruthInfo::targetPY, ANtpTruthInfo::targetPZ, MCEventInfo::tarPx, MCEventInfo::tarPy, MCEventInfo::tarPz, truth, Registry::UnLockValues(), MCEventInfo::w2, ANtpTruthInfoBeam::w2, MCEventInfo::x, and MCEventInfo::y.

Referenced by FindMODBYRSWeight().

00409 {
00410   assert(truth);
00411 
00412   TString neugen = "neugen:";
00413 
00414   MCReweight &mcReweight = MCReweight::Instance();
00415 
00416   int nucleus = 1; //default
00417 
00418   //figure out the nucleus
00419   if(int(truth->atomicNumber == 1))  nucleus = 0; // free
00420   else if(int(truth->atomicNumber == 6))  nucleus = 274; // oxygen
00421   else if(int(truth->atomicNumber == 8))  nucleus = 284; // carbon
00422   else if(int(truth->atomicNumber == 26)) nucleus = 372; // iron
00423 
00424   if(nucleus == 1) return 1;
00425 
00426   MCEventInfo ei;
00427   ei.nuE           = truth->nuEnergy;
00428   ei.nuPx          = truth->nuDCosX*truth->nuEnergy;
00429   ei.nuPy          = truth->nuDCosY*truth->nuEnergy;
00430   ei.nuPz          = truth->nuDCosZ*truth->nuEnergy;
00431   ei.tarE          = truth->targetEnergy;
00432   ei.tarPx         = truth->targetPX;
00433   ei.tarPy         = truth->targetPY;
00434   ei.tarPz         = truth->targetPZ;
00435   ei.y             = truth->hadronicY;
00436   ei.x             = truth->bjorkenX;
00437   ei.q2            = truth->q2;
00438   ei.w2            = truth->w2;
00439   ei.iaction       = truth->interactionType;
00440   ei.inu           = truth->nuFlavor;
00441   ei.iresonance    = truth->resonanceCode;
00442   ei.initial_state = truth->initialState;
00443   ei.nucleus       = nucleus;
00444   ei.had_fs        = truth->hadronicFinalState;
00445 
00446   NuParent* np = 0;
00447 
00448   Registry fReweightConfigRegistry;
00449   fReweightConfigRegistry.UnLockValues();
00450   Registry defaultConfigRegistry;
00451 
00452   const char* mcString = (header->softVersion).Data();
00453   ReleaseType::Release_t mcType=ReleaseType::StringToType(mcString);
00454 
00455 
00456   //Only apply MODBYRS3 for Carrot or earlier
00457   //Note: According to discussion with Hugh G. and
00458   //Tricia V., Carrot was actually generated with MODBYRS2
00459   //and then found to agree better with data using MODBYRS3.
00460   //Anyone using this code on carrot will get unweighted carrot if
00461   //useMODBYRS3=false and reweighted carrot if flag useMODBYRS3=true
00462 
00463   //overriding default version values for MODBYRS
00464   if(overrideMODBYRS != 0)
00465   {
00466      fReweightConfigRegistry.Set("neugen:config_name", "MODBYRS");
00467      fReweightConfigRegistry.Set("neugen:config_no", overrideMODBYRS);
00468   }
00469   //no override
00470   else
00471   {
00472      if(useMODBYRS3 && ReleaseType::IsCarrot(mcType) ){
00473         fReweightConfigRegistry.Set("neugen:config_name", "MODBYRS");
00474         fReweightConfigRegistry.Set("neugen:config_no", 3);
00475      }
00476      else if(ReleaseType::IsDaikon(mcType)){
00477         fReweightConfigRegistry.Set("neugen:config_name", "MODBYRS");
00478         fReweightConfigRegistry.Set("neugen:config_no", 4);
00479      }
00480   }
00481   /*
00482   if((int) useParameters.size() < NCType::kNumNeugenParameters){
00483     MSG("NCEventInfo", Msg::kWarning) << "use parameters not same size"
00484                                           << " as neugen parameters - return"
00485                                           << " weight of 1." << endl;
00486     return 1.;
00487   }
00488   */
00489 
00490   //set the configuration for the reweight based on the percent change
00491   double change = 1.;
00492   for(int i = 0; i < (int)adjustedValues.size(); ++i){
00493     change = adjustedValues[i];
00494 
00495     //for now the reweighting doesnt work right - see comment below
00496     //make sure that the defaults for all unchanged parameters are the
00497     //current defaults
00498     if(!useParameters[i]
00499        && i < NCType::kDISFACT
00500        && !(i == NCType::kma_qe && useParameters[NCType::kCCMA])
00501        && !(i == NCType::kma_res && useParameters[NCType::kCCMA])
00502        && !(i == NCType::kkno_r112 && useParameters[NCType::kkno_r112122])
00503        && !(i == NCType::kkno_r122 && useParameters[NCType::kkno_r112122])
00504        && !(i == NCType::kkno_r113 && useParameters[NCType::kkno_r113123])
00505        && !(i == NCType::kkno_r123 && useParameters[NCType::kkno_r113123])
00506        && !(i == NCType::kkno_r212 && useParameters[NCType::kkno_r212222])
00507        && !(i == NCType::kkno_r222 && useParameters[NCType::kkno_r212222])
00508        && !(i == NCType::kkno_r213 && useParameters[NCType::kkno_r213223])
00509        && !(i == NCType::kkno_r223 && useParameters[NCType::kkno_r213223])) {
00510 
00511        if(ReleaseType::IsDaikon(mcType))
00512        {
00513           fReweightConfigRegistry.Set(neugen+NCType::kParams[i].name,
00514                                       NCType::kParams[i].defaultVal);
00515        }
00516     }
00517 
00518     if(useParameters[i] && i < NCType::kDISFACT){
00519       fReweightConfigRegistry.Set(neugen+NCType::kParams[i].name, change);
00520     }
00521     else if(useParameters[i] && i == NCType::kDISFACT){
00522       //here adjusted values is the fractional change for the parameters,
00523       //multiply it by the default values
00524       fReweightConfigRegistry.Set("neugen:kno_r112",
00525                                   change*NCType::kParams[NCType::kkno_r112].defaultVal);
00526       fReweightConfigRegistry.Set("neugen:kno_r122",
00527                                   change*NCType::kParams[NCType::kkno_r122].defaultVal);
00528       fReweightConfigRegistry.Set("neugen:kno_r132",
00529                                   change*NCType::kParams[NCType::kkno_r132].defaultVal);
00530       fReweightConfigRegistry.Set("neugen:kno_r142",
00531                                   change*NCType::kParams[NCType::kkno_r142].defaultVal);
00532       fReweightConfigRegistry.Set("neugen:kno_r113",
00533                                   change*NCType::kParams[NCType::kkno_r113].defaultVal);
00534       fReweightConfigRegistry.Set("neugen:kno_r123",
00535                                   change*NCType::kParams[NCType::kkno_r123].defaultVal);
00536       fReweightConfigRegistry.Set("neugen:kno_r133",
00537                                   change*NCType::kParams[NCType::kkno_r133].defaultVal);
00538       fReweightConfigRegistry.Set("neugen:kno_r143",
00539                                   change*NCType::kParams[NCType::kkno_r143].defaultVal);
00540     }
00541     else if(useParameters[i] && i == NCType::kCCMA){
00542       fReweightConfigRegistry.Set("neugen:ma_qe",
00543                                   change*NCType::kParams[NCType::kma_qe].defaultVal);
00544       fReweightConfigRegistry.Set("neugen:ma_res",
00545                                   change*NCType::kParams[NCType::kma_res].defaultVal);
00546     }
00547     else if(useParameters[i] && i == NCType::kkno_r112122){
00548       fReweightConfigRegistry.Set("neugen:kno_r112",
00549                                   change*NCType::kParams[NCType::kkno_r112].defaultVal);
00550       fReweightConfigRegistry.Set("neugen:kno_r122",
00551                                   change*NCType::kParams[NCType::kkno_r122].defaultVal);
00552     }
00553     else if(useParameters[i] && i == NCType::kkno_r113123){
00554       fReweightConfigRegistry.Set("neugen:kno_r113",
00555                                   change*NCType::kParams[NCType::kkno_r113].defaultVal);
00556       fReweightConfigRegistry.Set("neugen:kno_r123",
00557                                   change*NCType::kParams[NCType::kkno_r123].defaultVal);
00558     }
00559     else if(useParameters[i] && i == NCType::kkno_r212222){
00560       fReweightConfigRegistry.Set("neugen:kno_r212",
00561                                   change*NCType::kParams[NCType::kkno_r212].defaultVal);
00562       fReweightConfigRegistry.Set("neugen:kno_r222",
00563                                   change*NCType::kParams[NCType::kkno_r222].defaultVal);
00564     }
00565     else if(useParameters[i] && i == NCType::kkno_r213223){
00566       fReweightConfigRegistry.Set("neugen:kno_r213",
00567                                   change*NCType::kParams[NCType::kkno_r213].defaultVal);
00568       fReweightConfigRegistry.Set("neugen:kno_r223",
00569                                   change*NCType::kParams[NCType::kkno_r223].defaultVal);
00570     }
00571 
00572   }//end loop over adjusted values
00573 
00574   mcReweight.ResetAllReweightConfigs();
00575 
00576   double weight = mcReweight.ComputeWeight(&ei,np,&fReweightConfigRegistry);
00577 
00578   //reweighting is in strange state right now - it returns the weight
00579   //with respect to parameters as of MODBYRS2 - Daikon is MODBYRS4
00580   //so have to get weight from MODBYRS2 defaults to MODBYRS4 defaults first
00581   double defaultWeight = 1.;
00582   if(ReleaseType::IsDaikon(mcType)){
00583     defaultConfigRegistry.Set("neugen:config_name", "MODBYRS");
00584     defaultConfigRegistry.Set("neugen:config_no", 4);
00585 
00586     //use defaults for all parameters up to the combinations
00587     for(int i = 0; i < NCType::kDISFACT; ++i)
00588       defaultConfigRegistry.Set(neugen+NCType::kParams[i].name,
00589                                 NCType::kParams[i].defaultVal);
00590 
00591     mcReweight.ResetAllReweightConfigs();
00592 
00593     defaultWeight = mcReweight.ComputeWeight(&ei,np,&defaultConfigRegistry);
00594 
00595   }//end if daikon
00596 
00597   //divide reweight by default weight
00598   //cout << "oldw = " << weight << endl;
00599   if(TMath::Abs(defaultWeight) > 0.) weight /= defaultWeight;
00600   //cout << "neww = " << weight << endl;
00601   //cout << "neww*w = " << weight * reco->weight << endl;
00602   if( TMath::IsNaN(weight) ){
00603     MSG("NCEventInfo", Msg::kWarning)
00604       << "mcreweight IsNaN "
00605       <<  truth->nuEnergy
00606       << " " << truth->interactionType
00607       << " " << truth->resonanceCode
00608       << " " << truth->nuFlavor
00609       << " " << truth->initialState
00610       << " " << truth->hadronicFinalState
00611       << " " << nucleus
00612       << endl;
00613     weight = 1.;
00614   }
00615 
00616   if(weight != 1.){
00617     MAXMSG("NCEventInfo", Msg::kDebug, 100)
00618       << "mcreweight to " << weight << endl
00619       << "values into neugen" << endl
00620       << "event:nu_en "
00621       << truth->nuEnergy << endl
00622       << "event:nu_px "
00623       << truth->nuDCosX*truth->nuEnergy << endl
00624       << "event:nu_py "
00625       << truth->nuDCosY*truth->nuEnergy << endl
00626       << "event:nu_pz "
00627       << truth->nuDCosZ*truth->nuEnergy << endl
00628       << "event:tar_en "
00629       << truth->targetEnergy << endl
00630       << "event:tar_px "
00631       << truth->targetPX << endl
00632       << "event:tar_py "
00633       << truth->targetPY << endl
00634       << "event:tar_pz "
00635       << truth->targetPZ << endl
00636       << "event:x "
00637       << truth->bjorkenX << endl
00638       << "event:y "
00639       << truth->hadronicY << endl
00640       << "event:q2 " << truth->q2 << endl
00641       << "event:w2 " << truth->w2 << endl
00642       << "event:iaction "
00643       << truth->interactionType << endl
00644       << "event:inu "
00645       << truth->nuFlavor << endl
00646       << "event:iresonance "
00647       << truth->resonanceCode << endl
00648       << "event:initial_state "
00649       << truth->initialState << endl
00650       << "event:nucleus " << nucleus << endl
00651       << "event:had_fs "
00652       << truth->hadronicFinalState
00653       << endl << endl;
00654   }
00655 
00656   return weight;
00657 }

double NCEventInfo::FindRecoWeight ( const bool *  useParameters,
const std::vector< double > &  adjustedValues 
) const

Return the reco weight for this event based on the systematics passed in.

This uses the current values of the shower/track/nu energies in the reco object, so if you want to use the shifted values of those quantities (eg because of shower energy scale shifts), you must call ShiftEnergies() first

double NCEventInfo::FindTransitionProbability ( const NC::OscProb::OscPars pars,
bool  useNuE = false 
) const [private]

Helper for SetEventWeight.

Definition at line 1293 of file NCEventInfo.cxx.

References ANtpHeaderInfo::detector, header, ANtpTruthInfo::interactionType, NCType::kBaseLineFar, Detector::kFar, ANtpTruthInfoBeam::nonOscNuFlavor, ANtpTruthInfo::nuEnergy, ANtpTruthInfo::nuFlavor, NC::OscProb::OscPars::TransitionProbability(), and truth.

01295 {
01296   assert(header && truth);
01297 
01298   if(header->detector != int(Detector::kFar)) return 1;
01299 
01300   const int from = TMath::Abs(truth->nonOscNuFlavor);
01301   const int to = TMath::Abs(truth->nuFlavor);
01302 
01303   if(from == 14 && to == 12 && !useNuE) return 0;
01304 
01305   return pars->TransitionProbability(from, to,
01306                                      NCType::EEventType(truth->interactionType),
01307                                      NCType::kBaseLineFar,
01308                                      truth->nuEnergy);
01309 }

double NCEventInfo::GetEventEnergy ( CandShowerHandle::ShowerType_t  showerType,
bool  stoppingBeamMuon 
) const

Definition at line 273 of file NCEventInfo.cxx.

References GetShowerEnergy(), GetTrackEnergy(), and CandShowerHandle::kWtNC.

Referenced by MicroDSTMaker::FillRecoInfo().

00275 {
00276   double showerEnergy = 0.;
00277   double trackEnergy = 0.;
00278 
00279   if(event->showers > 0)
00280     showerEnergy = GetShowerEnergy(showerType);
00281   if(event->tracks > 0)
00282     trackEnergy = GetTrackEnergy(stoppingBeamMuon);//fCuts->IsStoppingBeamMuon());
00283 
00284 
00285   if(showerType == CandShowerHandle::kWtNC) return showerEnergy;
00286 
00287   return trackEnergy + showerEnergy;
00288 }

double NCEventInfo::GetEventVertex ( double &  x,
double &  y,
double &  z 
) const

Return value is $ \sqrt{x^2+y^2} $ in the FD and distance from the beam axis in the ND.

Definition at line 234 of file NCEventInfo.cxx.

References ANtpHeaderInfo::detector, header, NCType::kNDBeamAngle, NCType::kNDBeamCenterX, NCType::kNDBeamCenterY, Detector::kNear, NCType::kTrackVtxAdjustment, ANtpShowerInfo::planes, ANtpTrackInfo::planes, reco_nom, shower, track, ANtpTrackInfo::vtxX, ANtpTrackInfo::vtxY, and ANtpTrackInfo::vtxZ.

Referenced by MicroDSTMaker::FillRecoInfo().

00235 {
00236   // choice of whether to use Event or Track vertex should follow what is in
00237   //NCAnalysisCuts::InBeamFiducialVolumeOx(), otherwise the vertex that is being
00238   //cut and the vertex that is being stored are not the same
00239 
00240   assert(header);
00241   assert(event && track && shower);
00242 
00243   // If we have reco_nom then it's analysis time and we shouldn't
00244   // be redoing the calculation but merely using the variables we
00245   // calculated before.
00246   assert(!reco_nom);
00247 
00248   if(event->tracks > 0 &&
00249      track->planes - shower->planes > 0){
00250     x = track->vtxX;
00251     y = track->vtxY;
00252     z = track->vtxZ  - NCType::kTrackVtxAdjustment;
00253   }
00254   else{
00255     x = event->vtxX;
00256     y = event->vtxY;
00257     z = event->vtxZ;
00258   }
00259 
00260   // Correct the coordinates into beam coordinates for the purposes of
00261   // calculating this return value only.
00262   if(header->detector == int(Detector::kNear)){
00263     const double x1 = x - NCType::kNDBeamCenterX;
00264     const double y1 = y - NCType::kNDBeamCenterY - NCType::kNDBeamAngle*z;
00265     return TMath::Sqrt(x1*x1 + y1*y1);
00266   }
00267 
00268   return TMath::Sqrt(x*x + y*y);
00269 }

double NCEventInfo::GetShowerEnergy ( CandShowerHandle::ShowerType_t  showerType = CandShowerHandle::kCC  )  const

Definition at line 352 of file NCEventInfo.cxx.

References ANtpHeaderInfo::dataType, det, ANtpHeaderInfo::detector, ANtpShowerInfo::deweightCCGeV, ANtpShowerInfo::deweightNCGeV, EnergyCorrections::FullyCorrectShowerEnergy(), GetTimestamp(), header, CandShowerHandle::kCC, ANtpDefaultValue::kDouble, CandShowerHandle::kEM, CandShowerHandle::kNC, CandShowerHandle::kWtCC, CandShowerHandle::kWtNC, ANtpShowerInfo::linearCCGeV, ANtpShowerInfo::linearNCGeV, reco_nom, shower, ANtpHeaderInfo::softVersion, and ReleaseType::StringToType().

Referenced by MicroDSTMaker::FillRecoInfo(), and GetEventEnergy().

00353 {
00354   assert(header);
00355   assert(shower);
00356 
00357   // If we have reco_nom then it's analysis time and we shouldn't
00358   // be redoing the calculation but merely using the variables we
00359   // calculated before.
00360   assert(!reco_nom);
00361 
00362   const SimFlag::SimFlag_t sim = SimFlag::SimFlag_t(header->dataType);
00363 
00364   using namespace ReleaseType;
00365   const Release_t rt = StringToType(header->softVersion);
00366 
00367   const Detector::Detector_t det = Detector::Detector_t(header->detector);
00368 
00369   //get a validity context for the energy corrections
00370   VldContext vldc(det, sim, GetTimestamp());
00371 
00372   double showerEnergy = ANtpDefaultValue::kDouble;
00373 
00374   switch(showerType){
00375   case CandShowerHandle::kCC:
00376     showerEnergy = shower->linearCCGeV;
00377     break;
00378   case CandShowerHandle::kWtCC:
00379     showerEnergy = shower->deweightCCGeV;
00380     break;
00381   case CandShowerHandle::kNC:
00382     showerEnergy = shower->linearNCGeV;
00383     break;
00384   case CandShowerHandle::kWtNC:
00385     showerEnergy = shower->deweightNCGeV;
00386     break;
00387   case CandShowerHandle::kEM:
00388     assert(0 && "Not implemented");
00389   }
00390 
00391   if(showerEnergy > 0){
00392     showerEnergy = FullyCorrectShowerEnergy(showerEnergy,
00393                                             showerType, vldc, rt);
00394 
00395     // Various corrections for cedar_phy_linfix used to be done
00396     // here. If you want to see them, checkout r1.51
00397   }
00398 
00399   return showerEnergy;
00400 }

SKZPWeightCalculator * NCEventInfo::GetSKZPCalc (  )  [private]

Constructing the SKZPWeightCalculator is extremely expensive, so only do it on demand

Definition at line 169 of file NCEventInfo.cxx.

References fBeamWeightConfig, fSKZPWeight, header, ReleaseType::IsCedar(), ReleaseType::IsDogwood(), ReleaseType::IsMC(), Msg::kError, MAXMSG, ANtpHeaderInfo::softVersion, and ReleaseType::StringToType().

Referenced by FindMEGAFitWeight().

00170 {
00171   if(!fSKZPWeight)
00172     fSKZPWeight = new SKZPWeightCalculator(fBeamWeightConfig, true);
00173 
00174 
00175   const ReleaseType::Release_t rel
00176     = ReleaseType::StringToType(header->softVersion);
00177 
00178   if(fBeamWeightConfig == "PiMinus_CedarDaikon"){
00179     if(!ReleaseType::IsCedar(rel)){
00180       MAXMSG("NCEventInfo", Msg::kError, 10) << endl
00181         << "*******************************************************" << endl
00182         << "* APPLYING CEDARDAIKON SKZP TO NON CEDAR FILE         *" << endl
00183         << "* FIX BEFORE YOU DO A REAL ANALYSIS.                  *" << endl
00184         << "*******************************************************" << endl;
00185     }
00186     if(ReleaseType::IsMC(rel) && !ReleaseType::IsDogwood(rel)){
00187       MAXMSG("NCEventInfo", Msg::kError, 10) << endl
00188         << "*******************************************************" << endl
00189         << "* APPLYING CEDARDAIKON SKZP TO NON DOGWOOD FILE       *" << endl
00190         << "* FIX BEFORE YOU DO A REAL ANALYSIS.                  *" << endl
00191         << "*******************************************************" << endl;
00192     }
00193   }
00194 
00195   if(fBeamWeightConfig == "Dogwood1_Daikon07_v2" && !ReleaseType::IsDogwood(rel)){
00196     MAXMSG("NCEventInfo", Msg::kError, 10) << endl
00197       << "*******************************************************" << endl
00198       << "* APPLYING DOGWOODDAIKON07 SKZP TO NON DOGWOOD FILE   *" << endl
00199       << "* FIX BEFORE YOU DO A REAL ANALYSIS.                  *" << endl
00200       << "*******************************************************" << endl;
00201   }
00202   
00203   return fSKZPWeight;
00204 
00205 }

double NCEventInfo::GetSKZPWeight (  )  const

Return the appropriate SKZP weight.

Definition at line 1373 of file NCEventInfo.cxx.

References reco_nom, and ANtpRecoInfo::weight.

Referenced by NCExtrapolationModule::SetEventWeight().

01374 {
01375   return reco_nom->weight;
01376 }

VldTimeStamp NCEventInfo::GetTimestamp (  )  const

Translate the time information in header into a VldTimeStamp.

Definition at line 1454 of file NCEventInfo.cxx.

References ANtpHeaderInfo::day, header, ANtpHeaderInfo::hour, ANtpHeaderInfo::minute, ANtpHeaderInfo::month, ANtpHeaderInfo::second, and ANtpHeaderInfo::year.

Referenced by GetShowerEnergy(), and GetTrackEnergy().

01455 {
01456   return VldTimeStamp(header->year, header->month, header->day,
01457                       header->hour, header->minute,
01458                       TMath::FloorNint(header->second));
01459 }

double NCEventInfo::GetTrackEnergy ( bool  contained = false  )  const

Definition at line 292 of file NCEventInfo.cxx.

References ANtpHeaderInfo::dataType, det, ANtpHeaderInfo::detector, ANtpTrackInfo::fitMomentum, EnergyCorrections::FullyCorrectMomentumFromRange(), EnergyCorrections::FullyCorrectSignedMomentumFromCurvature(), GetTimestamp(), header, NCType::kMuMassGeV, ANtpTrackInfo::rangeMomentum, ANtpHeaderInfo::softVersion, SQR, ReleaseType::StringToType(), and track.

Referenced by MicroDSTMaker::FillRecoInfo(), and GetEventEnergy().

00293 {
00294   assert(header);
00295 
00296   const SimFlag::SimFlag_t sim = SimFlag::SimFlag_t(header->dataType);
00297 
00298   using namespace ReleaseType;
00299   const Release_t rt = StringToType(header->softVersion);
00300 
00301   const Detector::Detector_t det = Detector::Detector_t(header->detector);
00302 
00303   //get a validity context for the energy corrections
00304   VldContext vldc(det, sim, GetTimestamp());
00305 
00306   bool fromCurve = false;
00307   bool fromRange = false;
00308 
00309   double inputMomentum;
00310 
00311   if(contained || track->fitMomentum < -9000) {
00312     if(track->rangeMomentum > 0){
00313       fromRange = true;
00314       inputMomentum = track->rangeMomentum;
00315     }
00316     else{
00317       fromCurve = true;
00318       inputMomentum = track->fitMomentum;
00319     }
00320   }
00321   else{
00322     fromCurve = true;
00323     inputMomentum = track->fitMomentum;
00324   }
00325 
00326   assert(fromCurve || fromRange);
00327   assert(!(fromCurve && fromRange));
00328 
00329   // required to shut gcc up in optimized mode
00330   // the asserts above guarantee that one of the branches below will be taken
00331   double trackMomentum = 0;
00332 
00333   if(fromCurve)
00334     trackMomentum = FullyCorrectSignedMomentumFromCurvature(inputMomentum,
00335                                                             vldc, rt);
00336   if(fromRange)
00337     trackMomentum = FullyCorrectMomentumFromRange(inputMomentum, vldc, rt);
00338 
00339   return TMath::Sqrt(SQR(trackMomentum) + SQR(NCType::kMuMassGeV));
00340 }

void NCEventInfo::SelectINukeHist ( int &  offset,
int &  from,
int &  to 
) const [private]

Definition at line 1128 of file NCEventInfo.cxx.

References ANtpTruthInfo::hadronicY, kDIS, kQE, kRES, ANtpTruthInfo::nuEnergy, ANtpTruthInfoBeam::resonanceCode, ANtpTruthInfoBeam::trueVisibleE, and truth.

01129 {
01130   assert(truth);
01131 
01132   const double trueY = truth->nuEnergy*truth->hadronicY;
01133 
01134   // pick the histograms to use, based on process but with
01135   // cut on energy. (reason for cut = sparse statistics)
01136   if(truth->resonanceCode == 1001){
01137     if(truth->trueVisibleE < 1.0) offset = kQE;
01138     else if(truth->trueVisibleE < 2.0) offset = kRES;
01139     else offset = kDIS;
01140 
01141     if(trueY < 1.0){
01142       from = kQE;
01143       to = kQE;
01144     }
01145     else if(trueY < 2.0){
01146       from = kRES;
01147       to = kRES;
01148     }
01149     else{
01150       from = kDIS;
01151       to = kDIS;
01152     }
01153   }//end if QE
01154   else if(truth->resonanceCode == 1002
01155           || truth->resonanceCode == 1004){
01156     if(truth->trueVisibleE < 2.0) offset = kRES;
01157     else offset = kDIS;
01158 
01159     if(trueY < 2.0){
01160       from = kRES;
01161       to = kRES;
01162     }
01163     else{
01164       from = kDIS;
01165       to = kDIS;
01166     }
01167   }
01168   else{
01169     from = kDIS;
01170     to = kDIS;
01171     offset = kDIS;
01172   }
01173 }

void NCEventInfo::SetChainBranches ( TChain *  ch,
TString  extractionName,
bool  setTruthBranch 
)

Set branches in ch such that FillFromChain will fill our fields.

Parameters:
ch The chain to get the branches from
extractionName Which analysis* branch to use. eg "TO.", "RPann."
setTruthBranch Whether the truth branch should also be loaded

Definition at line 1399 of file NCEventInfo.cxx.

References analysis, beam, header, reco_nom, and truth.

Referenced by NCExtrapolationModule::Run().

01402 {
01403   const TString extractionBranch = "analysis"+extractionName;
01404 
01405   ch->SetBranchStatus("*", 0);
01406   ch->SetBranchStatus("header.*", 1);
01407   ch->SetBranchStatus("beam.*", 1);
01408   ch->SetBranchStatus("reco.*", 1);
01409   ch->SetBranchStatus(extractionBranch+"*", 1);
01410 
01411   ch->SetBranchAddress("header.", &header);
01412   ch->SetBranchAddress("beam.", &beam);
01413   // Would like to set this branch to also fill the "reco" pointer,
01414   // but can't, hence the FillFromChain function
01415   ch->SetBranchAddress("reco.", &reco_nom);
01416   ch->SetBranchAddress(extractionBranch, &analysis);
01417 
01418   if(setTruthBranch){
01419     ch->SetBranchStatus("truth.*", 1);
01420     ch->SetBranchAddress("truth.", &truth);
01421   }
01422 }

void NCEventInfo::SetEventWeight ( const bool *  useParameters,
const std::vector< double > &  adjustedValues,
const NC::OscProb::OscPars pars,
SKZPWeightCalculator skzpcalc = 0,
NC::RunUtil::ERunType  runType = NC::RunUtil::kRunI,
bool  useNuE = true,
bool  useOscProb = true 
)
void NCEventInfo::SetInfoObjects ( ANtpHeaderInfo headerInfo,
ANtpBeamInfo beamInfo,
ANtpEventInfoNC eventInfo,
ANtpTrackInfoNC trackInfo,
ANtpShowerInfoNC showerInfo,
ANtpAnalysisInfo analysisInfo = 0,
ANtpRecoInfo recoInfo = 0,
ANtpTruthInfoBeam truthInfo = 0 
)

Definition at line 1434 of file NCEventInfo.cxx.

References analysis, beam, header, reco, shower, track, and truth.

Referenced by MicroDSTMaker::ExtractNCCC(), and MicroDSTMaker::MakeuDST().

01442 {
01443   header = headerInfo;
01444   beam = beamInfo;
01445   event = eventInfo;
01446   track = trackInfo;
01447   shower = showerInfo;
01448   analysis = analysisInfo;
01449   reco = recoInfo;
01450   truth = truthInfo;
01451 }

void NCEventInfo::ShiftEnergies ( const bool *  useParameters,
const std::vector< double > &  adjustedValues 
) [private]

Shift the track, shower and nu energies in their NC and CC variants. This should be idempotent because it sets the values in the reco object based on the unshifted values from reco_nom, times the shift

double NCEventInfo::SimulateShowerOffset ( TH2F *  offsetHist,
double  offset 
) const [private]

This function will just abort, because I don't think we use it and I have no way of telling whether it does what is intended

Definition at line 1177 of file NCEventInfo.cxx.

References Msg::kDebug, Msg::kFatal, MAXMSG, MSG, ANtpRecoInfo::muEnergy, ANtpRecoInfo::nuEnergy, reco_nom, ANtpTruthInfoBeam::resonanceCode, ANtpRecoInfo::showerEnergy, ANtpTruthInfoBeam::trueVisibleE, and truth.

01178 {
01179   // (PAR 2009-11-27) I really don't understand this function, and I
01180   // don't think we use it anyway, so I'm moving the onus for checking
01181   // it to any potential future users
01182   MSG("NCEventInfo", Msg::kFatal) 
01183     << "SimulateShowerOffset is untested."
01184     << "If you really want to use it, read the code"
01185     << "and check it does what you want" << endl;
01186   // Dummy message to make sure it exits
01187   MSG("NCEventInfo", Msg::kFatal) << "Exiting" << endl;
01188 
01189   assert(truth && reco_nom);
01190 
01191   MAXMSG("NCEventInfo", Msg::kDebug, 20)
01192     << "simulate offset "
01193     << offsetHist->GetName()
01194     << " " << offset
01195     << " " << truth->trueVisibleE
01196     << " " << reco_nom->nuEnergy
01197     << " " << reco_nom->muEnergy
01198     << " " << reco_nom->showerEnergy
01199     << endl;
01200 
01201   // don't do anything to IMD
01202   if(truth->resonanceCode==1005) return reco_nom->showerEnergy;
01203   // sufficiently far from zero
01204   if(truth->trueVisibleE > 5.){
01205 
01206     if(reco_nom->showerEnergy+offset < 0.)
01207       return 0.;
01208 
01209     return reco_nom->showerEnergy+offset;
01210   }
01211   // below zero = zero
01212   if(truth->trueVisibleE+offset < 0.) return 0.;
01213 
01214   // find original bin in reco and true visible energy
01215   int iox = offsetHist->GetXaxis()->FindBin(truth->trueVisibleE);
01216   int ioy = offsetHist->GetYaxis()->FindBin(reco_nom->showerEnergy);
01217   double porig = offsetHist->GetBinContent(iox,ioy);
01218 
01219   // find shifted bin
01220   int isx = offsetHist->GetXaxis()->FindBin(truth->trueVisibleE
01221                                             + offset);
01222   int isy = 0;
01223   double pnew = 0;
01224   for(int i = 1; i <= offsetHist->GetNbinsY(); i++){
01225     pnew = offsetHist->GetBinContent(isx,i);
01226     if(pnew >= porig){
01227       isy = i;
01228       break;
01229     }
01230   }
01231 
01232   // if we have moved bins, sample from a uniform distribution
01233   // in the new bins
01234   double eup = offsetHist->GetYaxis()->GetBinUpEdge(isy);
01235   double elow = offsetHist->GetYaxis()->GetBinLowEdge(isy);
01236   double E = gRandom->Rndm()*(eup-elow) + elow;
01237 
01238   // if we haven't moved bins in reco
01239   // do not change the energy
01240   if(isy == ioy) return reco_nom->showerEnergy;
01241 
01242   return E;
01243 }


Member Data Documentation

std::string NCEventInfo::fBeamWeightConfig [private]

Definition at line 207 of file NCEventInfo.h.

Referenced by GetSKZPCalc().

Definition at line 206 of file NCEventInfo.h.

Referenced by GetSKZPCalc().

Definition at line 43 of file NCEventInfo.h.

Referenced by NCExtrapolation::AddEvent(), NCExtrapolationPID::AddEvent(), NCExtrapolationNone::AddEvent(), NC::RealDataAdder::AddEventsToExtrapolations(), NC::MockDataAdder::AddEventsToExtrapolations(), NC::FakeDataAdder::AddEventsToExtrapolations(), NC::SplitFakeDataAdder::AddEventsToExtrapolations(), NCExtrapolationModule::AddEventToExtrapolations(), NCExtrapolationModule::AddShiftedEventToExtrapolations(), LoopRunLimitHelper::AreDone(), DeepCopy(), MicroDSTMaker::ExtractNCCC(), NCExtrapolationModule::FillDataQualityPlotsSpecial(), NCExtractionMDA::FillPVector(), FinalEventCheck(), NCExtrapolationModule::FinalEventCheck(), FindMEGAFitWeight(), FindMEGAFitWeightUncertainty(), FindNeugenWeight(), FindTransitionProbability(), GetEventVertex(), NCExtractionANN::GetIdProbability(), NCAnalysisCuts::GetReleaseType(), GetShowerEnergy(), GetSKZPCalc(), GetTimestamp(), GetTrackEnergy(), NCAnalysisCutsCC::InBeamFiducialVolume(), NCAnalysisCutsNC::InBeamFiducialVolume(), NCAnalysisCutsNC::InFiducialVolumeTrue(), NCAnalysisCuts::IsCleanLowMultSnarl(), NCAnalysisCutsCC::IsFarDetectorBeamEvent(), NCAnalysisCutsNC::IsGoodBeamEvent(), NCAnalysisCutsCC::IsGoodBeamEvent(), NCAnalysisCuts::IsGoodBeamSnarl(), NCAnalysisCuts::IsGoodShower(), NCAnalysisCuts::IsGoodSpill(), NCAnalysisCutsNC::IsLIInSpillOx(), NCAnalysisCuts::IsNewSnarl(), NCAnalysisCutsNC::IsStoppingBeamMuon(), NCAnalysisCutsCC::IsStoppingBeamMuon(), LoopRunLimitHelper::LoopRunLimitHelper(), NCExtrapolationModule::NCExtrapolationModule(), NCExtractionCuts::PassesCCCuts(), NCExtractionCutswkNN::PassesNCCuts(), NCExtractionCuts::PassesNCCuts(), NCExtractionMDA::ReadCalibInfoFromFile(), NCExtractionCuts::ReadPDFs(), NC::EventAdderBase::ReportOnEventInfo(), SetChainBranches(), NCExtrapolationModule::SetEventWeight(), SetInfoObjects(), NCAnalysisCuts::SetInfoObjects(), and NCExtrapolationModule::~NCExtrapolationModule().

This is the reco branch as read from the file. DO NOT change it with systematic shifts, etc. With one exception: NCExtrapolationModule::SetEnergies sets reco_nom->showerEnergy to the appropriate NC/CC variant

Definition at line 48 of file NCEventInfo.h.

Referenced by DeepCopy(), FillFromChain(), FinalEventCheck(), GetEventVertex(), GetShowerEnergy(), GetSKZPWeight(), SetChainBranches(), NCExtrapolationModule::SetEnergies(), SimulateShowerOffset(), and NCExtrapolationModule::~NCExtrapolationModule().

Definition at line 176 of file NCEventInfo.h.


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1