CMS 3D CMS Logo

TrackIPHistograms.h
Go to the documentation of this file.
1 #ifndef DQMOffline_RecoB_TrackIPHistograms_h
2 #define DQMOffline_RecoB_TrackIPHistograms_h
3 
4 #include <string>
5 
8 
9 template <class T>
11 public:
14 
15  TrackIPHistograms(const std::string& baseNameTitle_,
16  const std::string& baseNameDescription_,
17  const int& nBins_,
18  const double& lowerBound_,
19  const double& upperBound_,
20  const std::string& plotFirst_,
21  const std::string& folder,
22  const unsigned int& mc,
23  const bool& quality,
24  DQMStore::IGetter& iget);
25 
26  TrackIPHistograms(const std::string& baseNameTitle_,
27  const std::string& baseNameDescription_,
28  const int& nBins_,
29  const double& lowerBound_,
30  const double& upperBound_,
31  const bool& statistics,
32  const bool& plotLog_,
33  const bool& plotNormalized_,
34  const std::string& plotFirst_,
35  const std::string& folder,
36  const unsigned int& mc,
37  const bool& quality,
38  DQMStore::IBooker& ibook);
39 
40  ~TrackIPHistograms() override{};
41 
42  void fill(const int& flavour,
44  const T& variable,
45  const bool& hasTrack) const;
46  void fill(const int& flavour,
48  const T& variable,
49  const bool& hasTrack,
50  const T& w) const;
51 
52  void fill(const int& flavour,
54  const T* variable,
55  const bool& hasTrack) const;
56  void fill(const int& flavour,
58  const T* variable,
59  const bool& hasTrack,
60  const T& w) const;
61 
62  void settitle(const char* title);
63 
64 protected:
65  void fillVariable(const reco::TrackBase::TrackQuality& qual, const T& var, const bool& hasTrack) const;
66  void fillVariable(const reco::TrackBase::TrackQuality& qual, const T& var, const bool& hasTrack, const T& w) const;
67 
68  bool quality_;
69 
74 
75 private:
77 };
78 
79 template <class T>
81  const std::string& baseNameDescription_,
82  const int& nBins_,
83  const double& lowerBound_,
84  const double& upperBound_,
85  const bool& statistics_,
86  const bool& plotLog_,
87  const bool& plotNormalized_,
88  const std::string& plotFirst_,
89  const std::string& folder,
90  const unsigned int& mc,
91  const bool& quality,
92  DQMStore::IBooker& ibook)
93  : FlavourHistograms<T>(baseNameTitle_,
94  baseNameDescription_,
95  nBins_,
96  lowerBound_,
97  upperBound_,
98  statistics_,
99  plotLog_,
100  plotNormalized_,
101  plotFirst_,
102  folder,
103  mc,
104  ibook),
105  quality_(quality) {
106  if (quality_) {
107  HistoProviderDQM prov("Btag", folder, ibook);
108  theQual_undefined = prov.book1D(
109  baseNameTitle_ + "QualUnDef", baseNameDescription_ + " Undefined Quality", nBins_, lowerBound_, upperBound_);
110  theQual_loose = prov.book1D(
111  baseNameTitle_ + "QualLoose", baseNameDescription_ + " Loose Quality", nBins_, lowerBound_, upperBound_);
112  theQual_tight = prov.book1D(
113  baseNameTitle_ + "QualTight", baseNameDescription_ + " Tight Quality", nBins_, lowerBound_, upperBound_);
114  theQual_highpur = prov.book1D(
115  baseNameTitle_ + "QualHighPur", baseNameDescription_ + " High Purity Quality", nBins_, lowerBound_, upperBound_);
116 
117  if (statistics_) {
122  }
123  }
124 }
125 template <class T>
127  const std::string& baseNameDescription_,
128  const int& nBins_,
129  const double& lowerBound_,
130  const double& upperBound_,
131  const std::string& plotFirst_,
132  const std::string& folder,
133  const unsigned int& mc,
134  const bool& quality,
135  DQMStore::IGetter& iget)
136  : FlavourHistograms<T>(
137  baseNameTitle_, baseNameDescription_, nBins_, lowerBound_, upperBound_, plotFirst_, folder, mc, iget),
138  quality_(quality) {
139  if (quality_) {
140  theQual_undefined = iget.get("Btag/" + folder + "/" + baseNameTitle_ + "QualUnDef");
141  theQual_loose = iget.get("Btag/" + folder + "/" + baseNameTitle_ + "QualLoose");
142  theQual_tight = iget.get("Btag/" + folder + "/" + baseNameTitle_ + "QualTight");
143  theQual_highpur = iget.get("Btag/" + folder + "/" + baseNameTitle_ + "QualHighPur");
144  }
145 }
146 
147 template <class T>
150  const T& variable,
151  const bool& hasTrack) const {
153  if (quality_)
154  fillVariable(quality, variable, hasTrack);
155 }
156 
157 template <class T>
160  const T& variable,
161  const bool& hasTrack,
162  const T& w) const {
164  if (quality_)
165  fillVariable(quality, variable, hasTrack, w);
166 }
167 
168 template <class T>
171  const T* variable,
172  const bool& hasTrack) const {
173  const int* theArrayDimension = FlavourHistograms<T>::arrayDimension();
174  const int& theMaxDimension = FlavourHistograms<T>::maxDimension();
175  const int& theIndexToPlot = FlavourHistograms<T>::indexToPlot();
176 
178  if (theArrayDimension == nullptr && quality_) {
179  fillVariable(quality, *variable);
180  } else {
181  int iMax = (*theArrayDimension > theMaxDimension) ? theMaxDimension : *theArrayDimension;
182  for (int i = 0; i != iMax; ++i) {
183  if (quality_ && ((theIndexToPlot < 0) || (i == theIndexToPlot))) {
184  fillVariable(flavour, *(variable + i), hasTrack);
185  }
186  }
187 
188  if (theIndexToPlot >= iMax && quality_) {
189  const T& theZero = static_cast<T>(0.0);
190  fillVariable(quality, theZero, hasTrack);
191  }
192  }
193 }
194 
195 template <class T>
198  const T* variable,
199  const bool& hasTrack,
200  const T& w) const {
201  const int* theArrayDimension = FlavourHistograms<T>::arrayDimension();
202  const int& theMaxDimension = FlavourHistograms<T>::maxDimension();
203  const int& theIndexToPlot = FlavourHistograms<T>::indexToPlot();
204 
206  if (theArrayDimension == nullptr && quality_) {
207  fillVariable(quality, *variable, w);
208  } else {
209  int iMax = (*theArrayDimension > theMaxDimension) ? theMaxDimension : *theArrayDimension;
210  for (int i = 0; i != iMax; ++i) {
211  if (quality_ && ((theIndexToPlot < 0) || (i == theIndexToPlot))) {
212  fillVariable(flavour, *(variable + i), hasTrack, w);
213  }
214  }
215 
216  if (theIndexToPlot >= iMax && quality_) {
217  const T& theZero = static_cast<T>(0.0);
218  fillVariable(quality, theZero, hasTrack, w);
219  }
220  }
221 }
222 
223 template <class T>
226  theQual_undefined->setAxisTitle(title);
227  theQual_loose->setAxisTitle(title);
228  theQual_tight->setAxisTitle(title);
229  theQual_highpur->setAxisTitle(title);
230 }
231 
232 template <class T>
234  const T& var,
235  const bool& hasTrack) const {
236  if (!hasTrack || !quality_)
237  return;
238 
239  switch (qual) {
241  theQual_loose->Fill(var);
242  break;
244  theQual_tight->Fill(var);
245  break;
247  theQual_highpur->Fill(var);
248  break;
249  default:
250  theQual_undefined->Fill(var);
251  break;
252  }
253 }
254 
255 template <class T>
257  const T& var,
258  const bool& hasTrack,
259  const T& w) const {
260  if (!hasTrack || !quality_)
261  return;
262 
263  switch (qual) {
265  theQual_loose->Fill(var, w);
266  break;
268  theQual_tight->Fill(var, w);
269  break;
271  theQual_highpur->Fill(var, w);
272  break;
273  default:
274  theQual_undefined->Fill(var, w);
275  break;
276  }
277 }
278 
279 #endif
TrackIPHistograms::~TrackIPHistograms
~TrackIPHistograms() override
Definition: TrackIPHistograms.h:40
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
TrackIPHistograms::settitle
void settitle(const char *title)
Definition: TrackIPHistograms.h:224
mps_fire.i
i
Definition: mps_fire.py:428
reco::TrackBase::tight
Definition: TrackBase.h:153
reco::TrackBase::loose
Definition: TrackBase.h:152
TrackIPHistograms::theQual_tight
MonitorElement * theQual_tight
Definition: TrackIPHistograms.h:72
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
printsummarytable.folder
folder
Definition: printsummarytable.py:7
reco::TrackBase::TrackQuality
TrackQuality
track quality
Definition: TrackBase.h:150
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
TrackIPHistograms::TrackIPHistograms
TrackIPHistograms()
Definition: TrackIPHistograms.h:76
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:122
trigObjTnPSource_cfi.var
var
Definition: trigObjTnPSource_cfi.py:21
TrackIPHistograms::fillVariable
void fillVariable(const reco::TrackBase::TrackQuality &qual, const T &var, const bool &hasTrack) const
Definition: TrackIPHistograms.h:233
Track.h
dqm::legacy::DQMStore
Definition: DQMStore.h:728
FlavourHistorgrams.h
FlavourHistograms::fill
void fill(const int &flavour, const T &variable) const
Definition: FlavourHistorgrams.h:352
FlavourHistograms
Definition: FlavourHistorgrams.h:26
w
const double w
Definition: UKUtility.cc:23
TrackIPHistograms::theQual_loose
MonitorElement * theQual_loose
Definition: TrackIPHistograms.h:71
FlavourHistograms::maxDimension
int maxDimension() const
Definition: FlavourHistorgrams.h:87
TrackIPHistograms
Definition: TrackIPHistograms.h:10
FlavourHistograms::statistics
bool statistics() const
Definition: FlavourHistorgrams.h:82
HistoProviderDQM::book1D
virtual MonitorElement * book1D(const std::string &name, const std::string &title, const int &nchX, const double &lowX, const double &highX)
Definition: HistoProviderDQM.cc:15
FlavourHistograms::settitle
void settitle(const char *title)
Definition: FlavourHistorgrams.h:389
FlavourHistograms::indexToPlot
int indexToPlot() const
Definition: FlavourHistorgrams.h:88
TrackIPHistograms::fill
void fill(const int &flavour, const reco::TrackBase::TrackQuality &quality, const T &variable, const bool &hasTrack) const
Definition: TrackIPHistograms.h:148
TrackIPHistograms::quality_
bool quality_
Definition: TrackIPHistograms.h:68
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackIPHistograms::theQual_highpur
MonitorElement * theQual_highpur
Definition: TrackIPHistograms.h:73
taus_updatedMVAIds_cff.variable
variable
Definition: taus_updatedMVAIds_cff.py:33
T
long double T
Definition: Basic3DVectorLD.h:48
dqm::implementation::IGetter
Definition: DQMStore.h:484
TrackIPHistograms::theQual_undefined
MonitorElement * theQual_undefined
Definition: TrackIPHistograms.h:70
TrackIPHistograms::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: TrackIPHistograms.h:13
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:673
dqm::implementation::IBooker
Definition: DQMStore.h:43
FlavourHistograms::arrayDimension
int * arrayDimension() const
Definition: FlavourHistorgrams.h:86
HistoProviderDQM
Definition: HistoProviderDQM.h:8
dqm::impl::MonitorElement::enableSumw2
virtual void enableSumw2()
Definition: MonitorElement.cc:863
TrackIPHistograms::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: TrackIPHistograms.h:12
DiLeptonHelp::flavour
flavour
Definition: DiLeptonVertexHelpers.h:46
reco::TrackBase::highPurity
Definition: TrackBase.h:154