CMS 3D CMS Logo

BDHadronTrackMonitoringHarvester.cc
Go to the documentation of this file.
2 
3 // intialize category map
4 // std::map<unsigned int, std::string>
5 // BDHadronTrackMonitoringAnalyzer::TrkHistCat(map_start_values,
6 // map_start_values
7 // + map_start_values_size);
8 
9 // typedef std::map<unsigned int, std::string>::iterator it_type;
10 
12 
14 
16 
18  // ***********************
19  //
20  // Book all new histograms.
21  //
22  // ***********************
24  ibook.setCurrentFolder("BDHadronTracks/JetContent");
25 
26  // b jets
27  // absolute average number of tracks
28  nTrk_absolute_bjet = ibook.book1D("nTrk_absolute_bjet", "absolute average number of tracks in b jets", 6, -0.5, 5.5);
29  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
31  }
33  nTrk_absolute_bjet->setAxisTitle("average number of tracks", 2);
34 
35  // relative (in percent) average number of tracks
36  nTrk_relative_bjet = ibook.book1D("nTrk_relative_bjet", "relative average number of tracks in b jets", 6, -0.5, 5.5);
37  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
39  }
41  nTrk_relative_bjet->setAxisTitle("average fraction of tracks", 2);
42 
43  // standard deviation of number of tracks
44  nTrk_std_bjet = ibook.book1D("nTrk_std_bjet", "RMS of number of tracks in b jets", 6, -0.5, 5.5);
45  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
47  }
48  nTrk_std_bjet->setAxisRange(0, 3, 2);
49  nTrk_std_bjet->setAxisTitle("RMS of number of tracks", 2);
50 
51  // c jets
52  nTrk_absolute_cjet = ibook.book1D("nTrk_absolute_cjet", "absolute average number of tracks in c jets", 6, -0.5, 5.5);
53  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
55  }
57  nTrk_absolute_cjet->setAxisTitle("average number of tracks", 2);
58 
59  nTrk_relative_cjet = ibook.book1D("nTrk_relative_cjet", "relative average number of tracks in c jets", 6, -0.5, 5.5);
60  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
62  }
64  nTrk_relative_cjet->setAxisTitle("average fraction of tracks", 2);
65 
66  nTrk_std_cjet = ibook.book1D("nTrk_std_cjet", "RMS of number of tracks in c jets", 6, -0.5, 5.5);
67  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
69  }
70  nTrk_std_cjet->setAxisRange(0, 3, 2);
71  nTrk_std_cjet->setAxisTitle("RMS of number of tracks", 2);
72 
73  // udsg jets
75  ibook.book1D("nTrk_absolute_dusgjet", "absolute average number of tracks in dusg jets", 6, -0.5, 5.5);
76  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
78  }
80  nTrk_absolute_dusgjet->setAxisTitle("average number of tracks", 2);
81 
83  ibook.book1D("nTrk_relative_dusgjet", "relative average number of tracks in dusg jets", 6, -0.5, 5.5);
84  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
86  }
88  nTrk_relative_dusgjet->setAxisTitle("average fraction of tracks", 2);
89 
90  nTrk_std_dusgjet = ibook.book1D("nTrk_std_dusgjet", "RMS of number of tracks in dusg jets", 6, -0.5, 5.5);
91  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
93  }
95  nTrk_std_dusgjet->setAxisTitle("RMS of number of tracks", 2);
96 
97  // ***********************
98  //
99  // get all the old histograms
100  //
101  // ***********************
102 
103  // b jets
104  MonitorElement *nTrk_bjet[6];
105  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
106  nTrk_bjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_bjet_" + BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
107  }
108  MonitorElement *nTrkAll_bjet = iget.get("BDHadronTracks/JetContent/nTrkAll_bjet");
109 
110  // c jets
111  MonitorElement *nTrk_cjet[6];
112  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
113  nTrk_cjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_cjet_" + BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
114  }
115  MonitorElement *nTrkAll_cjet = iget.get("BDHadronTracks/JetContent/nTrkAll_cjet");
116 
117  // dusg jets
118  MonitorElement *nTrk_dusgjet[6];
119  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
120  nTrk_dusgjet[i] =
121  iget.get("BDHadronTracks/JetContent/nTrk_dusgjet_" + BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
122  }
123  MonitorElement *nTrkAll_dusgjet = iget.get("BDHadronTracks/JetContent/nTrkAll_dusgjet");
124 
125  // ***********************
126  //
127  // Calculate contents of new histograms
128  //
129  // ***********************
130 
131  // b jets
132  float mean_bjets[6];
133  float std_bjets[6];
134  float meanAll_bjets;
135  meanAll_bjets = std::max(0.01, nTrkAll_bjet->getMean(1));
136  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
137  mean_bjets[i] = nTrk_bjet[i]->getMean(1); // mean number of tracks per category
138  std_bjets[i] = nTrk_bjet[i]->getRMS(1);
139  nTrk_absolute_bjet->setBinContent(i + 1, mean_bjets[i]);
140  nTrk_relative_bjet->setBinContent(i + 1, mean_bjets[i] / meanAll_bjets);
141  nTrk_std_bjet->setBinContent(i + 1, std_bjets[i]);
142  }
143 
144  // c jets
145  float mean_cjets[6];
146  float std_cjets[6];
147  float meanAll_cjets;
148  meanAll_cjets = std::max(0.01, nTrkAll_cjet->getMean(1));
149  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
150  mean_cjets[i] = nTrk_cjet[i]->getMean(1); // mean number of tracks per category
151  std_cjets[i] = nTrk_cjet[i]->getRMS(1);
152  nTrk_absolute_cjet->setBinContent(i + 1, mean_cjets[i]);
153  nTrk_relative_cjet->setBinContent(i + 1, mean_cjets[i] / meanAll_cjets);
154  nTrk_std_cjet->setBinContent(i + 1, std_cjets[i]);
155  }
156 
157  // dusg jets
158  float mean_dusgjets[6];
159  float std_dusgjets[6];
160  float meanAll_dusgjets;
161  meanAll_dusgjets = std::max(0.01, nTrkAll_dusgjet->getMean(1));
162  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
163  mean_dusgjets[i] = nTrk_dusgjet[i]->getMean(1); // mean number of tracks per category
164  std_dusgjets[i] = nTrk_dusgjet[i]->getRMS(1);
165  nTrk_absolute_dusgjet->setBinContent(i + 1, mean_dusgjets[i]);
166  nTrk_relative_dusgjet->setBinContent(i + 1, mean_dusgjets[i] / meanAll_dusgjets);
167  nTrk_std_dusgjet->setBinContent(i + 1, std_dusgjets[i]);
168  }
169 
170  // ***********************
171  //
172  // Remove histograms with nTracks that we do not want to show
173  //
174  // ***********************
175 
176  // b jets
177  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
179  }
180  iget.removeElement("nTrkAll_bjet");
181 
182  // c jets
183  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
185  }
186  iget.removeElement("nTrkAll_cjet");
187 
188  // dusg jets
189  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
191  }
192  iget.removeElement("nTrkAll_dusgjet");
193 }
194 
195 // define this as a plug-in
void setBinContent(int binx, double content)
set content of bin (1-D)
void setAxisRange(double xmin, double xmax, int axis=1)
set x-, y- or z-axis range (axis=1, 2, 3 respectively)
BDHadronTrackMonitoringHarvester(const edm::ParameterSet &pSet)
TStyle * setTDRStyle()
Definition: Tools.cc:346
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
static const std::vector< std::string > TrkHistCat
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:303
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void removeElement(Args &&...args)
Definition: DQMStore.h:199