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

SummedSmallGENIE systematics, from histograms: More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-03-03/3FlavorAna/Systs/NumuSysts.h"

Inheritance diagram for ana::NumuSummedSmallGENIESyst:
ana::ISyst

Public Member Functions

 NumuSummedSmallGENIESyst (const std::string &fnameND, const std::string &fnameFD)
 
 ~NumuSummedSmallGENIESyst ()
 
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 Types

enum  { kND, kFD, kNumDets }
 
enum  { kSig, kBkg, kNumComponents }
 

Private Member Functions

void InitializeHistograms () const
 

Private Attributes

std::string fHistoFnames [kNumDets]
 
TH1D * fHists [kNumDets][kNumComponents]
 

Detailed Description

SummedSmallGENIE systematics, from histograms:

Definition at line 40 of file NumuSysts.h.

Member Enumeration Documentation

anonymous enum
private
anonymous enum
private

Constructor & Destructor Documentation

ana::NumuSummedSmallGENIESyst::NumuSummedSmallGENIESyst ( const std::string fnameND,
const std::string fnameFD 
)

Definition at line 208 of file NumuSysts.cxx.

References fHistoFnames, fHists, kFD, and kSig.

Referenced by ana::getAllDirectNumuSysts2017().

210  : ISyst("numuSumSmallGENIE", "Summed Small GENIE")
211  {
212  fHistoFnames[0] = fnameND;
213  fHistoFnames[1] = fnameFD;
214 
215  // Signal that these aren't loaded yet
216  fHists[kFD][kSig] = 0;
217  }
std::string fHistoFnames[kNumDets]
Definition: NumuSysts.h:56
ISyst(const std::string &shortName, const std::string &latexName)
Definition: ISyst.cxx:10
TH1D * fHists[kNumDets][kNumComponents]
Definition: NumuSysts.h:58
ana::NumuSummedSmallGENIESyst::~NumuSummedSmallGENIESyst ( )

Definition at line 276 of file NumuSysts.cxx.

References fHists, MECModelEnuComparisons::i, calib::j, kNumComponents, and kNumDets.

277  {
278  for(int i = 0; i < kNumDets; ++i){
279  for(int j = 0; j < kNumComponents; ++j){
280  delete fHists[i][j];
281  fHists[i][j] = 0;
282  }
283  }
284  }
const double j
Definition: BetheBloch.cxx:29
TH1D * fHists[kNumDets][kNumComponents]
Definition: NumuSysts.h:58

Member Function Documentation

void ana::NumuSummedSmallGENIESyst::InitializeHistograms ( ) const
private

Definition at line 221 of file NumuSysts.cxx.

References om::cerr, allTimeWatchdog::endl, fHistoFnames, fHists, fin, kBkg, kFD, kND, kNumDets, and kSig.

Referenced by Shift().

222  {
223 
224  // Bail if we've already loaded histograms
225  if(fHists[kFD][kSig]) return;
226 
227 
228  for(int iDet = kND; iDet < kNumDets; ++iDet){
229  TFile fin(fHistoFnames[iDet].c_str(), "read");
230  if(fin.IsZombie()){
231  std::cerr << "Warning: couldn't open " <<
232  fHistoFnames[iDet] << std::endl;
233  return;
234  }
235 
236  fHists[iDet][kSig] = (TH1D*)fin.Get("allcc_sig")->Clone();
237  fHists[iDet][kSig]->SetDirectory(0);
238  fHists[iDet][kBkg] = (TH1D*)fin.Get("allcc_bkg")->Clone();
239  fHists[iDet][kBkg]->SetDirectory(0);
240  }
241  }
TString fin
Definition: Style.C:24
OStream cerr
Definition: OStream.cxx:7
std::string fHistoFnames[kNumDets]
Definition: NumuSysts.h:56
TH1D * fHists[kNumDets][kNumComponents]
Definition: NumuSysts.h:58
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::NumuSummedSmallGENIESyst::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

Initialize the scale factor for the weight

Reimplemented from ana::ISyst.

Definition at line 245 of file NumuSysts.cxx.

References abs(), om::cerr, fillBadChanDBTables::det, caf::Proxy< caf::SRHeader >::det, allTimeWatchdog::endl, energy, caf::Proxy< caf::StandardRecord >::energy, fHists, caf::Proxy< caf::StandardRecord >::hdr, analysePickle::hist, InitializeHistograms(), kBkg, kFD, kND, kSig, caf::Proxy< caf::StandardRecord >::mc, caf::Proxy< caf::SRTruthBranch >::nnu, caf::Proxy< caf::SRTruthBranch >::nu, caf::Proxy< caf::SREnergyBranch >::numu, sigma(), and caf::Proxy< caf::SRNumuEnergy >::trkccE.

247  {
249  /// Initialize the scale factor for the weight
250  double shift = 0;
251  if(sr->mc.nnu == 0) return;
252 
253  int det;
254  switch (sr->hdr.det){
255  case 1 : det = kND; break;
256  case 2 : det = kFD; break;
257  default: std::cerr <<"Wrong detector; ignore" << std::endl; return;
258  }
259 
260  TH1D* hist = NULL;
261  if(abs(sr->mc.nu[0].pdg) == 14 && sr->mc.nu[0].iscc)
262  hist = fHists[det][kSig];
263  else
264  hist = fHists[det][kBkg];
265 
266  double energy = sr->energy.numu.trkccE;
267 
268  if (energy > hist->GetXaxis()->GetXmin() &&
269  energy < hist->GetXaxis()->GetXmax() )
270  shift = hist->Interpolate(energy) - 1;
271  weight *= 1 + shift * sigma;
272 
273  }
caf::Proxy< float > trkccE
Definition: SRProxy.h:195
const Var weight
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
caf::Proxy< caf::SRNumuEnergy > numu
Definition: SRProxy.h:214
caf::Proxy< std::vector< caf::SRNeutrino > > nu
Definition: SRProxy.h:618
OStream cerr
Definition: OStream.cxx:7
void abs(TH1 *hist)
caf::Proxy< short int > nnu
Definition: SRProxy.h:617
caf::Proxy< caf::SREnergyBranch > energy
Definition: SRProxy.h:2136
double energy
Definition: plottest35.C:25
double sigma(TH1F *hist, double percentile)
caf::Proxy< caf::SRTruthBranch > mc
Definition: SRProxy.h:2138
TH1D * fHists[kNumDets][kNumComponents]
Definition: NumuSysts.h:58
void InitializeHistograms() const
Definition: NumuSysts.cxx:221
caf::Proxy< caf::Det_t > det
Definition: SRProxy.h:232
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 ana::BeamSyst, demo::DemoSyst1, ana::GenericSystComponentScale< T >, ana::GenericSystComponentScale< T >, ana::GenericSystComponentScale< T >, ana::ReinteractionSyst, 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

std::string ana::NumuSummedSmallGENIESyst::fHistoFnames[kNumDets]
private

Definition at line 56 of file NumuSysts.h.

Referenced by InitializeHistograms(), and NumuSummedSmallGENIESyst().

TH1D* ana::NumuSummedSmallGENIESyst::fHists[kNumDets][kNumComponents]
mutableprivate

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