BCMTFChannel.h
1 #ifndef __BCMTFCHANNEL__H
2 #define __BCMTFCHANNEL__H
3 
14 /*
15  * Copyright (C) 2007-2018, the BAT core developer team
16  * All rights reserved.
17  *
18  * For the licensing terms see doc/COPYING.
19  * For documentation see http://mpp.mpg.de/bat
20  */
21 
22 // ---------------------------------------------------------
23 
24 #include "../../BAT/BCAux.h"
25 
26 #include <TH1D.h>
27 
28 #include <string>
29 #include <vector>
30 
31 class BCMTFTemplate;
33 class TH2D;
34 
35 // ---------------------------------------------------------
37 {
38 
39 public:
40 
47  BCMTFChannel(const std::string& name);
48 
51  ~BCMTFChannel();
52 
59  const std::string& GetName() const
60  { return fName; };
61 
64  const std::string& GetSafeName() const
65  { return fSafeName; };
66 
70  { return fData; };
71 
77  { return fTemplateContainer.at(index); };
78 
84  { return fSystematicVariationContainer.at(index); };
85 
89  { return fFlagChannelActive; };
90 
96  { return fHistUncertaintyBandExpectation; };
97 
102  { return fHistUncertaintyBandPoisson; };
103 
106  double GetRangeYMin()
107  { return fRangeYMin; };
108 
111  double GetRangeYMax()
112  { return fRangeYMax; };
113 
121  void SetName(const std::string& name)
122  { fName = name; fSafeName = BCAux::SafeName(fName); };
123 
127  void SetData(BCMTFTemplate* bctemplate)
128  { fData = bctemplate; };
129 
134  void SetHistUncertaintyBandExpectation(TH2D* hist);
135 
140  {
141  fHistUncertaintyBandPoisson = hist;
142  }
143 
147  void SetFlagChannelActive(bool flag)
148  { fFlagChannelActive = flag; };
149 
154  void SetRangeY(double min, double max)
155  {
156  fRangeYMin = min;
157  fRangeYMax = max;
158  };
159 
168  void AddTemplate(BCMTFTemplate* bctemplate)
169  { fTemplateContainer.push_back(bctemplate); };
170 
175  { fSystematicVariationContainer.push_back(variation); };
176 
180 
188  TH1D* CalculateUncertaintyBandPoisson(double minimum, double maximum, int color);
189 
198  void PrintTemplates(const std::string& filename);
199 
204  void PrintTemplate(int index, const std::string& filename);
205 
209  void PrintHistUncertaintyBandExpectation(const std::string& filename);
210 
215  void PrintHistUncertaintyBandPoisson(const std::string& filename, const std::string& options = "COLZ");
216 
220  void PrintHistCumulativeUncertaintyBandPoisson(const std::string& filename);
221 
228  void PrintUncertaintyBandPoisson(const std::string& filename, double minimum, double maximum, int color);
229 
232 private:
233 
236  std::string fName;
237 
240  std::string fSafeName;
241 
244  BCMTFTemplate* fData;
245 
248  double fRangeYMin;
249 
252  double fRangeYMax;
253 
256  std::vector<BCMTFTemplate*> fTemplateContainer;
257 
260  std::vector<BCMTFSystematicVariation*> fSystematicVariationContainer;
261 
264  bool fFlagChannelActive;
265 
268  TH2D* fHistUncertaintyBandExpectation;
269 
272  TH2D* fHistUncertaintyBandPoisson;
273 
274 };
275 // ---------------------------------------------------------
276 
277 #endif
void PrintHistUncertaintyBandExpectation(const std::string &filename)
Print histogram for uncertainty band calculation.
A class describing a template.
Definition: BCMTFTemplate.h:32
const std::string & GetSafeName() const
Definition: BCMTFChannel.h:64
void AddTemplate(BCMTFTemplate *bctemplate)
Add a template.
Definition: BCMTFChannel.h:168
bool GetFlagChannelActive()
Definition: BCMTFChannel.h:88
void SetHistUncertaintyBandExpectation(TH2D *hist)
Set a histogram ued for the calculation of the error band of the expectation.
void PrintTemplate(int index, const std::string &filename)
Print a particular template with systematics.
void PrintHistCumulativeUncertaintyBandPoisson(const std::string &filename)
Print cumulative histogram for uncertainty band calculation.
double GetRangeYMin()
Definition: BCMTFChannel.h:106
void AddSystematicVariation(BCMTFSystematicVariation *variation)
Add a systematic variation.
Definition: BCMTFChannel.h:174
BCMTFTemplate * GetTemplate(int index)
Return a template.
Definition: BCMTFChannel.h:76
void PrintHistUncertaintyBandPoisson(const std::string &filename, const std::string &options="COLZ")
Print histogram for uncertainty band calculation.
BCMTFSystematicVariation * GetSystematicVariation(int index)
Return a systematic variation.
Definition: BCMTFChannel.h:83
void PrintUncertaintyBandPoisson(const std::string &filename, double minimum, double maximum, int color)
Print uncertainty band.
std::string SafeName(const std::string &name)
Convert a name into a safe name for use in ROOT object naming.
Definition: BCAux.cxx:111
void SetName(const std::string &name)
Set the name of the channel.
Definition: BCMTFChannel.h:121
TH2D * GetHistUncertaintyBandExpectation()
Return a histogram ued for the calculation of the error band of the expectation.
Definition: BCMTFChannel.h:95
void SetRangeY(double min, double max)
Set the y-ranges for printing.
Definition: BCMTFChannel.h:154
TH2D * GetHistUncertaintyBandPoisson()
Return a histogram used for the calculation of the Poisson fluctuations.
Definition: BCMTFChannel.h:101
BCMTFChannel(const std::string &name)
The default constructor.
A class describing a physics channel.
Definition: BCMTFChannel.h:36
double GetRangeYMax()
Definition: BCMTFChannel.h:111
void CalculateHistUncertaintyBandPoisson()
Calculate histogram for uncertainty band calculation.
BCMTFTemplate * GetData()
Definition: BCMTFChannel.h:69
void SetFlagChannelActive(bool flag)
Set flag to define if the channel is active or not.
Definition: BCMTFChannel.h:147
void SetData(BCMTFTemplate *bctemplate)
Set the data set.
Definition: BCMTFChannel.h:127
const std::string & GetName() const
Definition: BCMTFChannel.h:59
~BCMTFChannel()
The default destructor.
void SetHistUncertaintyBandPoisson(TH2D *hist)
Set a histogram used for the calculation of the Poisson fluctuations.
Definition: BCMTFChannel.h:139
TH1D * CalculateUncertaintyBandPoisson(double minimum, double maximum, int color)
Calculate histogram for uncertainty band calculation and return a TH1D.
void PrintTemplates(const std::string &filename)
Print the templates in this channel.
A class describing a systematic variation.