CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalHitsProdHist.cc
Go to the documentation of this file.
1 
12 
14  fName(""), verbosity(0), frequency(0), vtxunit(0),
15  getAllProvenances(false), printProvenanceInfo(false), count(0)
16 {
17  std::string MsgLoggerCat = "GlobalHitsProdHist_GlobalHitsProdHist";
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  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  PxlBrlLowSrc_ = iPSet.getParameter<edm::InputTag>("PxlBrlLowSrc");
33  PxlBrlHighSrc_ = iPSet.getParameter<edm::InputTag>("PxlBrlHighSrc");
34  PxlFwdLowSrc_ = iPSet.getParameter<edm::InputTag>("PxlFwdLowSrc");
35  PxlFwdHighSrc_ = iPSet.getParameter<edm::InputTag>("PxlFwdHighSrc");
36 
37  SiTIBLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTIBLowSrc");
38  SiTIBHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTIBHighSrc");
39  SiTOBLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTOBLowSrc");
40  SiTOBHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTOBHighSrc");
41  SiTIDLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTIDLowSrc");
42  SiTIDHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTIDHighSrc");
43  SiTECLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTECLowSrc");
44  SiTECHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTECHighSrc");
45 
46  MuonCscSrc_ = iPSet.getParameter<edm::InputTag>("MuonCscSrc");
47  MuonDtSrc_ = iPSet.getParameter<edm::InputTag>("MuonDtSrc");
48  MuonRpcSrc_ = iPSet.getParameter<edm::InputTag>("MuonRpcSrc");
49 
50  ECalEBSrc_ = iPSet.getParameter<edm::InputTag>("ECalEBSrc");
51  ECalEESrc_ = iPSet.getParameter<edm::InputTag>("ECalEESrc");
52  ECalESSrc_ = iPSet.getParameter<edm::InputTag>("ECalESSrc");
53 
54  HCalSrc_ = iPSet.getParameter<edm::InputTag>("HCalSrc");
55 
56  // use value of first digit to determine default output level (inclusive)
57  // 0 is none, 1 is basic, 2 is fill output, 3 is gather output
58  verbosity %= 10;
59 
60  // print out Parameter Set information being used
61  if (verbosity >= 0) {
62  edm::LogInfo(MsgLoggerCat)
63  << "\n===============================\n"
64  << "Initialized as EDProducer with parameter values:\n"
65  << " Name = " << fName << "\n"
66  << " Verbosity = " << verbosity << "\n"
67  << " Frequency = " << frequency << "\n"
68  << " VtxUnit = " << vtxunit << "\n"
69  << " GetProv = " << getAllProvenances << "\n"
70  << " PrintProv = " << printProvenanceInfo << "\n"
71  << " PxlBrlLowSrc = " << PxlBrlLowSrc_.label()
72  << ":" << PxlBrlLowSrc_.instance() << "\n"
73  << " PxlBrlHighSrc = " << PxlBrlHighSrc_.label()
74  << ":" << PxlBrlHighSrc_.instance() << "\n"
75  << " PxlFwdLowSrc = " << PxlFwdLowSrc_.label()
76  << ":" << PxlBrlLowSrc_.instance() << "\n"
77  << " PxlFwdHighSrc = " << PxlFwdHighSrc_.label()
78  << ":" << PxlBrlHighSrc_.instance() << "\n"
79  << " SiTIBLowSrc = " << SiTIBLowSrc_.label()
80  << ":" << SiTIBLowSrc_.instance() << "\n"
81  << " SiTIBHighSrc = " << SiTIBHighSrc_.label()
82  << ":" << SiTIBHighSrc_.instance() << "\n"
83  << " SiTOBLowSrc = " << SiTOBLowSrc_.label()
84  << ":" << SiTOBLowSrc_.instance() << "\n"
85  << " SiTOBHighSrc = " << SiTOBHighSrc_.label()
86  << ":" << SiTOBHighSrc_.instance() << "\n"
87  << " SiTIDLowSrc = " << SiTIDLowSrc_.label()
88  << ":" << SiTIDLowSrc_.instance() << "\n"
89  << " SiTIDHighSrc = " << SiTIDHighSrc_.label()
90  << ":" << SiTIDHighSrc_.instance() << "\n"
91  << " SiTECLowSrc = " << SiTECLowSrc_.label()
92  << ":" << SiTECLowSrc_.instance() << "\n"
93  << " SiTECHighSrc = " << SiTECHighSrc_.label()
94  << ":" << SiTECHighSrc_.instance() << "\n"
95  << " MuonCscSrc = " << MuonCscSrc_.label()
96  << ":" << MuonCscSrc_.instance() << "\n"
97  << " MuonDtSrc = " << MuonDtSrc_.label()
98  << ":" << MuonDtSrc_.instance() << "\n"
99  << " MuonRpcSrc = " << MuonRpcSrc_.label()
100  << ":" << MuonRpcSrc_.instance() << "\n"
101  << " ECalEBSrc = " << ECalEBSrc_.label()
102  << ":" << ECalEBSrc_.instance() << "\n"
103  << " ECalEESrc = " << ECalEESrc_.label()
104  << ":" << ECalEESrc_.instance() << "\n"
105  << " ECalESSrc = " << ECalESSrc_.label()
106  << ":" << ECalESSrc_.instance() << "\n"
107  << " HCalSrc = " << HCalSrc_.label()
108  << ":" << HCalSrc_.instance() << "\n"
109  << "===============================\n";
110  }
111 
112  //create histograms
113  Char_t hname[200];
114  Char_t htitle[200];
115 
116  // MCGeant
117  sprintf(hname,"hMCRGP1");
118  histName_.push_back(hname);
119  sprintf(htitle,"RawGenParticles");
120  hMCRGP[0] = new TH1F(hname,htitle,100,0.,5000.);
121  sprintf(hname,"hMCRGP2");
122  histName_.push_back(hname);
123  hMCRGP[1] = new TH1F(hname,htitle,100,0.,500.);
124  for (Int_t i = 0; i < 2; ++i) {
125  hMCRGP[i]->GetXaxis()->SetTitle("Number of Raw Generated Particles");
126  hMCRGP[i]->GetYaxis()->SetTitle("Count");
127  histMap_[hMCRGP[i]->GetName()] = hMCRGP[i];
128  }
129 
130  sprintf(hname,"hMCG4Vtx1");
131  histName_.push_back(hname);
132  sprintf(htitle,"G4 Vertices");
133  hMCG4Vtx[0] = new TH1F(hname,htitle,100,0.,50000.);
134  sprintf(hname,"hMCG4Vtx2");
135  histName_.push_back(hname);
136  hMCG4Vtx[1] = new TH1F(hname,htitle,100,-0.5,99.5);
137  for (Int_t i = 0; i < 2; ++i) {
138  hMCG4Vtx[i]->GetXaxis()->SetTitle("Number of Vertices");
139  hMCG4Vtx[i]->GetYaxis()->SetTitle("Count");
140  histMap_[hMCG4Vtx[i]->GetName()] = hMCG4Vtx[i];
141  }
142 
143  sprintf(hname,"hMCG4Trk1");
144  histName_.push_back(hname);
145  sprintf(htitle,"G4 Tracks");
146  hMCG4Trk[0] = new TH1F(hname,htitle,150,0.,15000.);
147  sprintf(hname,"hMCG4Trk2");
148  histName_.push_back(hname);
149  hMCG4Trk[1] = new TH1F(hname,htitle,150,-0.5,99.5);
150  for (Int_t i = 0; i < 2; ++i) {
151  hMCG4Trk[i]->GetXaxis()->SetTitle("Number of Tracks");
152  hMCG4Trk[i]->GetYaxis()->SetTitle("Count");
153  histMap_[hMCG4Trk[i]->GetName()] = hMCG4Trk[i];
154  }
155 
156  sprintf(hname,"hGeantVtxX1");
157  histName_.push_back(hname);
158  sprintf(htitle,"Geant vertex x/micrometer");
159  hGeantVtxX[0] = new TH1F(hname,htitle,100,-8000000.,8000000.);
160  sprintf(hname,"hGeantVtxX2");
161  histName_.push_back(hname);
162  hGeantVtxX[1] = new TH1F(hname,htitle,100,-50.,50.);
163  for (Int_t i = 0; i < 2; ++i) {
164  hGeantVtxX[i]->GetXaxis()->SetTitle("x of Vertex (um)");
165  hGeantVtxX[i]->GetYaxis()->SetTitle("Count");
166  histMap_[hGeantVtxX[i]->GetName()] = hGeantVtxX[i];
167  }
168 
169  sprintf(hname,"hGeantVtxY1");
170  histName_.push_back(hname);
171  sprintf(htitle,"Geant vertex y/micrometer");
172  hGeantVtxY[0] = new TH1F(hname,htitle,100,-8000000,8000000.);
173  sprintf(hname,"hGeantVtxY2");
174  histName_.push_back(hname);
175  hGeantVtxY[1] = new TH1F(hname,htitle,100,-50.,50.);
176  for (Int_t i = 0; i < 2; ++i) {
177  hGeantVtxY[i]->GetXaxis()->SetTitle("y of Vertex (um)");
178  hGeantVtxY[i]->GetYaxis()->SetTitle("Count");
179  histMap_[hGeantVtxY[i]->GetName()] = hGeantVtxY[i];
180  }
181 
182  sprintf(hname,"hGeantVtxZ1");
183  histName_.push_back(hname);
184  sprintf(htitle,"Geant vertex z/millimeter");
185  hGeantVtxZ[0] = new TH1F(hname,htitle,100,-11000.,11000.);
186  sprintf(hname,"hGeantVtxZ2");
187  histName_.push_back(hname);
188  hGeantVtxZ[1] = new TH1F(hname,htitle,100,-250.,250.);
189  for (Int_t i = 0; i < 2; ++i) {
190  hGeantVtxZ[i]->GetXaxis()->SetTitle("z of Vertex (mm)");
191  hGeantVtxZ[i]->GetYaxis()->SetTitle("Count");
192  histMap_[hGeantVtxZ[i]->GetName()] = hGeantVtxZ[i];
193  }
194 
195  sprintf(hname,"hGeantTrkPt");
196  histName_.push_back(hname);
197  sprintf(htitle,"Geant track pt/GeV");
198  hGeantTrkPt = new TH1F(hname,htitle,100,0.,200.);
199  hGeantTrkPt->GetXaxis()->SetTitle("pT of Track (GeV)");
200  hGeantTrkPt->GetYaxis()->SetTitle("Count");
201  histMap_[hGeantTrkPt->GetName()] = hGeantTrkPt;
202 
203  sprintf(hname,"hGeantTrkE");
204  histName_.push_back(hname);
205  sprintf(htitle,"Geant track E/GeV");
206  hGeantTrkE = new TH1F(hname,htitle,100,0.,5000.);
207  hGeantTrkE->GetXaxis()->SetTitle("E of Track (GeV)");
208  hGeantTrkE->GetYaxis()->SetTitle("Count");
209  histMap_[hGeantTrkE->GetName()] = hGeantTrkE;
210 
211  // ECal
212  sprintf(hname,"hCaloEcal1");
213  histName_.push_back(hname);
214  sprintf(htitle,"Ecal hits");
215  hCaloEcal[0] = new TH1F(hname,htitle,100,0.,10000.);
216  sprintf(hname,"hCaloEcal2");
217  histName_.push_back(hname);
218  hCaloEcal[1] = new TH1F(hname,htitle,100,-0.5,99.5);
219 
220  sprintf(hname,"hCaloEcalE1");
221  histName_.push_back(hname);
222  sprintf(htitle,"Ecal hits, energy/GeV");
223  hCaloEcalE[0] = new TH1F(hname,htitle,100,0.,10.);
224  sprintf(hname,"hCaloEcalE2");
225  histName_.push_back(hname);
226  hCaloEcalE[1] = new TH1F(hname,htitle,100,0.,0.1);
227 
228  sprintf(hname,"hCaloEcalToF1");
229  histName_.push_back(hname);
230  sprintf(htitle,"Ecal hits, ToF/ns");
231  hCaloEcalToF[0] = new TH1F(hname,htitle,100,0.,1000.);
232  sprintf(hname,"hCaloEcalToF2");
233  histName_.push_back(hname);
234  hCaloEcalToF[1] = new TH1F(hname,htitle,100,0.,100.);
235 
236  for (Int_t i = 0; i < 2; ++i) {
237  hCaloEcal[i]->GetXaxis()->SetTitle("Number of Hits");
238  hCaloEcal[i]->GetYaxis()->SetTitle("Count");
239  histMap_[hCaloEcal[i]->GetName()] = hCaloEcal[i];
240  hCaloEcalE[i]->GetXaxis()->SetTitle("Energy of Hits (GeV)");
241  hCaloEcalE[i]->GetYaxis()->SetTitle("Count");
242  histMap_[hCaloEcalE[i]->GetName()] = hCaloEcalE[i];
243  hCaloEcalToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
244  hCaloEcalToF[i]->GetYaxis()->SetTitle("Count");
245  histMap_[hCaloEcalToF[i]->GetName()] = hCaloEcalToF[i];
246  }
247 
248  sprintf(hname,"hCaloEcalPhi");
249  histName_.push_back(hname);
250  sprintf(htitle,"Ecal hits, phi/rad");
251  hCaloEcalPhi = new TH1F(hname,htitle,100,-3.2,3.2);
252  hCaloEcalPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
253  hCaloEcalPhi->GetYaxis()->SetTitle("Count");
254  histMap_[hCaloEcalPhi->GetName()] = hCaloEcalPhi;
255 
256  sprintf(hname,"hCaloEcalEta");
257  histName_.push_back(hname);
258  sprintf(htitle,"Ecal hits, eta");
259  hCaloEcalEta = new TH1F(hname,htitle,100,-5.5,5.5);
260  hCaloEcalEta->GetXaxis()->SetTitle("Eta of Hits");
261  hCaloEcalEta->GetYaxis()->SetTitle("Count");
262  histMap_[hCaloEcalEta->GetName()] = hCaloEcalEta;
263 
264  sprintf(hname,"hCaloPreSh1");
265  histName_.push_back(hname);
266  sprintf(htitle,"PreSh hits");
267  hCaloPreSh[0] = new TH1F(hname,htitle,100,0.,10000.);
268  sprintf(hname,"hCaloPreSh2");
269  histName_.push_back(hname);
270  hCaloPreSh[1] = new TH1F(hname,htitle,100,-0.5,99.5);
271 
272  sprintf(hname,"hCaloPreShE1");
273  histName_.push_back(hname);
274  sprintf(htitle,"PreSh hits, energy/GeV");
275  hCaloPreShE[0] = new TH1F(hname,htitle,100,0.,10.);
276  sprintf(hname,"hCaloPreShE2");
277  histName_.push_back(hname);
278  hCaloPreShE[1] = new TH1F(hname,htitle,100,0.,0.1);
279 
280  sprintf(hname,"hCaloPreShToF1");
281  histName_.push_back(hname);
282  sprintf(htitle,"PreSh hits, ToF/ns");
283  hCaloPreShToF[0] = new TH1F(hname,htitle,100,0.,1000.);
284  sprintf(hname,"hCaloPreShToF2");
285  histName_.push_back(hname);
286  hCaloPreShToF[1] = new TH1F(hname,htitle,100,0.,100.);
287 
288  for (Int_t i = 0; i < 2; ++i) {
289  hCaloPreSh[i]->GetXaxis()->SetTitle("Number of Hits");
290  hCaloPreSh[i]->GetYaxis()->SetTitle("Count");
291  histMap_[hCaloPreSh[i]->GetName()] = hCaloPreSh[i];
292  hCaloPreShE[i]->GetXaxis()->SetTitle("Energy of Hits (GeV)");
293  hCaloPreShE[i]->GetYaxis()->SetTitle("Count");
294  histMap_[hCaloPreShE[i]->GetName()] = hCaloPreShE[i];
295  hCaloPreShToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
296  hCaloPreShToF[i]->GetYaxis()->SetTitle("Count");
297  histMap_[hCaloPreShToF[i]->GetName()] = hCaloPreShToF[i];
298  }
299 
300  sprintf(hname,"hCaloPreShPhi");
301  histName_.push_back(hname);
302  sprintf(htitle,"PreSh hits, phi/rad");
303  hCaloPreShPhi = new TH1F(hname,htitle,100,-3.2,3.2);
304  hCaloPreShPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
305  hCaloPreShPhi->GetYaxis()->SetTitle("Count");
306  histMap_[hCaloPreShPhi->GetName()] = hCaloPreShPhi;
307 
308  sprintf(hname,"hCaloPreShEta");
309  histName_.push_back(hname);
310  sprintf(htitle,"PreSh hits, eta");
311  hCaloPreShEta = new TH1F(hname,htitle,100,-5.5,5.5);
312  hCaloPreShEta->GetXaxis()->SetTitle("Eta of Hits");
313  hCaloPreShEta->GetYaxis()->SetTitle("Count");
314  histMap_[hCaloPreShEta->GetName()] = hCaloPreShEta;
315 
316  // Hcal
317  sprintf(hname,"hCaloHcal1");
318  histName_.push_back(hname);
319  sprintf(htitle,"Hcal hits");
320  hCaloHcal[0] = new TH1F(hname,htitle,100,0.,10000.);
321  sprintf(hname,"hCaloHcal2");
322  histName_.push_back(hname);
323  hCaloHcal[1] = new TH1F(hname,htitle,100,-0.5,99.5);
324 
325  sprintf(hname,"hCaloHcalE1");
326  histName_.push_back(hname);
327  sprintf(htitle,"Hcal hits, energy/GeV");
328  hCaloHcalE[0] = new TH1F(hname,htitle,100,0.,10.);
329  sprintf(hname,"hCaloHcalE2");
330  histName_.push_back(hname);
331  hCaloHcalE[1] = new TH1F(hname,htitle,100,0.,0.1);
332 
333  sprintf(hname,"hCaloHcalToF1");
334  histName_.push_back(hname);
335  sprintf(htitle,"Hcal hits, ToF/ns");
336  hCaloHcalToF[0] = new TH1F(hname,htitle,100,0.,1000.);
337  sprintf(hname,"hCaloHcalToF2");
338  histName_.push_back(hname);
339  hCaloHcalToF[1] = new TH1F(hname,htitle,100,0.,100.);
340 
341  for (Int_t i = 0; i < 2; ++i) {
342  hCaloHcal[i]->GetXaxis()->SetTitle("Number of Hits");
343  hCaloHcal[i]->GetYaxis()->SetTitle("Count");
344  histMap_[hCaloHcal[i]->GetName()] = hCaloHcal[i];
345  hCaloHcalE[i]->GetXaxis()->SetTitle("Energy of Hits (GeV)");
346  hCaloHcalE[i]->GetYaxis()->SetTitle("Count");
347  histMap_[hCaloHcalE[i]->GetName()] = hCaloHcalE[i];
348  hCaloHcalToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
349  hCaloHcalToF[i]->GetYaxis()->SetTitle("Count");
350  histMap_[hCaloHcalToF[i]->GetName()] = hCaloHcalToF[i];
351  }
352 
353  sprintf(hname,"hCaloHcalPhi");
354  histName_.push_back(hname);
355  sprintf(htitle,"Hcal hits, phi/rad");
356  hCaloHcalPhi = new TH1F(hname,htitle,100,-3.2,3.2);
357  hCaloHcalPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
358  hCaloHcalPhi->GetYaxis()->SetTitle("Count");
359  histMap_[hCaloHcalPhi->GetName()] = hCaloHcalPhi;
360 
361  sprintf(hname,"hCaloHcalEta");
362  histName_.push_back(hname);
363  sprintf(htitle,"Hcal hits, eta");
364  hCaloHcalEta = new TH1F(hname,htitle,100,-5.5,5.5);
365  hCaloHcalEta->GetXaxis()->SetTitle("Eta of Hits");
366  hCaloHcalEta->GetYaxis()->SetTitle("Count");
367  histMap_[hCaloHcalEta->GetName()] = hCaloHcalEta;
368 
369  // tracker
370  sprintf(hname,"hTrackerPx1");
371  histName_.push_back(hname);
372  sprintf(htitle,"Pixel hits");
373  hTrackerPx[0] = new TH1F(hname,htitle,100,0.,10000.);
374  sprintf(hname,"hTrackerPx2");
375  histName_.push_back(hname);
376  hTrackerPx[1] = new TH1F(hname,htitle,100,-0.5,99.5);
377  for (Int_t i = 0; i < 2; ++i) {
378  hTrackerPx[i]->GetXaxis()->SetTitle("Number of Pixel Hits");
379  hTrackerPx[i]->GetYaxis()->SetTitle("Count");
380  histMap_[hTrackerPx[i]->GetName()] = hTrackerPx[i];
381  }
382 
383  sprintf(hname,"hTrackerPxPhi");
384  histName_.push_back(hname);
385  sprintf(htitle,"Pixel hits phi/rad");
386  hTrackerPxPhi = new TH1F(hname,htitle,100,-3.2,3.2);
387  hTrackerPxPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
388  hTrackerPxPhi->GetYaxis()->SetTitle("Count");
389  histMap_[hTrackerPxPhi->GetName()] = hTrackerPxPhi;
390 
391  sprintf(hname,"hTrackerPxEta");
392  histName_.push_back(hname);
393  sprintf(htitle,"Pixel hits eta");
394  hTrackerPxEta = new TH1F(hname,htitle,100,-3.5,3.5);
395  hTrackerPxEta->GetXaxis()->SetTitle("Eta of Hits");
396  hTrackerPxEta->GetYaxis()->SetTitle("Count");
397  histMap_[hTrackerPxEta->GetName()] = hTrackerPxEta;
398 
399  sprintf(hname,"hTrackerPxBToF");
400  histName_.push_back(hname);
401  sprintf(htitle,"Pixel barrel hits, ToF/ns");
402  hTrackerPxBToF = new TH1F(hname,htitle,100,0.,40.);
403  hTrackerPxBToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
404  hTrackerPxBToF->GetYaxis()->SetTitle("Count");
405  histMap_[hTrackerPxBToF->GetName()] = hTrackerPxBToF;
406 
407  sprintf(hname,"hTrackerPxBR");
408  histName_.push_back(hname);
409  sprintf(htitle,"Pixel barrel hits, R/cm");
410  hTrackerPxBR = new TH1F(hname,htitle,100,0.,50.);
411  hTrackerPxBR->GetXaxis()->SetTitle("R of Hits (cm)");
412  hTrackerPxBR->GetYaxis()->SetTitle("Count");
413  histMap_[hTrackerPxBR->GetName()] = hTrackerPxBR;
414 
415  sprintf(hname,"hTrackerPxFToF");
416  histName_.push_back(hname);
417  sprintf(htitle,"Pixel forward hits, ToF/ns");
418  hTrackerPxFToF = new TH1F(hname,htitle,100,0.,50.);
419  hTrackerPxFToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
420  hTrackerPxFToF->GetYaxis()->SetTitle("Count");
421  histMap_[hTrackerPxFToF->GetName()] = hTrackerPxFToF;
422 
423  sprintf(hname,"hTrackerPxFZ");
424  histName_.push_back(hname);
425  sprintf(htitle,"Pixel forward hits, Z/cm");
426  hTrackerPxFZ = new TH1F(hname,htitle,200,-100.,100.);
427  hTrackerPxFZ->GetXaxis()->SetTitle("Z of Hits (cm)");
428  hTrackerPxFZ->GetYaxis()->SetTitle("Count");
429  histMap_[hTrackerPxFZ->GetName()] = hTrackerPxFZ;
430 
431  sprintf(hname,"hTrackerSi1");
432  histName_.push_back(hname);
433  sprintf(htitle,"Silicon hits");
434  hTrackerSi[0] = new TH1F(hname,htitle,100,0.,10000.);
435  sprintf(hname,"hTrackerSi2");
436  histName_.push_back(hname);
437  hTrackerSi[1] = new TH1F(hname,htitle,100,-0.5,99.5);
438  for (Int_t i = 0; i < 2; ++i) {
439  hTrackerSi[i]->GetXaxis()->SetTitle("Number of Silicon Hits");
440  hTrackerSi[i]->GetYaxis()->SetTitle("Count");
441  histMap_[hTrackerSi[i]->GetName()] = hTrackerSi[i];
442  }
443 
444  sprintf(hname,"hTrackerSiPhi");
445  histName_.push_back(hname);
446  sprintf(htitle,"Silicon hits phi/rad");
447  hTrackerSiPhi = new TH1F(hname,htitle,100,-3.2,3.2);
448  hTrackerSiPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
449  hTrackerSiPhi->GetYaxis()->SetTitle("Count");
450  histMap_[hTrackerSiPhi->GetName()] = hTrackerSiPhi;
451 
452  sprintf(hname,"hTrackerSiEta");
453  histName_.push_back(hname);
454  sprintf(htitle,"Silicon hits eta");
455  hTrackerSiEta = new TH1F(hname,htitle,100,-3.5,3.5);
456  hTrackerSiEta->GetXaxis()->SetTitle("Eta of Hits");
457  hTrackerSiEta->GetYaxis()->SetTitle("Count");
458  histMap_[hTrackerSiEta->GetName()] = hTrackerSiEta;
459 
460  sprintf(hname,"hTrackerSiBToF");
461  histName_.push_back(hname);
462  sprintf(htitle,"Silicon barrel hits, ToF/ns");
463  hTrackerSiBToF = new TH1F(hname,htitle,100,0.,50.);
464  hTrackerSiBToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
465  hTrackerSiBToF->GetYaxis()->SetTitle("Count");
466  histMap_[hTrackerSiBToF->GetName()] = hTrackerSiBToF;
467 
468  sprintf(hname,"hTrackerSiBR");
469  histName_.push_back(hname);
470  sprintf(htitle,"Silicon barrel hits, R/cm");
471  hTrackerSiBR = new TH1F(hname,htitle,100,0.,200.);
472  hTrackerSiBR->GetXaxis()->SetTitle("R of Hits (cm)");
473  hTrackerSiBR->GetYaxis()->SetTitle("Count");
474  histMap_[hTrackerSiBR->GetName()] = hTrackerSiBR;
475 
476  sprintf(hname,"hTrackerSiFToF");
477  histName_.push_back(hname);
478  sprintf(htitle,"Silicon forward hits, ToF/ns");
479  hTrackerSiFToF = new TH1F(hname,htitle,100,0.,75.);
480  hTrackerSiFToF->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
481  hTrackerSiFToF->GetYaxis()->SetTitle("Count");
482  histMap_[hTrackerSiFToF->GetName()] = hTrackerSiFToF;
483 
484  sprintf(hname,"hTrackerSiFZ");
485  histName_.push_back(hname);
486  sprintf(htitle,"Silicon forward hits, Z/cm");
487  hTrackerSiFZ = new TH1F(hname,htitle,200,-300.,300.);
488  hTrackerSiFZ->GetXaxis()->SetTitle("Z of Hits (cm)");
489  hTrackerSiFZ->GetYaxis()->SetTitle("Count");
490  histMap_[hTrackerSiFZ->GetName()] = hTrackerSiFZ;
491 
492  // muon
493  sprintf(hname,"hMuon1");
494  histName_.push_back(hname);
495  sprintf(htitle,"Muon hits");
496  hMuon[0] = new TH1F(hname,htitle,100,0.,10000.);
497  sprintf(hname,"hMuon2");
498  histName_.push_back(hname);
499  hMuon[1] = new TH1F(hname,htitle,100,-0.5,99.5);
500  for (Int_t i = 0; i < 2; ++i) {
501  hMuon[i]->GetXaxis()->SetTitle("Number of Muon Hits");
502  hMuon[i]->GetYaxis()->SetTitle("Count");
503  histMap_[hMuon[i]->GetName()] = hMuon[i];
504  }
505 
506  sprintf(hname,"hMuonPhi");
507  histName_.push_back(hname);
508  sprintf(htitle,"Muon hits phi/rad");
509  hMuonPhi = new TH1F(hname,htitle,100,-3.2,3.2);
510  hMuonPhi->GetXaxis()->SetTitle("Phi of Hits (rad)");
511  hMuonPhi->GetYaxis()->SetTitle("Count");
512  histMap_[hMuonPhi->GetName()] = hMuonPhi;
513 
514  sprintf(hname,"hMuonEta");
515  histName_.push_back(hname);
516  sprintf(htitle,"Muon hits eta");
517  hMuonEta = new TH1F(hname,htitle,100,-3.5,3.5);
518  hMuonEta->GetXaxis()->SetTitle("Eta of Hits");
519  hMuonEta->GetYaxis()->SetTitle("Count");
520  histMap_[hMuonEta->GetName()] = hMuonEta;
521 
522  sprintf(hname,"hMuonCscToF1");
523  histName_.push_back(hname);
524  sprintf(htitle,"Muon CSC hits, ToF/ns");
525  hMuonCscToF[0] = new TH1F(hname,htitle,100,0.,250.);
526  sprintf(hname,"hMuonCscToF2");
527  histName_.push_back(hname);
528  hMuonCscToF[1] = new TH1F(hname,htitle,100,0.,50.);
529  for (Int_t i = 0; i < 2; ++i) {
530  hMuonCscToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
531  hMuonCscToF[i]->GetYaxis()->SetTitle("Count");
532  histMap_[hMuonCscToF[i]->GetName()] = hMuonCscToF[i];
533  }
534 
535  sprintf(hname,"hMuonCscZ");
536  histName_.push_back(hname);
537  sprintf(htitle,"Muon CSC hits, Z/cm");
538  hMuonCscZ = new TH1F(hname,htitle,200,-1500.,1500.);
539  hMuonCscZ->GetXaxis()->SetTitle("Z of Hits (cm)");
540  hMuonCscZ->GetYaxis()->SetTitle("Count");
541  histMap_[hMuonCscZ->GetName()] = hMuonCscZ;
542 
543  sprintf(hname,"hMuonDtToF1");
544  histName_.push_back(hname);
545  sprintf(htitle,"Muon DT hits, ToF/ns");
546  hMuonDtToF[0] = new TH1F(hname,htitle,100,0.,250.);
547  sprintf(hname,"hMuonDtToF2");
548  histName_.push_back(hname);
549  hMuonDtToF[1] = new TH1F(hname,htitle,100,0.,50.);
550  for (Int_t i = 0; i < 2; ++i) {
551  hMuonDtToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
552  hMuonDtToF[i]->GetYaxis()->SetTitle("Count");
553  histMap_[hMuonDtToF[i]->GetName()] = hMuonDtToF[i];
554  }
555 
556  sprintf(hname,"hMuonDtR");
557  histName_.push_back(hname);
558  sprintf(htitle,"Muon DT hits, R/cm");
559  hMuonDtR = new TH1F(hname,htitle,100,0.,1500.);
560  hMuonDtR->GetXaxis()->SetTitle("R of Hits (cm)");
561  hMuonDtR->GetYaxis()->SetTitle("Count");
562  histMap_[hMuonDtR->GetName()] = hMuonDtR;
563 
564  sprintf(hname,"hMuonRpcFToF1");
565  histName_.push_back(hname);
566  sprintf(htitle,"Muon RPC forward hits, ToF/ns");
567  hMuonRpcFToF[0] = new TH1F(hname,htitle,100,0.,250.);
568  sprintf(hname,"hMuonRpcFToF2");
569  histName_.push_back(hname);
570  hMuonRpcFToF[1] = new TH1F(hname,htitle,100,0.,50.);
571  for (Int_t i = 0; i < 2; ++i) {
572  hMuonRpcFToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
573  hMuonRpcFToF[i]->GetYaxis()->SetTitle("Count");
574  histMap_[hMuonRpcFToF[i]->GetName()] = hMuonRpcFToF[i];
575  }
576 
577  sprintf(hname,"hMuonRpcFZ");
578  histName_.push_back(hname);
579  sprintf(htitle,"Muon RPC forward hits, Z/cm");
580  hMuonRpcFZ = new TH1F(hname,htitle,201,-1500.,1500.);
581  hMuonRpcFZ->GetXaxis()->SetTitle("Z of Hits (cm)");
582  hMuonRpcFZ->GetYaxis()->SetTitle("Count");
583  histMap_[hMuonRpcFZ->GetName()] = hMuonRpcFZ;
584 
585  sprintf(hname,"hMuonRpcBToF1");
586  histName_.push_back(hname);
587  sprintf(htitle,"Muon RPC barrel hits, ToF/ns");
588  hMuonRpcBToF[0] = new TH1F(hname,htitle,100,0.,250.);
589  sprintf(hname,"hMuonRpcBToF2");
590  histName_.push_back(hname);
591  hMuonRpcBToF[1] = new TH1F(hname,htitle,100,0.,50.);
592  for (Int_t i = 0; i < 2; ++i) {
593  hMuonRpcBToF[i]->GetXaxis()->SetTitle("Time of Flight of Hits (ns)");
594  hMuonRpcBToF[i]->GetYaxis()->SetTitle("Count");
595  histMap_[hMuonRpcBToF[i]->GetName()] = hMuonRpcBToF[i];
596  }
597 
598  sprintf(hname,"hMuonRpcBR");
599  histName_.push_back(hname);
600  sprintf(htitle,"Muon RPC barrel hits, R/cm");
601  hMuonRpcBR = new TH1F(hname,htitle,100,0.,1500.);
602  hMuonRpcBR->GetXaxis()->SetTitle("R of Hits (cm)");
603  hMuonRpcBR->GetYaxis()->SetTitle("Count");
604  histMap_[hMuonRpcBR->GetName()] = hMuonRpcBR;
605 
606  // create persistent objects
607  for (std::size_t i = 0; i < histName_.size(); ++i) {
608  produces<TH1F, edm::InRun>(histName_[i]).setBranchAlias(histName_[i]);
609  }
610 }
611 
613 {
614 }
615 
617 {
618  return;
619 }
620 
622 {
623  std::string MsgLoggerCat = "GlobalHitsProdHist_endJob";
624  if (verbosity >= 0)
625  edm::LogInfo(MsgLoggerCat)
626  << "Terminating having processed " << count << " events.";
627  return;
628 }
629 
631  const edm::EventSetup& iSetup)
632 {
633  std::string MsgLoggerCat = "GlobalHitsProdHist_produce";
634 
635  // keep track of number of events processed
636  ++count;
637 
638  // get event id information
639  int nrun = iEvent.id().run();
640  int nevt = iEvent.id().event();
641 
642  if (verbosity > 0) {
643  edm::LogInfo(MsgLoggerCat)
644  << "Processing run " << nrun << ", event " << nevt
645  << " (" << count << " events total)";
646  } else if (verbosity == 0) {
647  if (nevt%frequency == 0 || nevt == 1) {
648  edm::LogInfo(MsgLoggerCat)
649  << "Processing run " << nrun << ", event " << nevt
650  << " (" << count << " events total)";
651  }
652  }
653 
654  // look at information available in the event
655  if (getAllProvenances) {
656 
657  std::vector<const edm::Provenance*> AllProv;
658  iEvent.getAllProvenance(AllProv);
659 
660  if (verbosity >= 0)
661  edm::LogInfo(MsgLoggerCat)
662  << "Number of Provenances = " << AllProv.size();
663 
664  if (printProvenanceInfo && (verbosity >= 0)) {
665  TString eventout("\nProvenance info:\n");
666 
667  for (unsigned int i = 0; i < AllProv.size(); ++i) {
668  eventout += "\n ******************************";
669  eventout += "\n Module : ";
670  eventout += AllProv[i]->moduleLabel();
671  eventout += "\n ProductID : ";
672  eventout += AllProv[i]->productID().id();
673  eventout += "\n ClassName : ";
674  eventout += AllProv[i]->className();
675  eventout += "\n InstanceName : ";
676  eventout += AllProv[i]->productInstanceName();
677  eventout += "\n BranchName : ";
678  eventout += AllProv[i]->branchName();
679  }
680  eventout += "\n ******************************\n";
681  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
682  printProvenanceInfo = false;
683  }
684  getAllProvenances = false;
685  }
686 
687  // call fill functions
688  //gather G4MC information from event
689  fillG4MC(iEvent);
690  // gather Tracker information from event
691  fillTrk(iEvent,iSetup);
692  // gather muon information from event
693  fillMuon(iEvent, iSetup);
694  // gather Ecal information from event
695  fillECal(iEvent, iSetup);
696  // gather Hcal information from event
697  fillHCal(iEvent, iSetup);
698 
699  if (verbosity > 0)
700  edm::LogInfo (MsgLoggerCat)
701  << "Done gathering data from event.";
702 
703  return;
704 }
705 
707 {
708 
709  std::string MsgLoggerCat = "GlobalHitsProdHist_endRun";
710 
711  TString eventout;
712  TString eventoutw;
713  bool warning = false;
714 
715  if (verbosity > 0)
716  edm::LogInfo (MsgLoggerCat)
717  << "\nStoring histograms.";
718 
719  // store persistent objects
720  std::map<std::string, TH1F*>::iterator iter;
721  for (std::size_t i = 0; i < histName_.size(); ++i) {
722  iter = histMap_.find(histName_[i]);
723  if (iter != histMap_.end()) {
724  std::auto_ptr<TH1F> hist1D(iter->second);
725  eventout += "\n Storing histogram " + histName_[i];
726  iRun.put(hist1D, histName_[i]);
727  } else {
728  warning = true;
729  eventoutw += "\n Unable to find histogram with name " + histName_[i];
730  }
731  }
732 
733  if (verbosity > 0) {
734  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
735  if (warning)
736  edm::LogWarning(MsgLoggerCat) << eventoutw << "\n";
737  }
738  return;
739 }
740 
741 //==================fill and store functions================================
743 {
744 
745  std::string MsgLoggerCat = "GlobalHitsProdHist_fillG4MC";
746 
747  TString eventout;
748  if (verbosity > 0)
749  eventout = "\nGathering info:";
750 
752  // get MC information
755  std::vector<edm::Handle<edm::HepMCProduct> > AllHepMCEvt;
756  iEvent.getManyByType(AllHepMCEvt);
757 
758  // loop through products and extract VtxSmearing if available. Any of them
759  // should have the information needed
760  for (unsigned int i = 0; i < AllHepMCEvt.size(); ++i) {
761  HepMCEvt = AllHepMCEvt[i];
762  if ((HepMCEvt.provenance()->product()).moduleLabel() == "VtxSmeared")
763  break;
764  }
765 
766  if (!HepMCEvt.isValid()) {
767  edm::LogWarning(MsgLoggerCat)
768  << "Unable to find HepMCProduct in event!";
769  return;
770  } else {
771  eventout += "\n Using HepMCProduct: ";
772  eventout += (HepMCEvt.provenance()->product()).moduleLabel();
773  }
774  const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
775  nRawGenPart = MCEvt->particles_size();
776 
777  if (verbosity > 1) {
778  eventout += "\n Number of Raw Particles collected:......... ";
779  eventout += nRawGenPart;
780  }
781 
782  if (hMCRGP[0]) hMCRGP[0]->Fill((float)nRawGenPart);
783  if (hMCRGP[1]) hMCRGP[1]->Fill((float)nRawGenPart);
784 
786  // get G4Vertex information
788  // convert unit stored in SimVertex to mm
789  float unit = 0.;
790  if (vtxunit == 0) unit = 1.; // already in mm
791  if (vtxunit == 1) unit = 10.; // stored in cm, convert to mm
792 
794  iEvent.getByType(G4VtxContainer);
795  if (!G4VtxContainer.isValid()) {
796  edm::LogWarning(MsgLoggerCat)
797  << "Unable to find SimVertex in event!";
798  return;
799  }
800  int i = 0;
801  edm::SimVertexContainer::const_iterator itVtx;
802  for (itVtx = G4VtxContainer->begin(); itVtx != G4VtxContainer->end();
803  ++itVtx) {
804 
805  ++i;
806 
807  const math::XYZTLorentzVector G4Vtx1(itVtx->position().x(),
808  itVtx->position().y(),
809  itVtx->position().z(),
810  itVtx->position().e());
811 
812  double G4Vtx[4];
813  G4Vtx1.GetCoordinates(G4Vtx);
814 
815  if (hGeantVtxX[0]) hGeantVtxX[0]->Fill((G4Vtx[0]*unit)/micrometer);
816  if (hGeantVtxX[1]) hGeantVtxX[1]->Fill((G4Vtx[0]*unit)/micrometer);
817 
818  if (hGeantVtxY[0]) hGeantVtxY[0]->Fill((G4Vtx[1]*unit)/micrometer);
819  if (hGeantVtxY[1]) hGeantVtxY[1]->Fill((G4Vtx[1]*unit)/micrometer);
820 
821  if (hGeantVtxZ[0]) hGeantVtxZ[0]->Fill((G4Vtx[2]*unit)/millimeter);
822  if (hGeantVtxZ[1]) hGeantVtxZ[1]->Fill((G4Vtx[2]*unit)/millimeter);
823 
824  }
825 
826  if (verbosity > 1) {
827  eventout += "\n Number of G4Vertices collected:............ ";
828  eventout += i;
829  }
830 
831  if (hMCG4Vtx[0]) hMCG4Vtx[0]->Fill((float)i);
832  if (hMCG4Vtx[1]) hMCG4Vtx[1]->Fill((float)i);
833 
835  // get G4Track information
838  iEvent.getByType(G4TrkContainer);
839  if (!G4TrkContainer.isValid()) {
840  edm::LogWarning(MsgLoggerCat)
841  << "Unable to find SimTrack in event!";
842  return;
843  }
844  i = 0;
845  edm::SimTrackContainer::const_iterator itTrk;
846  for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
847  ++itTrk) {
848 
849  ++i;
850 
851  const math::XYZTLorentzVector G4Trk1(itTrk->momentum().x(),
852  itTrk->momentum().y(),
853  itTrk->momentum().z(),
854  itTrk->momentum().e());
855  double G4Trk[4];
856  G4Trk1.GetCoordinates(G4Trk);
857 
858  if (hGeantTrkPt) hGeantTrkPt->
859  Fill(sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]));
860  if (hGeantTrkE) hGeantTrkE->Fill(G4Trk[3]);
861  }
862 
863  if (verbosity > 1) {
864  eventout += "\n Number of G4Tracks collected:.............. ";
865  eventout += i;
866  }
867 
868  if (hMCG4Trk[0]) hMCG4Trk[0]->Fill((float)i);
869  if (hMCG4Trk[1]) hMCG4Trk[1]->Fill((float)i);
870 
871  if (verbosity > 0)
872  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
873 
874  return;
875 }
876 
878  const edm::EventSetup& iSetup)
879 {
880 
881  nPxlHits = 0;
882  std::string MsgLoggerCat = "GlobalHitsProdHist_fillTrk";
883 
884  TString eventout;
885  if (verbosity > 0)
886  eventout = "\nGathering info:";
887 
888  // access the tracker geometry
889  edm::ESHandle<TrackerGeometry> theTrackerGeometry;
890  iSetup.get<TrackerDigiGeometryRecord>().get(theTrackerGeometry);
891  if (!theTrackerGeometry.isValid()) {
892  edm::LogWarning(MsgLoggerCat)
893  << "Unable to find TrackerDigiGeometryRecord in event!";
894  return;
895  }
896  const TrackerGeometry& theTracker(*theTrackerGeometry);
897 
898  // iterator to access containers
899  edm::PSimHitContainer::const_iterator itHit;
900 
902  // get Pixel Barrel information
904  edm::PSimHitContainer thePxlBrlHits;
905  // extract low container
906  edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
907  iEvent.getByLabel(PxlBrlLowSrc_,PxlBrlLowContainer);
908  if (!PxlBrlLowContainer.isValid()) {
909  edm::LogWarning(MsgLoggerCat)
910  << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
911  return;
912  }
913  // extract high container
914  edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
915  iEvent.getByLabel(PxlBrlHighSrc_,PxlBrlHighContainer);
916  if (!PxlBrlHighContainer.isValid()) {
917  edm::LogWarning(MsgLoggerCat)
918  << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
919  return;
920  }
921  // place both containers into new container
922  thePxlBrlHits.insert(thePxlBrlHits.end(),PxlBrlLowContainer->begin(),
923  PxlBrlLowContainer->end());
924  thePxlBrlHits.insert(thePxlBrlHits.end(),PxlBrlHighContainer->begin(),
925  PxlBrlHighContainer->end());
926 
927  // cycle through new container
928  int i = 0, j = 0;
929  for (itHit = thePxlBrlHits.begin(); itHit != thePxlBrlHits.end(); ++itHit) {
930 
931  ++i;
932 
933  // create a DetId from the detUnitId
934  DetId theDetUnitId(itHit->detUnitId());
935  int detector = theDetUnitId.det();
936  int subdetector = theDetUnitId.subdetId();
937 
938  // check that expected detector is returned
939  if ((detector == dTrk) && (subdetector == sdPxlBrl)) {
940 
941  // get the GeomDetUnit from the geometry using theDetUnitID
942  const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
943 
944  if (!theDet) {
945  edm::LogWarning(MsgLoggerCat)
946  << "Unable to get GeomDetUnit from PxlBrlHits for Hit " << i;
947  continue;
948  }
949 
950  ++j;
951 
952  // get the Surface of the hit (knows how to go from local <-> global)
953  const BoundPlane& bSurface = theDet->surface();
954 
955  if(hTrackerPxBToF) hTrackerPxBToF->Fill(itHit->tof());
956  if(hTrackerPxBR)
957  hTrackerPxBR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
958  if(hTrackerPxPhi)
959  hTrackerPxPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
960  if(hTrackerPxEta)
961  hTrackerPxEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
962 
963  } else {
964  edm::LogWarning(MsgLoggerCat)
965  << "PxlBrl PSimHit " << i
966  << " is expected to be (det,subdet) = ("
967  << dTrk << "," << sdPxlBrl
968  << "); value returned is: ("
969  << detector << "," << subdetector << ")";
970  continue;
971  } // end detector type check
972  } // end loop through PxlBrl Hits
973 
974  if (verbosity > 1) {
975  eventout += "\n Number of Pixel Barrel Hits collected:..... ";
976  eventout += j;
977  }
978 
979  nPxlHits += j;
980 
982  // get Pixel Forward information
984  edm::PSimHitContainer thePxlFwdHits;
985  // extract low container
986  edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
987  iEvent.getByLabel(PxlFwdLowSrc_,PxlFwdLowContainer);
988  if (!PxlFwdLowContainer.isValid()) {
989  edm::LogWarning(MsgLoggerCat)
990  << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
991  return;
992  }
993  // extract high container
994  edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
995  iEvent.getByLabel(PxlFwdHighSrc_,PxlFwdHighContainer);
996  if (!PxlFwdHighContainer.isValid()) {
997  edm::LogWarning("GlobalHitsProdHist_fillTrk")
998  << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
999  return;
1000  }
1001  // place both containers into new container
1002  thePxlFwdHits.insert(thePxlFwdHits.end(),PxlFwdLowContainer->begin(),
1003  PxlFwdLowContainer->end());
1004  thePxlFwdHits.insert(thePxlFwdHits.end(),PxlFwdHighContainer->begin(),
1005  PxlFwdHighContainer->end());
1006 
1007  // cycle through new container
1008  i = 0; j = 0;
1009  for (itHit = thePxlFwdHits.begin(); itHit != thePxlFwdHits.end(); ++itHit) {
1010 
1011  ++i;
1012 
1013  // create a DetId from the detUnitId
1014  DetId theDetUnitId(itHit->detUnitId());
1015  int detector = theDetUnitId.det();
1016  int subdetector = theDetUnitId.subdetId();
1017 
1018  // check that expected detector is returned
1019  if ((detector == dTrk) && (subdetector == sdPxlFwd)) {
1020 
1021  // get the GeomDetUnit from the geometry using theDetUnitID
1022  const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
1023 
1024  if (!theDet) {
1025  edm::LogWarning(MsgLoggerCat)
1026  << "Unable to get GeomDetUnit from PxlFwdHits for Hit " << i;;
1027  continue;
1028  }
1029 
1030  ++j;
1031 
1032  // get the Surface of the hit (knows how to go from local <-> global)
1033  const BoundPlane& bSurface = theDet->surface();
1034 
1035  if(hTrackerPxFToF) hTrackerPxFToF->Fill(itHit->tof());
1036  if(hTrackerPxFZ)
1037  hTrackerPxFZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
1038  if(hTrackerPxPhi)
1039  hTrackerPxPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1040  if(hTrackerPxEta)
1041  hTrackerPxEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1042 
1043  } else {
1044  edm::LogWarning(MsgLoggerCat)
1045  << "PxlFwd PSimHit " << i
1046  << " is expected to be (det,subdet) = ("
1047  << dTrk << "," << sdPxlFwd
1048  << "); value returned is: ("
1049  << detector << "," << subdetector << ")";
1050  continue;
1051  } // end detector type check
1052  } // end loop through PxlFwd Hits
1053 
1054  if (verbosity > 1) {
1055  eventout += "\n Number of Pixel Forward Hits collected:.... ";
1056  eventout += j;
1057  }
1058 
1059  nPxlHits += j;
1060 
1061  if (hTrackerPx[0]) hTrackerPx[0]->Fill((float)nPxlHits);
1062  if (hTrackerPx[1]) hTrackerPx[1]->Fill((float)nPxlHits);
1063 
1065  // get Silicon Barrel information
1067  nSiHits = 0;
1068  edm::PSimHitContainer theSiBrlHits;
1069  // extract TIB low container
1070  edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
1071  iEvent.getByLabel(SiTIBLowSrc_,SiTIBLowContainer);
1072  if (!SiTIBLowContainer.isValid()) {
1073  edm::LogWarning(MsgLoggerCat)
1074  << "Unable to find TrackerHitsTIBLowTof in event!";
1075  return;
1076  }
1077  // extract TIB high container
1078  edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
1079  iEvent.getByLabel(SiTIBHighSrc_,SiTIBHighContainer);
1080  if (!SiTIBHighContainer.isValid()) {
1081  edm::LogWarning(MsgLoggerCat)
1082  << "Unable to find TrackerHitsTIBHighTof in event!";
1083  return;
1084  }
1085  // extract TOB low container
1086  edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
1087  iEvent.getByLabel(SiTOBLowSrc_,SiTOBLowContainer);
1088  if (!SiTOBLowContainer.isValid()) {
1089  edm::LogWarning(MsgLoggerCat)
1090  << "Unable to find TrackerHitsTOBLowTof in event!";
1091  return;
1092  }
1093  // extract TOB high container
1094  edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
1095  iEvent.getByLabel(SiTOBHighSrc_,SiTOBHighContainer);
1096  if (!SiTOBHighContainer.isValid()) {
1097  edm::LogWarning(MsgLoggerCat)
1098  << "Unable to find TrackerHitsTOBHighTof in event!";
1099  return;
1100  }
1101  // place all containers into new container
1102  theSiBrlHits.insert(theSiBrlHits.end(),SiTIBLowContainer->begin(),
1103  SiTIBLowContainer->end());
1104  theSiBrlHits.insert(theSiBrlHits.end(),SiTIBHighContainer->begin(),
1105  SiTIBHighContainer->end());
1106  theSiBrlHits.insert(theSiBrlHits.end(),SiTOBLowContainer->begin(),
1107  SiTOBLowContainer->end());
1108  theSiBrlHits.insert(theSiBrlHits.end(),SiTOBHighContainer->begin(),
1109  SiTOBHighContainer->end());
1110 
1111  // cycle through new container
1112  i = 0; j = 0;
1113  for (itHit = theSiBrlHits.begin(); itHit != theSiBrlHits.end(); ++itHit) {
1114 
1115  ++i;
1116 
1117  // create a DetId from the detUnitId
1118  DetId theDetUnitId(itHit->detUnitId());
1119  int detector = theDetUnitId.det();
1120  int subdetector = theDetUnitId.subdetId();
1121 
1122  // check that expected detector is returned
1123  if ((detector == dTrk) &&
1124  ((subdetector == sdSiTIB) ||
1125  (subdetector == sdSiTOB))) {
1126 
1127  // get the GeomDetUnit from the geometry using theDetUnitID
1128  const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
1129 
1130  if (!theDet) {
1131  edm::LogWarning(MsgLoggerCat)
1132  << "Unable to get GeomDetUnit from SiBrlHits for Hit " << i;
1133  continue;
1134  }
1135 
1136  ++j;
1137 
1138  // get the Surface of the hit (knows how to go from local <-> global)
1139  const BoundPlane& bSurface = theDet->surface();
1140 
1141  if(hTrackerSiBToF) hTrackerSiBToF->Fill(itHit->tof());
1142  if(hTrackerSiBR)
1143  hTrackerSiBR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
1144  if(hTrackerSiPhi)
1145  hTrackerSiPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1146  if(hTrackerSiEta)
1147  hTrackerSiEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1148 
1149  } else {
1150  edm::LogWarning(MsgLoggerCat)
1151  << "SiBrl PSimHit " << i
1152  << " is expected to be (det,subdet) = ("
1153  << dTrk << "," << sdSiTIB
1154  << " || " << sdSiTOB << "); value returned is: ("
1155  << detector << "," << subdetector << ")";
1156  continue;
1157  } // end detector type check
1158  } // end loop through SiBrl Hits
1159 
1160  if (verbosity > 1) {
1161  eventout += "\n Number of Silicon Barrel Hits collected:... ";
1162  eventout += j;
1163  }
1164 
1165  nSiHits += j;
1166 
1168  // get Silicon Forward information
1170  edm::PSimHitContainer theSiFwdHits;
1171  // extract TID low container
1172  edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
1173  iEvent.getByLabel(SiTIDLowSrc_,SiTIDLowContainer);
1174  if (!SiTIDLowContainer.isValid()) {
1175  edm::LogWarning(MsgLoggerCat)
1176  << "Unable to find TrackerHitsTIDLowTof in event!";
1177  return;
1178  }
1179  // extract TID high container
1180  edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
1181  iEvent.getByLabel(SiTIDHighSrc_,SiTIDHighContainer);
1182  if (!SiTIDHighContainer.isValid()) {
1183  edm::LogWarning("GlobalHitsProdHist_fillTrk")
1184  << "Unable to find TrackerHitsTIDHighTof in event!";
1185  return;
1186  }
1187  // extract TEC low container
1188  edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
1189  iEvent.getByLabel(SiTECLowSrc_,SiTECLowContainer);
1190  if (!SiTECLowContainer.isValid()) {
1191  edm::LogWarning(MsgLoggerCat)
1192  << "Unable to find TrackerHitsTECLowTof in event!";
1193  return;
1194  }
1195  // extract TEC high container
1196  edm::Handle<edm::PSimHitContainer> SiTECHighContainer;
1197  iEvent.getByLabel(SiTECHighSrc_,SiTECHighContainer);
1198  if (!SiTECHighContainer.isValid()) {
1199  edm::LogWarning(MsgLoggerCat)
1200  << "Unable to find TrackerHitsTECHighTof in event!";
1201  return;
1202  }
1203  // place all containers into new container
1204  theSiFwdHits.insert(theSiFwdHits.end(),SiTIDLowContainer->begin(),
1205  SiTIDLowContainer->end());
1206  theSiFwdHits.insert(theSiFwdHits.end(),SiTIDHighContainer->begin(),
1207  SiTIDHighContainer->end());
1208  theSiFwdHits.insert(theSiFwdHits.end(),SiTECLowContainer->begin(),
1209  SiTECLowContainer->end());
1210  theSiFwdHits.insert(theSiFwdHits.end(),SiTECHighContainer->begin(),
1211  SiTECHighContainer->end());
1212 
1213  // cycle through container
1214  i = 0; j = 0;
1215  for (itHit = theSiFwdHits.begin(); itHit != theSiFwdHits.end(); ++itHit) {
1216 
1217  ++i;
1218 
1219  // create a DetId from the detUnitId
1220  DetId theDetUnitId(itHit->detUnitId());
1221  int detector = theDetUnitId.det();
1222  int subdetector = theDetUnitId.subdetId();
1223 
1224  // check that expected detector is returned
1225  if ((detector == dTrk) &&
1226  ((subdetector == sdSiTID) ||
1227  (subdetector == sdSiTEC))) {
1228 
1229  // get the GeomDetUnit from the geometry using theDetUnitID
1230  const GeomDetUnit *theDet = theTracker.idToDetUnit(theDetUnitId);
1231 
1232  if (!theDet) {
1233  edm::LogWarning(MsgLoggerCat)
1234  << "Unable to get GeomDetUnit from SiFwdHits Hit " << i;
1235  return;
1236  }
1237 
1238  ++j;
1239 
1240  // get the Surface of the hit (knows how to go from local <-> global)
1241  const BoundPlane& bSurface = theDet->surface();
1242 
1243  if(hTrackerSiFToF) hTrackerSiFToF->Fill(itHit->tof());
1244  if(hTrackerSiFZ)
1245  hTrackerSiFZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
1246  if(hTrackerSiPhi)
1247  hTrackerSiPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1248  if(hTrackerSiEta)
1249  hTrackerSiEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1250 
1251  } else {
1252  edm::LogWarning(MsgLoggerCat)
1253  << "SiFwd PSimHit " << i
1254  << " is expected to be (det,subdet) = ("
1255  << dTrk << "," << sdSiTOB
1256  << " || " << sdSiTEC << "); value returned is: ("
1257  << detector << "," << subdetector << ")";
1258  continue;
1259  } // end check detector type
1260  } // end loop through SiFwd Hits
1261 
1262  if (verbosity > 1) {
1263  eventout += "\n Number of Silicon Forward Hits collected:.. ";
1264  eventout += j;
1265  }
1266 
1267  nSiHits +=j;
1268 
1269  if (hTrackerSi[0]) hTrackerSi[0]->Fill((float)nSiHits);
1270  if (hTrackerSi[1]) hTrackerSi[1]->Fill((float)nSiHits);
1271 
1272  if (verbosity > 0)
1273  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1274 
1275  return;
1276 }
1277 
1279  const edm::EventSetup& iSetup)
1280 {
1281  nMuonHits = 0;
1282  std::string MsgLoggerCat = "GlobalHitsProdHist_fillMuon";
1283 
1284  TString eventout;
1285  if (verbosity > 0)
1286  eventout = "\nGathering info:";
1287 
1288  // iterator to access containers
1289  edm::PSimHitContainer::const_iterator itHit;
1290 
1292  // access the CSC Muon
1294  // access the CSC Muon geometry
1295  edm::ESHandle<CSCGeometry> theCSCGeometry;
1296  iSetup.get<MuonGeometryRecord>().get(theCSCGeometry);
1297  if (!theCSCGeometry.isValid()) {
1298  edm::LogWarning(MsgLoggerCat)
1299  << "Unable to find MuonGeometryRecord for the CSCGeometry in event!";
1300  return;
1301  }
1302  const CSCGeometry& theCSCMuon(*theCSCGeometry);
1303 
1304  // get Muon CSC information
1305  edm::Handle<edm::PSimHitContainer> MuonCSCContainer;
1306  iEvent.getByLabel(MuonCscSrc_,MuonCSCContainer);
1307  if (!MuonCSCContainer.isValid()) {
1308  edm::LogWarning(MsgLoggerCat)
1309  << "Unable to find MuonCSCHits in event!";
1310  return;
1311  }
1312 
1313  // cycle through container
1314  int i = 0, j = 0;
1315  for (itHit = MuonCSCContainer->begin(); itHit != MuonCSCContainer->end();
1316  ++itHit) {
1317 
1318  ++i;
1319 
1320  // create a DetId from the detUnitId
1321  DetId theDetUnitId(itHit->detUnitId());
1322  int detector = theDetUnitId.det();
1323  int subdetector = theDetUnitId.subdetId();
1324 
1325  // check that expected detector is returned
1326  if ((detector == dMuon) &&
1327  (subdetector == sdMuonCSC)) {
1328 
1329  // get the GeomDetUnit from the geometry using theDetUnitID
1330  const GeomDetUnit *theDet = theCSCMuon.idToDetUnit(theDetUnitId);
1331 
1332  if (!theDet) {
1333  edm::LogWarning(MsgLoggerCat)
1334  << "Unable to get GeomDetUnit from theCSCMuon for hit " << i;
1335  continue;
1336  }
1337 
1338  ++j;
1339 
1340  // get the Surface of the hit (knows how to go from local <-> global)
1341  const BoundPlane& bSurface = theDet->surface();
1342 
1343  if (hMuonCscToF[0]) hMuonCscToF[0]->Fill(itHit->tof());
1344  if (hMuonCscToF[1]) hMuonCscToF[1]->Fill(itHit->tof());
1345  if (hMuonCscZ)
1346  hMuonCscZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
1347  if (hMuonPhi)
1348  hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1349  if (hMuonEta)
1350  hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1351 
1352  } else {
1353  edm::LogWarning(MsgLoggerCat)
1354  << "MuonCsc PSimHit " << i
1355  << " is expected to be (det,subdet) = ("
1356  << dMuon << "," << sdMuonCSC
1357  << "); value returned is: ("
1358  << detector << "," << subdetector << ")";
1359  continue;
1360  } // end detector type check
1361  } // end loop through CSC Hits
1362 
1363  if (verbosity > 1) {
1364  eventout += "\n Number of CSC muon Hits collected:......... ";
1365  eventout += j;
1366  }
1367 
1368  nMuonHits += j;
1369 
1371  // access the DT Muon
1373  // access the DT Muon geometry
1374  edm::ESHandle<DTGeometry> theDTGeometry;
1375  iSetup.get<MuonGeometryRecord>().get(theDTGeometry);
1376  if (!theDTGeometry.isValid()) {
1377  edm::LogWarning(MsgLoggerCat)
1378  << "Unable to find MuonGeometryRecord for the DTGeometry in event!";
1379  return;
1380  }
1381  const DTGeometry& theDTMuon(*theDTGeometry);
1382 
1383  // get Muon DT information
1384  edm::Handle<edm::PSimHitContainer> MuonDtContainer;
1385  iEvent.getByLabel(MuonDtSrc_,MuonDtContainer);
1386  if (!MuonDtContainer.isValid()) {
1387  edm::LogWarning(MsgLoggerCat)
1388  << "Unable to find MuonDTHits in event!";
1389  return;
1390  }
1391 
1392  // cycle through container
1393  i = 0, j = 0;
1394  for (itHit = MuonDtContainer->begin(); itHit != MuonDtContainer->end();
1395  ++itHit) {
1396 
1397  ++i;
1398 
1399  // create a DetId from the detUnitId
1400  DetId theDetUnitId(itHit->detUnitId());
1401  int detector = theDetUnitId.det();
1402  int subdetector = theDetUnitId.subdetId();
1403 
1404  // check that expected detector is returned
1405  if ((detector == dMuon) &&
1406  (subdetector == sdMuonDT)) {
1407 
1408  // CSC uses wires and layers rather than the full detID
1409  // get the wireId
1410  DTWireId wireId(itHit->detUnitId());
1411 
1412  // get the DTLayer from the geometry using the wireID
1413  const DTLayer *theDet = theDTMuon.layer(wireId.layerId());
1414 
1415  if (!theDet) {
1416  edm::LogWarning(MsgLoggerCat)
1417  << "Unable to get GeomDetUnit from theDtMuon for hit " << i;
1418  continue;
1419  }
1420 
1421  ++j;
1422 
1423  // get the Surface of the hit (knows how to go from local <-> global)
1424  const BoundPlane& bSurface = theDet->surface();
1425 
1426  if (hMuonDtToF[0]) hMuonDtToF[0]->Fill(itHit->tof());
1427  if (hMuonDtToF[1]) hMuonDtToF[1]->Fill(itHit->tof());
1428  if (hMuonDtR)
1429  hMuonDtR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
1430  if (hMuonPhi)
1431  hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1432  if (hMuonEta)
1433  hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1434 
1435  } else {
1436  edm::LogWarning(MsgLoggerCat)
1437  << "MuonDt PSimHit " << i
1438  << " is expected to be (det,subdet) = ("
1439  << dMuon << "," << sdMuonDT
1440  << "); value returned is: ("
1441  << detector << "," << subdetector << ")";
1442  continue;
1443  } // end detector type check
1444  } // end loop through DT Hits
1445 
1446  if (verbosity > 1) {
1447  eventout += "\n Number of DT muon Hits collected:.......... ";
1448  eventout += j;
1449  }
1450 
1451  nMuonHits += j;
1452 
1453  //int RPCBrl = 0, RPCFwd = 0;
1455  // access the RPC Muon
1457  // access the RPC Muon geometry
1458  edm::ESHandle<RPCGeometry> theRPCGeometry;
1459  iSetup.get<MuonGeometryRecord>().get(theRPCGeometry);
1460  if (!theRPCGeometry.isValid()) {
1461  edm::LogWarning(MsgLoggerCat)
1462  << "Unable to find MuonGeometryRecord for the RPCGeometry in event!";
1463  return;
1464  }
1465  const RPCGeometry& theRPCMuon(*theRPCGeometry);
1466 
1467  // get Muon RPC information
1468  edm::Handle<edm::PSimHitContainer> MuonRPCContainer;
1469  iEvent.getByLabel(MuonRpcSrc_,MuonRPCContainer);
1470  if (!MuonRPCContainer.isValid()) {
1471  edm::LogWarning(MsgLoggerCat)
1472  << "Unable to find MuonRPCHits in event!";
1473  return;
1474  }
1475 
1476  // cycle through container
1477  i = 0, j = 0;
1478  int RPCBrl =0, RPCFwd = 0;
1479  for (itHit = MuonRPCContainer->begin(); itHit != MuonRPCContainer->end();
1480  ++itHit) {
1481 
1482  ++i;
1483 
1484  // create a DetID from the detUnitId
1485  DetId theDetUnitId(itHit->detUnitId());
1486  int detector = theDetUnitId.det();
1487  int subdetector = theDetUnitId.subdetId();
1488 
1489  // check that expected detector is returned
1490  if ((detector == dMuon) &&
1491  (subdetector == sdMuonRPC)) {
1492 
1493  // get an RPCDetID from the detUnitID
1494  RPCDetId RPCId(itHit->detUnitId());
1495 
1496  // find the region of the RPC hit
1497  int region = RPCId.region();
1498 
1499  // get the GeomDetUnit from the geometry using the RPCDetId
1500  const GeomDetUnit *theDet = theRPCMuon.idToDetUnit(theDetUnitId);
1501 
1502  if (!theDet) {
1503  edm::LogWarning(MsgLoggerCat)
1504  << "Unable to get GeomDetUnit from theRPCMuon for hit " << i;
1505  continue;
1506  }
1507 
1508  ++j;
1509 
1510  // get the Surface of the hit (knows how to go from local <-> global)
1511  const BoundPlane& bSurface = theDet->surface();
1512 
1513  // gather necessary information
1514  if ((region == sdMuonRPCRgnFwdp) || (region == sdMuonRPCRgnFwdn)) {
1515  ++RPCFwd;
1516 
1517  if (hMuonRpcFToF[0]) hMuonRpcFToF[0]->Fill(itHit->tof());
1518  if (hMuonRpcFToF[1]) hMuonRpcFToF[1]->Fill(itHit->tof());
1519  if (hMuonRpcFZ)
1520  hMuonRpcFZ->Fill(bSurface.toGlobal(itHit->localPosition()).z());
1521  if (hMuonPhi)
1522  hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1523  if (hMuonEta)
1524  hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1525 
1526  } else if (region == sdMuonRPCRgnBrl) {
1527  ++RPCBrl;
1528 
1529  if (hMuonRpcBToF[0]) hMuonRpcBToF[0]->Fill(itHit->tof());
1530  if (hMuonRpcBToF[1]) hMuonRpcBToF[1]->Fill(itHit->tof());
1531  if (hMuonRpcBR)
1532  hMuonRpcBR->Fill(bSurface.toGlobal(itHit->localPosition()).perp());
1533  if (hMuonPhi)
1534  hMuonPhi->Fill(bSurface.toGlobal(itHit->localPosition()).phi());
1535  if (hMuonEta)
1536  hMuonEta->Fill(bSurface.toGlobal(itHit->localPosition()).eta());
1537 
1538  } else {
1539  edm::LogWarning(MsgLoggerCat)
1540  << "Invalid region for RPC Muon hit" << i;
1541  continue;
1542  } // end check of region
1543  } else {
1544  edm::LogWarning(MsgLoggerCat)
1545  << "MuonRpc PSimHit " << i
1546  << " is expected to be (det,subdet) = ("
1547  << dMuon << "," << sdMuonRPC
1548  << "); value returned is: ("
1549  << detector << "," << subdetector << ")";
1550  continue;
1551  } // end detector type check
1552  } // end loop through RPC Hits
1553 
1554  if (verbosity > 1) {
1555  eventout += "\n Number of RPC muon Hits collected:......... ";
1556  eventout += j;
1557  eventout += "\n RPC Barrel muon Hits:............ ";
1558  eventout += RPCBrl;
1559  eventout += "\n RPC Forward muon Hits:........... ";
1560  eventout += RPCFwd;
1561  }
1562 
1563  nMuonHits += j;
1564 
1565  if (hMuon[0]) hMuon[0]->Fill((float)nMuonHits);
1566  if (hMuon[1]) hMuon[1]->Fill((float)nMuonHits);
1567 
1568  if (verbosity > 0)
1569  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1570 
1571  return;
1572 }
1573 
1575  const edm::EventSetup& iSetup)
1576 {
1577  std::string MsgLoggerCat = "GlobalHitsProdHist_fillECal";
1578 
1579  TString eventout;
1580  if (verbosity > 0)
1581  eventout = "\nGathering info:";
1582 
1583  // access the calorimeter geometry
1584  edm::ESHandle<CaloGeometry> theCaloGeometry;
1585  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
1586  if (!theCaloGeometry.isValid()) {
1587  edm::LogWarning(MsgLoggerCat)
1588  << "Unable to find CaloGeometryRecord in event!";
1589  return;
1590  }
1591  const CaloGeometry& theCalo(*theCaloGeometry);
1592 
1593  // iterator to access containers
1594  edm::PCaloHitContainer::const_iterator itHit;
1595 
1597  // get ECal information
1599  edm::PCaloHitContainer theECalHits;
1600  // extract EB container
1602  iEvent.getByLabel(ECalEBSrc_,EBContainer);
1603  if (!EBContainer.isValid()) {
1604  edm::LogWarning(MsgLoggerCat)
1605  << "Unable to find EcalHitsEB in event!";
1606  return;
1607  }
1608  // extract EE container
1610  iEvent.getByLabel(ECalEESrc_,EEContainer);
1611  if (!EEContainer.isValid()) {
1612  edm::LogWarning(MsgLoggerCat)
1613  << "Unable to find EcalHitsEE in event!";
1614  return;
1615  }
1616  // place both containers into new container
1617  theECalHits.insert(theECalHits.end(),EBContainer->begin(),
1618  EBContainer->end());
1619  theECalHits.insert(theECalHits.end(),EEContainer->begin(),
1620  EEContainer->end());
1621 
1622  // cycle through new container
1623  int i = 0, j = 0;
1624  for (itHit = theECalHits.begin(); itHit != theECalHits.end(); ++itHit) {
1625 
1626  ++i;
1627 
1628  // create a DetId from the detUnitId
1629  DetId theDetUnitId(itHit->id());
1630  int detector = theDetUnitId.det();
1631  int subdetector = theDetUnitId.subdetId();
1632 
1633  // check that expected detector is returned
1634  if ((detector == dEcal) &&
1635  ((subdetector == sdEcalBrl) ||
1636  (subdetector == sdEcalFwd))) {
1637 
1638  // get the Cell geometry
1639  const CaloCellGeometry *theDet = theCalo.
1640  getSubdetectorGeometry(theDetUnitId)->getGeometry(theDetUnitId);
1641 
1642  if (!theDet) {
1643  edm::LogWarning(MsgLoggerCat)
1644  << "Unable to get CaloCellGeometry from ECalHits for Hit " << i;
1645  continue;
1646  }
1647 
1648  ++j;
1649 
1650  // get the global position of the cell
1651  const GlobalPoint& globalposition = theDet->getPosition();
1652 
1653  if (hCaloEcalE[0]) hCaloEcalE[0]->Fill(itHit->energy());
1654  if (hCaloEcalE[1]) hCaloEcalE[1]->Fill(itHit->energy());
1655  if (hCaloEcalToF[0]) hCaloEcalToF[0]->Fill(itHit->time());
1656  if (hCaloEcalToF[1]) hCaloEcalToF[1]->Fill(itHit->time());
1657  if (hCaloEcalPhi) hCaloEcalPhi->Fill(globalposition.phi());
1658  if (hCaloEcalEta) hCaloEcalEta->Fill(globalposition.eta());
1659 
1660  } else {
1661  edm::LogWarning(MsgLoggerCat)
1662  << "ECal PCaloHit " << i
1663  << " is expected to be (det,subdet) = ("
1664  << dEcal << "," << sdEcalBrl
1665  << " || " << sdEcalFwd << "); value returned is: ("
1666  << detector << "," << subdetector << ")";
1667  continue;
1668  } // end detector type check
1669  } // end loop through ECal Hits
1670 
1671  if (verbosity > 1) {
1672  eventout += "\n Number of ECal Hits collected:............. ";
1673  eventout += j;
1674  }
1675 
1676  if (hCaloEcal[0]) hCaloEcal[0]->Fill((float)j);
1677  if (hCaloEcal[1]) hCaloEcal[1]->Fill((float)j);
1678 
1680  // Get Preshower information
1682  // extract PreShower container
1683  edm::Handle<edm::PCaloHitContainer> PreShContainer;
1684  iEvent.getByLabel(ECalESSrc_,PreShContainer);
1685  if (!PreShContainer.isValid()) {
1686  edm::LogWarning(MsgLoggerCat)
1687  << "Unable to find EcalHitsES in event!";
1688  return;
1689  }
1690 
1691  // cycle through container
1692  i = 0, j = 0;
1693  for (itHit = PreShContainer->begin();
1694  itHit != PreShContainer->end(); ++itHit) {
1695 
1696  ++i;
1697 
1698  // create a DetId from the detUnitId
1699  DetId theDetUnitId(itHit->id());
1700  int detector = theDetUnitId.det();
1701  int subdetector = theDetUnitId.subdetId();
1702 
1703  // check that expected detector is returned
1704  if ((detector == dEcal) &&
1705  (subdetector == sdEcalPS)) {
1706 
1707  // get the Cell geometry
1708  const CaloCellGeometry *theDet = theCalo.
1709  getSubdetectorGeometry(theDetUnitId)->getGeometry(theDetUnitId);
1710 
1711  if (!theDet) {
1712  edm::LogWarning(MsgLoggerCat)
1713  << "Unable to get CaloCellGeometry from PreShContainer for Hit "
1714  << i;
1715  continue;
1716  }
1717 
1718  ++j;
1719 
1720  // get the global position of the cell
1721  const GlobalPoint& globalposition = theDet->getPosition();
1722 
1723  if (hCaloPreShE[0]) hCaloPreShE[0]->Fill(itHit->energy());
1724  if (hCaloPreShE[1]) hCaloPreShE[1]->Fill(itHit->energy());
1725  if (hCaloPreShToF[0]) hCaloPreShToF[0]->Fill(itHit->time());
1726  if (hCaloPreShToF[1]) hCaloPreShToF[1]->Fill(itHit->time());
1727  if (hCaloPreShPhi) hCaloPreShPhi->Fill(globalposition.phi());
1728  if (hCaloPreShEta) hCaloPreShEta->Fill(globalposition.eta());
1729 
1730  } else {
1731  edm::LogWarning(MsgLoggerCat)
1732  << "PreSh PCaloHit " << i
1733  << " is expected to be (det,subdet) = ("
1734  << dEcal << "," << sdEcalPS
1735  << "); value returned is: ("
1736  << detector << "," << subdetector << ")";
1737  continue;
1738  } // end detector type check
1739  } // end loop through PreShower Hits
1740 
1741  if (verbosity > 1) {
1742  eventout += "\n Number of PreSh Hits collected:............ ";
1743  eventout += j;
1744  }
1745 
1746  if (hCaloPreSh[0]) hCaloPreSh[0]->Fill((float)j);
1747  if (hCaloPreSh[1]) hCaloPreSh[1]->Fill((float)j);
1748 
1749  if (verbosity > 0)
1750  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1751 
1752  return;
1753 }
1754 
1756  const edm::EventSetup& iSetup)
1757 {
1758  std::string MsgLoggerCat = "GlobalHitsProdHist_fillHCal";
1759 
1760  TString eventout;
1761  if (verbosity > 0)
1762  eventout = "\nGathering info:";
1763 
1764  // access the calorimeter geometry
1765  edm::ESHandle<CaloGeometry> theCaloGeometry;
1766  iSetup.get<CaloGeometryRecord>().get(theCaloGeometry);
1767  if (!theCaloGeometry.isValid()) {
1768  edm::LogWarning(MsgLoggerCat)
1769  << "Unable to find CaloGeometryRecord in event!";
1770  return;
1771  }
1772  const CaloGeometry& theCalo(*theCaloGeometry);
1773 
1774  // iterator to access containers
1775  edm::PCaloHitContainer::const_iterator itHit;
1776 
1778  // get HCal information
1780  // extract HCal container
1782  iEvent.getByLabel(HCalSrc_,HCalContainer);
1783  if (!HCalContainer.isValid()) {
1784  edm::LogWarning(MsgLoggerCat)
1785  << "Unable to find HCalHits in event!";
1786  return;
1787  }
1788 
1789  // cycle through container
1790  int i = 0, j = 0;
1791  for (itHit = HCalContainer->begin();
1792  itHit != HCalContainer->end(); ++itHit) {
1793 
1794  ++i;
1795 
1796  // create a DetId from the detUnitId
1797  DetId theDetUnitId(itHit->id());
1798  int detector = theDetUnitId.det();
1799  int subdetector = theDetUnitId.subdetId();
1800 
1801  // check that expected detector is returned
1802  if ((detector == dHcal) &&
1803  ((subdetector == sdHcalBrl) ||
1804  (subdetector == sdHcalEC) ||
1805  (subdetector == sdHcalOut) ||
1806  (subdetector == sdHcalFwd))) {
1807 
1808  // get the Cell geometry
1809  const CaloCellGeometry *theDet = theCalo.
1810  getSubdetectorGeometry(theDetUnitId)->getGeometry(theDetUnitId);
1811 
1812  if (!theDet) {
1813  edm::LogWarning(MsgLoggerCat)
1814  << "Unable to get CaloCellGeometry from HCalContainer for Hit " << i;
1815  continue;
1816  }
1817 
1818  ++j;
1819 
1820  // get the global position of the cell
1821  const GlobalPoint& globalposition = theDet->getPosition();
1822 
1823  if (hCaloHcalE[0]) hCaloHcalE[0]->Fill(itHit->energy());
1824  if (hCaloHcalE[1]) hCaloHcalE[1]->Fill(itHit->energy());
1825  if (hCaloHcalToF[0]) hCaloHcalToF[0]->Fill(itHit->time());
1826  if (hCaloHcalToF[1]) hCaloHcalToF[1]->Fill(itHit->time());
1827  if (hCaloHcalPhi) hCaloHcalPhi->Fill(globalposition.phi());
1828  if (hCaloHcalEta) hCaloHcalEta->Fill(globalposition.eta());
1829 
1830  } else {
1831  edm::LogWarning(MsgLoggerCat)
1832  << "HCal PCaloHit " << i
1833  << " is expected to be (det,subdet) = ("
1834  << dHcal << "," << sdHcalBrl
1835  << " || " << sdHcalEC << " || " << sdHcalOut << " || " << sdHcalFwd
1836  << "); value returned is: ("
1837  << detector << "," << subdetector << ")";
1838  continue;
1839  } // end detector type check
1840  } // end loop through HCal Hits
1841 
1842  if (verbosity > 1) {
1843  eventout += "\n Number of HCal Hits collected:............. ";
1844  eventout += j;
1845  }
1846 
1847  if (hCaloHcal[0]) hCaloHcal[0]->Fill((float)j);
1848  if (hCaloHcal[1]) hCaloHcal[1]->Fill((float)j);
1849 
1850  if (verbosity > 0)
1851  edm::LogInfo(MsgLoggerCat) << eventout << "\n";
1852 
1853  return;
1854 }
RunNumber_t run() const
Definition: EventID.h:42
edm::InputTag SiTECHighSrc_
void getManyByType(std::vector< Handle< PROD > > &results) const
Definition: Event.h:408
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
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:70
int i
Definition: DBlmapReader.cc:9
static const int dEcal
edm::InputTag SiTIDLowSrc_
std::map< std::string, TH1F * > histMap_
static const int dTrk
std::vector< PCaloHit > PCaloHitContainer
virtual void produce(edm::Event &, const edm::EventSetup &)
static const int sdMuonRPCRgnFwdn
static const int sdHcalOut
static const int sdMuonDT
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:47
edm::InputTag SiTECLowSrc_
virtual void endRun(edm::Run &, const edm::EventSetup &)
virtual void beginJob(void)
static const int sdSiTID
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
edm::InputTag MuonRpcSrc_
static const int sdEcalPS
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
static const int sdMuonRPC
T eta() const
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
edm::InputTag MuonCscSrc_
double double double z
void fillHCal(edm::Event &, const edm::EventSetup &)
edm::InputTag SiTIBLowSrc_
const DTLayer * layer(DTLayerId id) const
Return a layer given its id.
Definition: DTGeometry.cc:115
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
std::vector< std::string > histName_
int iEvent
Definition: GenABIO.cc:243
void fillG4MC(edm::Event &)
static const int sdSiTIB
edm::InputTag PxlFwdHighSrc_
edm::InputTag MuonDtSrc_
static const int sdPxlBrl
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: CSCGeometry.cc:87
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
string unit
Definition: csvLumiCalc.py:46
T sqrt(T t)
Definition: SSEVec.h:46
static const int sdMuonCSC
static const int sdEcalFwd
edm::InputTag ECalEESrc_
int j
Definition: DBlmapReader.cc:9
edm::InputTag SiTOBHighSrc_
static const int sdSiTOB
static const int sdEcalBrl
BranchDescription const & product() const
Definition: Provenance.h:44
static const int sdMuonRPCRgnFwdp
void fillTrk(edm::Event &, const edm::EventSetup &)
static const int sdMuonRPCRgnBrl
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
Definition: DetId.h:20
static const int dHcal
edm::InputTag ECalESSrc_
edm::InputTag SiTIBHighSrc_
edm::InputTag PxlFwdLowSrc_
const T & get() const
Definition: EventSetup.h:55
static const int sdHcalFwd
void fillECal(edm::Event &, const edm::EventSetup &)
static const int sdHcalBrl
std::string const & label() const
Definition: InputTag.h:25
T eta() const
Definition: PV3DBase.h:75
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::EventID id() const
Definition: EventBase.h:56
static const int sdSiTEC
T perp() const
Magnitude of transverse component.
edm::InputTag PxlBrlHighSrc_
static const int dMuon
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
void fillMuon(edm::Event &, const edm::EventSetup &)
const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id.
Definition: CaloGeometry.cc:76
edm::InputTag PxlBrlLowSrc_
void put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Run.h:81
std::vector< PSimHit > PSimHitContainer
static const int sdPxlFwd
edm::InputTag SiTOBLowSrc_
bool isValid() const
Definition: ESHandle.h:37
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
GlobalHitsProdHist(const edm::ParameterSet &)
edm::InputTag ECalEBSrc_
std::string const & instance() const
Definition: InputTag.h:26
static const int sdHcalEC
edm::InputTag SiTIDHighSrc_
Definition: Run.h:33
Provenance const * provenance() const
Definition: HandleBase.h:84
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:67
Definition: DDAxes.h:10