Public Member Functions | Private Member Functions | Private Attributes | List of all members
ana::ReinteractionSyst Class Reference

Base class for GEANT4 reinteraction systs. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-04-10/CAFAna/Systs/ReinteractionSysts.h"

Inheritance diagram for ana::ReinteractionSyst:
ana::ISyst

Public Member Functions

 ReinteractionSyst (std::string shortName, std::string latexName, int pdg, EG4RwChannel channel)
 
void TruthShift (double sigma, caf::SRNeutrinoProxy *nu, double &weight) const override
 
int GetPdg () const
 
EG4RwChannel GetChannel () const
 
std::vector< intGetKnobIndices () const
 
virtual const std::stringShortName () const final
 The name printed out to the screen. More...
 
virtual const std::stringLatexName () const final
 The name used on plots (ROOT's TLatex syntax) More...
 
virtual void Shift (double sigma, caf::SRProxy *sr, double &weight) const
 Perform the systematic shift. More...
 
virtual bool IsGenieReweight () const
 GENIE reweights can only provide +/-1,2sigma. More...
 

Private Member Functions

double GetWeight (double knobval, caf::SRNeutrinoProxy *nu) const
 
void SetKnobIndices ()
 

Private Attributes

int fPdg
 PDG code of particle this syts is for. More...
 
EG4RwChannel fChannel
 Scattering channel (knob) this syst is for. More...
 
std::vector< intfKnobIndices
 Indices in CAF vector of weights which pertain to this knob. More...
 

Detailed Description

Base class for GEANT4 reinteraction systs.

Definition at line 17 of file ReinteractionSysts.h.

Constructor & Destructor Documentation

ana::ReinteractionSyst::ReinteractionSyst ( std::string  shortName,
std::string  latexName,
int  pdg,
EG4RwChannel  channel 
)
inline

Definition at line 20 of file ReinteractionSysts.h.

References sigma(), and ana::weight.

21  : ISyst(shortName, latexName),
22  fPdg(pdg),
23  fChannel(channel)
24  {
26  }
int fPdg
PDG code of particle this syts is for.
EG4RwChannel fChannel
Scattering channel (knob) this syst is for.
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
ISyst(const std::string &shortName, const std::string &latexName)
Definition: ISyst.cxx:10

Member Function Documentation

EG4RwChannel ana::ReinteractionSyst::GetChannel ( ) const
inline

Definition at line 31 of file ReinteractionSysts.h.

31 { return fChannel;}
EG4RwChannel fChannel
Scattering channel (knob) this syst is for.
std::vector<int> ana::ReinteractionSyst::GetKnobIndices ( ) const
inline

Definition at line 32 of file ReinteractionSysts.h.

32 { return fKnobIndices;}
std::vector< int > fKnobIndices
Indices in CAF vector of weights which pertain to this knob.
int ana::ReinteractionSyst::GetPdg ( ) const
inline

Definition at line 30 of file ReinteractionSysts.h.

30 { return fPdg;}
int fPdg
PDG code of particle this syts is for.
double ana::ReinteractionSyst::GetWeight ( double  knobval,
caf::SRNeutrinoProxy nu 
) const
private

Definition at line 21 of file ReinteractionSysts.cxx.

References ana::assert(), om::cerr, fKnobIndices, fPdg, caf::Proxy< caf::SRMCReweight >::geant4, MECModelEnuComparisons::i, ana::Interpolate(), caf::Proxy< caf::SRGeant4Weights >::piminus_univ, caf::Proxy< caf::SRGeant4Weights >::piplus_univ, caf::Proxy< caf::SRGeant4Weights >::proton_univ, and caf::Proxy< caf::SRNeutrino >::rwgt.

Referenced by TruthShift().

22  {
23 
24  // Convert requested nSigma to a knob value.
25  // At this time we arbitrarily say that each knob has error 0.2, but this may change in future
26  double knobval = 1.0 + sigma*0.2;
27 
28  if(knobval == 1.0) return 1.0;
29 
30  if(knobval < 0.0){
31  std::cerr << "Warning: knob set to negative value. Returning weight of 1.0 instead";
32  std::cerr.flush();
33  return 1.0;
34  }
35 
36  double knob_weights[6];
37 
38  const caf::Proxy<std::vector<float>>* wgts = 0;
39  if(fPdg == 211) wgts = &nu->rwgt.geant4.piplus_univ;
40  else if(fPdg == -211) wgts = &nu->rwgt.geant4.piminus_univ;
41  else if(fPdg == 2212) wgts = &nu->rwgt.geant4.proton_univ;
42 
43  assert(wgts);
44 
45  if(wgts->size() < 1){
46  std::cerr << "Warning: no stored weights found for this event. Returning weight of 1.0";
47  std::cerr.flush();
48  return 1.0;
49  }
50  else{
51  // Grab the relevant indices from weight vector
52  for(uint i=0; i<fKnobIndices.size(); i++){
53  knob_weights[i] = (*wgts)[fKnobIndices[i]];
54  }
55  }
56 
57  return Interpolate(knobval, knob_weights);
58  }
int fPdg
PDG code of particle this syts is for.
caf::Proxy< caf::SRMCReweight > rwgt
Definition: SRProxy.h:560
OStream cerr
Definition: OStream.cxx:7
double Interpolate(double knobval, double knob_weights[6])
caf::Proxy< std::vector< float > > proton_univ
Definition: SRProxy.h:457
double sigma(TH1F *hist, double percentile)
caf::Proxy< std::vector< float > > piplus_univ
Definition: SRProxy.h:455
caf::Proxy< std::vector< float > > piminus_univ
Definition: SRProxy.h:453
assert(nhit_max >=nhit_nbins)
std::vector< int > fKnobIndices
Indices in CAF vector of weights which pertain to this knob.
caf::Proxy< caf::SRGeant4Weights > geant4
Definition: SRProxy.h:504
unsigned int uint
virtual bool ana::ISyst::IsGenieReweight ( ) const
inlinevirtualinherited

GENIE reweights can only provide +/-1,2sigma.

Reimplemented in ana::SummedSyst.

Definition at line 56 of file ISyst.h.

56 {return false;}
virtual const std::string& ana::ISyst::LatexName ( ) const
inlinefinalvirtualinherited
void ana::ReinteractionSyst::SetKnobIndices ( )
private

Definition at line 62 of file ReinteractionSysts.cxx.

References abs(), om::cout, allTimeWatchdog::endl, fChannel, fKnobIndices, fPdg, ana::kAbs, ana::kCex, ana::kDcex, ana::kProd, ana::kQe, and ana::kTot.

63  {
64 
65  if(abs(fPdg) == 211){
66  // ---------------------------------------------------------------------------
67  // Set the indices which hold weights for the {0.8, 0.9, 0.95, 1.05, 1.1, 1.2}
68  // setting of this knob in CAF vector rwgt.geant4.<species>_univ
69  // ---------------------------------------------------------------------------
70 
71  // Total inelastic xsec knob. Also known as "reactive" knob sometimes.
72  // Other knobs are subset of this
73  if(fChannel == EG4RwChannel::kTot) fKnobIndices = {0,1,2,3,4,5};
74  // Charge exchange knob
75  else if(fChannel == EG4RwChannel::kCex) fKnobIndices = {6,7,8,9,10,11};
76  // Double charge exchange knob
77  else if(fChannel == EG4RwChannel::kDcex) fKnobIndices = {12,13,14,15,16,17};
78  // Quasi-elastic knob. AKA "inel" knob
79  else if(fChannel == EG4RwChannel::kQe) fKnobIndices = {18,19,20,21,22,23};
80  // Pion absorption knob
81  else if(fChannel == EG4RwChannel::kAbs) fKnobIndices = {24,25,26,27,28,29};
82  // Pion production knob
83  else if(fChannel == EG4RwChannel::kProd) fKnobIndices = {30,31,32,33,34,35};
84  else{
85  // This else() is probably redundant with enum
86  //std::cout << "Knob \"" << fChannel << "\" not supported for pdg \"" << fPdg << "\" \n";
87  std::cout << "Knob not supported for pdg \"" << fPdg << "\" \n";
88  std::cout << "Allowed options are {kTot, kCex, kDcex, kQe, kAbs, kProd}" << std::endl;
89  abort();
90  }
91  } // end if(piplus || piminus)
92  else if( fPdg == 2212){
93  // Total inelastic xsec knob. Also known as "reactive" knob sometimes.
94  // This is currently the only knobs for protons
95  if(fChannel == EG4RwChannel::kTot) fKnobIndices = {0,1,2,3,4,5};
96  else{
97  //std::cout << "Knob \"" << fChannel << "\" not supported for pdg \"" << fPdg << "\" \n";
98  std::cout << "Knob not supported for pdg \"" << fPdg << "\" \n";
99  std::cout << "Only allowed option is \"kTot\"" << std::endl;
100  abort();
101  }
102  } // end if(proton)
103  else{
104  std::cout << "PDG code \"" << fPdg << "\" not supported \n";
105  std::cout << "Allowed options are {211, -211, 2212}" << std::endl;
106  abort();
107  }
108 
109  }
int fPdg
PDG code of particle this syts is for.
void abs(TH1 *hist)
EG4RwChannel fChannel
Scattering channel (knob) this syst is for.
OStream cout
Definition: OStream.cxx:6
std::vector< int > fKnobIndices
Indices in CAF vector of weights which pertain to this knob.
void ana::ISyst::Shift ( double  sigma,
caf::SRProxy sr,
double &  weight 
) const
virtualinherited

Perform the systematic shift.

Override this function if your systematic depends on non-SRNeutrino quantities. If it is SRNeutrino-only, implement the other function, and let this default forward to you when necessary.

Parameters
sigmaNumber of sigma to shift record by
srThe record to inspect and alter
weightScale this weight for reweighting systematics

Reimplemented in ana::MinosResSuppSyst, ana::MECDoubleGaussEnhSystDOWN, ana::MECDoubleGaussEnhSystUP, ana::MECDoubleGaussEnhSyst, ana::MinosResSuppSyst, ana::MECGaussEnhSyst, ana::MECGaussEnhSyst, jw::MECInitStateNPFracShift, jw::CompNormSyst, ana::CompNormSyst, ana::CompNormSyst, ana::BolombMuESyst2019, ana::DISHighWScaleSyst, ana::ContainmentSyst, ana::PileupMuESyst2019, ana::PileupMuESyst2020, ana::NumuRelEnergyScaleSyst, ana::RockMuonNormSyst, ana::NumuEnergyScaleSyst, ana::RemIDScaleSyst, ana::UnCorrMuCatMuESyst2019, ana::LEMScaleSyst, ana::NumuRelNormSyst, ana::UnCorrMuCatMuESyst2020, demo::DemoSyst2, ana::DirectRelHadEScaleSyst2017, ana::BeamIntensitySyst, ana::NumuNormSyst, ana::Nus18BaseSyst, ana::UnCorrNDMuEScaleSyst2019, ana::KaonScaleSyst, ana::FDMuEnergyScaleSyst, ana::UnCorrNDMuEScaleSyst2020, ana::NumuTauContaminationSyst, ana::MyWrongSignScale, ana::MECDoubleGaussEnhSyst, ana::NueAcceptSystSignalKin2020RHC, ana::DirectHadEScaleSyst2017, ana::NumuCCScaleSyst, ana::Nus18FlatSyst, ana::FDHadEnergyScaleSyst, ana::NumuNCScaleSyst, ana::NueAcceptSystSignalKin2018RHC, ana::BeamNueScaleSyst, ana::NueAcceptSystBkg2018RHC, ana::UnCorrFDMuEScaleSyst2019, ana::UnCorrFDMuEScaleSyst2020, ana::MuEnergyScaleSyst, ana::WrongSignScale100, ana::NCScaleSyst, ana::covmx::NormSyst, ana::NusFlatSyst, ana::RelMuEScaleSyst2017, ana::MECDoubleGaussEnhSystNux, ana::Nus17FlatSyst, ana::Numutest, ana::NumuSummedSmallGENIESyst, ana::Nus18SystFromHist, ana::NusAna2020TauSyst, ana::NueAcceptSystSignalKin2020FHC, ana::WrongSignEnergyBin, ana::RelNormSyst, ana::MichelTaggingSyst2018, ana::Nuetest, ana::GenericSystComponentScale< T >, ana::CorrMuEScaleSyst2019, ana::CorrMuEScaleSyst2020, ana::NumuGEANTScaleSyst, ana::GenericSystComponentScale< T >, ana::HadEnergyScaleSyst, ana::NueAcceptSystSignalKin2018FHC, ana::NormSyst, ana::NusAna2020KaonSyst, ana::WrongSignEnergyBinRHC, ana::NuWROSyst, ana::GenericSystComponentScale< T >, ana::LeptonAngleSyst, ana::NueExtrapSystSignalKin2017, ana::SystFromWeight, ana::MuEScaleSyst2017, ana::NCtest, ana::NusSystFromHist, ana::NueSyst, ana::Nus17SystFromHist, ana::SummedSyst, ana::DummyNue2017Syst, ana::DummyNumu2017Syst, ana::GeniePCASyst, ana::NueAcceptSystBkg2018FHC, ana::NumuGEANTNormSyst, ana::DummyAnaSyst, ana::NeutronVisEScaleSyst2018, ana::NueExtrapSystBkg2017, ana::DummyRockScaleSyst, ana::MichelTaggingSyst2020, ana::CosmicBkgScaleSyst, ana::WrongSignScale, ana::WrongSignContamination, ana::NCSyst, and ana::NumuSyst.

Definition at line 26 of file ISyst.cxx.

References caf::Proxy< caf::StandardRecord >::mc, caf::Proxy< caf::SRTruthBranch >::nnu, caf::Proxy< caf::SRTruthBranch >::nu, and ana::ISyst::TruthShift().

Referenced by ana::ISyst::LatexName(), and ana::GenericSystComponentScale< T >::Shift().

27  {
28  // Override this function if your systematic depends on non-SRNeutrino
29  // quantities. If it is SRNeutrino-only, implement the other function,
30  // and let this default forward to you when necessary.
31  if(sr->mc.nnu > 0) TruthShift(sigma, &sr->mc.nu[0], weight);
32  }
const Var weight
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
virtual void TruthShift(double sigma, caf::SRNeutrinoProxy *nu, double &weight) const
Definition: ISyst.h:46
double sigma(TH1F *hist, double percentile)
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
virtual const std::string& ana::ISyst::ShortName ( ) const
inlinefinalvirtualinherited
void ana::ReinteractionSyst::TruthShift ( double  sigma,
caf::SRNeutrinoProxy nu,
double &  weight 
) const
overridevirtual

For systematics that deal only with the neutrino truth and not any reconstruction/PID details. Systematics defined this way will work on nuTree-derived spectra too (e.g. denominators of efficiencies).

Reimplemented from ana::ISyst.

Definition at line 13 of file ReinteractionSysts.cxx.

References GetWeight().

14  {
15  weight *= this->GetWeight(sigma, nu);
16 
17  }
const Var weight
double GetWeight(double knobval, caf::SRNeutrinoProxy *nu) const
double sigma(TH1F *hist, double percentile)

Member Data Documentation

EG4RwChannel ana::ReinteractionSyst::fChannel
private

Scattering channel (knob) this syst is for.

Definition at line 36 of file ReinteractionSysts.h.

Referenced by SetKnobIndices().

std::vector<int> ana::ReinteractionSyst::fKnobIndices
private

Indices in CAF vector of weights which pertain to this knob.

Definition at line 37 of file ReinteractionSysts.h.

Referenced by GetWeight(), and SetKnobIndices().

int ana::ReinteractionSyst::fPdg
private

PDG code of particle this syts is for.

Definition at line 35 of file ReinteractionSysts.h.

Referenced by GetWeight(), and SetKnobIndices().


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