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

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-11-30/3FlavorAna/Systs/MichelTaggingSyst.h"

Inheritance diagram for ana::MichelTaggingSyst2018:
ana::ISyst

Public Member Functions

 MichelTaggingSyst2018 ()
 
void Shift (double sigma, caf::SRProxy *sr, double &weight) const override
 Perform the systematic shift. More...
 
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 TruthShift (double sigma, caf::SRNeutrinoProxy *nu, double &weight) const
 
virtual bool IsGenieReweight () const
 GENIE reweights can only provide +/-1,2sigma. More...
 

Private Member Functions

int Hash (caf::SRProxy *sr) const
 

Private Attributes

double fProbUP = .36
 
double fProbDO = .08
 
TRandom3 fMRnd
 

Detailed Description

Definition at line 34 of file MichelTaggingSyst.h.

Constructor & Destructor Documentation

ana::MichelTaggingSyst2018::MichelTaggingSyst2018 ( )
inline

Definition at line 37 of file MichelTaggingSyst.h.

References ana::MichelTaggingSyst2020::Hash(), ana::MichelTaggingSyst2020::Shift(), sigma(), sr, and ana::weight.

37 : ISyst("michel_tagging2018", "Michel Electrons Tagging Uncertainty") {}
ISyst(const std::string &shortName, const std::string &latexName)
Definition: ISyst.cxx:10

Member Function Documentation

int ana::MichelTaggingSyst2018::Hash ( caf::SRProxy sr) const
private

Definition at line 111 of file MichelTaggingSyst.cxx.

References caf::Proxy< caf::SRHeader >::cycle, caf::Proxy< caf::SRHeader >::evt, caf::Proxy< caf::StandardRecord >::hdr, makeTrainCVSamples::int, caf::Proxy< caf::SRHeader >::run, seed, caf::Proxy< caf::SRHeader >::subevt, caf::Proxy< caf::SRHeader >::subrun, and registry_explorer::v.

112  {
113  std::size_t seed = 0;
114  std::vector<unsigned int> evtNums {sr->hdr.run, sr->hdr.subrun, (unsigned int)(sr->hdr.cycle), sr->hdr.evt, sr->hdr.subevt};
115  for (auto v : evtNums)
116  seed ^= std::hash<unsigned int>{}(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
117  return seed;
118  }
caf::Proxy< unsigned int > subrun
Definition: SRProxy.h:254
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
caf::Proxy< unsigned int > run
Definition: SRProxy.h:248
caf::Proxy< short unsigned int > subevt
Definition: SRProxy.h:250
unsigned int seed
Definition: runWimpSim.h:102
caf::Proxy< int > cycle
Definition: SRProxy.h:230
caf::Proxy< unsigned int > evt
Definition: SRProxy.h:237
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

The name used on plots (ROOT's TLatex syntax)

Definition at line 30 of file ISyst.h.

References ana::ISyst::fLatexName, ana::ISyst::Shift(), sigma(), sr, and ana::weight.

Referenced by ana::PredictionInterp::DebugPlotColz(), GetGENIEShiftLabels(), ana::NuISyst::SaveTo(), SystsGENIEAna(), and WriteSystName().

30 {return fLatexName;}
std::string fLatexName
Definition: ISyst.h:60
void ana::MichelTaggingSyst2018::Shift ( double  sigma,
caf::SRProxy sr,
double &  weight 
) const
overridevirtual

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 from ana::ISyst.

Definition at line 69 of file MichelTaggingSyst.cxx.

References std::abs(), om::cout, caf::Proxy< caf::SRSlcME >::deltat, caf::Proxy< caf::SRTrkME >::deltat, allTimeWatchdog::endl, ana::MichelTaggingSyst2020::fMRnd, ana::MichelTaggingSyst2020::fProbDO, ana::MichelTaggingSyst2020::fProbUP, ana::MichelTaggingSyst2020::Hash(), samweb_client.utility::hash, caf::Proxy< caf::StandardRecord >::me, caf::Proxy< caf::SRSlcME >::mid, caf::Proxy< caf::SRTrkME >::mid, caf::Proxy< caf::SRMichelE >::nkalman, caf::Proxy< caf::SRMichelE >::nslc, caf::Proxy< caf::SRParticleTruth >::pdg, PandAna.Demos.tute_pid_validation::slc, caf::Proxy< caf::SRMichelE >::slc, caf::Proxy< caf::SRMichelE >::trkkalman, caf::Proxy< caf::SRSlcME >::truth, and caf::Proxy< caf::SRTrkME >::truth.

70  {
71  if(sr->me.nslc != sr->me.slc.size()){
72  std::cout << "me.nslc (" << sr->me.nslc << ") does not match "
73  << "me.slc.size() (" << sr->me.slc.size() << ")..."
74  << std::endl;
75  }
76 
77  if(sr->me.nkalman != sr->me.trkkalman.size()){
78  std::cout << "me.nkalman (" << sr->me.nkalman << ") does not match "
79  << "me.trkkalman.size() (" << sr->me.trkkalman.size() << ")..."
80  << std::endl;
81  }
82 
83  // for the random numbers
84  int hash = Hash(sr);
85  fMRnd.SetSeed(hash);
86 
87  // are shifting the MEs UP or DOWN?
88  double fProb = (sigma >= 0) ? fProbUP : fProbDO;
89 
90  // force to pass/fail MID and deltat criteria in me.slc
91  for(caf::SRSlcMEProxy& slc: sr->me.slc){
92  if(std::abs(slc.truth.pdg) == 11 &&
93  fMRnd.Uniform() < std::abs(sigma*fProb)){
94  slc.mid = (sigma >= 0) ? 1.0 : -1.0;
95  if(slc.deltat <= 800.) slc.deltat = 801.;
96  }
97  }
98 
99  // force to pass/fail MID and deltat criteria in trkkalman
100  for(caf::SRTrkMEProxy& trk: sr->me.trkkalman){
101  if(std::abs(trk.truth.pdg) == 11 &&
102  fMRnd.Uniform() < std::abs(sigma*fProb)){
103  trk.mid = (sigma >= 0) ? 1.0 : -1.0;
104  if(trk.deltat <= 800.) trk.deltat = 801.;
105  }
106  }
107  }
Proxy for caf::SRSlcME.
Definition: SRProxy.h:658
caf::Proxy< size_t > nslc
Definition: SRProxy.h:716
caf::Proxy< std::vector< caf::SRTrkME > > trkkalman
Definition: SRProxy.h:721
caf::Proxy< std::vector< caf::SRSlcME > > slc
Definition: SRProxy.h:717
caf::Proxy< caf::SRParticleTruth > truth
Definition: SRProxy.h:698
caf::Proxy< float > deltat
Definition: SRProxy.h:692
caf::Proxy< caf::SRMichelE > me
Definition: SRProxy.h:2139
float abs(float number)
Definition: d0nt_math.hpp:39
caf::Proxy< float > deltat
Definition: SRProxy.h:670
Proxy for caf::SRTrkME.
Definition: SRProxy.h:680
Track finder for cosmic rays.
caf::Proxy< size_t > nkalman
Definition: SRProxy.h:715
caf::Proxy< float > mid
Definition: SRProxy.h:673
double sigma(TH1F *hist, double percentile)
OStream cout
Definition: OStream.cxx:6
caf::Proxy< caf::SRParticleTruth > truth
Definition: SRProxy.h:676
caf::Proxy< float > mid
Definition: SRProxy.h:695
int Hash(caf::SRProxy *sr) const
virtual const std::string& ana::ISyst::ShortName ( ) const
inlinefinalvirtualinherited
virtual void ana::ISyst::TruthShift ( double  sigma,
caf::SRNeutrinoProxy nu,
double &  weight 
) const
inlinevirtualinherited

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 in demo::DemoSyst1, ana::BeamSyst, ana::GenericSystComponentScale< T >, ana::GenericSystComponentScale< T >, ana::GenericSystComponentScale< T >, and ana::NOvARwgtSyst.

Definition at line 46 of file ISyst.h.

Referenced by ana::ISyst::Shift().

49  {
50  // Implement this function if your systematic depends only
51  // SRNeutrino. Left blank by default, since systematics using other
52  // information can do nothing sensible to the nuTree.
53  }

Member Data Documentation

TRandom3 ana::MichelTaggingSyst2018::fMRnd
mutableprivate

Definition at line 52 of file MichelTaggingSyst.h.

double ana::MichelTaggingSyst2018::fProbDO = .08
private

Definition at line 50 of file MichelTaggingSyst.h.

double ana::MichelTaggingSyst2018::fProbUP = .36
private

Definition at line 49 of file MichelTaggingSyst.h.


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