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