Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ana::SystMakerShiftSigma Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N20-12-01/NuXAna/Analysis/SystMaker.h"

Public Member Functions

 SystMakerShiftSigma ()
 
 SystMakerShiftSigma (std::string name, int sigma)
 
 ~SystMakerShiftSigma ()
 SystMakerShiftSigma destructor. More...
 
void PrintSigma (std::ostream &os=std::cout)
 Print the sigmas for a given shift. More...
 
void SaveTo (TDirectory *dir) const
 

Static Public Member Functions

static SystMakerShiftSigmaLoadFrom (TDirectory *dir)
 

Public Attributes

std::string fName
 
int fSigma
 
IPredictionfPrediction
 
std::pair< TH1 *, TH1 * > fShiftedSpectrum
 
std::pair< TH1 *, TH1 * > fShiftedRatio
 
std::pair< double, double > fShift
 

Detailed Description

Definition at line 70 of file SystMaker.h.

Constructor & Destructor Documentation

ana::SystMakerShiftSigma::SystMakerShiftSigma ( )
ana::SystMakerShiftSigma::SystMakerShiftSigma ( std::string  name,
int  sigma 
)
ana::SystMakerShiftSigma::~SystMakerShiftSigma ( )

SystMakerShiftSigma destructor.

Definition at line 146 of file SystMaker.cxx.

References fPrediction, fShiftedRatio, and fShiftedSpectrum.

146  {
147  if (fPrediction) delete fPrediction;
148  if (fShiftedSpectrum.first) delete fShiftedSpectrum.first;
149  if (fShiftedSpectrum.second) delete fShiftedSpectrum.second;
150  if (fShiftedRatio.first) delete fShiftedRatio.first;
151  if (fShiftedRatio.second) delete fShiftedRatio.second;
152  }
std::pair< TH1 *, TH1 * > fShiftedRatio
Definition: SystMaker.h:82
IPrediction * fPrediction
Definition: SystMaker.h:80
std::pair< TH1 *, TH1 * > fShiftedSpectrum
Definition: SystMaker.h:81

Member Function Documentation

SystMakerShiftSigma * ana::SystMakerShiftSigma::LoadFrom ( TDirectory *  dir)
static

Definition at line 200 of file SystMaker.cxx.

References ana::assert(), fPrediction, fShift, fShiftedRatio, fShiftedSpectrum, ana::PredictionSterile::LoadFrom(), ana::FDPredictionSterile::LoadFrom(), ana::NDPredictionSterile::LoadFrom(), make_pair(), SystMakerShiftSigma(), getGoodRuns4SAM::tag, and registry_explorer::v.

Referenced by ana::SystMakerShift::LoadFrom().

200  {
201 
202  DontAddDirectory guard;
203 
204  TObjString* tag = (TObjString*)dir->Get("type");
205  assert(tag);
206  assert(tag->GetString() == "SystMakerShiftSigma");
207 
208  TObjString* name = (TObjString*)dir->Get("name");;
209  const TVectorD sigma = *(TVectorD*)dir->Get("sigma");
210  SystMakerShiftSigma* systMakerShiftSigma
211  = new SystMakerShiftSigma(name->GetString().Data(), sigma[0]);
212 
213  tag = (TObjString*)dir->Get("pred/type");
214  assert(tag);
215  if (tag->GetString() == "NDPredictionSterile")
216  systMakerShiftSigma->fPrediction = NDPredictionSterile::LoadFrom(dir, "pred").release();
217  else if (tag->GetString() == "FDPredictionSterile")
218  systMakerShiftSigma->fPrediction = FDPredictionSterile::LoadFrom(dir, "pred").release();
219  else if (tag->GetString() == "PredictionSterile")
220  systMakerShiftSigma->fPrediction = PredictionSterile::LoadFrom(dir, "pred").release();
221  else assert(false && "Prediction type not recognised!");
222 
223  TH1* shiftSig = (TH1*)dir->Get("shiftSig");
224  TH1* shiftBkg = (TH1*)dir->Get("shiftBkg");
225  if (shiftSig and shiftBkg)
226  systMakerShiftSigma->fShiftedSpectrum = make_pair(shiftSig, shiftBkg);
227  TH1* shiftRatSig = (TH1*)dir->Get("shiftRatSig");
228  TH1* shiftRatBkg = (TH1*)dir->Get("shiftRatBkg");
229  if (shiftRatSig and shiftRatBkg)
230  systMakerShiftSigma->fShiftedRatio = make_pair(shiftRatSig, shiftRatBkg);
231 
232  const TVectorD v = *(TVectorD*)dir->Get("shift");
233  systMakerShiftSigma->fShift = make_pair(v[0], v[1]);
234 
235  return systMakerShiftSigma;
236 
237  }
const XML_Char * name
Definition: expat.h:151
static std::unique_ptr< FDPredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
static std::unique_ptr< PredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
static std::unique_ptr< NDPredictionSterile > LoadFrom(TDirectory *dir, const std::string &name)
double sigma(TH1F *hist, double percentile)
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
void ana::SystMakerShiftSigma::PrintSigma ( std::ostream &  os = std::cout)

Print the sigmas for a given shift.

Definition at line 156 of file SystMaker.cxx.

References allTimeWatchdog::endl, fShift, and fSigma.

156  {
157  os << " " << showpos << fSigma << ": "
158  << fShift.first << " (signal), "
159  << fShift.second << " (background)"
160  << endl;
161  }
std::pair< double, double > fShift
Definition: SystMaker.h:83
void ana::SystMakerShiftSigma::SaveTo ( TDirectory *  dir) const

Definition at line 164 of file SystMaker.cxx.

References fName, fPrediction, fShift, fShiftedRatio, fShiftedSpectrum, fSigma, ana::IPrediction::SaveTo(), sigma(), tmp, registry_explorer::v, and Write().

164  {
165 
166  TDirectory* tmp = gDirectory;
167 
168  dir->cd();
169  TObjString("SystMakerShiftSigma").Write("type");
170 
171  TObjString(fName.c_str()).Write("name");
172  TVectorD sigma(1);
173  sigma[0] = fSigma;
174  sigma.Write("sigma");
175 
176  fPrediction->SaveTo(dir, "pred");
177  TH1* shiftSig = fShiftedSpectrum.first;
178  TH1* shiftBkg = fShiftedSpectrum.second;
179  if (shiftSig)
180  shiftSig->Write("shiftSig");
181  if (shiftBkg)
182  shiftBkg->Write("shiftBkg");
183  TH1* shiftRatSig = fShiftedRatio.first;
184  TH1* shiftRatBkg = fShiftedRatio.second;
185  if (shiftRatSig)
186  shiftRatSig->Write("shiftRatSig");
187  if (shiftRatBkg)
188  shiftRatBkg->Write("shiftRatBkg");
189 
190  TVectorD v(2);
191  v[0] = fShift.first;
192  v[1] = fShift.second;
193  v.Write("shift");
194 
195  tmp->cd();
196 
197  }
std::pair< TH1 *, TH1 * > fShiftedRatio
Definition: SystMaker.h:82
Float_t tmp
Definition: plot.C:36
virtual void SaveTo(TDirectory *dir, const std::string &name) const
IPrediction * fPrediction
Definition: SystMaker.h:80
std::pair< double, double > fShift
Definition: SystMaker.h:83
double sigma(TH1F *hist, double percentile)
std::pair< TH1 *, TH1 * > fShiftedSpectrum
Definition: SystMaker.h:81
TDirectory * dir
Definition: macro.C:5
gm Write()

Member Data Documentation

std::string ana::SystMakerShiftSigma::fName

Definition at line 78 of file SystMaker.h.

Referenced by SaveTo().

IPrediction* ana::SystMakerShiftSigma::fPrediction

Definition at line 80 of file SystMaker.h.

Referenced by LoadFrom(), SaveTo(), and ~SystMakerShiftSigma().

std::pair<double, double> ana::SystMakerShiftSigma::fShift

Definition at line 83 of file SystMaker.h.

Referenced by LoadFrom(), PrintSigma(), and SaveTo().

std::pair<TH1*, TH1*> ana::SystMakerShiftSigma::fShiftedRatio

Definition at line 82 of file SystMaker.h.

Referenced by LoadFrom(), SaveTo(), and ~SystMakerShiftSigma().

std::pair<TH1*, TH1*> ana::SystMakerShiftSigma::fShiftedSpectrum

Definition at line 81 of file SystMaker.h.

Referenced by LoadFrom(), SaveTo(), and ~SystMakerShiftSigma().

int ana::SystMakerShiftSigma::fSigma

Definition at line 79 of file SystMaker.h.

Referenced by ana::SystMakerShift::LoadFrom(), PrintSigma(), and SaveTo().


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