CMS 3D CMS Logo

BDHadronTrackMonitoringHarvester.cc
Go to the documentation of this file.
2 
3 using namespace edm;
4 using namespace std;
5 using namespace RecoBTag;
6 
7 // intialize category map
8 // std::map<unsigned int, std::string>
9 // BDHadronTrackMonitoringAnalyzer::TrkHistCat(map_start_values,
10 // map_start_values
11 // + map_start_values_size);
12 
13 // typedef std::map<unsigned int, std::string>::iterator it_type;
14 
16 
18 
20 
22  // ***********************
23  //
24  // Book all new histograms.
25  //
26  // ***********************
28  ibook.setCurrentFolder("BDHadronTracks/JetContent");
29 
30  // b jets
31  // absolute average number of tracks
32  nTrk_absolute_bjet = ibook.book1D("nTrk_absolute_bjet", "absolute average number of tracks in b jets", 6, -0.5, 5.5);
33  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
34  nTrk_absolute_bjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
35  }
36  nTrk_absolute_bjet->setAxisRange(0, 5, 2);
37  nTrk_absolute_bjet->setAxisTitle("average number of tracks", 2);
38 
39  // relative (in percent) average number of tracks
40  nTrk_relative_bjet = ibook.book1D("nTrk_relative_bjet", "relative average number of tracks in b jets", 6, -0.5, 5.5);
41  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
42  nTrk_relative_bjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
43  }
44  nTrk_relative_bjet->setAxisRange(0, 1, 2);
45  nTrk_relative_bjet->setAxisTitle("average fraction of tracks", 2);
46 
47  // standard deviation of number of tracks
48  nTrk_std_bjet = ibook.book1D("nTrk_std_bjet", "RMS of number of tracks in b jets", 6, -0.5, 5.5);
49  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
51  }
52  nTrk_std_bjet->setAxisRange(0, 3, 2);
53  nTrk_std_bjet->setAxisTitle("RMS of number of tracks", 2);
54 
55  // c jets
56  nTrk_absolute_cjet = ibook.book1D("nTrk_absolute_cjet", "absolute average number of tracks in c jets", 6, -0.5, 5.5);
57  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
58  nTrk_absolute_cjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
59  }
60  nTrk_absolute_cjet->setAxisRange(0, 5, 2);
61  nTrk_absolute_cjet->setAxisTitle("average number of tracks", 2);
62 
63  nTrk_relative_cjet = ibook.book1D("nTrk_relative_cjet", "relative average number of tracks in c jets", 6, -0.5, 5.5);
64  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
65  nTrk_relative_cjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
66  }
67  nTrk_relative_cjet->setAxisRange(0, 1, 2);
68  nTrk_relative_cjet->setAxisTitle("average fraction of tracks", 2);
69 
70  nTrk_std_cjet = ibook.book1D("nTrk_std_cjet", "RMS of number of tracks in c jets", 6, -0.5, 5.5);
71  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
73  }
74  nTrk_std_cjet->setAxisRange(0, 3, 2);
75  nTrk_std_cjet->setAxisTitle("RMS of number of tracks", 2);
76 
77  // udsg jets
78  nTrk_absolute_dusgjet =
79  ibook.book1D("nTrk_absolute_dusgjet", "absolute average number of tracks in dusg jets", 6, -0.5, 5.5);
80  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
81  nTrk_absolute_dusgjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
82  }
83  nTrk_absolute_dusgjet->setAxisRange(0, 5, 2);
84  nTrk_absolute_dusgjet->setAxisTitle("average number of tracks", 2);
85 
86  nTrk_relative_dusgjet =
87  ibook.book1D("nTrk_relative_dusgjet", "relative average number of tracks in dusg jets", 6, -0.5, 5.5);
88  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
89  nTrk_relative_dusgjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
90  }
91  nTrk_relative_dusgjet->setAxisRange(0, 1, 2);
92  nTrk_relative_dusgjet->setAxisTitle("average fraction of tracks", 2);
93 
94  nTrk_std_dusgjet = ibook.book1D("nTrk_std_dusgjet", "RMS of number of tracks in dusg jets", 6, -0.5, 5.5);
95  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
96  nTrk_std_dusgjet->setBinLabel(i + 1, BDHadronTrackMonitoringAnalyzer::TrkHistCat[i], 1);
97  }
98  nTrk_std_dusgjet->setAxisRange(0, 3, 2);
99  nTrk_std_dusgjet->setAxisTitle("RMS of number of tracks", 2);
100 
101  // ***********************
102  //
103  // get all the old histograms
104  //
105  // ***********************
106 
107  // b jets
108  MonitorElement *nTrk_bjet[6];
109  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
110  nTrk_bjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_bjet_" + BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
111  }
112  MonitorElement *nTrkAll_bjet = iget.get("BDHadronTracks/JetContent/nTrkAll_bjet");
113 
114  // c jets
115  MonitorElement *nTrk_cjet[6];
116  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
117  nTrk_cjet[i] = iget.get("BDHadronTracks/JetContent/nTrk_cjet_" + BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
118  }
119  MonitorElement *nTrkAll_cjet = iget.get("BDHadronTracks/JetContent/nTrkAll_cjet");
120 
121  // dusg jets
122  MonitorElement *nTrk_dusgjet[6];
123  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
124  nTrk_dusgjet[i] =
125  iget.get("BDHadronTracks/JetContent/nTrk_dusgjet_" + BDHadronTrackMonitoringAnalyzer::TrkHistCat[i]);
126  }
127  MonitorElement *nTrkAll_dusgjet = iget.get("BDHadronTracks/JetContent/nTrkAll_dusgjet");
128 
129  // ***********************
130  //
131  // Calculate contents of new histograms
132  //
133  // ***********************
134 
135  // b jets
136  float mean_bjets[6];
137  float std_bjets[6];
138  float meanAll_bjets;
139  meanAll_bjets = std::max(0.01, nTrkAll_bjet->getMean(1));
140  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
141  mean_bjets[i] = nTrk_bjet[i]->getMean(1); // mean number of tracks per category
142  std_bjets[i] = nTrk_bjet[i]->getRMS(1);
143  nTrk_absolute_bjet->setBinContent(i + 1, mean_bjets[i]);
144  nTrk_relative_bjet->setBinContent(i + 1, mean_bjets[i] / meanAll_bjets);
145  nTrk_std_bjet->setBinContent(i + 1, std_bjets[i]);
146  }
147 
148  // c jets
149  float mean_cjets[6];
150  float std_cjets[6];
151  float meanAll_cjets;
152  meanAll_cjets = std::max(0.01, nTrkAll_cjet->getMean(1));
153  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
154  mean_cjets[i] = nTrk_cjet[i]->getMean(1); // mean number of tracks per category
155  std_cjets[i] = nTrk_cjet[i]->getRMS(1);
156  nTrk_absolute_cjet->setBinContent(i + 1, mean_cjets[i]);
157  nTrk_relative_cjet->setBinContent(i + 1, mean_cjets[i] / meanAll_cjets);
158  nTrk_std_cjet->setBinContent(i + 1, std_cjets[i]);
159  }
160 
161  // dusg jets
162  float mean_dusgjets[6];
163  float std_dusgjets[6];
164  float meanAll_dusgjets;
165  meanAll_dusgjets = std::max(0.01, nTrkAll_dusgjet->getMean(1));
166  for (unsigned int i = 0; i < BDHadronTrackMonitoringAnalyzer::TrkHistCat.size(); i++) {
167  mean_dusgjets[i] = nTrk_dusgjet[i]->getMean(1); // mean number of tracks per category
168  std_dusgjets[i] = nTrk_dusgjet[i]->getRMS(1);
169  nTrk_absolute_dusgjet->setBinContent(i + 1, mean_dusgjets[i]);
170  nTrk_relative_dusgjet->setBinContent(i + 1, mean_dusgjets[i] / meanAll_dusgjets);
171  nTrk_std_dusgjet->setBinContent(i + 1, std_dusgjets[i]);
172  }
173 }
174 
175 // define this as a plug-in
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
BDHadronTrackMonitoringHarvester(const edm::ParameterSet &pSet)
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
TStyle * setTDRStyle()
Definition: Tools.cc:343
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual 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)
static const std::vector< std::string > TrkHistCat
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
Definition: Tools.h:22
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
HLT enums.
MonitorElement * get(std::string const &path)
Definition: DQMStore.cc:437