CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GlobalHitsHistogrammer.cc
Go to the documentation of this file.
1 
9 // #include "DQMServices/Core/interface/DQMStore.h"
10 
12  : fName(""),
13  verbosity(0),
14  frequency(0),
15  vtxunit(0),
16  label(""),
17  getAllProvenances(false),
18  printProvenanceInfo(false),
19  count(0) {
20  std::string MsgLoggerCat = "GlobalHitsHistogrammer_GlobalHitsHistogrammer";
21 
22  // get information from parameter set
23  fName = iPSet.getUntrackedParameter<std::string>("Name");
24  verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
25  frequency = iPSet.getUntrackedParameter<int>("Frequency");
26  vtxunit = iPSet.getUntrackedParameter<int>("VtxUnit");
27  outputfile = iPSet.getParameter<std::string>("OutputFile");
28  doOutput = iPSet.getParameter<bool>("DoOutput");
29  edm::ParameterSet m_Prov = iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
30  getAllProvenances = m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
31  printProvenanceInfo = m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
32 
33  // get Labels to use to extract information
34  GlobalHitSrc_ = iPSet.getParameter<edm::InputTag>("GlobalHitSrc");
35  // fix for consumes
36  GlobalHitSrc_Token_ = consumes<PGlobalSimHit>(iPSet.getParameter<edm::InputTag>("GlobalHitSrc"));
37 
38  // use value of first digit to determine default output level (inclusive)
39  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
40  verbosity %= 10;
41 
42  // print out Parameter Set information being used
43  if (verbosity >= 0) {
44  edm::LogInfo(MsgLoggerCat) << "\n===============================\n"
45  << "Initialized as EDAnalyzer with parameter values:\n"
46  << " Name = " << fName << "\n"
47  << " Verbosity = " << verbosity << "\n"
48  << " Frequency = " << frequency << "\n"
49  << " VtxUnit = " << vtxunit << "\n"
50  << " OutputFile = " << outputfile << "\n"
51  << " DoOutput = " << doOutput << "\n"
52  << " GetProv = " << getAllProvenances << "\n"
53  << " PrintProv = " << printProvenanceInfo << "\n"
54  << " GlobalHitSrc = " << GlobalHitSrc_.label() << ":" << GlobalHitSrc_.instance()
55  << "\n"
56  << "===============================\n";
57  }
58 }
59 
61  // initialize monitor elements
62  for (Int_t i = 0; i < 2; ++i) {
63  meMCRGP[i] = nullptr;
64  meMCG4Vtx[i] = nullptr;
65  meGeantVtxX[i] = nullptr;
66  meGeantVtxY[i] = nullptr;
67  meGeantVtxZ[i] = nullptr;
68  meMCG4Trk[i] = nullptr;
69  meCaloEcal[i] = nullptr;
70  meCaloEcalE[i] = nullptr;
71  meCaloEcalToF[i] = nullptr;
72  meCaloPreSh[i] = nullptr;
73  meCaloPreShE[i] = nullptr;
74  meCaloPreShToF[i] = nullptr;
75  meCaloHcal[i] = nullptr;
76  meCaloHcalE[i] = nullptr;
77  meCaloHcalToF[i] = nullptr;
78  meTrackerPx[i] = nullptr;
79  meTrackerSi[i] = nullptr;
80  meMuon[i] = nullptr;
81  meMuonDtToF[i] = nullptr;
82  meMuonCscToF[i] = nullptr;
83  meMuonRpcFToF[i] = nullptr;
84  meMuonRpcBToF[i] = nullptr;
85  }
86  meGeantTrkPt = nullptr;
87  meGeantTrkE = nullptr;
88  meCaloEcalPhi = nullptr;
89  meCaloEcalEta = nullptr;
90  meCaloPreShPhi = nullptr;
91  meCaloPreShEta = nullptr;
92  meCaloHcalPhi = nullptr;
93  meCaloHcalEta = nullptr;
94  meTrackerPxPhi = nullptr;
95  meTrackerPxEta = nullptr;
96  meTrackerPxBToF = nullptr;
97  meTrackerPxBR = nullptr;
98  meTrackerPxFToF = nullptr;
99  meTrackerPxFZ = nullptr;
100  meTrackerSiPhi = nullptr;
101  meTrackerSiEta = nullptr;
102  meTrackerSiBToF = nullptr;
103  meTrackerSiBR = nullptr;
104  meTrackerSiFToF = nullptr;
105  meTrackerSiFZ = nullptr;
106  meMuonPhi = nullptr;
107  meMuonEta = nullptr;
108  meMuonDtR = nullptr;
109  meMuonCscZ = nullptr;
110  meMuonRpcBR = nullptr;
111  meMuonRpcFZ = nullptr;
112 
113  // create histograms
114  Char_t hname[200];
115  Char_t htitle[200];
116 
117  // MCGeant
118  ibooker.setCurrentFolder("GlobalHitsV/MCGeant");
119  sprintf(hname, "hMCRGP1");
120  sprintf(htitle, "RawGenParticles");
121  meMCRGP[0] = ibooker.book1D(hname, htitle, 100, 0., 5000.);
122  sprintf(hname, "hMCRGP2");
123  meMCRGP[1] = ibooker.book1D(hname, htitle, 100, 0., 500.);
124  for (Int_t i = 0; i < 2; ++i) {
125  meMCRGP[i]->setAxisTitle("Number of Raw Generated Particles", 1);
126  meMCRGP[i]->setAxisTitle("Count", 2);
127  }
128 
129  sprintf(hname, "hMCG4Vtx1");
130  sprintf(htitle, "G4 Vertices");
131  meMCG4Vtx[0] = ibooker.book1D(hname, htitle, 100, 0., 50000.);
132  sprintf(hname, "hMCG4Vtx2");
133  meMCG4Vtx[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
134  for (Int_t i = 0; i < 2; ++i) {
135  meMCG4Vtx[i]->setAxisTitle("Number of Vertices", 1);
136  meMCG4Vtx[i]->setAxisTitle("Count", 2);
137  }
138 
139  sprintf(hname, "hMCG4Trk1");
140  sprintf(htitle, "G4 Tracks");
141  meMCG4Trk[0] = ibooker.book1D(hname, htitle, 150, 0., 15000.);
142  sprintf(hname, "hMCG4Trk2");
143  meMCG4Trk[1] = ibooker.book1D(hname, htitle, 150, -0.5, 99.5);
144  for (Int_t i = 0; i < 2; ++i) {
145  meMCG4Trk[i]->setAxisTitle("Number of Tracks", 1);
146  meMCG4Trk[i]->setAxisTitle("Count", 2);
147  }
148 
149  sprintf(hname, "hGeantVtxX1");
150  sprintf(htitle, "Geant vertex x/micrometer");
151  meGeantVtxX[0] = ibooker.book1D(hname, htitle, 100, -8000000., 8000000.);
152  sprintf(hname, "hGeantVtxX2");
153  meGeantVtxX[1] = ibooker.book1D(hname, htitle, 100, -50., 50.);
154  for (Int_t i = 0; i < 2; ++i) {
155  meGeantVtxX[i]->setAxisTitle("x of Vertex (um)", 1);
156  meGeantVtxX[i]->setAxisTitle("Count", 2);
157  }
158 
159  sprintf(hname, "hGeantVtxY1");
160  sprintf(htitle, "Geant vertex y/micrometer");
161  meGeantVtxY[0] = ibooker.book1D(hname, htitle, 100, -8000000, 8000000.);
162  sprintf(hname, "hGeantVtxY2");
163  meGeantVtxY[1] = ibooker.book1D(hname, htitle, 100, -50., 50.);
164  for (Int_t i = 0; i < 2; ++i) {
165  meGeantVtxY[i]->setAxisTitle("y of Vertex (um)", 1);
166  meGeantVtxY[i]->setAxisTitle("Count", 2);
167  }
168 
169  sprintf(hname, "hGeantVtxZ1");
170  sprintf(htitle, "Geant vertex z/millimeter");
171  meGeantVtxZ[0] = ibooker.book1D(hname, htitle, 100, -11000., 11000.);
172  sprintf(hname, "hGeantVtxZ2");
173  meGeantVtxZ[1] = ibooker.book1D(hname, htitle, 100, -250., 250.);
174  for (Int_t i = 0; i < 2; ++i) {
175  meGeantVtxZ[i]->setAxisTitle("z of Vertex (mm)", 1);
176  meGeantVtxZ[i]->setAxisTitle("Count", 2);
177  }
178 
179  sprintf(hname, "hGeantTrkPt");
180  sprintf(htitle, "Geant track pt/GeV");
181  meGeantTrkPt = ibooker.book1D(hname, htitle, 100, 0., 200.);
182  meGeantTrkPt->setAxisTitle("pT of Track (GeV)", 1);
183  meGeantTrkPt->setAxisTitle("Count", 2);
184 
185  sprintf(hname, "hGeantTrkE");
186  sprintf(htitle, "Geant track E/GeV");
187  meGeantTrkE = ibooker.book1D(hname, htitle, 100, 0., 5000.);
188  meGeantTrkE->setAxisTitle("E of Track (GeV)", 1);
189  meGeantTrkE->setAxisTitle("Count", 2);
190 
191  // ECal
192  ibooker.setCurrentFolder("GlobalHitsV/ECals");
193 
194  sprintf(hname, "hCaloEcal1");
195  sprintf(htitle, "Ecal hits");
196  meCaloEcal[0] = ibooker.book1D(hname, htitle, 100, 0., 10000.);
197  sprintf(hname, "hCaloEcal2");
198  meCaloEcal[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
199 
200  sprintf(hname, "hCaloEcalE1");
201  sprintf(htitle, "Ecal hits, energy/GeV");
202  meCaloEcalE[0] = ibooker.book1D(hname, htitle, 100, 0., 10.);
203  sprintf(hname, "hCaloEcalE2");
204  meCaloEcalE[1] = ibooker.book1D(hname, htitle, 100, 0., 0.1);
205 
206  sprintf(hname, "hCaloEcalToF1");
207  sprintf(htitle, "Ecal hits, ToF/ns");
208  meCaloEcalToF[0] = ibooker.book1D(hname, htitle, 100, 0., 1000.);
209  sprintf(hname, "hCaloEcalToF2");
210  meCaloEcalToF[1] = ibooker.book1D(hname, htitle, 100, 0., 100.);
211 
212  for (Int_t i = 0; i < 2; ++i) {
213  meCaloEcal[i]->setAxisTitle("Number of Hits", 1);
214  meCaloEcal[i]->setAxisTitle("Count", 2);
215  meCaloEcalE[i]->setAxisTitle("Energy of Hits (GeV)", 1);
216  meCaloEcalE[i]->setAxisTitle("Count", 2);
217  meCaloEcalToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
218  meCaloEcalToF[i]->setAxisTitle("Count", 2);
219  }
220 
221  sprintf(hname, "hCaloEcalPhi");
222  sprintf(htitle, "Ecal hits, phi/rad");
223  meCaloEcalPhi = ibooker.book1D(hname, htitle, 100, -3.2, 3.2);
224  meCaloEcalPhi->setAxisTitle("Phi of Hits (rad)", 1);
225  meCaloEcalPhi->setAxisTitle("Count", 2);
226 
227  sprintf(hname, "hCaloEcalEta");
228  sprintf(htitle, "Ecal hits, eta");
229  meCaloEcalEta = ibooker.book1D(hname, htitle, 100, -5.5, 5.5);
230  meCaloEcalEta->setAxisTitle("Eta of Hits", 1);
231  meCaloEcalEta->setAxisTitle("Count", 2);
232 
233  sprintf(hname, "hCaloPreSh1");
234  sprintf(htitle, "PreSh hits");
235  meCaloPreSh[0] = ibooker.book1D(hname, htitle, 100, 0., 10000.);
236  sprintf(hname, "hCaloPreSh2");
237  meCaloPreSh[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
238 
239  sprintf(hname, "hCaloPreShE1");
240  sprintf(htitle, "PreSh hits, energy/GeV");
241  meCaloPreShE[0] = ibooker.book1D(hname, htitle, 100, 0., 10.);
242  sprintf(hname, "hCaloPreShE2");
243  meCaloPreShE[1] = ibooker.book1D(hname, htitle, 100, 0., 0.1);
244 
245  sprintf(hname, "hCaloPreShToF1");
246  sprintf(htitle, "PreSh hits, ToF/ns");
247  meCaloPreShToF[0] = ibooker.book1D(hname, htitle, 100, 0., 1000.);
248  sprintf(hname, "hCaloPreShToF2");
249  meCaloPreShToF[1] = ibooker.book1D(hname, htitle, 100, 0., 100.);
250 
251  for (Int_t i = 0; i < 2; ++i) {
252  meCaloPreSh[i]->setAxisTitle("Number of Hits", 1);
253  meCaloPreSh[i]->setAxisTitle("Count", 2);
254  meCaloPreShE[i]->setAxisTitle("Energy of Hits (GeV)", 1);
255  meCaloPreShE[i]->setAxisTitle("Count", 2);
256  meCaloPreShToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
257  meCaloPreShToF[i]->setAxisTitle("Count", 2);
258  }
259 
260  sprintf(hname, "hCaloPreShPhi");
261  sprintf(htitle, "PreSh hits, phi/rad");
262  meCaloPreShPhi = ibooker.book1D(hname, htitle, 100, -3.2, 3.2);
263  meCaloPreShPhi->setAxisTitle("Phi of Hits (rad)", 1);
264  meCaloPreShPhi->setAxisTitle("Count", 2);
265 
266  sprintf(hname, "hCaloPreShEta");
267  sprintf(htitle, "PreSh hits, eta");
268  meCaloPreShEta = ibooker.book1D(hname, htitle, 100, -5.5, 5.5);
269  meCaloPreShEta->setAxisTitle("Eta of Hits", 1);
270  meCaloPreShEta->setAxisTitle("Count", 2);
271 
272  // Hcal
273  ibooker.setCurrentFolder("GlobalHitsV/HCals");
274  sprintf(hname, "hCaloHcal1");
275  sprintf(htitle, "Hcal hits");
276  meCaloHcal[0] = ibooker.book1D(hname, htitle, 100, 0., 10000.);
277  sprintf(hname, "hCaloHcal2");
278  meCaloHcal[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
279 
280  sprintf(hname, "hCaloHcalE1");
281  sprintf(htitle, "Hcal hits, energy/GeV");
282  meCaloHcalE[0] = ibooker.book1D(hname, htitle, 100, 0., 10.);
283  sprintf(hname, "hCaloHcalE2");
284  meCaloHcalE[1] = ibooker.book1D(hname, htitle, 100, 0., 0.1);
285 
286  sprintf(hname, "hCaloHcalToF1");
287  sprintf(htitle, "Hcal hits, ToF/ns");
288  meCaloHcalToF[0] = ibooker.book1D(hname, htitle, 100, 0., 1000.);
289  sprintf(hname, "hCaloHcalToF2");
290  meCaloHcalToF[1] = ibooker.book1D(hname, htitle, 100, 0., 100.);
291 
292  for (Int_t i = 0; i < 2; ++i) {
293  meCaloHcal[i]->setAxisTitle("Number of Hits", 1);
294  meCaloHcal[i]->setAxisTitle("Count", 2);
295  meCaloHcalE[i]->setAxisTitle("Energy of Hits (GeV)", 1);
296  meCaloHcalE[i]->setAxisTitle("Count", 2);
297  meCaloHcalToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
298  meCaloHcalToF[i]->setAxisTitle("Count", 2);
299  }
300 
301  sprintf(hname, "hCaloHcalPhi");
302  sprintf(htitle, "Hcal hits, phi/rad");
303  meCaloHcalPhi = ibooker.book1D(hname, htitle, 100, -3.2, 3.2);
304  meCaloHcalPhi->setAxisTitle("Phi of Hits (rad)", 1);
305  meCaloHcalPhi->setAxisTitle("Count", 2);
306 
307  sprintf(hname, "hCaloHcalEta");
308  sprintf(htitle, "Hcal hits, eta");
309  meCaloHcalEta = ibooker.book1D(hname, htitle, 100, -5.5, 5.5);
310  meCaloHcalEta->setAxisTitle("Eta of Hits", 1);
311  meCaloHcalEta->setAxisTitle("Count", 2);
312 
313  // SiPixels
314  ibooker.setCurrentFolder("GlobalHitsV/SiPixels");
315  sprintf(hname, "hTrackerPx1");
316  sprintf(htitle, "Pixel hits");
317  meTrackerPx[0] = ibooker.book1D(hname, htitle, 100, 0., 10000.);
318  sprintf(hname, "hTrackerPx2");
319  meTrackerPx[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
320  for (Int_t i = 0; i < 2; ++i) {
321  meTrackerPx[i]->setAxisTitle("Number of Pixel Hits", 1);
322  meTrackerPx[i]->setAxisTitle("Count", 2);
323  }
324 
325  sprintf(hname, "hTrackerPxPhi");
326  sprintf(htitle, "Pixel hits phi/rad");
327  meTrackerPxPhi = ibooker.book1D(hname, htitle, 100, -3.2, 3.2);
328  meTrackerPxPhi->setAxisTitle("Phi of Hits (rad)", 1);
329  meTrackerPxPhi->setAxisTitle("Count", 2);
330 
331  sprintf(hname, "hTrackerPxEta");
332  sprintf(htitle, "Pixel hits eta");
333  meTrackerPxEta = ibooker.book1D(hname, htitle, 100, -3.5, 3.5);
334  meTrackerPxEta->setAxisTitle("Eta of Hits", 1);
335  meTrackerPxEta->setAxisTitle("Count", 2);
336 
337  sprintf(hname, "hTrackerPxBToF");
338  sprintf(htitle, "Pixel barrel hits, ToF/ns");
339  meTrackerPxBToF = ibooker.book1D(hname, htitle, 100, 0., 40.);
340  meTrackerPxBToF->setAxisTitle("Time of Flight of Hits (ns)", 1);
341  meTrackerPxBToF->setAxisTitle("Count", 2);
342 
343  sprintf(hname, "hTrackerPxBR");
344  sprintf(htitle, "Pixel barrel hits, R/cm");
345  meTrackerPxBR = ibooker.book1D(hname, htitle, 100, 0., 50.);
346  meTrackerPxBR->setAxisTitle("R of Hits (cm)", 1);
347  meTrackerPxBR->setAxisTitle("Count", 2);
348 
349  sprintf(hname, "hTrackerPxFToF");
350  sprintf(htitle, "Pixel forward hits, ToF/ns");
351  meTrackerPxFToF = ibooker.book1D(hname, htitle, 100, 0., 50.);
352  meTrackerPxFToF->setAxisTitle("Time of Flight of Hits (ns)", 1);
353  meTrackerPxFToF->setAxisTitle("Count", 2);
354 
355  sprintf(hname, "hTrackerPxFZ");
356  sprintf(htitle, "Pixel forward hits, Z/cm");
357  meTrackerPxFZ = ibooker.book1D(hname, htitle, 200, -100., 100.);
358  meTrackerPxFZ->setAxisTitle("Z of Hits (cm)", 1);
359  meTrackerPxFZ->setAxisTitle("Count", 2);
360 
361  // SiStrips
362  ibooker.setCurrentFolder("GlobalHitsV/SiPixels");
363  sprintf(hname, "hTrackerSi1");
364  sprintf(htitle, "Silicon hits");
365  meTrackerSi[0] = ibooker.book1D(hname, htitle, 100, 0., 10000.);
366  sprintf(hname, "hTrackerSi2");
367  meTrackerSi[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
368  for (Int_t i = 0; i < 2; ++i) {
369  meTrackerSi[i]->setAxisTitle("Number of Silicon Hits", 1);
370  meTrackerSi[i]->setAxisTitle("Count", 2);
371  }
372 
373  sprintf(hname, "hTrackerSiPhi");
374  sprintf(htitle, "Silicon hits phi/rad");
375  meTrackerSiPhi = ibooker.book1D(hname, htitle, 100, -3.2, 3.2);
376  meTrackerSiPhi->setAxisTitle("Phi of Hits (rad)", 1);
377  meTrackerSiPhi->setAxisTitle("Count", 2);
378 
379  sprintf(hname, "hTrackerSiEta");
380  sprintf(htitle, "Silicon hits eta");
381  meTrackerSiEta = ibooker.book1D(hname, htitle, 100, -3.5, 3.5);
382  meTrackerSiEta->setAxisTitle("Eta of Hits", 1);
383  meTrackerSiEta->setAxisTitle("Count", 2);
384 
385  sprintf(hname, "hTrackerSiBToF");
386  sprintf(htitle, "Silicon barrel hits, ToF/ns");
387  meTrackerSiBToF = ibooker.book1D(hname, htitle, 100, 0., 50.);
388  meTrackerSiBToF->setAxisTitle("Time of Flight of Hits (ns)", 1);
389  meTrackerSiBToF->setAxisTitle("Count", 2);
390 
391  sprintf(hname, "hTrackerSiBR");
392  sprintf(htitle, "Silicon barrel hits, R/cm");
393  meTrackerSiBR = ibooker.book1D(hname, htitle, 100, 0., 200.);
394  meTrackerSiBR->setAxisTitle("R of Hits (cm)", 1);
395  meTrackerSiBR->setAxisTitle("Count", 2);
396 
397  sprintf(hname, "hTrackerSiFToF");
398  sprintf(htitle, "Silicon forward hits, ToF/ns");
399  meTrackerSiFToF = ibooker.book1D(hname, htitle, 100, 0., 75.);
400  meTrackerSiFToF->setAxisTitle("Time of Flight of Hits (ns)", 1);
401  meTrackerSiFToF->setAxisTitle("Count", 2);
402 
403  sprintf(hname, "hTrackerSiFZ");
404  sprintf(htitle, "Silicon forward hits, Z/cm");
405  meTrackerSiFZ = ibooker.book1D(hname, htitle, 200, -300., 300.);
406  meTrackerSiFZ->setAxisTitle("Z of Hits (cm)", 1);
407  meTrackerSiFZ->setAxisTitle("Count", 2);
408 
409  // muon
410  ibooker.setCurrentFolder("GlobalHitsV/Muons");
411  sprintf(hname, "hMuon1");
412  sprintf(htitle, "Muon hits");
413  meMuon[0] = ibooker.book1D(hname, htitle, 100, 0., 10000.);
414  sprintf(hname, "hMuon2");
415  meMuon[1] = ibooker.book1D(hname, htitle, 100, -0.5, 99.5);
416  for (Int_t i = 0; i < 2; ++i) {
417  meMuon[i]->setAxisTitle("Number of Muon Hits", 1);
418  meMuon[i]->setAxisTitle("Count", 2);
419  }
420 
421  sprintf(hname, "hMuonPhi");
422  sprintf(htitle, "Muon hits phi/rad");
423  meMuonPhi = ibooker.book1D(hname, htitle, 100, -3.2, 3.2);
424  meMuonPhi->setAxisTitle("Phi of Hits (rad)", 1);
425  meMuonPhi->setAxisTitle("Count", 2);
426 
427  sprintf(hname, "hMuonEta");
428  sprintf(htitle, "Muon hits eta");
429  meMuonEta = ibooker.book1D(hname, htitle, 100, -3.5, 3.5);
430  meMuonEta->setAxisTitle("Eta of Hits", 1);
431  meMuonEta->setAxisTitle("Count", 2);
432 
433  sprintf(hname, "hMuonCscToF1");
434  sprintf(htitle, "Muon CSC hits, ToF/ns");
435  meMuonCscToF[0] = ibooker.book1D(hname, htitle, 100, 0., 250.);
436  sprintf(hname, "hMuonCscToF2");
437  meMuonCscToF[1] = ibooker.book1D(hname, htitle, 100, 0., 50.);
438  for (Int_t i = 0; i < 2; ++i) {
439  meMuonCscToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
440  meMuonCscToF[i]->setAxisTitle("Count", 2);
441  }
442 
443  sprintf(hname, "hMuonCscZ");
444  sprintf(htitle, "Muon CSC hits, Z/cm");
445  meMuonCscZ = ibooker.book1D(hname, htitle, 200, -1500., 1500.);
446  meMuonCscZ->setAxisTitle("Z of Hits (cm)", 1);
447  meMuonCscZ->setAxisTitle("Count", 2);
448 
449  sprintf(hname, "hMuonDtToF1");
450  sprintf(htitle, "Muon DT hits, ToF/ns");
451  meMuonDtToF[0] = ibooker.book1D(hname, htitle, 100, 0., 250.);
452  sprintf(hname, "hMuonDtToF2");
453  meMuonDtToF[1] = ibooker.book1D(hname, htitle, 100, 0., 50.);
454  for (Int_t i = 0; i < 2; ++i) {
455  meMuonDtToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
456  meMuonDtToF[i]->setAxisTitle("Count", 2);
457  }
458 
459  sprintf(hname, "hMuonDtR");
460  sprintf(htitle, "Muon DT hits, R/cm");
461  meMuonDtR = ibooker.book1D(hname, htitle, 100, 0., 1500.);
462  meMuonDtR->setAxisTitle("R of Hits (cm)", 1);
463  meMuonDtR->setAxisTitle("Count", 2);
464 
465  sprintf(hname, "hMuonRpcFToF1");
466  sprintf(htitle, "Muon RPC forward hits, ToF/ns");
467  meMuonRpcFToF[0] = ibooker.book1D(hname, htitle, 100, 0., 250.);
468  sprintf(hname, "hMuonRpcFToF2_4305");
469  meMuonRpcFToF[1] = ibooker.book1D(hname, htitle, 100, 0., 50.);
470  for (Int_t i = 0; i < 2; ++i) {
471  meMuonRpcFToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
472  meMuonRpcFToF[i]->setAxisTitle("Count", 2);
473  }
474 
475  sprintf(hname, "hMuonRpcFZ");
476  sprintf(htitle, "Muon RPC forward hits, Z/cm");
477  meMuonRpcFZ = ibooker.book1D(hname, htitle, 201, -1500., 1500.);
478  meMuonRpcFZ->setAxisTitle("Z of Hits (cm)", 1);
479  meMuonRpcFZ->setAxisTitle("Count", 2);
480 
481  sprintf(hname, "hMuonRpcBToF1");
482  sprintf(htitle, "Muon RPC barrel hits, ToF/ns");
483  meMuonRpcBToF[0] = ibooker.book1D(hname, htitle, 100, 0., 250.);
484  sprintf(hname, "hMuonRpcBToF2");
485  meMuonRpcBToF[1] = ibooker.book1D(hname, htitle, 100, 0., 50.);
486  for (Int_t i = 0; i < 2; ++i) {
487  meMuonRpcBToF[i]->setAxisTitle("Time of Flight of Hits (ns)", 1);
488  meMuonRpcBToF[i]->setAxisTitle("Count", 2);
489  }
490 
491  sprintf(hname, "hMuonRpcBR");
492  sprintf(htitle, "Muon RPC barrel hits, R/cm");
493  meMuonRpcBR = ibooker.book1D(hname, htitle, 100, 0., 1500.);
494  meMuonRpcBR->setAxisTitle("R of Hits (cm)", 1);
495  meMuonRpcBR->setAxisTitle("Count", 2);
496 }
497 
499 
501  std::string MsgLoggerCat = "GlobalHitsHistogrammer_analyze";
502 
503  // keep track of number of events processed
504  ++count;
505 
506  // get event id information
507  edm::RunNumber_t nrun = iEvent.id().run();
508  edm::EventNumber_t nevt = iEvent.id().event();
509 
510  if (verbosity > 0) {
511  edm::LogInfo(MsgLoggerCat) << "Processing run " << nrun << ", event " << nevt << " (" << count << " events total)";
512  } else if (verbosity == 0) {
513  if (nevt % frequency == 0 || nevt == 1) {
514  edm::LogInfo(MsgLoggerCat) << "Processing run " << nrun << ", event " << nevt << " (" << count
515  << " events total)";
516  }
517  }
518 
519  // look at information available in the event
520  if (getAllProvenances) {
521  std::vector<const edm::StableProvenance *> AllProv;
522  iEvent.getAllStableProvenance(AllProv);
523 
524  if (verbosity >= 0)
525  edm::LogInfo(MsgLoggerCat) << "Number of Provenances = " << AllProv.size();
526 
527  if (printProvenanceInfo && (verbosity >= 0)) {
528  TString eventout("\nProvenance info:\n");
529 
530  for (unsigned int i = 0; i < AllProv.size(); ++i) {
531  eventout += "\n ******************************";
532  eventout += "\n Module : ";
533  eventout += AllProv[i]->moduleLabel();
534  eventout += "\n ProductID : ";
535  eventout += AllProv[i]->productID().id();
536  eventout += "\n ClassName : ";
537  eventout += AllProv[i]->className();
538  eventout += "\n InstanceName : ";
539  eventout += AllProv[i]->productInstanceName();
540  eventout += "\n BranchName : ";
541  eventout += AllProv[i]->branchName();
542  }
543  eventout += "\n ******************************\n";
544  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
545  printProvenanceInfo = false;
546  }
547  getAllProvenances = false;
548  }
549 
550  // fill histograms
551  edm::Handle<PGlobalSimHit> srcGlobalHits;
552  iEvent.getByToken(GlobalHitSrc_Token_, srcGlobalHits);
553  if (!srcGlobalHits.isValid()) {
554  edm::LogWarning(MsgLoggerCat) << "Unable to find PGlobalSimHit in event!";
555  return;
556  }
557 
558  nPxlBrlHits = srcGlobalHits->getnPxlBrlHits();
559  nPxlFwdHits = srcGlobalHits->getnPxlFwdHits();
561  nSiBrlHits = srcGlobalHits->getnSiBrlHits();
562  nSiFwdHits = srcGlobalHits->getnSiFwdHits();
564  nMuonDtHits = srcGlobalHits->getnMuonDtHits();
565  nMuonCscHits = srcGlobalHits->getnMuonCscHits();
566  nMuonRpcBrlHits = srcGlobalHits->getnMuonRpcBrlHits();
567  nMuonRpcFwdHits = srcGlobalHits->getnMuonRpcFwdHits();
569 
570  for (Int_t i = 0; i < 2; ++i) {
571  meMCRGP[i]->Fill((float)srcGlobalHits->getnRawGenPart());
572  meMCG4Vtx[i]->Fill((float)srcGlobalHits->getnG4Vtx());
573  meMCG4Trk[i]->Fill((float)srcGlobalHits->getnG4Trk());
574  meCaloEcal[i]->Fill((float)srcGlobalHits->getnECalHits());
575  meCaloPreSh[i]->Fill((float)srcGlobalHits->getnPreShHits());
576  meCaloHcal[i]->Fill((float)srcGlobalHits->getnHCalHits());
577  meTrackerPx[i]->Fill((float)nPxlHits);
578  meTrackerSi[i]->Fill((float)nSiHits);
579  meMuon[i]->Fill((float)nMuonHits);
580  }
581 
582  // get G4Vertex info
583  std::vector<PGlobalSimHit::Vtx> G4Vtx = srcGlobalHits->getG4Vtx();
584  for (unsigned int i = 0; i < G4Vtx.size(); ++i) {
585  for (int j = 0; j < 2; ++j) {
586  meGeantVtxX[j]->Fill(G4Vtx[i].x);
587  meGeantVtxY[j]->Fill(G4Vtx[i].y);
588  meGeantVtxZ[j]->Fill(G4Vtx[i].z);
589  }
590  }
591 
592  // get G4Track info
593  std::vector<PGlobalSimHit::Trk> G4Trk = srcGlobalHits->getG4Trk();
594  for (unsigned int i = 0; i < G4Trk.size(); ++i) {
595  meGeantTrkPt->Fill(G4Trk[i].pt);
596  meGeantTrkE->Fill(G4Trk[i].e);
597  }
598 
599  // get Ecal info
600  std::vector<PGlobalSimHit::CalHit> ECalHits = srcGlobalHits->getECalHits();
601  for (unsigned int i = 0; i < ECalHits.size(); ++i) {
602  for (Int_t j = 0; j < 2; ++j) {
603  meCaloEcalE[j]->Fill(ECalHits[i].e);
604  meCaloEcalToF[j]->Fill(ECalHits[i].tof);
605  }
606  meCaloEcalPhi->Fill(ECalHits[i].phi);
607  meCaloEcalEta->Fill(ECalHits[i].eta);
608  }
609 
610  // get PreShower info
611  std::vector<PGlobalSimHit::CalHit> PreShHits = srcGlobalHits->getPreShHits();
612  for (unsigned int i = 0; i < PreShHits.size(); ++i) {
613  for (Int_t j = 0; j < 2; ++j) {
614  meCaloPreShE[j]->Fill(PreShHits[i].e);
615  meCaloPreShToF[j]->Fill(PreShHits[i].tof);
616  }
617  meCaloPreShPhi->Fill(PreShHits[i].phi);
618  meCaloPreShEta->Fill(PreShHits[i].eta);
619  }
620 
621  // get Hcal info
622  std::vector<PGlobalSimHit::CalHit> HCalHits = srcGlobalHits->getHCalHits();
623  for (unsigned int i = 0; i < HCalHits.size(); ++i) {
624  for (Int_t j = 0; j < 2; ++j) {
625  meCaloHcalE[j]->Fill(HCalHits[i].e);
626  meCaloHcalToF[j]->Fill(HCalHits[i].tof);
627  }
628  meCaloHcalPhi->Fill(HCalHits[i].phi);
629  meCaloHcalEta->Fill(HCalHits[i].eta);
630  }
631 
632  // get Pixel Barrel info
633  std::vector<PGlobalSimHit::BrlHit> PxlBrlHits = srcGlobalHits->getPxlBrlHits();
634  for (unsigned int i = 0; i < PxlBrlHits.size(); ++i) {
635  meTrackerPxPhi->Fill(PxlBrlHits[i].phi);
636  meTrackerPxEta->Fill(PxlBrlHits[i].eta);
637  meTrackerPxBToF->Fill(PxlBrlHits[i].tof);
638  meTrackerPxBR->Fill(PxlBrlHits[i].r);
639  }
640 
641  // get Pixel Forward info
642  std::vector<PGlobalSimHit::FwdHit> PxlFwdHits = srcGlobalHits->getPxlFwdHits();
643  for (unsigned int i = 0; i < PxlFwdHits.size(); ++i) {
644  meTrackerPxPhi->Fill(PxlFwdHits[i].phi);
645  meTrackerPxEta->Fill(PxlFwdHits[i].eta);
646  meTrackerPxFToF->Fill(PxlFwdHits[i].tof);
647  meTrackerPxFZ->Fill(PxlFwdHits[i].z);
648  }
649 
650  // get Strip Barrel info
651  std::vector<PGlobalSimHit::BrlHit> SiBrlHits = srcGlobalHits->getSiBrlHits();
652  for (unsigned int i = 0; i < SiBrlHits.size(); ++i) {
653  meTrackerSiPhi->Fill(SiBrlHits[i].phi);
654  meTrackerSiEta->Fill(SiBrlHits[i].eta);
655  meTrackerSiBToF->Fill(SiBrlHits[i].tof);
656  meTrackerSiBR->Fill(SiBrlHits[i].r);
657  }
658 
659  // get Strip Forward info
660  std::vector<PGlobalSimHit::FwdHit> SiFwdHits = srcGlobalHits->getSiFwdHits();
661  for (unsigned int i = 0; i < SiFwdHits.size(); ++i) {
662  meTrackerSiPhi->Fill(SiFwdHits[i].phi);
663  meTrackerSiEta->Fill(SiFwdHits[i].eta);
664  meTrackerSiFToF->Fill(SiFwdHits[i].tof);
665  meTrackerSiFZ->Fill(SiFwdHits[i].z);
666  }
667 
668  // get Muon CSC info
669  std::vector<PGlobalSimHit::FwdHit> MuonCscHits = srcGlobalHits->getMuonCscHits();
670  for (unsigned int i = 0; i < MuonCscHits.size(); ++i) {
671  meMuonPhi->Fill(MuonCscHits[i].phi);
672  meMuonEta->Fill(MuonCscHits[i].eta);
673  for (Int_t j = 0; j < 2; ++j) {
674  meMuonCscToF[j]->Fill(MuonCscHits[i].tof);
675  }
676  meMuonCscZ->Fill(MuonCscHits[i].z);
677  }
678 
679  // get Muon DT info
680  std::vector<PGlobalSimHit::BrlHit> MuonDtHits = srcGlobalHits->getMuonDtHits();
681  for (unsigned int i = 0; i < MuonDtHits.size(); ++i) {
682  meMuonPhi->Fill(MuonDtHits[i].phi);
683  meMuonEta->Fill(MuonDtHits[i].eta);
684  for (Int_t j = 0; j < 2; ++j) {
685  meMuonDtToF[j]->Fill(MuonDtHits[i].tof);
686  }
687  meMuonDtR->Fill(MuonDtHits[i].r);
688  }
689 
690  // get Muon RPC forward info
691  std::vector<PGlobalSimHit::FwdHit> MuonRpcFwdHits = srcGlobalHits->getMuonRpcFwdHits();
692  for (unsigned int i = 0; i < MuonRpcFwdHits.size(); ++i) {
693  meMuonPhi->Fill(MuonRpcFwdHits[i].phi);
694  meMuonEta->Fill(MuonRpcFwdHits[i].eta);
695  for (Int_t j = 0; j < 2; ++j) {
696  meMuonRpcFToF[j]->Fill(MuonRpcFwdHits[i].tof);
697  }
698  meMuonRpcFZ->Fill(MuonRpcFwdHits[i].z);
699  }
700 
701  // get Muon RPC barrel info
702  std::vector<PGlobalSimHit::BrlHit> MuonRpcBrlHits = srcGlobalHits->getMuonRpcBrlHits();
703  for (unsigned int i = 0; i < MuonRpcBrlHits.size(); ++i) {
704  meMuonPhi->Fill(MuonRpcBrlHits[i].phi);
705  meMuonEta->Fill(MuonRpcBrlHits[i].eta);
706  for (Int_t j = 0; j < 2; ++j) {
707  meMuonRpcBToF[j]->Fill(MuonRpcBrlHits[i].tof);
708  }
709  meMuonRpcBR->Fill(MuonRpcBrlHits[i].r);
710  }
711 
712  return;
713 }
RunNumber_t run() const
Definition: EventID.h:38
EventNumber_t event() const
Definition: EventID.h:40
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meMCG4Vtx[2]
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
MonitorElement * meCaloHcal[2]
GlobalHitsHistogrammer(const edm::ParameterSet &)
MonitorElement * meCaloEcalE[2]
unsigned long long EventNumber_t
MonitorElement * meMuonRpcBToF[2]
MonitorElement * meCaloPreSh[2]
void Fill(long long x)
MonitorElement * meMuonCscToF[2]
MonitorElement * meGeantVtxY[2]
char const * label
int iEvent
Definition: GenABIO.cc:224
MonitorElement * meMuonDtToF[2]
MonitorElement * meCaloPreShE[2]
MonitorElement * meMCRGP[2]
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * meCaloHcalE[2]
Log< level::Info, false > LogInfo
MonitorElement * meTrackerSi[2]
MonitorElement * meMCG4Trk[2]
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * meCaloEcal[2]
MonitorElement * meCaloPreShToF[2]
edm::EDGetTokenT< PGlobalSimHit > GlobalHitSrc_Token_
edm::EventID id() const
Definition: EventBase.h:59
MonitorElement * meCaloEcalToF[2]
MonitorElement * meMuonRpcFToF[2]
MonitorElement * meTrackerPx[2]
unsigned int RunNumber_t
Log< level::Warning, false > LogWarning
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * meGeantVtxZ[2]
MonitorElement * meGeantVtxX[2]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * meCaloHcalToF[2]
Definition: Run.h:45
void getAllStableProvenance(std::vector< StableProvenance const * > &provenances) const
Definition: Event.cc:136
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)