CMS 3D CMS Logo

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