CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TrackerHitAnalyzer.cc
Go to the documentation of this file.
2 
3 
5 
6 // tracker info
13 
14 // data in edm::event
17 //#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
24 
25 // helper files
26 #include <CLHEP/Vector/LorentzVector.h>
27 #include "CLHEP/Units/GlobalSystemOfUnits.h"
28 
29 
30 #include <iostream>
32 using namespace edm;
33 using namespace std;
34 
36 
37  fDBE = Service<DQMStore>().operator->();
38  fOutputFile = ps.getUntrackedParameter<string>("outputFile", "TrackerHitHisto.root");
39  verbose_ = ps.getUntrackedParameter<bool>("Verbosity",false);
40  //get Labels to use to extract information
41  PxlBrlLowSrc_ = ps.getParameter<edm::InputTag>("PxlBrlLowSrc");
42  PxlBrlHighSrc_ = ps.getParameter<edm::InputTag>("PxlBrlHighSrc");
43  PxlFwdLowSrc_ = ps.getParameter<edm::InputTag>("PxlFwdLowSrc");
44  PxlFwdHighSrc_ = ps.getParameter<edm::InputTag>("PxlFwdHighSrc");
45 
46  SiTIBLowSrc_ = ps.getParameter<edm::InputTag>("SiTIBLowSrc");
47  SiTIBHighSrc_ = ps.getParameter<edm::InputTag>("SiTIBHighSrc");
48  SiTOBLowSrc_ = ps.getParameter<edm::InputTag>("SiTOBLowSrc");
49  SiTOBHighSrc_ = ps.getParameter<edm::InputTag>("SiTOBHighSrc");
50  SiTIDLowSrc_ = ps.getParameter<edm::InputTag>("SiTIDLowSrc");
51  SiTIDHighSrc_ = ps.getParameter<edm::InputTag>("SiTIDHighSrc");
52  SiTECLowSrc_ = ps.getParameter<edm::InputTag>("SiTECLowSrc");
53  SiTECHighSrc_ = ps.getParameter<edm::InputTag>("SiTECHighSrc");
54 
55 
57 
58  Char_t hname1[50], htitle1[80];
59  Char_t hname2[50], htitle2[80];
60  Char_t hname3[50], htitle3[80];
61  Char_t hname4[50], htitle4[80];
62  Char_t hname5[50], htitle5[80];
63  Char_t hname6[50], htitle6[80];
64 
65  if ( fDBE ) {
66  if ( verbose_ ) {
67  fDBE->setVerbose(1);
68  } else {
69  fDBE->setVerbose(0);
70  }
71  }
72 
73  if ( fDBE) {
74  if ( verbose_ ) fDBE->showDirStructure();
75  }
76 
77  if ( fDBE != NULL ) {
78 // fDBE->setCurrentFolder("TrackerHitsV/TrackerHitTask");
79 
80  // is there any way to record CPU Info ???
81  // if so, it can be done once - via beginJob()
82  int nbin = 5000;
83 
84  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/");
85  htofeta = fDBE->book2D ("tof_eta", "Time of flight vs eta", nbin , -3.0 , 3.0,200,-100,100);
86  htofphi = fDBE->book2D("tof_phi", "Time of flight vs phi", nbin,-180,180,200,-100,100);
87  htofr = fDBE->book2D("tof_r", "Time of flight vs r", nbin , 0 , 300, 200, -100,100);
88  htofz = fDBE->book2D("tof_z", "Time of flight vs z", nbin , -280 , 280, 200, -100,100);
89 
90 
91  const float E2NEL = 1.;
92 
93  const char *Region[] = {"005","051","115","152","225","253",
94  "-050","-105","-151","-215","-252","-325"};
95  nbin = 10000;
96 
97 // Energy loss histograms
98  for(int i=0; i<12; i++) {
99 
100  sprintf (htitle1,"Energy loss in TIB %s", Region[i]);
101  sprintf (htitle2,"Energy loss in TOB %s", Region[i]);
102  sprintf (htitle3,"Energy loss in TID %s", Region[i]);
103  sprintf (htitle4,"Energy loss in TEC %s", Region[i]);
104  sprintf (htitle5,"Energy loss in BPIX %s", Region[i]);
105  sprintf (htitle6,"Energy loss in FPIX %s", Region[i]);
106 
107  sprintf (hname1,"Eloss_TIB_%i",i+1);
108  sprintf (hname2,"Eloss_TOB_%i",i+1);
109  sprintf (hname3,"Eloss_TID_%i",i+1);
110  sprintf (hname4,"Eloss_TEC_%i",i+1);
111  sprintf (hname5,"Eloss_BPIX_%i",i+1);
112  sprintf (hname6,"Eloss_FPIX_%i",i+1);
113 
114  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
115  h1e[i] = fDBE->book1D (hname1, htitle1, nbin , 0.0 , 0.001*E2NEL);
116  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
117  h2e[i] = fDBE->book1D (hname2, htitle2, nbin , 0.0 , 0.001*E2NEL);
118  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
119  h3e[i] = fDBE->book1D (hname3, htitle3, nbin , 0.0 , 0.001*E2NEL);
120  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
121  h4e[i] = fDBE->book1D (hname4, htitle4, nbin , 0.0 , 0.001*E2NEL);
122  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
123  h5e[i] = fDBE->book1D (hname5, htitle5, nbin , 0.0 , 0.001*E2NEL);
124  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
125  h6e[i] = fDBE->book1D (hname6, htitle6, nbin , 0.0 , 0.001*E2NEL);
126 
127  }
128 
129 // limits
130 const float high[] = {0.03, 0.03, 0.02, 0.03, 0.03, 0.03};
131 const float low[] = {-0.03, -0.03, -0.02, -0.03, -0.03, -0.03};
132 
133  for(int i=0; i<12; i++) {
134 
135  sprintf (htitle1,"Entryx-Exitx in TIB %s", Region[i]);
136  sprintf (htitle2,"Entryx-Exitx in TOB %s", Region[i]);
137  sprintf (htitle3,"Entryx-Exitx in TID %s", Region[i]);
138  sprintf (htitle4,"Entryx-Exitx in TEC %s", Region[i]);
139  sprintf (htitle5,"Entryx-Exitx in BPIX %s", Region[i]);
140  sprintf (htitle6,"Entryx-Exitx in FPIX %s", Region[i]);
141 
142  sprintf (hname1,"Entryx-Exitx_TIB_%i",i+1);
143  sprintf (hname2,"Entryx-Exitx_TOB_%i",i+1);
144  sprintf (hname3,"Entryx-Exitx_TID_%i",i+1);
145  sprintf (hname4,"Entryx-Exitx_TEC_%i",i+1);
146  sprintf (hname5,"Entryx-Exitx_BPIX_%i",i+1);
147  sprintf (hname6,"Entryx-Exitx_FPIX_%i",i+1);
148 
149  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
150  h1ex[i] = fDBE->book1D (hname1, htitle1, nbin , low[0] , high[0]);
151  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
152  h2ex[i] = fDBE->book1D (hname2, htitle2, nbin , low[1] , high[1]);
153  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
154  h3ex[i] = fDBE->book1D (hname3, htitle3, nbin , low[2] , high[2]);
155  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
156  h4ex[i] = fDBE->book1D (hname4, htitle4, nbin , low[3] , high[3]);
157  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
158  h5ex[i] = fDBE->book1D (hname5, htitle5, nbin , low[4] , high[4]);
159  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
160  h6ex[i] = fDBE->book1D (hname6, htitle6, nbin , low[5] , high[5]);
161 
162  }
163 
164 const float high0[] = {0.05, 0.06, 0.03, 0.03, 0.03, 0.03};
165 const float low0[] = {-0.05, -0.06, -0.03, -0.03, -0.03, -0.03};
166 
167  for(int i=0; i<12; i++) {
168 
169  sprintf (htitle1,"Entryy-Exity in TIB %s", Region[i]);
170  sprintf (htitle2,"Entryy-Exity in TOB %s", Region[i]);
171  sprintf (htitle3,"Entryy-Exity in TID %s", Region[i]);
172  sprintf (htitle4,"Entryy-Exity in TEC %s", Region[i]);
173  sprintf (htitle5,"Entryy-Exity in BPIX %s", Region[i]);
174  sprintf (htitle6,"Entryy-Exity in FPIX %s", Region[i]);
175 
176  sprintf (hname1,"Entryy-Exity_TIB_%i",i+1);
177  sprintf (hname2,"Entryy-Exity_TOB_%i",i+1);
178  sprintf (hname3,"Entryy-Exity_TID_%i",i+1);
179  sprintf (hname4,"Entryy-Exity_TEC_%i",i+1);
180  sprintf (hname5,"Entryy-Exity_BPIX_%i",i+1);
181  sprintf (hname6,"Entryy-Exity_FPIX_%i",i+1);
182 
183  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
184  h1ey[i] = fDBE->book1D (hname1, htitle1, nbin , low0[0] , high0[0]);
185  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
186  h2ey[i] = fDBE->book1D (hname2, htitle2, nbin , low0[1] , high0[1]);
187  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
188  h3ey[i] = fDBE->book1D (hname3, htitle3, nbin , low0[2] , high0[2]);
189  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
190  h4ey[i] = fDBE->book1D (hname4, htitle4, nbin , low0[3] , high0[3]);
191  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
192  h5ey[i] = fDBE->book1D (hname5, htitle5, nbin , low0[4] , high0[4]);
193  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
194  h6ey[i] = fDBE->book1D (hname6, htitle6, nbin , low0[5] , high0[5]);
195 
196  }
197 
198 const float high1[] = {0.05, 0.06, 0.05, 0.06, 0.05, 0.05};
199 const float low1[] = {0.,0.,0.,0.,0.,0.};
200 
201  for(int i=0; i<12; i++) {
202 
203  sprintf (htitle1,"abs(Entryz-Exitz) in TIB %s", Region[i]);
204  sprintf (htitle2,"abs(Entryz-Exitz) in TOB %s", Region[i]);
205  sprintf (htitle3,"abs(Entryz-Exitz) in TID %s", Region[i]);
206  sprintf (htitle4,"abs(Entryz-Exitz) in TEC %s", Region[i]);
207  sprintf (htitle5,"abs(Entryz-Exitz) in BPIX %s", Region[i]);
208  sprintf (htitle6,"abs(Entryz-Exitz) in FPIX %s", Region[i]);
209 
210  sprintf (hname1,"Entryz-Exitz_TIB_%i",i+1);
211  sprintf (hname2,"Entryz-Exitz_TOB_%i",i+1);
212  sprintf (hname3,"Entryz-Exitz_TID_%i",i+1);
213  sprintf (hname4,"Entryz-Exitz_TEC_%i",i+1);
214  sprintf (hname5,"Entryz-Exitz_BPIX_%i",i+1);
215  sprintf (hname6,"Entryz-Exitz_FPIX_%i",i+1);
216 
217  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
218  h1ez[i] = fDBE->book1D (hname1, htitle1, nbin , low1[0] , high1[0]);
219  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
220  h2ez[i] = fDBE->book1D (hname2, htitle2, nbin , low1[1] , high1[1]);
221  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
222  h3ez[i] = fDBE->book1D (hname3, htitle3, nbin , low1[2] , high1[2]);
223  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
224  h4ez[i] = fDBE->book1D (hname4, htitle4, nbin , low1[3] , high1[3]);
225  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
226  h5ez[i] = fDBE->book1D (hname5, htitle5, nbin , low1[4] , high1[4]);
227  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
228  h6ez[i] = fDBE->book1D (hname6, htitle6, nbin , low1[5] , high1[5]);
229 
230  }
231 
232 
233 const float high2[] = {3.2, 5.0, 5.5, 6.2, 0.85, 0.5};
234 const float low2[] = {-3.2, -5.0, -5.5, -6.2, -0.85, -0.5};
235 
236  for(int i=0; i<12; i++) {
237 
238  sprintf (htitle1,"Localx in TIB %s", Region[i]);
239  sprintf (htitle2,"Localx in TOB %s", Region[i]);
240  sprintf (htitle3,"Localx in TID %s", Region[i]);
241  sprintf (htitle4,"Localx in TEC %s", Region[i]);
242  sprintf (htitle5,"Localx in BPIX %s", Region[i]);
243  sprintf (htitle6,"Localx in FPIX %s", Region[i]);
244 
245  sprintf (hname1,"Localx_TIB_%i",i+1);
246  sprintf (hname2,"Localx_TOB_%i",i+1);
247  sprintf (hname3,"Localx_TID_%i",i+1);
248  sprintf (hname4,"Localx_TEC_%i",i+1);
249  sprintf (hname5,"Localx_BPIX_%i",i+1);
250  sprintf (hname6,"Localx_FPIX_%i",i+1);
251 
252  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
253  h1lx[i] = fDBE->book1D (hname1, htitle1, nbin , low2[0] , high2[0]);
254  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
255  h2lx[i] = fDBE->book1D (hname2, htitle2, nbin , low2[1] , high2[1]);
256  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
257  h3lx[i] = fDBE->book1D (hname3, htitle3, nbin , low2[2] , high2[2]);
258  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
259  h4lx[i] = fDBE->book1D (hname4, htitle4, nbin , low2[3] , high2[3]);
260  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
261  h5lx[i] = fDBE->book1D (hname5, htitle5, nbin , low2[4] , high2[4]);
262  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
263  h6lx[i] = fDBE->book1D (hname6, htitle6, nbin , low2[5] , high2[5]);
264 
265  }
266 
267 
268 const float high3[] = {6.0, 10., 5.6, 10.5, 3.4, 0.52};
269 const float low3[] = {-6.0, -10., -5.6, -10.5, -3.4, -0.52};
270 
271  for(int i=0; i<12; i++) {
272 
273  sprintf (htitle1,"Localy in TIB %s", Region[i]);
274  sprintf (htitle2,"Localy in TOB %s", Region[i]);
275  sprintf (htitle3,"Localy in TID %s", Region[i]);
276  sprintf (htitle4,"Localy in TEC %s", Region[i]);
277  sprintf (htitle5,"Localy in BPIX %s", Region[i]);
278  sprintf (htitle6,"Localy in FPIX %s", Region[i]);
279 
280  sprintf (hname1,"Localy_TIB_%i",i+1);
281  sprintf (hname2,"Localy_TOB_%i",i+1);
282  sprintf (hname3,"Localy_TID_%i",i+1);
283  sprintf (hname4,"Localy_TEC_%i",i+1);
284  sprintf (hname5,"Localy_BPIX_%i",i+1);
285  sprintf (hname6,"Localy_FPIX_%i",i+1);
286 
287  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
288  h1ly[i] = fDBE->book1D (hname1, htitle1, nbin , low3[0] , high3[0]);
289  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
290  h2ly[i] = fDBE->book1D (hname2, htitle2, nbin , low3[1] , high3[1]);
291  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
292  h3ly[i] = fDBE->book1D (hname3, htitle3, nbin , low3[2] , high3[2]);
293  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
294  h4ly[i] = fDBE->book1D (hname4, htitle4, nbin , low3[3] , high3[3]);
295  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
296  h5ly[i] = fDBE->book1D (hname5, htitle5, nbin , low3[4] , high3[4]);
297  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
298  h6ly[i] = fDBE->book1D (hname6, htitle6, nbin , low3[5] , high3[5]);
299 
300  }
301 
302 
303  }
304 }
305 
307 {
308  // don't try to delete any pointers - they're handled by DQM machinery
309 }
310 
311 
312 
314 {
315  //before check that histos are there....
316 
317  // check if ME still there (and not killed by MEtoEDM for memory saving)
318  if( fDBE )
319  {
320  // check existence of first histo in the list
321  if (! fDBE->get("TrackerHitsV/TrackerHit/tof_eta")) return;
322  }
323  else
324  return;
325 
326  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/");
327  htofeta_profile = fDBE->bookProfile ("tof_eta_profile",htofeta->getTH2F()->ProfileX());
328  htofphi_profile = fDBE->bookProfile("tof_phi_profile", htofphi->getTH2F()->ProfileX());
329  htofr_profile = fDBE->bookProfile("tof_r_profile",htofr->getTH2F()->ProfileX());
330  htofz_profile = fDBE->bookProfile("tof_z_profile", htofz->getTH2F()->ProfileX());
331 
332 
333  if ( fOutputFile.size() != 0 && fDBE ) fDBE->save(fOutputFile);
334 
335  return ;
336 
337 }
338 
339 
341 {
342 
343  LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
344 
345  // iterator to access containers
346  edm::PSimHitContainer::const_iterator itHit;
348  // get Pixel Barrel information
350  // extract low container
351  edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
352  e.getByLabel(PxlBrlLowSrc_,PxlBrlLowContainer);
353  if (!PxlBrlLowContainer.isValid()) {
354  edm::LogError("TrackerHitAnalyzer::analyze")
355  << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
356  return;
357  }
358  // extract high container
359  edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
360  e.getByLabel(PxlBrlHighSrc_,PxlBrlHighContainer);
361  if (!PxlBrlHighContainer.isValid()) {
362  edm::LogError("TrackerHitAnalyzer::analyze")
363  << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
364  return;
365  }
367  // get Pixel Forward information
369  // extract low container
370  edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
371  e.getByLabel(PxlFwdLowSrc_,PxlFwdLowContainer);
372  if (!PxlFwdLowContainer.isValid()) {
373  edm::LogError("TrackerHitAnalyzer::analyze")
374  << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
375  return;
376  }
377  // extract high container
378  edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
379  e.getByLabel(PxlFwdHighSrc_,PxlFwdHighContainer);
380  if (!PxlFwdHighContainer.isValid()) {
381  edm::LogError("TrackerHitAnalyzer::analyze")
382  << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
383  return;
384  }
385 
387  // get Silicon TIB information
389  // extract TIB low container
390  edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
391 // iEvent.getByLabel("g4SimHits","TrackerHitsTIBLowTof",SiTIBLowContainer);
392  e.getByLabel(SiTIBLowSrc_,SiTIBLowContainer);
393  if (!SiTIBLowContainer.isValid()) {
394  edm::LogError("TrackerHitProducer::analyze")
395  << "Unable to find TrackerHitsTIBLowTof in event!";
396  return;
397  }
399  // extract TIB low container
400  edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
401 // iEvent.getByLabel("g4SimHits","TrackerHitsTIBHighTof",SiTIBHighContainer);
402  e.getByLabel(SiTIBHighSrc_,SiTIBHighContainer);
403  if (!SiTIBHighContainer.isValid()) {
404  edm::LogError("TrackerHitProducer::analyze")
405  << "Unable to find TrackerHitsTIBHighTof in event!";
406  return;
407  }
409  // get Silicon TOB information
411  // extract TOB low container
412  edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
413 // iEvent.getByLabel("g4SimHits","TrackerHitsTOBLowTof",SiTOBLowContainer);
414  e.getByLabel(SiTOBLowSrc_,SiTOBLowContainer);
415  if (!SiTOBLowContainer.isValid()) {
416  edm::LogError("TrackerHitProducer::analyze")
417  << "Unable to find TrackerHitsTOBLowTof in event!";
418  return;
419  }
421  // extract TOB low container
422  edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
423 // iEvent.getByLabel("g4SimHits","TrackerHitsTOBHighTof",SiTOBHighContainer);
424  e.getByLabel(SiTOBHighSrc_,SiTOBHighContainer);
425  if (!SiTOBHighContainer.isValid()) {
426  edm::LogError("TrackerHitProducer::analyze")
427  << "Unable to find TrackerHitsTOBHighTof in event!";
428  return;
429  }
430 
432  // get Silicon TID information
434  // extract TID low container
435  edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
436 // iEvent.getByLabel("g4SimHits","TrackerHitsTIDLowTof",SiTIDLowContainer);
437  e.getByLabel(SiTIDLowSrc_,SiTIDLowContainer);
438  if (!SiTIDLowContainer.isValid()) {
439  edm::LogError("TrackerHitProducer::analyze")
440  << "Unable to find TrackerHitsTIDLowTof in event!";
441  return;
442  }
444  // extract TID low container
445  edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
446 // iEvent.getByLabel("g4SimHits","TrackerHitsTIDHighTof",SiTIDHighContainer);
447  e.getByLabel(SiTIDHighSrc_,SiTIDHighContainer);
448  if (!SiTIDHighContainer.isValid()) {
449  edm::LogError("TrackerHitProducer::analyze")
450  << "Unable to find TrackerHitsTIDHighTof in event!";
451  return;
452  }
454  // get Silicon TEC information
456  // extract TEC low container
457  edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
458 // iEvent.getByLabel("g4SimHits","TrackerHitsTECLowTof",SiTECLowContainer);
459  e.getByLabel(SiTECLowSrc_,SiTECLowContainer);
460  if (!SiTECLowContainer.isValid()) {
461  edm::LogError("TrackerHitProducer::analyze")
462  << "Unable to find TrackerHitsTECLowTof in event!";
463  return;
464  }
466  // extract TEC low container
467  edm ::Handle<edm::PSimHitContainer> SiTECHighContainer;
468 // iEvent.getByLabel("g4SimHits","TrackerHitsTECHighTof",SiTECHighContainer);
469  e.getByLabel(SiTECHighSrc_,SiTECHighContainer);
470  if (!SiTECHighContainer.isValid()) {
471  edm::LogError("TrackerHitProducer::analyze")
472  << "Unable to find TrackerHitsTECHighTof in event!";
473  return;
474  }
475 
477  // get G4Track information
479 
481  e.getByType(G4TrkContainer);
482  if (!G4TrkContainer.isValid()) {
483  edm::LogError("TrackerHitAnalyzer::analyze")
484  << "Unable to find SimTrack in event!";
485  return;
486  }
487 
488  // Get geometry information
489 
491  c.get<TrackerDigiGeometryRecord>().get( tracker );
492 
493 
494 
495  int ir = -100;
496  edm::SimTrackContainer::const_iterator itTrk;
497  for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
498  ++itTrk) {
499 
500 // cout << "itTrk = "<< itTrk << endl;
501  double eta =0, phi =0, p =0;
502  const CLHEP::HepLorentzVector& G4Trk = CLHEP::HepLorentzVector(itTrk->momentum().x(),
503  itTrk->momentum().y(),
504  itTrk->momentum().z(),
505  itTrk->momentum().e());
506  p =sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]+G4Trk[2]*G4Trk[2]);
507  if ( p == 0)
508  edm::LogError("TrackerHitAnalyzer::analyze")
509  << "TrackerTest::INFO: Primary has p = 0 ";
510  else {
511  double costheta = G4Trk[2]/p;
512  double theta = acos(TMath::Min(TMath::Max(costheta, -1.),1.));
513  eta = -log(tan(theta/2));
514  if ( G4Trk[0] != 0 || G4Trk[1] != 0) phi = atan2(G4Trk[1],G4Trk[0]);
515 
516  if (eta>0.0 && eta<=0.5) ir = 0;
517  if (eta>0.5 && eta<=1.0) ir = 1;
518  if (eta>1.0 && eta<=1.5) ir = 2;
519  if (eta>1.5 && eta<=2.0) ir = 3;
520  if (eta>2.0 && eta<=2.5) ir = 4;
521  if (eta>2.5) ir = 5;
522 
523  if (eta>-0.5 && eta<= 0.0) ir = 6;
524  if (eta>-1.0 && eta<=-0.5) ir = 7;
525  if (eta>-1.5 && eta<=-1.0) ir = 8;
526  if (eta>-2.0 && eta<=-1.5) ir = 9;
527  if (eta>-2.5 && eta<=-2.0) ir = 10;
528  if (eta<=-2.5) ir = 11;
529 // LogInfo("EventInfo") << " eta = " << eta << " ir = " << ir;
530 // cout << " " <<endl;
531 // cout << "eta " << eta << " ir = " << ir << endl;
532 // cout << " " <<endl;
533  }
534  }
536  // get Pixel information
538  for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
539  DetId detid=DetId(itHit->detUnitId());
540  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
541  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
542  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
543  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
544  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
545  htofz->Fill(gpos.z(), itHit->timeOfFlight());
546 
547  h5e[ir]->Fill(itHit->energyLoss());
548  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
549  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
550  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
551  h5lx[ir]->Fill(itHit->localPosition().x());
552  h5ly[ir]->Fill(itHit->localPosition().y());
553  }
554  for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->end(); ++itHit) {
555  DetId detid=DetId(itHit->detUnitId());
556  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
557  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
558  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
559  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
560  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
561  htofz->Fill(gpos.z(), itHit->timeOfFlight());
562 
563 
564  h5e[ir]->Fill(itHit->energyLoss());
565  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
566  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
567  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
568  h5lx[ir]->Fill(itHit->localPosition().x());
569  h5ly[ir]->Fill(itHit->localPosition().y());
570  }
571  for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
572  DetId detid=DetId(itHit->detUnitId());
573  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
574  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
575  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
576  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
577  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
578  htofz->Fill(gpos.z(), itHit->timeOfFlight());
579 
580 
581  h6e[ir]->Fill(itHit->energyLoss());
582  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
583  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
584  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
585  h6lx[ir]->Fill(itHit->localPosition().x());
586  h6ly[ir]->Fill(itHit->localPosition().y());
587  }
588  for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
589  DetId detid=DetId(itHit->detUnitId());
590  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
591  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
592  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
593  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
594  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
595  htofz->Fill(gpos.z(), itHit->timeOfFlight());
596 
597 
598  h6e[ir]->Fill(itHit->energyLoss());
599  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
600  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
601  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
602  h6lx[ir]->Fill(itHit->localPosition().x());
603  h6ly[ir]->Fill(itHit->localPosition().y());
604  }
606  // get TIB information
608  for (itHit = SiTIBLowContainer->begin(); itHit != SiTIBLowContainer->end(); ++itHit) {
609  DetId detid=DetId(itHit->detUnitId());
610  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
611  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
612  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
613  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
614  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
615  htofz->Fill(gpos.z(), itHit->timeOfFlight());
616 
617 
618  h1e[ir]->Fill(itHit->energyLoss());
619  h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
620  h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
621  h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
622  h1lx[ir]->Fill(itHit->localPosition().x());
623  h1ly[ir]->Fill(itHit->localPosition().y());
624  }
625  for (itHit = SiTIBHighContainer->begin(); itHit != SiTIBHighContainer->end(); ++itHit) {
626  DetId detid=DetId(itHit->detUnitId());
627  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
628  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
629  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
630  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
631  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
632  htofz->Fill(gpos.z(), itHit->timeOfFlight());
633 
634 
635  h1e[ir]->Fill(itHit->energyLoss());
636  h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
637  h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
638  h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
639  h1lx[ir]->Fill(itHit->localPosition().x());
640  h1ly[ir]->Fill(itHit->localPosition().y());
641  }
643  // get TOB information
645  for (itHit = SiTOBLowContainer->begin(); itHit != SiTOBLowContainer->end(); ++itHit) {
646  DetId detid=DetId(itHit->detUnitId());
647  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
648  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
649  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
650  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
651  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
652  htofz->Fill(gpos.z(), itHit->timeOfFlight());
653 
654 
655  h2e[ir]->Fill(itHit->energyLoss());
656  h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
657  h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
658  h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
659  h2lx[ir]->Fill(itHit->localPosition().x());
660  h2ly[ir]->Fill(itHit->localPosition().y());
661  }
662  for (itHit = SiTOBHighContainer->begin(); itHit != SiTOBHighContainer->end(); ++itHit) {
663  DetId detid=DetId(itHit->detUnitId());
664  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
665  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
666  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
667  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
668  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
669  htofz->Fill(gpos.z(), itHit->timeOfFlight());
670 
671  h2e[ir]->Fill(itHit->energyLoss());
672  h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
673  h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
674  h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
675  h2lx[ir]->Fill(itHit->localPosition().x());
676  h2ly[ir]->Fill(itHit->localPosition().y());
677  }
679  // get TID information
681  for (itHit = SiTIDLowContainer->begin(); itHit != SiTIDLowContainer->end(); ++itHit) {
682  DetId detid=DetId(itHit->detUnitId());
683  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
684  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
685  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
686  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
687  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
688  htofz->Fill(gpos.z(), itHit->timeOfFlight());
689 
690  h3e[ir]->Fill(itHit->energyLoss());
691  h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
692  h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
693  h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
694  h3lx[ir]->Fill(itHit->localPosition().x());
695  h3ly[ir]->Fill(itHit->localPosition().y());
696  }
697  for (itHit = SiTIDHighContainer->begin(); itHit != SiTIDHighContainer->end(); ++itHit) {
698  DetId detid=DetId(itHit->detUnitId());
699  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
700  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
701  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
702  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
703  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
704  htofz->Fill(gpos.z(), itHit->timeOfFlight());
705 
706  h3e[ir]->Fill(itHit->energyLoss());
707  h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
708  h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
709  h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
710  h3lx[ir]->Fill(itHit->localPosition().x());
711  h3ly[ir]->Fill(itHit->localPosition().y());
712  }
714  // get TEC information
716  for (itHit = SiTECLowContainer->begin(); itHit != SiTECLowContainer->end(); ++itHit) {
717  DetId detid=DetId(itHit->detUnitId());
718  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
719  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
720  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
721  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
722  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
723  htofz->Fill(gpos.z(), itHit->timeOfFlight());
724 
725  h4e[ir]->Fill(itHit->energyLoss());
726  h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
727  h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
728  h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
729  h4lx[ir]->Fill(itHit->localPosition().x());
730  h4ly[ir]->Fill(itHit->localPosition().y());
731  }
732  for (itHit = SiTECHighContainer->begin(); itHit != SiTECHighContainer->end(); ++itHit) {
733  DetId detid=DetId(itHit->detUnitId());
734  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
735  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
736  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
737  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
738  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
739  htofz->Fill(gpos.z(), itHit->timeOfFlight());
740 
741  h4e[ir]->Fill(itHit->energyLoss());
742  h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
743  h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
744  h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
745  h4lx[ir]->Fill(itHit->localPosition().x());
746  h4ly[ir]->Fill(itHit->localPosition().y());
747  }
748 
749 
750  return ;
751 
752 }
753 
755 
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
int i
Definition: DBlmapReader.cc:9
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
#define NULL
Definition: scimark2.h:8
Geom::Theta< T > theta() const
bool getByType(Handle< PROD > &result) const
Definition: Event.h:403
DEFINE_FWK_MODULE(HiMixingModule)
T eta() const
return((rh^lh)&mask)
T mag() const
Definition: PV3DBase.h:61
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
Region
Definition: Region.h:7
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
~TrackerHitAnalyzer()
Destructor.
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
Definition: DetId.h:20
Log< T >::type log(const T &t)
Definition: Log.h:22
const T & get() const
Definition: EventSetup.h:55
T eta() const
Definition: PV3DBase.h:70
edm::EventID id() const
Definition: EventBase.h:56
T degrees() const
Definition: Phi.h:51
TrackerHitAnalyzer(const edm::ParameterSet &ps)
Constructor.
Definition: DDAxes.h:10