CMS 3D CMS Logo

TrackerHitAnalyzer.cc
Go to the documentation of this file.
2 
9 
12 
15 
16 // tracker info
23 
24 // data in edm::event
27 //#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
31 
32 // helper files
33 #include <CLHEP/Vector/LorentzVector.h>
34 #include "CLHEP/Units/GlobalSystemOfUnits.h"
35 
36 #include <map>
37 #include <memory>
38 #include <cstdlib>
39 #include <vector>
40 
42  : verbose_( ps.getUntrackedParameter<bool>( "Verbosity",false ) )
43  , edmPSimHitContainer_pxlBrlLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlBrlLowSrc" ) ) )
44  , edmPSimHitContainer_pxlBrlHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlBrlHighSrc" ) ) )
45  , edmPSimHitContainer_pxlFwdLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlFwdLowSrc" ) ) )
46  , edmPSimHitContainer_pxlFwdHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlFwdHighSrc" ) ) )
47  , edmPSimHitContainer_siTIBLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIBLowSrc" ) ) )
48  , edmPSimHitContainer_siTIBHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIBHighSrc" ) ) )
49  , edmPSimHitContainer_siTOBLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTOBLowSrc" ) ) )
50  , edmPSimHitContainer_siTOBHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTOBHighSrc" ) ) )
51  , edmPSimHitContainer_siTIDLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIDLowSrc" ) ) )
52  , edmPSimHitContainer_siTIDHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIDHighSrc" ) ) )
53  , edmPSimHitContainer_siTECLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTECLowSrc" ) ) )
54  , edmPSimHitContainer_siTECHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTECHighSrc" ) ) )
55  , edmSimTrackContainerToken_( consumes<edm::SimTrackContainer>( ps.getParameter<edm::InputTag>( "G4TrkSrc" ) ) )
56  , fDBE( nullptr )
57  , conf_(ps)
58  , runStandalone ( ps.getParameter<bool>("runStandalone") )
59  , fOutputFile( ps.getUntrackedParameter<std::string>( "outputFile", "TrackerHitHisto.root" ) )
60  , pixelOutput ( ps.getParameter<bool>("pixelOutput") ) {
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 != nullptr ) {
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  if ( pixelOutput ) sprintf (htitle5,"Energy loss in BPIX %s", Region[i]);
114  if ( pixelOutput ) 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  if ( pixelOutput ) sprintf (hname5,"Eloss_BPIX_%i",i+1);
121  if ( pixelOutput ) 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  if ( pixelOutput ) {
132  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
133  h5e[i] = ibooker.book1D (hname5, htitle5, nbin , 0.0 , 0.001*E2NEL);
134  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
135  h6e[i] = ibooker.book1D (hname6, htitle6, nbin , 0.0 , 0.001*E2NEL);
136  }
137 
138  }
139 
140 // limits
141 const float high[] = {0.03, 0.03, 0.02, 0.03, 0.03, 0.03};
142 const float low[] = {-0.03, -0.03, -0.02, -0.03, -0.03, -0.03};
143 
144  for(int i=0; i<12; i++) {
145 
146  sprintf (htitle1,"Entryx-Exitx in TIB %s", Region[i]);
147  sprintf (htitle2,"Entryx-Exitx in TOB %s", Region[i]);
148  sprintf (htitle3,"Entryx-Exitx in TID %s", Region[i]);
149  sprintf (htitle4,"Entryx-Exitx in TEC %s", Region[i]);
150  if ( pixelOutput ) sprintf (htitle5,"Entryx-Exitx in BPIX %s", Region[i]);
151  if ( pixelOutput ) sprintf (htitle6,"Entryx-Exitx in FPIX %s", Region[i]);
152 
153  sprintf (hname1,"Entryx-Exitx_TIB_%i",i+1);
154  sprintf (hname2,"Entryx-Exitx_TOB_%i",i+1);
155  sprintf (hname3,"Entryx-Exitx_TID_%i",i+1);
156  sprintf (hname4,"Entryx-Exitx_TEC_%i",i+1);
157  if ( pixelOutput ) sprintf (hname5,"Entryx-Exitx_BPIX_%i",i+1);
158  if ( pixelOutput ) sprintf (hname6,"Entryx-Exitx_FPIX_%i",i+1);
159 
160  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
161  h1ex[i] = ibooker.book1D (hname1, htitle1, nbin , low[0] , high[0]);
162  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
163  h2ex[i] = ibooker.book1D (hname2, htitle2, nbin , low[1] , high[1]);
164  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
165  h3ex[i] = ibooker.book1D (hname3, htitle3, nbin , low[2] , high[2]);
166  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
167  h4ex[i] = ibooker.book1D (hname4, htitle4, nbin , low[3] , high[3]);
168  if ( pixelOutput ) {
169  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
170  h5ex[i] = ibooker.book1D (hname5, htitle5, nbin , low[4] , high[4]);
171  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
172  h6ex[i] = ibooker.book1D (hname6, htitle6, nbin , low[5] , high[5]);
173  }
174 
175  }
176 
177 const float high0[] = {0.05, 0.06, 0.03, 0.03, 0.03, 0.03};
178 const float low0[] = {-0.05, -0.06, -0.03, -0.03, -0.03, -0.03};
179 
180  for(int i=0; i<12; i++) {
181 
182  sprintf (htitle1,"Entryy-Exity in TIB %s", Region[i]);
183  sprintf (htitle2,"Entryy-Exity in TOB %s", Region[i]);
184  sprintf (htitle3,"Entryy-Exity in TID %s", Region[i]);
185  sprintf (htitle4,"Entryy-Exity in TEC %s", Region[i]);
186  if ( pixelOutput ) sprintf (htitle5,"Entryy-Exity in BPIX %s", Region[i]);
187  if ( pixelOutput ) sprintf (htitle6,"Entryy-Exity in FPIX %s", Region[i]);
188 
189  sprintf (hname1,"Entryy-Exity_TIB_%i",i+1);
190  sprintf (hname2,"Entryy-Exity_TOB_%i",i+1);
191  sprintf (hname3,"Entryy-Exity_TID_%i",i+1);
192  sprintf (hname4,"Entryy-Exity_TEC_%i",i+1);
193  if ( pixelOutput ) sprintf (hname5,"Entryy-Exity_BPIX_%i",i+1);
194  if ( pixelOutput ) sprintf (hname6,"Entryy-Exity_FPIX_%i",i+1);
195 
196  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
197  h1ey[i] = ibooker.book1D (hname1, htitle1, nbin , low0[0] , high0[0]);
198  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
199  h2ey[i] = ibooker.book1D (hname2, htitle2, nbin , low0[1] , high0[1]);
200  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
201  h3ey[i] = ibooker.book1D (hname3, htitle3, nbin , low0[2] , high0[2]);
202  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
203  h4ey[i] = ibooker.book1D (hname4, htitle4, nbin , low0[3] , high0[3]);
204  if ( pixelOutput ) {
205  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
206  h5ey[i] = ibooker.book1D (hname5, htitle5, nbin , low0[4] , high0[4]);
207  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
208  h6ey[i] = ibooker.book1D (hname6, htitle6, nbin , low0[5] , high0[5]);
209  }
210 
211  }
212 
213 const float high1[] = {0.05, 0.06, 0.05, 0.06, 0.05, 0.05};
214 const float low1[] = {0.,0.,0.,0.,0.,0.};
215 
216  for(int i=0; i<12; i++) {
217 
218  sprintf (htitle1,"abs(Entryz-Exitz) in TIB %s", Region[i]);
219  sprintf (htitle2,"abs(Entryz-Exitz) in TOB %s", Region[i]);
220  sprintf (htitle3,"abs(Entryz-Exitz) in TID %s", Region[i]);
221  sprintf (htitle4,"abs(Entryz-Exitz) in TEC %s", Region[i]);
222  if ( pixelOutput ) sprintf (htitle5,"abs(Entryz-Exitz) in BPIX %s", Region[i]);
223  if ( pixelOutput ) sprintf (htitle6,"abs(Entryz-Exitz) in FPIX %s", Region[i]);
224 
225  sprintf (hname1,"Entryz-Exitz_TIB_%i",i+1);
226  sprintf (hname2,"Entryz-Exitz_TOB_%i",i+1);
227  sprintf (hname3,"Entryz-Exitz_TID_%i",i+1);
228  sprintf (hname4,"Entryz-Exitz_TEC_%i",i+1);
229  if ( pixelOutput ) sprintf (hname5,"Entryz-Exitz_BPIX_%i",i+1);
230  if ( pixelOutput ) sprintf (hname6,"Entryz-Exitz_FPIX_%i",i+1);
231 
232  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
233  h1ez[i] = ibooker.book1D (hname1, htitle1, nbin , low1[0] , high1[0]);
234  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
235  h2ez[i] = ibooker.book1D (hname2, htitle2, nbin , low1[1] , high1[1]);
236  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
237  h3ez[i] = ibooker.book1D (hname3, htitle3, nbin , low1[2] , high1[2]);
238  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
239  h4ez[i] = ibooker.book1D (hname4, htitle4, nbin , low1[3] , high1[3]);
240  if ( pixelOutput ) {
241  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
242  h5ez[i] = ibooker.book1D (hname5, htitle5, nbin , low1[4] , high1[4]);
243  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
244  h6ez[i] = ibooker.book1D (hname6, htitle6, nbin , low1[5] , high1[5]);
245  }
246 
247  }
248 
249 
250 const float high2[] = {3.2, 5.0, 5.5, 6.2, 0.85, 0.5};
251 const float low2[] = {-3.2, -5.0, -5.5, -6.2, -0.85, -0.5};
252 
253  for(int i=0; i<12; i++) {
254 
255  sprintf (htitle1,"Localx in TIB %s", Region[i]);
256  sprintf (htitle2,"Localx in TOB %s", Region[i]);
257  sprintf (htitle3,"Localx in TID %s", Region[i]);
258  sprintf (htitle4,"Localx in TEC %s", Region[i]);
259  if ( pixelOutput ) sprintf (htitle5,"Localx in BPIX %s", Region[i]);
260  if ( pixelOutput ) sprintf (htitle6,"Localx in FPIX %s", Region[i]);
261 
262  sprintf (hname1,"Localx_TIB_%i",i+1);
263  sprintf (hname2,"Localx_TOB_%i",i+1);
264  sprintf (hname3,"Localx_TID_%i",i+1);
265  sprintf (hname4,"Localx_TEC_%i",i+1);
266  if ( pixelOutput ) sprintf (hname5,"Localx_BPIX_%i",i+1);
267  if ( pixelOutput ) sprintf (hname6,"Localx_FPIX_%i",i+1);
268 
269  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
270  h1lx[i] = ibooker.book1D (hname1, htitle1, nbin , low2[0] , high2[0]);
271  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
272  h2lx[i] = ibooker.book1D (hname2, htitle2, nbin , low2[1] , high2[1]);
273  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
274  h3lx[i] = ibooker.book1D (hname3, htitle3, nbin , low2[2] , high2[2]);
275  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
276  h4lx[i] = ibooker.book1D (hname4, htitle4, nbin , low2[3] , high2[3]);
277  if ( pixelOutput ) {
278  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
279  h5lx[i] = ibooker.book1D (hname5, htitle5, nbin , low2[4] , high2[4]);
280  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
281  h6lx[i] = ibooker.book1D (hname6, htitle6, nbin , low2[5] , high2[5]);
282  }
283 
284  }
285 
286 
287 const float high3[] = {6.0, 10., 5.6, 10.5, 3.4, 0.52};
288 const float low3[] = {-6.0, -10., -5.6, -10.5, -3.4, -0.52};
289 
290  for(int i=0; i<12; i++) {
291 
292  sprintf (htitle1,"Localy in TIB %s", Region[i]);
293  sprintf (htitle2,"Localy in TOB %s", Region[i]);
294  sprintf (htitle3,"Localy in TID %s", Region[i]);
295  sprintf (htitle4,"Localy in TEC %s", Region[i]);
296  if ( pixelOutput ) sprintf (htitle5,"Localy in BPIX %s", Region[i]);
297  if ( pixelOutput ) sprintf (htitle6,"Localy in FPIX %s", Region[i]);
298 
299  sprintf (hname1,"Localy_TIB_%i",i+1);
300  sprintf (hname2,"Localy_TOB_%i",i+1);
301  sprintf (hname3,"Localy_TID_%i",i+1);
302  sprintf (hname4,"Localy_TEC_%i",i+1);
303  if ( pixelOutput ) sprintf (hname5,"Localy_BPIX_%i",i+1);
304  if ( pixelOutput ) sprintf (hname6,"Localy_FPIX_%i",i+1);
305 
306  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
307  h1ly[i] = ibooker.book1D (hname1, htitle1, nbin , low3[0] , high3[0]);
308  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
309  h2ly[i] = ibooker.book1D (hname2, htitle2, nbin , low3[1] , high3[1]);
310  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
311  h3ly[i] = ibooker.book1D (hname3, htitle3, nbin , low3[2] , high3[2]);
312  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
313  h4ly[i] = ibooker.book1D (hname4, htitle4, nbin , low3[3] , high3[3]);
314  if ( pixelOutput ) {
315  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
316  h5ly[i] = ibooker.book1D (hname5, htitle5, nbin , low3[4] , high3[4]);
317  ibooker.setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
318  h6ly[i] = ibooker.book1D (hname6, htitle6, nbin , low3[5] , high3[5]);
319  }
320 
321  }
322 
323  }
324 }
325 
327 {
328  // don't try to delete any pointers - they're handled by DQM machinery
329 }
330 
331 
332 
334  //According to the previous code some profile plots were created here
335  //However, these profile plots are not in the final root file
336  //For now we comment out these plots (since they are not created in any case)
337  //Then, if needed we will consider moving the booking of the profileplots to the bookHistograms function
338  //and here we will do the profile
339 
340  //Save root file only in standalone mode
341  if ( runStandalone && !fOutputFile.empty() && fDBE ){ fDBE->save(fOutputFile);}
342 }
343 
344 
346 {
347 
348  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
349 
350  // iterator to access containers
351  edm::PSimHitContainer::const_iterator itHit;
353  // get Pixel Barrel information
355  // extract low container
356  edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
357  e.getByToken( edmPSimHitContainer_pxlBrlLow_Token_, PxlBrlLowContainer );
358  if (!PxlBrlLowContainer.isValid()) {
359  edm::LogError("TrackerHitAnalyzer::analyze")
360  << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
361  return;
362  }
363  // extract high container
364  edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
365  e.getByToken( edmPSimHitContainer_pxlBrlHigh_Token_, PxlBrlHighContainer );
366  if (!PxlBrlHighContainer.isValid()) {
367  edm::LogError("TrackerHitAnalyzer::analyze")
368  << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
369  return;
370  }
372  // get Pixel Forward information
374  // extract low container
375  edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
376  e.getByToken( edmPSimHitContainer_pxlFwdLow_Token_, PxlFwdLowContainer );
377  if (!PxlFwdLowContainer.isValid()) {
378  edm::LogError("TrackerHitAnalyzer::analyze")
379  << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
380  return;
381  }
382  // extract high container
383  edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
384  e.getByToken( edmPSimHitContainer_pxlFwdHigh_Token_, PxlFwdHighContainer );
385  if (!PxlFwdHighContainer.isValid()) {
386  edm::LogError("TrackerHitAnalyzer::analyze")
387  << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
388  return;
389  }
391  // get Silicon TIB information
393  // extract TIB low container
394  edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
395  e.getByToken( edmPSimHitContainer_siTIBLow_Token_, SiTIBLowContainer );
396  if (!SiTIBLowContainer.isValid()) {
397  edm::LogError("TrackerHitProducer::analyze")
398  << "Unable to find TrackerHitsTIBLowTof in event!";
399  return;
400  }
402  // extract TIB high container
403  edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
404  e.getByToken( edmPSimHitContainer_siTIBHigh_Token_, SiTIBHighContainer );
405  if (!SiTIBHighContainer.isValid()) {
406  edm::LogError("TrackerHitProducer::analyze")
407  << "Unable to find TrackerHitsTIBHighTof in event!";
408  return;
409  }
411  // get Silicon TOB information
413  // extract TOB low container
414  edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
415  e.getByToken( edmPSimHitContainer_siTOBLow_Token_, SiTOBLowContainer );
416  if (!SiTOBLowContainer.isValid()) {
417  edm::LogError("TrackerHitProducer::analyze")
418  << "Unable to find TrackerHitsTOBLowTof in event!";
419  return;
420  }
422  // extract TOB high container
423  edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
424  e.getByToken( edmPSimHitContainer_siTOBHigh_Token_, 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  e.getByToken( edmPSimHitContainer_siTIDLow_Token_, SiTIDLowContainer );
437  if (!SiTIDLowContainer.isValid()) {
438  edm::LogError("TrackerHitProducer::analyze")
439  << "Unable to find TrackerHitsTIDLowTof in event!";
440  return;
441  }
443  // extract TID high container
444  edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
445  e.getByToken( edmPSimHitContainer_siTIDHigh_Token_, SiTIDHighContainer );
446  if (!SiTIDHighContainer.isValid()) {
447  edm::LogError("TrackerHitProducer::analyze")
448  << "Unable to find TrackerHitsTIDHighTof in event!";
449  return;
450  }
452  // get Silicon TEC information
454  // extract TEC low container
455  edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
456  e.getByToken( edmPSimHitContainer_siTECLow_Token_, SiTECLowContainer );
457  if (!SiTECLowContainer.isValid()) {
458  edm::LogError("TrackerHitProducer::analyze")
459  << "Unable to find TrackerHitsTECLowTof in event!";
460  return;
461  }
463  // extract TEC high container
464  edm::Handle<edm::PSimHitContainer> SiTECHighContainer;
465  e.getByToken( edmPSimHitContainer_siTECHigh_Token_, SiTECHighContainer );
466  if (!SiTECHighContainer.isValid()) {
467  edm::LogError("TrackerHitProducer::analyze")
468  << "Unable to find TrackerHitsTECHighTof in event!";
469  return;
470  }
471 
473  // get G4Track information
475 
477  e.getByToken( edmSimTrackContainerToken_, G4TrkContainer );
478  if (!G4TrkContainer.isValid()) {
479  edm::LogError("TrackerHitAnalyzer::analyze")
480  << "Unable to find SimTrack in event!";
481  return;
482  }
483 
484  // Get geometry information
485 
487  c.get<TrackerDigiGeometryRecord>().get( tracker );
488 
489 
490 
491  int ir = -100;
492  edm::SimTrackContainer::const_iterator itTrk;
493  for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
494  ++itTrk) {
495 
496 // std::cout << "itTrk = "<< itTrk << std::endl;
497  double eta =0, p =0;
498  const CLHEP::HepLorentzVector& G4Trk = CLHEP::HepLorentzVector(itTrk->momentum().x(),
499  itTrk->momentum().y(),
500  itTrk->momentum().z(),
501  itTrk->momentum().e());
502  p =sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]+G4Trk[2]*G4Trk[2]);
503  if ( p == 0)
504  edm::LogError("TrackerHitAnalyzer::analyze")
505  << "TrackerTest::INFO: Primary has p = 0 ";
506  else {
507  double costheta = G4Trk[2]/p;
508  double theta = acos(TMath::Min(TMath::Max(costheta, -1.),1.));
509  eta = -log(tan(theta/2));
510 
511  if (eta>0.0 && eta<=0.5) ir = 0;
512  if (eta>0.5 && eta<=1.0) ir = 1;
513  if (eta>1.0 && eta<=1.5) ir = 2;
514  if (eta>1.5 && eta<=2.0) ir = 3;
515  if (eta>2.0 && eta<=2.5) ir = 4;
516  if (eta>2.5) ir = 5;
517 
518  if (eta>-0.5 && eta<= 0.0) ir = 6;
519  if (eta>-1.0 && eta<=-0.5) ir = 7;
520  if (eta>-1.5 && eta<=-1.0) ir = 8;
521  if (eta>-2.0 && eta<=-1.5) ir = 9;
522  if (eta>-2.5 && eta<=-2.0) ir = 10;
523  if (eta<=-2.5) ir = 11;
524 // edm::LogInfo("EventInfo") << " eta = " << eta << " ir = " << ir;
525 // std::cout << " " << std::endl;
526 // std::cout << "eta " << eta << " ir = " << ir << std::endl;
527 // std::cout << " " << std::endl;
528  }
529  }
531  // get Pixel information
533  // If Phase 1, do not run - will run in new Phase 1 module
534 
535  if ( pixelOutput ) {
536  for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
537  DetId detid=DetId(itHit->detUnitId());
538  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
539  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
540  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
541  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
542  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
543  htofz->Fill(gpos.z(), itHit->timeOfFlight());
544 
545  h5e[ir]->Fill(itHit->energyLoss());
546  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
547  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
548  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
549  h5lx[ir]->Fill(itHit->localPosition().x());
550  h5ly[ir]->Fill(itHit->localPosition().y());
551  }
552  for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->end(); ++itHit) {
553  DetId detid=DetId(itHit->detUnitId());
554  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
555  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
556  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
557  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
558  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
559  htofz->Fill(gpos.z(), itHit->timeOfFlight());
560 
561 
562  h5e[ir]->Fill(itHit->energyLoss());
563  h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
564  h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
565  h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
566  h5lx[ir]->Fill(itHit->localPosition().x());
567  h5ly[ir]->Fill(itHit->localPosition().y());
568  }
569  for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
570  DetId detid=DetId(itHit->detUnitId());
571  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
572  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
573  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
574  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
575  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
576  htofz->Fill(gpos.z(), itHit->timeOfFlight());
577 
578 
579  h6e[ir]->Fill(itHit->energyLoss());
580  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
581  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
582  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
583  h6lx[ir]->Fill(itHit->localPosition().x());
584  h6ly[ir]->Fill(itHit->localPosition().y());
585  }
586  for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
587  DetId detid=DetId(itHit->detUnitId());
588  const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
589  GlobalPoint gpos=det->toGlobal(itHit->localPosition());
590  htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
591  htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
592  htofr->Fill(gpos.mag(), itHit->timeOfFlight());
593  htofz->Fill(gpos.z(), itHit->timeOfFlight());
594 
595 
596  h6e[ir]->Fill(itHit->energyLoss());
597  h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
598  h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
599  h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
600  h6lx[ir]->Fill(itHit->localPosition().x());
601  h6ly[ir]->Fill(itHit->localPosition().y());
602  }
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:39
MonitorElement * h1e[12]
EventNumber_t event() const
Definition: EventID.h:41
void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &run, const edm::EventSetup &es) override
MonitorElement * h2lx[12]
MonitorElement * h4e[12]
MonitorElement * h1lx[12]
MonitorElement * h6ex[12]
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:519
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * h1ez[12]
~TrackerHitAnalyzer() override
Destructor.
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]
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
#define nullptr
MonitorElement * h6ly[12]
MonitorElement * h5ex[12]
MonitorElement * h5ly[12]
void Fill(long long x)
MonitorElement * htofeta
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIBLow_Token_
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
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:118
Region
Definition: Region.h:7
MonitorElement * h6ey[12]
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
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")
Definition: DQMStore.cc:2555
MonitorElement * h4lx[12]
void setVerbose(unsigned level)
Definition: DQMStore.cc:552
bool isValid() const
Definition: HandleBase.h:74
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 showDirStructure() const
Definition: DQMStore.cc:3428
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlBrlHigh_Token_
MonitorElement * h5lx[12]
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
MonitorElement * h4ey[12]
MonitorElement * h1ly[12]
const T & get() const
Definition: EventSetup.h:59
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:60
MonitorElement * h3ey[12]
HLT enums.
MonitorElement * h2ey[12]
MonitorElement * h2ly[12]
MonitorElement * h3e[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIBHigh_Token_
std::vector< PSimHit > PSimHitContainer
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_
void endJob() override
MonitorElement * h5e[12]
MonitorElement * h6lx[12]
Definition: Run.h:43
MonitorElement * h4ez[12]