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 
9 
12 
15 
16 // tracker info
24 
25 // data in edm::event
28 //#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
32 
33 // helper files
34 #include <CLHEP/Vector/LorentzVector.h>
35 #include "CLHEP/Units/GlobalSystemOfUnits.h"
36 
37 #include <map>
38 #include <memory>
39 #include <stdlib.h>
40 #include <vector>
41 
43  : verbose_( ps.getUntrackedParameter<bool>( "Verbosity",false ) )
44  , edmPSimHitContainer_pxlBrlLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlBrlLowSrc" ) ) )
45  , edmPSimHitContainer_pxlBrlHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlBrlHighSrc" ) ) )
46  , edmPSimHitContainer_pxlFwdLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlFwdLowSrc" ) ) )
47  , edmPSimHitContainer_pxlFwdHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlFwdHighSrc" ) ) )
48  , edmPSimHitContainer_siTIBLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIBLowSrc" ) ) )
49  , edmPSimHitContainer_siTIBHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIBHighSrc" ) ) )
50  , edmPSimHitContainer_siTOBLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTOBLowSrc" ) ) )
51  , edmPSimHitContainer_siTOBHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTOBHighSrc" ) ) )
52  , edmPSimHitContainer_siTIDLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIDLowSrc" ) ) )
53  , edmPSimHitContainer_siTIDHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIDHighSrc" ) ) )
54  , edmPSimHitContainer_siTECLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTECLowSrc" ) ) )
55  , edmPSimHitContainer_siTECHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTECHighSrc" ) ) )
56  , edmSimTrackContainerToken_( consumes<edm::SimTrackContainer>( ps.getParameter<edm::InputTag>( "G4TrkSrc" ) ) )
57  , fDBE( NULL )
58  , conf_(ps)
59  , runStandalone ( ps.getParameter<bool>("runStandalone") )
60  , fOutputFile( ps.getUntrackedParameter<std::string>( "outputFile", "TrackerHitHisto.root" ) ) {
61 }
62 
66 
67  Char_t hname1[50], htitle1[80];
68  Char_t hname2[50], htitle2[80];
69  Char_t hname3[50], htitle3[80];
70  Char_t hname4[50], htitle4[80];
71  Char_t hname5[50], htitle5[80];
72  Char_t hname6[50], htitle6[80];
73 
74  if ( fDBE ) {
75  if ( verbose_ ) {
76  fDBE->setVerbose(1);
77  } else {
78  fDBE->setVerbose(0);
79  }
80  }
81 
82  if ( fDBE) {
83  if ( verbose_ ) fDBE->showDirStructure();
84  }
85 
86  if ( fDBE != NULL ) {
87 // fDBE->setCurrentFolder("TrackerHitsV/TrackerHitTask");
88 
89  // is there any way to record CPU Info ???
90  // if so, it can be done once - via beginJob()
91  int nbin = 5000;
92 
93  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/");
94  htofeta = ibooker.book2D ("tof_eta", "Time of flight vs eta", nbin , -3.0 , 3.0,200,-100,100);
95  htofphi = ibooker.book2D("tof_phi", "Time of flight vs phi", nbin,-180,180,200,-100,100);
96  htofr = ibooker.book2D("tof_r", "Time of flight vs r", nbin , 0 , 300, 200, -100,100);
97  htofz = ibooker.book2D("tof_z", "Time of flight vs z", nbin , -280 , 280, 200, -100,100);
98 
99 
100  const float E2NEL = 1.;
101 
102  const char *Region[] = {"005","051","115","152","225","253",
103  "-050","-105","-151","-215","-252","-325"};
104  nbin = 10000;
105 
106 // Energy loss histograms
107  for(int i=0; i<12; i++) {
108 
109  sprintf (htitle1,"Energy loss in TIB %s", Region[i]);
110  sprintf (htitle2,"Energy loss in TOB %s", Region[i]);
111  sprintf (htitle3,"Energy loss in TID %s", Region[i]);
112  sprintf (htitle4,"Energy loss in TEC %s", Region[i]);
113  sprintf (htitle5,"Energy loss in BPIX %s", Region[i]);
114  sprintf (htitle6,"Energy loss in FPIX %s", Region[i]);
115 
116  sprintf (hname1,"Eloss_TIB_%i",i+1);
117  sprintf (hname2,"Eloss_TOB_%i",i+1);
118  sprintf (hname3,"Eloss_TID_%i",i+1);
119  sprintf (hname4,"Eloss_TEC_%i",i+1);
120  sprintf (hname5,"Eloss_BPIX_%i",i+1);
121  sprintf (hname6,"Eloss_FPIX_%i",i+1);
122 
123  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
124  h1e[i] = ibooker.book1D (hname1, htitle1, nbin , 0.0 , 0.001*E2NEL);
125  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
126  h2e[i] = ibooker.book1D (hname2, htitle2, nbin , 0.0 , 0.001*E2NEL);
127  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
128  h3e[i] = ibooker.book1D (hname3, htitle3, nbin , 0.0 , 0.001*E2NEL);
129  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
130  h4e[i] = ibooker.book1D (hname4, htitle4, nbin , 0.0 , 0.001*E2NEL);
131  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
132  h5e[i] = ibooker.book1D (hname5, htitle5, nbin , 0.0 , 0.001*E2NEL);
133  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
134  h6e[i] = ibooker.book1D (hname6, htitle6, nbin , 0.0 , 0.001*E2NEL);
135 
136  }
137 
138 // limits
139 const float high[] = {0.03, 0.03, 0.02, 0.03, 0.03, 0.03};
140 const float low[] = {-0.03, -0.03, -0.02, -0.03, -0.03, -0.03};
141 
142  for(int i=0; i<12; i++) {
143 
144  sprintf (htitle1,"Entryx-Exitx in TIB %s", Region[i]);
145  sprintf (htitle2,"Entryx-Exitx in TOB %s", Region[i]);
146  sprintf (htitle3,"Entryx-Exitx in TID %s", Region[i]);
147  sprintf (htitle4,"Entryx-Exitx in TEC %s", Region[i]);
148  sprintf (htitle5,"Entryx-Exitx in BPIX %s", Region[i]);
149  sprintf (htitle6,"Entryx-Exitx in FPIX %s", Region[i]);
150 
151  sprintf (hname1,"Entryx-Exitx_TIB_%i",i+1);
152  sprintf (hname2,"Entryx-Exitx_TOB_%i",i+1);
153  sprintf (hname3,"Entryx-Exitx_TID_%i",i+1);
154  sprintf (hname4,"Entryx-Exitx_TEC_%i",i+1);
155  sprintf (hname5,"Entryx-Exitx_BPIX_%i",i+1);
156  sprintf (hname6,"Entryx-Exitx_FPIX_%i",i+1);
157 
158  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
159  h1ex[i] = ibooker.book1D (hname1, htitle1, nbin , low[0] , high[0]);
160  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
161  h2ex[i] = ibooker.book1D (hname2, htitle2, nbin , low[1] , high[1]);
162  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
163  h3ex[i] = ibooker.book1D (hname3, htitle3, nbin , low[2] , high[2]);
164  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
165  h4ex[i] = ibooker.book1D (hname4, htitle4, nbin , low[3] , high[3]);
166  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
167  h5ex[i] = ibooker.book1D (hname5, htitle5, nbin , low[4] , high[4]);
168  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
169  h6ex[i] = ibooker.book1D (hname6, htitle6, nbin , low[5] , high[5]);
170 
171  }
172 
173 const float high0[] = {0.05, 0.06, 0.03, 0.03, 0.03, 0.03};
174 const float low0[] = {-0.05, -0.06, -0.03, -0.03, -0.03, -0.03};
175 
176  for(int i=0; i<12; i++) {
177 
178  sprintf (htitle1,"Entryy-Exity in TIB %s", Region[i]);
179  sprintf (htitle2,"Entryy-Exity in TOB %s", Region[i]);
180  sprintf (htitle3,"Entryy-Exity in TID %s", Region[i]);
181  sprintf (htitle4,"Entryy-Exity in TEC %s", Region[i]);
182  sprintf (htitle5,"Entryy-Exity in BPIX %s", Region[i]);
183  sprintf (htitle6,"Entryy-Exity in FPIX %s", Region[i]);
184 
185  sprintf (hname1,"Entryy-Exity_TIB_%i",i+1);
186  sprintf (hname2,"Entryy-Exity_TOB_%i",i+1);
187  sprintf (hname3,"Entryy-Exity_TID_%i",i+1);
188  sprintf (hname4,"Entryy-Exity_TEC_%i",i+1);
189  sprintf (hname5,"Entryy-Exity_BPIX_%i",i+1);
190  sprintf (hname6,"Entryy-Exity_FPIX_%i",i+1);
191 
192  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
193  h1ey[i] = ibooker.book1D (hname1, htitle1, nbin , low0[0] , high0[0]);
194  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
195  h2ey[i] = ibooker.book1D (hname2, htitle2, nbin , low0[1] , high0[1]);
196  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
197  h3ey[i] = ibooker.book1D (hname3, htitle3, nbin , low0[2] , high0[2]);
198  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
199  h4ey[i] = ibooker.book1D (hname4, htitle4, nbin , low0[3] , high0[3]);
200  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
201  h5ey[i] = ibooker.book1D (hname5, htitle5, nbin , low0[4] , high0[4]);
202  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
203  h6ey[i] = ibooker.book1D (hname6, htitle6, nbin , low0[5] , high0[5]);
204 
205  }
206 
207 const float high1[] = {0.05, 0.06, 0.05, 0.06, 0.05, 0.05};
208 const float low1[] = {0.,0.,0.,0.,0.,0.};
209 
210  for(int i=0; i<12; i++) {
211 
212  sprintf (htitle1,"abs(Entryz-Exitz) in TIB %s", Region[i]);
213  sprintf (htitle2,"abs(Entryz-Exitz) in TOB %s", Region[i]);
214  sprintf (htitle3,"abs(Entryz-Exitz) in TID %s", Region[i]);
215  sprintf (htitle4,"abs(Entryz-Exitz) in TEC %s", Region[i]);
216  sprintf (htitle5,"abs(Entryz-Exitz) in BPIX %s", Region[i]);
217  sprintf (htitle6,"abs(Entryz-Exitz) in FPIX %s", Region[i]);
218 
219  sprintf (hname1,"Entryz-Exitz_TIB_%i",i+1);
220  sprintf (hname2,"Entryz-Exitz_TOB_%i",i+1);
221  sprintf (hname3,"Entryz-Exitz_TID_%i",i+1);
222  sprintf (hname4,"Entryz-Exitz_TEC_%i",i+1);
223  sprintf (hname5,"Entryz-Exitz_BPIX_%i",i+1);
224  sprintf (hname6,"Entryz-Exitz_FPIX_%i",i+1);
225 
226  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
227  h1ez[i] = ibooker.book1D (hname1, htitle1, nbin , low1[0] , high1[0]);
228  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
229  h2ez[i] = ibooker.book1D (hname2, htitle2, nbin , low1[1] , high1[1]);
230  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
231  h3ez[i] = ibooker.book1D (hname3, htitle3, nbin , low1[2] , high1[2]);
232  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
233  h4ez[i] = ibooker.book1D (hname4, htitle4, nbin , low1[3] , high1[3]);
234  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
235  h5ez[i] = ibooker.book1D (hname5, htitle5, nbin , low1[4] , high1[4]);
236  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
237  h6ez[i] = ibooker.book1D (hname6, htitle6, nbin , low1[5] , high1[5]);
238 
239  }
240 
241 
242 const float high2[] = {3.2, 5.0, 5.5, 6.2, 0.85, 0.5};
243 const float low2[] = {-3.2, -5.0, -5.5, -6.2, -0.85, -0.5};
244 
245  for(int i=0; i<12; i++) {
246 
247  sprintf (htitle1,"Localx in TIB %s", Region[i]);
248  sprintf (htitle2,"Localx in TOB %s", Region[i]);
249  sprintf (htitle3,"Localx in TID %s", Region[i]);
250  sprintf (htitle4,"Localx in TEC %s", Region[i]);
251  sprintf (htitle5,"Localx in BPIX %s", Region[i]);
252  sprintf (htitle6,"Localx in FPIX %s", Region[i]);
253 
254  sprintf (hname1,"Localx_TIB_%i",i+1);
255  sprintf (hname2,"Localx_TOB_%i",i+1);
256  sprintf (hname3,"Localx_TID_%i",i+1);
257  sprintf (hname4,"Localx_TEC_%i",i+1);
258  sprintf (hname5,"Localx_BPIX_%i",i+1);
259  sprintf (hname6,"Localx_FPIX_%i",i+1);
260 
261  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
262  h1lx[i] = ibooker.book1D (hname1, htitle1, nbin , low2[0] , high2[0]);
263  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
264  h2lx[i] = ibooker.book1D (hname2, htitle2, nbin , low2[1] , high2[1]);
265  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
266  h3lx[i] = ibooker.book1D (hname3, htitle3, nbin , low2[2] , high2[2]);
267  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
268  h4lx[i] = ibooker.book1D (hname4, htitle4, nbin , low2[3] , high2[3]);
269  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
270  h5lx[i] = ibooker.book1D (hname5, htitle5, nbin , low2[4] , high2[4]);
271  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
272  h6lx[i] = ibooker.book1D (hname6, htitle6, nbin , low2[5] , high2[5]);
273 
274  }
275 
276 
277 const float high3[] = {6.0, 10., 5.6, 10.5, 3.4, 0.52};
278 const float low3[] = {-6.0, -10., -5.6, -10.5, -3.4, -0.52};
279 
280  for(int i=0; i<12; i++) {
281 
282  sprintf (htitle1,"Localy in TIB %s", Region[i]);
283  sprintf (htitle2,"Localy in TOB %s", Region[i]);
284  sprintf (htitle3,"Localy in TID %s", Region[i]);
285  sprintf (htitle4,"Localy in TEC %s", Region[i]);
286  sprintf (htitle5,"Localy in BPIX %s", Region[i]);
287  sprintf (htitle6,"Localy in FPIX %s", Region[i]);
288 
289  sprintf (hname1,"Localy_TIB_%i",i+1);
290  sprintf (hname2,"Localy_TOB_%i",i+1);
291  sprintf (hname3,"Localy_TID_%i",i+1);
292  sprintf (hname4,"Localy_TEC_%i",i+1);
293  sprintf (hname5,"Localy_BPIX_%i",i+1);
294  sprintf (hname6,"Localy_FPIX_%i",i+1);
295 
296  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
297  h1ly[i] = ibooker.book1D (hname1, htitle1, nbin , low3[0] , high3[0]);
298  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
299  h2ly[i] = ibooker.book1D (hname2, htitle2, nbin , low3[1] , high3[1]);
300  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
301  h3ly[i] = ibooker.book1D (hname3, htitle3, nbin , low3[2] , high3[2]);
302  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
303  h4ly[i] = ibooker.book1D (hname4, htitle4, nbin , low3[3] , high3[3]);
304  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
305  h5ly[i] = ibooker.book1D (hname5, htitle5, nbin , low3[4] , high3[4]);
306  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
307  h6ly[i] = ibooker.book1D (hname6, htitle6, nbin , low3[5] , high3[5]);
308 
309  }
310 
311  }
312 }
313 
315 {
316  // don't try to delete any pointers - they're handled by DQM machinery
317 }
318 
319 
320 
322  //According to the previous code some profile plots were created here
323  //However, these profile plots are not in the final root file
324  //For now we comment out these plots (since they are not created in any case)
325  //Then, if needed we will consider moving the booking of the profileplots to the bookHistograms function
326  //and here we will do the profile
327 
328  //Save root file only in standalone mode
329  if ( runStandalone && fOutputFile.size() != 0 && fDBE ){ fDBE->save(fOutputFile);}
330 }
331 
332 
334 {
335 
336  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
337 
338  // iterator to access containers
339  edm::PSimHitContainer::const_iterator itHit;
341  // get Pixel Barrel information
343  // extract low container
344  edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
345  e.getByToken( edmPSimHitContainer_pxlBrlLow_Token_, PxlBrlLowContainer );
346  if (!PxlBrlLowContainer.isValid()) {
347  edm::LogError("TrackerHitAnalyzer::analyze")
348  << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
349  return;
350  }
351  // extract high container
352  edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
353  e.getByToken( edmPSimHitContainer_pxlBrlHigh_Token_, PxlBrlHighContainer );
354  if (!PxlBrlHighContainer.isValid()) {
355  edm::LogError("TrackerHitAnalyzer::analyze")
356  << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
357  return;
358  }
360  // get Pixel Forward information
362  // extract low container
363  edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
364  e.getByToken( edmPSimHitContainer_pxlFwdLow_Token_, PxlFwdLowContainer );
365  if (!PxlFwdLowContainer.isValid()) {
366  edm::LogError("TrackerHitAnalyzer::analyze")
367  << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
368  return;
369  }
370  // extract high container
371  edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
372  e.getByToken( edmPSimHitContainer_pxlFwdHigh_Token_, PxlFwdHighContainer );
373  if (!PxlFwdHighContainer.isValid()) {
374  edm::LogError("TrackerHitAnalyzer::analyze")
375  << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
376  return;
377  }
378 
380  // get Silicon TIB information
382  // extract TIB low container
383  edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
384  e.getByToken( edmPSimHitContainer_siTIBLow_Token_, SiTIBLowContainer );
385  if (!SiTIBLowContainer.isValid()) {
386  edm::LogError("TrackerHitProducer::analyze")
387  << "Unable to find TrackerHitsTIBLowTof in event!";
388  return;
389  }
391  // extract TIB high container
392  edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
393  e.getByToken( edmPSimHitContainer_siTIBHigh_Token_, SiTIBHighContainer );
394  if (!SiTIBHighContainer.isValid()) {
395  edm::LogError("TrackerHitProducer::analyze")
396  << "Unable to find TrackerHitsTIBHighTof in event!";
397  return;
398  }
400  // get Silicon TOB information
402  // extract TOB low container
403  edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
404  e.getByToken( edmPSimHitContainer_siTOBLow_Token_, SiTOBLowContainer );
405  if (!SiTOBLowContainer.isValid()) {
406  edm::LogError("TrackerHitProducer::analyze")
407  << "Unable to find TrackerHitsTOBLowTof in event!";
408  return;
409  }
411  // extract TOB high container
412  edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
413  e.getByToken( edmPSimHitContainer_siTOBHigh_Token_, SiTOBHighContainer );
414  if (!SiTOBHighContainer.isValid()) {
415  edm::LogError("TrackerHitProducer::analyze")
416  << "Unable to find TrackerHitsTOBHighTof in event!";
417  return;
418  }
419 
421  // get Silicon TID information
423  // extract TID low container
424  edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
425  e.getByToken( edmPSimHitContainer_siTIDLow_Token_, SiTIDLowContainer );
426  if (!SiTIDLowContainer.isValid()) {
427  edm::LogError("TrackerHitProducer::analyze")
428  << "Unable to find TrackerHitsTIDLowTof in event!";
429  return;
430  }
432  // extract TID high container
433  edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
434  e.getByToken( edmPSimHitContainer_siTIDHigh_Token_, SiTIDHighContainer );
435  if (!SiTIDHighContainer.isValid()) {
436  edm::LogError("TrackerHitProducer::analyze")
437  << "Unable to find TrackerHitsTIDHighTof in event!";
438  return;
439  }
441  // get Silicon TEC information
443  // extract TEC low container
444  edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
445  e.getByToken( edmPSimHitContainer_siTECLow_Token_, SiTECLowContainer );
446  if (!SiTECLowContainer.isValid()) {
447  edm::LogError("TrackerHitProducer::analyze")
448  << "Unable to find TrackerHitsTECLowTof in event!";
449  return;
450  }
452  // extract TEC high container
453  edm::Handle<edm::PSimHitContainer> SiTECHighContainer;
454  e.getByToken( edmPSimHitContainer_siTECHigh_Token_, SiTECHighContainer );
455  if (!SiTECHighContainer.isValid()) {
456  edm::LogError("TrackerHitProducer::analyze")
457  << "Unable to find TrackerHitsTECHighTof in event!";
458  return;
459  }
460 
462  // get G4Track information
464 
466  e.getByToken( edmSimTrackContainerToken_, G4TrkContainer );
467  if (!G4TrkContainer.isValid()) {
468  edm::LogError("TrackerHitAnalyzer::analyze")
469  << "Unable to find SimTrack in event!";
470  return;
471  }
472 
473  // Get geometry information
474 
476  c.get<TrackerDigiGeometryRecord>().get( tracker );
477 
478 
479 
480  int ir = -100;
481  edm::SimTrackContainer::const_iterator itTrk;
482  for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
483  ++itTrk) {
484 
485 // std::cout << "itTrk = "<< itTrk << std::endl;
486  double eta =0, p =0;
487  const CLHEP::HepLorentzVector& G4Trk = CLHEP::HepLorentzVector(itTrk->momentum().x(),
488  itTrk->momentum().y(),
489  itTrk->momentum().z(),
490  itTrk->momentum().e());
491  p =sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]+G4Trk[2]*G4Trk[2]);
492  if ( p == 0)
493  edm::LogError("TrackerHitAnalyzer::analyze")
494  << "TrackerTest::INFO: Primary has p = 0 ";
495  else {
496  double costheta = G4Trk[2]/p;
497  double theta = acos(TMath::Min(TMath::Max(costheta, -1.),1.));
498  eta = -log(tan(theta/2));
499 
500  if (eta>0.0 && eta<=0.5) ir = 0;
501  if (eta>0.5 && eta<=1.0) ir = 1;
502  if (eta>1.0 && eta<=1.5) ir = 2;
503  if (eta>1.5 && eta<=2.0) ir = 3;
504  if (eta>2.0 && eta<=2.5) ir = 4;
505  if (eta>2.5) ir = 5;
506 
507  if (eta>-0.5 && eta<= 0.0) ir = 6;
508  if (eta>-1.0 && eta<=-0.5) ir = 7;
509  if (eta>-1.5 && eta<=-1.0) ir = 8;
510  if (eta>-2.0 && eta<=-1.5) ir = 9;
511  if (eta>-2.5 && eta<=-2.0) ir = 10;
512  if (eta<=-2.5) ir = 11;
513 // edm::LogInfo("EventInfo") << " eta = " << eta << " ir = " << ir;
514 // std::cout << " " << std::endl;
515 // std::cout << "eta " << eta << " ir = " << ir << std::endl;
516 // std::cout << " " << std::endl;
517  }
518  }
520  // get Pixel information
522  for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
523  DetId detid=DetId(itHit->detUnitId());
524  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
525  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
526  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
527  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
528  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
529  htofz->Fill(gpos.z(), itHit->timeOfFlight());
530 
531  h5e[ir]->Fill(itHit->energyLoss());
532  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
533  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
534  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
535  h5lx[ir]->Fill(itHit->localPosition().x());
536  h5ly[ir]->Fill(itHit->localPosition().y());
537  }
538  for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->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 
548  h5e[ir]->Fill(itHit->energyLoss());
549  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
550  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
551  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
552  h5lx[ir]->Fill(itHit->localPosition().x());
553  h5ly[ir]->Fill(itHit->localPosition().y());
554  }
555  for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
556  DetId detid=DetId(itHit->detUnitId());
557  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
558  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
559  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
560  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
561  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
562  htofz->Fill(gpos.z(), itHit->timeOfFlight());
563 
564 
565  h6e[ir]->Fill(itHit->energyLoss());
566  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
567  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
568  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
569  h6lx[ir]->Fill(itHit->localPosition().x());
570  h6ly[ir]->Fill(itHit->localPosition().y());
571  }
572  for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
573  DetId detid=DetId(itHit->detUnitId());
574  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
575  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
576  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
577  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
578  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
579  htofz->Fill(gpos.z(), itHit->timeOfFlight());
580 
581 
582  h6e[ir]->Fill(itHit->energyLoss());
583  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
584  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
585  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
586  h6lx[ir]->Fill(itHit->localPosition().x());
587  h6ly[ir]->Fill(itHit->localPosition().y());
588  }
590  // get TIB information
592  for (itHit = SiTIBLowContainer->begin(); itHit != SiTIBLowContainer->end(); ++itHit) {
593  DetId detid=DetId(itHit->detUnitId());
594  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
595  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
596  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
597  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
598  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
599  htofz->Fill(gpos.z(), itHit->timeOfFlight());
600 
601 
602  h1e[ir]->Fill(itHit->energyLoss());
603  h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
604  h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
605  h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
606  h1lx[ir]->Fill(itHit->localPosition().x());
607  h1ly[ir]->Fill(itHit->localPosition().y());
608  }
609  for (itHit = SiTIBHighContainer->begin(); itHit != SiTIBHighContainer->end(); ++itHit) {
610  DetId detid=DetId(itHit->detUnitId());
611  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
612  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
613  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
614  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
615  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
616  htofz->Fill(gpos.z(), itHit->timeOfFlight());
617 
618 
619  h1e[ir]->Fill(itHit->energyLoss());
620  h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
621  h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
622  h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
623  h1lx[ir]->Fill(itHit->localPosition().x());
624  h1ly[ir]->Fill(itHit->localPosition().y());
625  }
627  // get TOB information
629  for (itHit = SiTOBLowContainer->begin(); itHit != SiTOBLowContainer->end(); ++itHit) {
630  DetId detid=DetId(itHit->detUnitId());
631  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
632  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
633  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
634  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
635  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
636  htofz->Fill(gpos.z(), itHit->timeOfFlight());
637 
638 
639  h2e[ir]->Fill(itHit->energyLoss());
640  h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
641  h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
642  h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
643  h2lx[ir]->Fill(itHit->localPosition().x());
644  h2ly[ir]->Fill(itHit->localPosition().y());
645  }
646  for (itHit = SiTOBHighContainer->begin(); itHit != SiTOBHighContainer->end(); ++itHit) {
647  DetId detid=DetId(itHit->detUnitId());
648  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
649  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
650  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
651  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
652  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
653  htofz->Fill(gpos.z(), itHit->timeOfFlight());
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  }
663  // get TID information
665  for (itHit = SiTIDLowContainer->begin(); itHit != SiTIDLowContainer->end(); ++itHit) {
666  DetId detid=DetId(itHit->detUnitId());
667  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
668  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
669  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
670  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
671  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
672  htofz->Fill(gpos.z(), itHit->timeOfFlight());
673 
674  h3e[ir]->Fill(itHit->energyLoss());
675  h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
676  h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
677  h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
678  h3lx[ir]->Fill(itHit->localPosition().x());
679  h3ly[ir]->Fill(itHit->localPosition().y());
680  }
681  for (itHit = SiTIDHighContainer->begin(); itHit != SiTIDHighContainer->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  }
698  // get TEC information
700  for (itHit = SiTECLowContainer->begin(); itHit != SiTECLowContainer->end(); ++itHit) {
701  DetId detid=DetId(itHit->detUnitId());
702  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
703  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
704  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
705  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
706  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
707  htofz->Fill(gpos.z(), itHit->timeOfFlight());
708 
709  h4e[ir]->Fill(itHit->energyLoss());
710  h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
711  h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
712  h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
713  h4lx[ir]->Fill(itHit->localPosition().x());
714  h4ly[ir]->Fill(itHit->localPosition().y());
715  }
716  for (itHit = SiTECHighContainer->begin(); itHit != SiTECHighContainer->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 
733 
734  return ;
735 
736 }
737 
739 
RunNumber_t run() const
Definition: EventID.h:39
MonitorElement * h1e[12]
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es)
EventNumber_t event() const
Definition: EventID.h:41
int i
Definition: DBlmapReader.cc:9
MonitorElement * h2lx[12]
MonitorElement * h4e[12]
MonitorElement * h1lx[12]
MonitorElement * h6ex[12]
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
MonitorElement * h1ey[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTECLow_Token_
MonitorElement * h3ly[12]
MonitorElement * h5ez[12]
MonitorElement * h4ex[12]
edm::EDGetTokenT< edm::SimTrackContainer > edmSimTrackContainerToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * h1ez[12]
MonitorElement * h3ez[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlBrlLow_Token_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Geom::Theta< T > theta() const
MonitorElement * h5ey[12]
#define NULL
Definition: scimark2.h:8
MonitorElement * h3lx[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTOBLow_Token_
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlFwdLow_Token_
T Min(T a, T b)
Definition: MathUtil.h:39
MonitorElement * htofr
MonitorElement * h6ly[12]
MonitorElement * h5ex[12]
MonitorElement * h5ly[12]
void Fill(long long x)
MonitorElement * htofeta
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIBLow_Token_
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTOBHigh_Token_
T mag() const
Definition: PV3DBase.h:67
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * h1ex[12]
T z() const
Definition: PV3DBase.h:64
MonitorElement * h2e[12]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Region
Definition: Region.h:7
MonitorElement * h6ey[12]
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
MonitorElement * h4lx[12]
~TrackerHitAnalyzer()
Destructor.
void setVerbose(unsigned level)
Definition: DQMStore.cc:670
bool isValid() const
Definition: HandleBase.h:75
MonitorElement * h2ex[12]
MonitorElement * h6ez[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIDLow_Token_
MonitorElement * h2ez[12]
MonitorElement * htofz
T Max(T a, T b)
Definition: MathUtil.h:44
Definition: DetId.h:18
MonitorElement * htofphi
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:273
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlBrlHigh_Token_
MonitorElement * h5lx[12]
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * h4ey[12]
MonitorElement * h1ly[12]
const T & get() const
Definition: EventSetup.h:56
MonitorElement * h4ly[12]
return(e1-e2)*(e1-e2)+dp *dp
T eta() const
Definition: PV3DBase.h:76
MonitorElement * h3ex[12]
edm::EventID id() const
Definition: EventBase.h:59
MonitorElement * h3ey[12]
MonitorElement * h2ey[12]
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2615
MonitorElement * h2ly[12]
MonitorElement * h3e[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIBHigh_Token_
std::vector< PSimHit > PSimHitContainer
volatile std::atomic< bool > shutdown_flag false
T degrees() const
Definition: Phi.h:54
void showDirStructure(void) const
Definition: DQMStore.cc:3410
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlFwdHigh_Token_
TrackerHitAnalyzer(const edm::ParameterSet &ps)
Constructor.
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTECHigh_Token_
MonitorElement * h6e[12]
std::vector< SimTrack > SimTrackContainer
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIDHigh_Token_
MonitorElement * h5e[12]
MonitorElement * h6lx[12]
Definition: Run.h:43
MonitorElement * h4ez[12]