Public Member Functions | Public Attributes | List of all members
CutFlow Class Reference

Public Member Functions

 CutFlow (std::string name, SpectrumLoader &loader, const HistAxis &axis, std::vector< Sample > samples)
 
void AddLevel (std::string shortName, std::string longName, Cut cut, int color)
 
void Reserve (size_t n)
 
int findSample (std::string sampleName)
 
void Draw (float pot, std::string sample, std::string opt, osc::IOscCalc *calc, int from, int to, int style=1)
 
void DrawEfficiency (float pot, std::string sample, std::string opt, osc::IOscCalc *calc, int from, int to)
 

Public Attributes

std::string fName
 
SpectrumLoaderfLoader
 
HistAxis fAxis
 
std::vector< CutLevelfSamples
 
std::vector< std::vector< CutLevel > > fLevels
 

Detailed Description

Definition at line 166 of file numu_cut_flow.C.

Constructor & Destructor Documentation

CutFlow::CutFlow ( std::string  name,
SpectrumLoader loader,
const HistAxis axis,
std::vector< Sample samples 
)
inline

Definition at line 169 of file numu_cut_flow.C.

170  :
171  fName(name),
172  fLoader(loader),
173  fAxis(axis)
174  {
175 
176  fSamples.reserve(samples.size());
177  for(const auto& sample:samples)
178  {
179  fSamples.emplace_back(sample.fShortName, sample.fLongName,
180  sample.fCut,
181  fLoader, fAxis, kBlack);
182  }
183  fLevels.resize(fSamples.size());
184  };
const XML_Char * name
Definition: expat.h:151
std::vector< std::vector< CutLevel > > fLevels
std::string fName
HistAxis fAxis
SpectrumLoader & fLoader
std::vector< CutLevel > fSamples

Member Function Documentation

void CutFlow::AddLevel ( std::string  shortName,
std::string  longName,
Cut  cut,
int  color 
)
inline

Definition at line 186 of file numu_cut_flow.C.

187  {
188  for(size_t iSample = 0; iSample < fSamples.size(); ++iSample)
189  {
190  fLevels[iSample].emplace_back(shortName, longName,
191  fSamples[iSample].fCut && cut,
192  fLoader, fAxis, color);
193  }
194 
195  };
std::vector< std::vector< CutLevel > > fLevels
HistAxis fAxis
SpectrumLoader & fLoader
std::vector< CutLevel > fSamples
string shortName
THUMBNAIL BLOCK: We need to make a thumbnail for each.
void CutFlow::Draw ( float  pot,
std::string  sample,
std::string  opt,
osc::IOscCalc calc,
int  from,
int  to,
int  style = 1 
)
inline

Definition at line 219 of file numu_cut_flow.C.

References addSame(), MECModelEnuComparisons::i, MECModelEnuComparisons::leg, and string.

221  {
222  int i = findSample(sample);
223 
224  std::string name = fName + "_" + fSamples[i].fShortName;
225  std::string currOpt(opt);
226  TLegend* leg = new TLegend(0.55, 0.55, 0.85, 0.85);
227  fSamples[i].Draw(pot, currOpt, calc, from, to, leg, style);
228  addSame(currOpt);
229  for(size_t iLevel = 0; iLevel < fLevels[i].size(); ++iLevel){
230  fLevels[i][iLevel].Draw(pot, currOpt, calc, from, to, leg, style);
231  }
232  leg->Draw();
233 
234  };
const XML_Char * name
Definition: expat.h:151
std::vector< std::vector< CutLevel > > fLevels
std::string fName
int findSample(std::string sampleName)
#define pot
std::vector< CutLevel > fSamples
void addSame(std::string &opt)
Definition: numu_cut_flow.C:85
enum BeamMode string
void CutFlow::DrawEfficiency ( float  pot,
std::string  sample,
std::string  opt,
osc::IOscCalc calc,
int  from,
int  to 
)
inline

Definition at line 237 of file numu_cut_flow.C.

References addSame(), ana::AutoPlaceLegend(), MECModelEnuComparisons::i, MECModelEnuComparisons::leg, and string.

239  {
240 
241  int i = findSample(sample);
242  std::string name = fName + "_" + fSamples[i].fShortName;
243  std::string currOpt(opt);
244  TLegend* leg = AutoPlaceLegend(0.3, 0.23, 0.33);
245 
246  TH1* denominator = fSamples[i].ToTH1(pot, calc, from, to);
247 
248  for(size_t iLevel = 0; iLevel < fLevels[i].size(); ++iLevel){
249  fLevels[i][iLevel].DrawEfficiency(pot, currOpt,
250  calc, from, to, denominator, leg);
251  addSame(currOpt);
252  }
253  leg->Draw();
254 
255  };
const XML_Char * name
Definition: expat.h:151
std::vector< std::vector< CutLevel > > fLevels
std::string fName
int findSample(std::string sampleName)
#define pot
std::vector< CutLevel > fSamples
TLegend * AutoPlaceLegend(double dx, double dy, double yPin)
Create a legend, maximizing distance from all histograms.
Definition: Plots.cxx:717
void addSame(std::string &opt)
Definition: numu_cut_flow.C:85
enum BeamMode string
int CutFlow::findSample ( std::string  sampleName)
inline

Definition at line 206 of file numu_cut_flow.C.

References MECModelEnuComparisons::i, and stan::math::invalid_argument().

207  {
208  int i = -1;
209  for(size_t iSample = 0; iSample < fSamples.size(); ++iSample){
210  if(!sampleName.compare(fSamples[iSample].fShortName))
211  {
212  i = iSample;
213  }
214  }
215  if(i == -1) throw std::invalid_argument("Sample not found");
216  return i;
217  }
std::vector< CutLevel > fSamples
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
void CutFlow::Reserve ( size_t  n)
inline

Definition at line 198 of file numu_cut_flow.C.

199  {
200 
201  for(auto& samp:fLevels)
202  samp.reserve(n);
203  };
std::vector< std::vector< CutLevel > > fLevels

Member Data Documentation

HistAxis CutFlow::fAxis

Definition at line 261 of file numu_cut_flow.C.

std::vector<std::vector<CutLevel> > CutFlow::fLevels

Definition at line 264 of file numu_cut_flow.C.

SpectrumLoader& CutFlow::fLoader

Definition at line 260 of file numu_cut_flow.C.

std::string CutFlow::fName

Definition at line 255 of file numu_cut_flow.C.

std::vector<CutLevel> CutFlow::fSamples

Definition at line 262 of file numu_cut_flow.C.


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