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, 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 
515  if (eta>0.0 && eta<=0.5) ir = 0;
516  if (eta>0.5 && eta<=1.0) ir = 1;
517  if (eta>1.0 && eta<=1.5) ir = 2;
518  if (eta>1.5 && eta<=2.0) ir = 3;
519  if (eta>2.0 && eta<=2.5) ir = 4;
520  if (eta>2.5) ir = 5;
521 
522  if (eta>-0.5 && eta<= 0.0) ir = 6;
523  if (eta>-1.0 && eta<=-0.5) ir = 7;
524  if (eta>-1.5 && eta<=-1.0) ir = 8;
525  if (eta>-2.0 && eta<=-1.5) ir = 9;
526  if (eta>-2.5 && eta<=-2.0) ir = 10;
527  if (eta<=-2.5) ir = 11;
528 // LogInfo("EventInfo") << " eta = " << eta << " ir = " << ir;
529 // cout << " " <<endl;
530 // cout << "eta " << eta << " ir = " << ir << endl;
531 // cout << " " <<endl;
532  }
533  }
535  // get Pixel information
537  for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
538  DetId detid=DetId(itHit->detUnitId());
539  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
540  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
541  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
542  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
543  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
544  htofz->Fill(gpos.z(), itHit->timeOfFlight());
545 
546  h5e[ir]->Fill(itHit->energyLoss());
547  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
548  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
549  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
550  h5lx[ir]->Fill(itHit->localPosition().x());
551  h5ly[ir]->Fill(itHit->localPosition().y());
552  }
553  for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->end(); ++itHit) {
554  DetId detid=DetId(itHit->detUnitId());
555  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
556  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
557  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
558  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
559  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
560  htofz->Fill(gpos.z(), itHit->timeOfFlight());
561 
562 
563  h5e[ir]->Fill(itHit->energyLoss());
564  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
565  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
566  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
567  h5lx[ir]->Fill(itHit->localPosition().x());
568  h5ly[ir]->Fill(itHit->localPosition().y());
569  }
570  for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
571  DetId detid=DetId(itHit->detUnitId());
572  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
573  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
574  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
575  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
576  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
577  htofz->Fill(gpos.z(), itHit->timeOfFlight());
578 
579 
580  h6e[ir]->Fill(itHit->energyLoss());
581  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
582  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
583  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
584  h6lx[ir]->Fill(itHit->localPosition().x());
585  h6ly[ir]->Fill(itHit->localPosition().y());
586  }
587  for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
588  DetId detid=DetId(itHit->detUnitId());
589  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
590  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
591  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
592  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
593  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
594  htofz->Fill(gpos.z(), itHit->timeOfFlight());
595 
596 
597  h6e[ir]->Fill(itHit->energyLoss());
598  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
599  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
600  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
601  h6lx[ir]->Fill(itHit->localPosition().x());
602  h6ly[ir]->Fill(itHit->localPosition().y());
603  }
605  // get TIB information
607  for (itHit = SiTIBLowContainer->begin(); itHit != SiTIBLowContainer->end(); ++itHit) {
608  DetId detid=DetId(itHit->detUnitId());
609  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
610  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
611  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
612  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
613  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
614  htofz->Fill(gpos.z(), itHit->timeOfFlight());
615 
616 
617  h1e[ir]->Fill(itHit->energyLoss());
618  h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
619  h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
620  h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
621  h1lx[ir]->Fill(itHit->localPosition().x());
622  h1ly[ir]->Fill(itHit->localPosition().y());
623  }
624  for (itHit = SiTIBHighContainer->begin(); itHit != SiTIBHighContainer->end(); ++itHit) {
625  DetId detid=DetId(itHit->detUnitId());
626  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
627  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
628  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
629  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
630  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
631  htofz->Fill(gpos.z(), itHit->timeOfFlight());
632 
633 
634  h1e[ir]->Fill(itHit->energyLoss());
635  h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
636  h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
637  h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
638  h1lx[ir]->Fill(itHit->localPosition().x());
639  h1ly[ir]->Fill(itHit->localPosition().y());
640  }
642  // get TOB information
644  for (itHit = SiTOBLowContainer->begin(); itHit != SiTOBLowContainer->end(); ++itHit) {
645  DetId detid=DetId(itHit->detUnitId());
646  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
647  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
648  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
649  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
650  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
651  htofz->Fill(gpos.z(), itHit->timeOfFlight());
652 
653 
654  h2e[ir]->Fill(itHit->energyLoss());
655  h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
656  h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
657  h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
658  h2lx[ir]->Fill(itHit->localPosition().x());
659  h2ly[ir]->Fill(itHit->localPosition().y());
660  }
661  for (itHit = SiTOBHighContainer->begin(); itHit != SiTOBHighContainer->end(); ++itHit) {
662  DetId detid=DetId(itHit->detUnitId());
663  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
664  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
665  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
666  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
667  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
668  htofz->Fill(gpos.z(), itHit->timeOfFlight());
669 
670  h2e[ir]->Fill(itHit->energyLoss());
671  h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
672  h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
673  h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
674  h2lx[ir]->Fill(itHit->localPosition().x());
675  h2ly[ir]->Fill(itHit->localPosition().y());
676  }
678  // get TID information
680  for (itHit = SiTIDLowContainer->begin(); itHit != SiTIDLowContainer->end(); ++itHit) {
681  DetId detid=DetId(itHit->detUnitId());
682  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
683  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
684  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
685  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
686  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
687  htofz->Fill(gpos.z(), itHit->timeOfFlight());
688 
689  h3e[ir]->Fill(itHit->energyLoss());
690  h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
691  h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
692  h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
693  h3lx[ir]->Fill(itHit->localPosition().x());
694  h3ly[ir]->Fill(itHit->localPosition().y());
695  }
696  for (itHit = SiTIDHighContainer->begin(); itHit != SiTIDHighContainer->end(); ++itHit) {
697  DetId detid=DetId(itHit->detUnitId());
698  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
699  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
700  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
701  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
702  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
703  htofz->Fill(gpos.z(), itHit->timeOfFlight());
704 
705  h3e[ir]->Fill(itHit->energyLoss());
706  h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
707  h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
708  h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
709  h3lx[ir]->Fill(itHit->localPosition().x());
710  h3ly[ir]->Fill(itHit->localPosition().y());
711  }
713  // get TEC information
715  for (itHit = SiTECLowContainer->begin(); itHit != SiTECLowContainer->end(); ++itHit) {
716  DetId detid=DetId(itHit->detUnitId());
717  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
718  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
719  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
720  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
721  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
722  htofz->Fill(gpos.z(), itHit->timeOfFlight());
723 
724  h4e[ir]->Fill(itHit->energyLoss());
725  h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
726  h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
727  h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
728  h4lx[ir]->Fill(itHit->localPosition().x());
729  h4ly[ir]->Fill(itHit->localPosition().y());
730  }
731  for (itHit = SiTECHighContainer->begin(); itHit != SiTECHighContainer->end(); ++itHit) {
732  DetId detid=DetId(itHit->detUnitId());
733  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
734  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
735  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
736  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
737  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
738  htofz->Fill(gpos.z(), itHit->timeOfFlight());
739 
740  h4e[ir]->Fill(itHit->energyLoss());
741  h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
742  h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
743  h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
744  h4lx[ir]->Fill(itHit->localPosition().x());
745  h4ly[ir]->Fill(itHit->localPosition().y());
746  }
747 
748 
749  return ;
750 
751 }
752 
754 
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:68
Geom::Theta< T > theta() const
#define NULL
Definition: scimark2.h:8
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
DEFINE_FWK_MODULE(HiMixingModule)
T eta() const
T mag() const
Definition: PV3DBase.h:66
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
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:356
Definition: DetId.h:20
const T & get() const
Definition: EventSetup.h:55
T eta() const
Definition: PV3DBase.h:75
edm::EventID id() const
Definition: EventBase.h:56
T degrees() const
Definition: Phi.h:51
TrackerHitAnalyzer(const edm::ParameterSet &ps)
Constructor.