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> BDHadronTrackMonitoringAnalyzer::TrkHistCat(map_start_values, map_start_values + map_start_values_size);
5 
6 
7 //typedef std::map<unsigned int, std::string>::iterator it_type;
8 
10 {
11 }
12 
13 
15 {
16 }
17 
19 {
20 }
21 
23 {
24  // ***********************
25  //
26  // Book all new histograms.
27  //
28  // ***********************
30  ibook.setCurrentFolder("BDHadronTracks/JetContent");
31 
32  // b jets
33  // absolute average number of tracks
34  nTrk_absolute_bjet = ibook.book1D("nTrk_absolute_bjet","absolute average number of tracks in b jets",6,-0.5,5.5);
35  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
37  }
39  nTrk_absolute_bjet->setAxisTitle("average number of tracks",2);
40 
41  // relative (in percent) average number of tracks
42  nTrk_relative_bjet = ibook.book1D("nTrk_relative_bjet","relative average number of tracks in b jets",6,-0.5,5.5);
43  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
45  }
47  nTrk_relative_bjet->setAxisTitle("average fraction of tracks",2);
48 
49  // standard deviation of number of tracks
50  nTrk_std_bjet = ibook.book1D("nTrk_std_bjet","RMS of number of tracks in b jets",6,-0.5,5.5);
51  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
53  }
54  nTrk_std_bjet->setAxisRange(0, 3, 2);
55  nTrk_std_bjet->setAxisTitle("RMS of number of tracks",2);
56 
57 
58 
59 
60  // c jets
61  nTrk_absolute_cjet = ibook.book1D("nTrk_absolute_cjet","absolute average number of tracks in c jets",6,-0.5,5.5);
62  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
64  }
66  nTrk_absolute_cjet->setAxisTitle("average number of tracks",2);
67 
68  nTrk_relative_cjet = ibook.book1D("nTrk_relative_cjet","relative average number of tracks in c jets",6,-0.5,5.5);
69  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
71  }
73  nTrk_relative_cjet->setAxisTitle("average fraction of tracks",2);
74 
75  nTrk_std_cjet = ibook.book1D("nTrk_std_cjet","RMS of number of tracks in c jets",6,-0.5,5.5);
76  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
78  }
79  nTrk_std_cjet->setAxisRange(0, 3, 2);
80  nTrk_std_cjet->setAxisTitle("RMS of number of tracks",2);
81 
82 
83 
84  // udsg jets
85  nTrk_absolute_dusgjet = ibook.book1D("nTrk_absolute_dusgjet","absolute average number of tracks in dusg jets",6,-0.5,5.5);
86  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
88  }
90  nTrk_absolute_dusgjet->setAxisTitle("average number of tracks",2);
91 
92  nTrk_relative_dusgjet = ibook.book1D("nTrk_relative_dusgjet","relative average number of tracks in dusg jets",6,-0.5,5.5);
93  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
95  }
97  nTrk_relative_dusgjet->setAxisTitle("average fraction of tracks",2);
98 
99  nTrk_std_dusgjet = ibook.book1D("nTrk_std_dusgjet","RMS of number of tracks in dusg jets",6,-0.5,5.5);
100  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
102  }
103  nTrk_std_dusgjet->setAxisRange(0, 3, 2);
104  nTrk_std_dusgjet->setAxisTitle("RMS of number of tracks",2);
105 
106 
107  // ***********************
108  //
109  // get all the old histograms
110  //
111  // ***********************
112 
113  // b jets
114  MonitorElement *nTrk_bjet[6];
115  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
116  nTrk_bjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_bjet_"+BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
117  }
118  MonitorElement *nTrkAll_bjet = iget.get("BDHadronTracks/JetContent/nTrkAll_bjet");
119 
120  // c jets
121  MonitorElement *nTrk_cjet[6];
122  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
123  nTrk_cjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_cjet_"+BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
124  }
125  MonitorElement *nTrkAll_cjet = iget.get("BDHadronTracks/JetContent/nTrkAll_cjet");
126 
127  // dusg jets
128  MonitorElement *nTrk_dusgjet[6];
129  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
130  nTrk_dusgjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_dusgjet_"+BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
131  }
132  MonitorElement *nTrkAll_dusgjet = iget.get("BDHadronTracks/JetContent/nTrkAll_dusgjet");
133 
134 
135 
136  // ***********************
137  //
138  // Calculate contents of new histograms
139  //
140  // ***********************
141 
142  // b jets
143  float mean_bjets[6];
144  float std_bjets[6];
145  float meanAll_bjets;
146  meanAll_bjets = std::max(0.01,nTrkAll_bjet->getMean(1));
147  for (unsigned int i = 0; i< BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++){
148  mean_bjets[i] = nTrk_bjet[i]->getMean(1); // mean number of tracks per category
149  std_bjets[i] = nTrk_bjet[i]->getRMS(1);
150  nTrk_absolute_bjet->setBinContent(i+1,mean_bjets[i]);
151  nTrk_relative_bjet->setBinContent(i+1,mean_bjets[i]/meanAll_bjets);
152  nTrk_std_bjet->setBinContent(i+1,std_bjets[i]);
153  }
154 
155  // c jets
156  float mean_cjets[6];
157  float std_cjets[6];
158  float meanAll_cjets;
159  meanAll_cjets = std::max(0.01,nTrkAll_cjet->getMean(1));
160  for (unsigned int i = 0; i< BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++){
161  mean_cjets[i] = nTrk_cjet[i]->getMean(1); // mean number of tracks per category
162  std_cjets[i] = nTrk_cjet[i]->getRMS(1);
163  nTrk_absolute_cjet->setBinContent(i+1,mean_cjets[i]);
164  nTrk_relative_cjet->setBinContent(i+1,mean_cjets[i]/meanAll_cjets);
165  nTrk_std_cjet->setBinContent(i+1,std_cjets[i]);
166  }
167 
168 
169  // dusg jets
170  float mean_dusgjets[6];
171  float std_dusgjets[6];
172  float meanAll_dusgjets;
173  meanAll_dusgjets = std::max(0.01,nTrkAll_dusgjet->getMean(1));
174  for (unsigned int i = 0; i< BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++){
175  mean_dusgjets[i] = nTrk_dusgjet[i]->getMean(1); // mean number of tracks per category
176  std_dusgjets[i] = nTrk_dusgjet[i]->getRMS(1);
177  nTrk_absolute_dusgjet->setBinContent(i+1,mean_dusgjets[i]);
178  nTrk_relative_dusgjet->setBinContent(i+1,mean_dusgjets[i]/meanAll_dusgjets);
179  nTrk_std_dusgjet->setBinContent(i+1,std_dusgjets[i]);
180  }
181 
182 
183  // ***********************
184  //
185  // Remove histograms with nTracks that we do not want to show
186  //
187  // ***********************
188 
189  // b jets
190  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
192  }
193  iget.removeElement("nTrkAll_bjet");
194 
195  // c jets
196  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
198  }
199  iget.removeElement("nTrkAll_cjet");
200 
201  // dusg jets
202  for(unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
204  }
205  iget.removeElement("nTrkAll_dusgjet");
206 
207 
208 
209 }
210 
211 
212 //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)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:307
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
static const std::vector< std::string > TrkHistCat
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
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:310