All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ana::BoosterFluxHadronSyst Class Reference

#include <BoosterFluxSysts.h>

Inheritance diagram for ana::BoosterFluxHadronSyst:
ana::ISyst

Public Member Functions

virtual ~BoosterFluxHadronSyst ()
 
void Shift (double sigma, caf::SRSliceProxy *slc, double &weight) const override
 Perform the systematic shift. More...
 
- Public Member Functions inherited from ana::ISyst
 ISyst (const std::string &shortName, const std::string &latexName, bool applyPenalty=true, double min=-3, double max=+3)
 
 ISyst (const ISyst &)=delete
 
 ISyst (ISyst &&rhs)=delete
 
virtual ~ISyst ()
 
void operator= (const ISyst &)=delete
 
void operator= (ISyst &&)=delete
 
virtual std::string ShortName () const final
 The name printed out to the screen. More...
 
virtual std::string LatexName () const final
 The name used on plots (ROOT's TLatex syntax) More...
 
virtual double Penalty (double x) const
 
virtual bool ApplyPenalty () const
 Should a penalty be applied for this shift? More...
 
virtual double Min () const
 Return the min/max value for this syst. More...
 
virtual double Max () const
 
virtual int PredInterpMaxNSigma () const
 

Protected Member Functions

 BoosterFluxHadronSyst (int i)
 

Protected Attributes

int fIdx
 
TH1 * fScale [3]
 

Friends

const BoosterFluxHadronSystGetBoosterFluxHadronSyst (unsigned int)
 

Detailed Description

Definition at line 11 of file BoosterFluxSysts.h.

Constructor & Destructor Documentation

ana::BoosterFluxHadronSyst::~BoosterFluxHadronSyst ( )
virtual

Definition at line 15 of file BoosterFluxSysts.cxx.

16 {
17  for(int i = 0; i < 3; ++i) delete fScale[i];
18 }
ana::BoosterFluxHadronSyst::BoosterFluxHadronSyst ( int  i)
inlineprotected

Definition at line 21 of file BoosterFluxSysts.h.

22  : ISyst(TString::Format("booster_%i", i).Data(),
23  TString::Format("Booster flux hadron syst #%i", i).Data()),
24  fIdx(i), fScale() {}
ISyst(const std::string &shortName, const std::string &latexName, bool applyPenalty=true, double min=-3, double max=+3)
Definition: ISyst.cxx:9

Member Function Documentation

void ana::BoosterFluxHadronSyst::Shift ( double  sigma,
caf::SRSliceProxy sr,
double &  weight 
) const
overridevirtual

Perform the systematic shift.

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

Implements ana::ISyst.

Definition at line 21 of file BoosterFluxSysts.cxx.

22 {
23  // Only implemented for numus so far
24  if(/*sr->mc.nnu == 0 ||*/ slc->truth.initpdg != 14) return;
25 
26  if(!fScale[0]){
27  TFile f((FindCAFAnaDir() + "/Systs/booster_flux_shifts.root").c_str());
28  assert(!f.IsZombie());
29 
30  for(int det = 0; det < 3; ++det){
31  std::string detStr;
32  if(det == 0) detStr = "nd";
33  if(det == 1) detStr = "ub";
34  if(det == 2) detStr = "fd";
35 
36  TH1*& h = fScale[det];
37 
38  h = (TH1*)f.Get(TString::Format("syst%d/%s_numu", fIdx, detStr.c_str()).Data());
39  h = (TH1*)h->Clone(UniqueName().c_str());
40  assert(h);
41  h->SetDirectory(0);
42  }
43  } // end if
44 
45  // TODO use the regular detector flag as soon as it's filled reliably
46  int det;
47  const double L = slc->truth.baseline;
48  if(L < 150) det = 0;
49  else if(L < 500) det = 1;
50  else det = 2;
51 
52  TH1* h = fScale[det];
53  assert(h);
54 
55  const int bin = h->FindBin(slc->truth.E);
56 
57  if(bin == 0 || bin == h->GetNbinsX()+1) return;
58 
59  weight *= exp(sigma*h->GetBinContent(bin));
60 }
constexpr details::BinObj< T > bin(T value)
Returns a wrapper to print the specified data in binary format.
while getopts h
std::string UniqueName()
Return a different string each time, for creating histograms.

Friends And Related Function Documentation

const BoosterFluxHadronSyst* GetBoosterFluxHadronSyst ( unsigned  int)
friend

Definition at line 63 of file BoosterFluxSysts.cxx.

64 {
65  // Make sure we always give the same one back
66  static std::vector<const BoosterFluxHadronSyst*> cache;
67 
68  if(i >= cache.size()) cache.resize(i+1);
69 
70  if(!cache[i]) cache[i] = new BoosterFluxHadronSyst(i);
71 
72  return cache[i];
73 }

Member Data Documentation

int ana::BoosterFluxHadronSyst::fIdx
protected

Definition at line 26 of file BoosterFluxSysts.h.

TH1* ana::BoosterFluxHadronSyst::fScale[3]
mutableprotected

Definition at line 28 of file BoosterFluxSysts.h.


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