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 
10 
13 
16 
17 // tracker info
25 
26 // data in edm::event
29 //#include "SimDataFormats/Vertex/interface/SimVertexContainer.h"
33 
34 // helper files
35 #include <CLHEP/Vector/LorentzVector.h>
36 #include "CLHEP/Units/GlobalSystemOfUnits.h"
37 
38 #include <map>
39 #include <memory>
40 #include <stdlib.h>
41 #include <vector>
42 
44  : verbose_( ps.getUntrackedParameter<bool>( "Verbosity",false ) )
45  , edmPSimHitContainer_pxlBrlLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlBrlLowSrc" ) ) )
46  , edmPSimHitContainer_pxlBrlHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlBrlHighSrc" ) ) )
47  , edmPSimHitContainer_pxlFwdLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlFwdLowSrc" ) ) )
48  , edmPSimHitContainer_pxlFwdHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "PxlFwdHighSrc" ) ) )
49  , edmPSimHitContainer_siTIBLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIBLowSrc" ) ) )
50  , edmPSimHitContainer_siTIBHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIBHighSrc" ) ) )
51  , edmPSimHitContainer_siTOBLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTOBLowSrc" ) ) )
52  , edmPSimHitContainer_siTOBHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTOBHighSrc" ) ) )
53  , edmPSimHitContainer_siTIDLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIDLowSrc" ) ) )
54  , edmPSimHitContainer_siTIDHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTIDHighSrc" ) ) )
55  , edmPSimHitContainer_siTECLow_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTECLowSrc" ) ) )
56  , edmPSimHitContainer_siTECHigh_Token_( consumes<edm::PSimHitContainer>( ps.getParameter<edm::InputTag>( "SiTECHighSrc" ) ) )
57  , edmSimTrackContainerToken_( consumes<edm::SimTrackContainer>( ps.getParameter<edm::InputTag>( "G4TrkSrc" ) ) )
58  , fDBE( NULL )
59  , fOutputFile( ps.getUntrackedParameter<std::string>( "outputFile", "TrackerHitHisto.root" ) ) {
60 }
61 
65 
66  Char_t hname1[50], htitle1[80];
67  Char_t hname2[50], htitle2[80];
68  Char_t hname3[50], htitle3[80];
69  Char_t hname4[50], htitle4[80];
70  Char_t hname5[50], htitle5[80];
71  Char_t hname6[50], htitle6[80];
72 
73  if ( fDBE ) {
74  if ( verbose_ ) {
75  fDBE->setVerbose(1);
76  } else {
77  fDBE->setVerbose(0);
78  }
79  }
80 
81  if ( fDBE) {
82  if ( verbose_ ) fDBE->showDirStructure();
83  }
84 
85  if ( fDBE != NULL ) {
86 // fDBE->setCurrentFolder("TrackerHitsV/TrackerHitTask");
87 
88  // is there any way to record CPU Info ???
89  // if so, it can be done once - via beginJob()
90  int nbin = 5000;
91 
92  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/");
93  htofeta = fDBE->book2D ("tof_eta", "Time of flight vs eta", nbin , -3.0 , 3.0,200,-100,100);
94  htofphi = fDBE->book2D("tof_phi", "Time of flight vs phi", nbin,-180,180,200,-100,100);
95  htofr = fDBE->book2D("tof_r", "Time of flight vs r", nbin , 0 , 300, 200, -100,100);
96  htofz = fDBE->book2D("tof_z", "Time of flight vs z", nbin , -280 , 280, 200, -100,100);
97 
98 
99  const float E2NEL = 1.;
100 
101  const char *Region[] = {"005","051","115","152","225","253",
102  "-050","-105","-151","-215","-252","-325"};
103  nbin = 10000;
104 
105 // Energy loss histograms
106  for(int i=0; i<12; i++) {
107 
108  sprintf (htitle1,"Energy loss in TIB %s", Region[i]);
109  sprintf (htitle2,"Energy loss in TOB %s", Region[i]);
110  sprintf (htitle3,"Energy loss in TID %s", Region[i]);
111  sprintf (htitle4,"Energy loss in TEC %s", Region[i]);
112  sprintf (htitle5,"Energy loss in BPIX %s", Region[i]);
113  sprintf (htitle6,"Energy loss in FPIX %s", Region[i]);
114 
115  sprintf (hname1,"Eloss_TIB_%i",i+1);
116  sprintf (hname2,"Eloss_TOB_%i",i+1);
117  sprintf (hname3,"Eloss_TID_%i",i+1);
118  sprintf (hname4,"Eloss_TEC_%i",i+1);
119  sprintf (hname5,"Eloss_BPIX_%i",i+1);
120  sprintf (hname6,"Eloss_FPIX_%i",i+1);
121 
122  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
123  h1e[i] = fDBE->book1D (hname1, htitle1, nbin , 0.0 , 0.001*E2NEL);
124  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
125  h2e[i] = fDBE->book1D (hname2, htitle2, nbin , 0.0 , 0.001*E2NEL);
126  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
127  h3e[i] = fDBE->book1D (hname3, htitle3, nbin , 0.0 , 0.001*E2NEL);
128  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
129  h4e[i] = fDBE->book1D (hname4, htitle4, nbin , 0.0 , 0.001*E2NEL);
130  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
131  h5e[i] = fDBE->book1D (hname5, htitle5, nbin , 0.0 , 0.001*E2NEL);
132  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
133  h6e[i] = fDBE->book1D (hname6, htitle6, nbin , 0.0 , 0.001*E2NEL);
134 
135  }
136 
137 // limits
138 const float high[] = {0.03, 0.03, 0.02, 0.03, 0.03, 0.03};
139 const float low[] = {-0.03, -0.03, -0.02, -0.03, -0.03, -0.03};
140 
141  for(int i=0; i<12; i++) {
142 
143  sprintf (htitle1,"Entryx-Exitx in TIB %s", Region[i]);
144  sprintf (htitle2,"Entryx-Exitx in TOB %s", Region[i]);
145  sprintf (htitle3,"Entryx-Exitx in TID %s", Region[i]);
146  sprintf (htitle4,"Entryx-Exitx in TEC %s", Region[i]);
147  sprintf (htitle5,"Entryx-Exitx in BPIX %s", Region[i]);
148  sprintf (htitle6,"Entryx-Exitx in FPIX %s", Region[i]);
149 
150  sprintf (hname1,"Entryx-Exitx_TIB_%i",i+1);
151  sprintf (hname2,"Entryx-Exitx_TOB_%i",i+1);
152  sprintf (hname3,"Entryx-Exitx_TID_%i",i+1);
153  sprintf (hname4,"Entryx-Exitx_TEC_%i",i+1);
154  sprintf (hname5,"Entryx-Exitx_BPIX_%i",i+1);
155  sprintf (hname6,"Entryx-Exitx_FPIX_%i",i+1);
156 
157  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
158  h1ex[i] = fDBE->book1D (hname1, htitle1, nbin , low[0] , high[0]);
159  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
160  h2ex[i] = fDBE->book1D (hname2, htitle2, nbin , low[1] , high[1]);
161  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
162  h3ex[i] = fDBE->book1D (hname3, htitle3, nbin , low[2] , high[2]);
163  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
164  h4ex[i] = fDBE->book1D (hname4, htitle4, nbin , low[3] , high[3]);
165  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
166  h5ex[i] = fDBE->book1D (hname5, htitle5, nbin , low[4] , high[4]);
167  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
168  h6ex[i] = fDBE->book1D (hname6, htitle6, nbin , low[5] , high[5]);
169 
170  }
171 
172 const float high0[] = {0.05, 0.06, 0.03, 0.03, 0.03, 0.03};
173 const float low0[] = {-0.05, -0.06, -0.03, -0.03, -0.03, -0.03};
174 
175  for(int i=0; i<12; i++) {
176 
177  sprintf (htitle1,"Entryy-Exity in TIB %s", Region[i]);
178  sprintf (htitle2,"Entryy-Exity in TOB %s", Region[i]);
179  sprintf (htitle3,"Entryy-Exity in TID %s", Region[i]);
180  sprintf (htitle4,"Entryy-Exity in TEC %s", Region[i]);
181  sprintf (htitle5,"Entryy-Exity in BPIX %s", Region[i]);
182  sprintf (htitle6,"Entryy-Exity in FPIX %s", Region[i]);
183 
184  sprintf (hname1,"Entryy-Exity_TIB_%i",i+1);
185  sprintf (hname2,"Entryy-Exity_TOB_%i",i+1);
186  sprintf (hname3,"Entryy-Exity_TID_%i",i+1);
187  sprintf (hname4,"Entryy-Exity_TEC_%i",i+1);
188  sprintf (hname5,"Entryy-Exity_BPIX_%i",i+1);
189  sprintf (hname6,"Entryy-Exity_FPIX_%i",i+1);
190 
191  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
192  h1ey[i] = fDBE->book1D (hname1, htitle1, nbin , low0[0] , high0[0]);
193  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
194  h2ey[i] = fDBE->book1D (hname2, htitle2, nbin , low0[1] , high0[1]);
195  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
196  h3ey[i] = fDBE->book1D (hname3, htitle3, nbin , low0[2] , high0[2]);
197  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
198  h4ey[i] = fDBE->book1D (hname4, htitle4, nbin , low0[3] , high0[3]);
199  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
200  h5ey[i] = fDBE->book1D (hname5, htitle5, nbin , low0[4] , high0[4]);
201  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
202  h6ey[i] = fDBE->book1D (hname6, htitle6, nbin , low0[5] , high0[5]);
203 
204  }
205 
206 const float high1[] = {0.05, 0.06, 0.05, 0.06, 0.05, 0.05};
207 const float low1[] = {0.,0.,0.,0.,0.,0.};
208 
209  for(int i=0; i<12; i++) {
210 
211  sprintf (htitle1,"abs(Entryz-Exitz) in TIB %s", Region[i]);
212  sprintf (htitle2,"abs(Entryz-Exitz) in TOB %s", Region[i]);
213  sprintf (htitle3,"abs(Entryz-Exitz) in TID %s", Region[i]);
214  sprintf (htitle4,"abs(Entryz-Exitz) in TEC %s", Region[i]);
215  sprintf (htitle5,"abs(Entryz-Exitz) in BPIX %s", Region[i]);
216  sprintf (htitle6,"abs(Entryz-Exitz) in FPIX %s", Region[i]);
217 
218  sprintf (hname1,"Entryz-Exitz_TIB_%i",i+1);
219  sprintf (hname2,"Entryz-Exitz_TOB_%i",i+1);
220  sprintf (hname3,"Entryz-Exitz_TID_%i",i+1);
221  sprintf (hname4,"Entryz-Exitz_TEC_%i",i+1);
222  sprintf (hname5,"Entryz-Exitz_BPIX_%i",i+1);
223  sprintf (hname6,"Entryz-Exitz_FPIX_%i",i+1);
224 
225  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
226  h1ez[i] = fDBE->book1D (hname1, htitle1, nbin , low1[0] , high1[0]);
227  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
228  h2ez[i] = fDBE->book1D (hname2, htitle2, nbin , low1[1] , high1[1]);
229  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
230  h3ez[i] = fDBE->book1D (hname3, htitle3, nbin , low1[2] , high1[2]);
231  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
232  h4ez[i] = fDBE->book1D (hname4, htitle4, nbin , low1[3] , high1[3]);
233  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
234  h5ez[i] = fDBE->book1D (hname5, htitle5, nbin , low1[4] , high1[4]);
235  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
236  h6ez[i] = fDBE->book1D (hname6, htitle6, nbin , low1[5] , high1[5]);
237 
238  }
239 
240 
241 const float high2[] = {3.2, 5.0, 5.5, 6.2, 0.85, 0.5};
242 const float low2[] = {-3.2, -5.0, -5.5, -6.2, -0.85, -0.5};
243 
244  for(int i=0; i<12; i++) {
245 
246  sprintf (htitle1,"Localx in TIB %s", Region[i]);
247  sprintf (htitle2,"Localx in TOB %s", Region[i]);
248  sprintf (htitle3,"Localx in TID %s", Region[i]);
249  sprintf (htitle4,"Localx in TEC %s", Region[i]);
250  sprintf (htitle5,"Localx in BPIX %s", Region[i]);
251  sprintf (htitle6,"Localx in FPIX %s", Region[i]);
252 
253  sprintf (hname1,"Localx_TIB_%i",i+1);
254  sprintf (hname2,"Localx_TOB_%i",i+1);
255  sprintf (hname3,"Localx_TID_%i",i+1);
256  sprintf (hname4,"Localx_TEC_%i",i+1);
257  sprintf (hname5,"Localx_BPIX_%i",i+1);
258  sprintf (hname6,"Localx_FPIX_%i",i+1);
259 
260  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
261  h1lx[i] = fDBE->book1D (hname1, htitle1, nbin , low2[0] , high2[0]);
262  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
263  h2lx[i] = fDBE->book1D (hname2, htitle2, nbin , low2[1] , high2[1]);
264  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
265  h3lx[i] = fDBE->book1D (hname3, htitle3, nbin , low2[2] , high2[2]);
266  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
267  h4lx[i] = fDBE->book1D (hname4, htitle4, nbin , low2[3] , high2[3]);
268  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
269  h5lx[i] = fDBE->book1D (hname5, htitle5, nbin , low2[4] , high2[4]);
270  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
271  h6lx[i] = fDBE->book1D (hname6, htitle6, nbin , low2[5] , high2[5]);
272 
273  }
274 
275 
276 const float high3[] = {6.0, 10., 5.6, 10.5, 3.4, 0.52};
277 const float low3[] = {-6.0, -10., -5.6, -10.5, -3.4, -0.52};
278 
279  for(int i=0; i<12; i++) {
280 
281  sprintf (htitle1,"Localy in TIB %s", Region[i]);
282  sprintf (htitle2,"Localy in TOB %s", Region[i]);
283  sprintf (htitle3,"Localy in TID %s", Region[i]);
284  sprintf (htitle4,"Localy in TEC %s", Region[i]);
285  sprintf (htitle5,"Localy in BPIX %s", Region[i]);
286  sprintf (htitle6,"Localy in FPIX %s", Region[i]);
287 
288  sprintf (hname1,"Localy_TIB_%i",i+1);
289  sprintf (hname2,"Localy_TOB_%i",i+1);
290  sprintf (hname3,"Localy_TID_%i",i+1);
291  sprintf (hname4,"Localy_TEC_%i",i+1);
292  sprintf (hname5,"Localy_BPIX_%i",i+1);
293  sprintf (hname6,"Localy_FPIX_%i",i+1);
294 
295  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
296  h1ly[i] = fDBE->book1D (hname1, htitle1, nbin , low3[0] , high3[0]);
297  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
298  h2ly[i] = fDBE->book1D (hname2, htitle2, nbin , low3[1] , high3[1]);
299  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
300  h3ly[i] = fDBE->book1D (hname3, htitle3, nbin , low3[2] , high3[2]);
301  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
302  h4ly[i] = fDBE->book1D (hname4, htitle4, nbin , low3[3] , high3[3]);
303  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
304  h5ly[i] = fDBE->book1D (hname5, htitle5, nbin , low3[4] , high3[4]);
305  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
306  h6ly[i] = fDBE->book1D (hname6, htitle6, nbin , low3[5] , high3[5]);
307 
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 {
323  //before check that histos are there....
324 
325  // check if ME still there (and not killed by MEtoEDM for memory saving)
326  if( fDBE )
327  {
328  // check existence of first histo in the list
329  if (! fDBE->get("TrackerHitsV/TrackerHit/tof_eta")) return;
330  }
331  else
332  return;
333 
334  fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/");
335  htofeta_profile = fDBE->bookProfile ("tof_eta_profile",htofeta->getTH2F()->ProfileX());
336  htofphi_profile = fDBE->bookProfile("tof_phi_profile", htofphi->getTH2F()->ProfileX());
337  htofr_profile = fDBE->bookProfile("tof_r_profile",htofr->getTH2F()->ProfileX());
338  htofz_profile = fDBE->bookProfile("tof_z_profile", htofz->getTH2F()->ProfileX());
339 
340 
341  if ( fOutputFile.size() != 0 && fDBE ) fDBE->save(fOutputFile);
342 
343  return ;
344 
345 }
346 
347 
349 {
350 
351  edm::LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
352 
353  // iterator to access containers
354  edm::PSimHitContainer::const_iterator itHit;
356  // get Pixel Barrel information
358  // extract low container
359  edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
360  e.getByToken( edmPSimHitContainer_pxlBrlLow_Token_, PxlBrlLowContainer );
361  if (!PxlBrlLowContainer.isValid()) {
362  edm::LogError("TrackerHitAnalyzer::analyze")
363  << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
364  return;
365  }
366  // extract high container
367  edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
368  e.getByToken( edmPSimHitContainer_pxlBrlHigh_Token_, PxlBrlHighContainer );
369  if (!PxlBrlHighContainer.isValid()) {
370  edm::LogError("TrackerHitAnalyzer::analyze")
371  << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
372  return;
373  }
375  // get Pixel Forward information
377  // extract low container
378  edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
379  e.getByToken( edmPSimHitContainer_pxlFwdLow_Token_, PxlFwdLowContainer );
380  if (!PxlFwdLowContainer.isValid()) {
381  edm::LogError("TrackerHitAnalyzer::analyze")
382  << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
383  return;
384  }
385  // extract high container
386  edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
387  e.getByToken( edmPSimHitContainer_pxlFwdHigh_Token_, PxlFwdHighContainer );
388  if (!PxlFwdHighContainer.isValid()) {
389  edm::LogError("TrackerHitAnalyzer::analyze")
390  << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
391  return;
392  }
393 
395  // get Silicon TIB information
397  // extract TIB low container
398  edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
399  e.getByToken( edmPSimHitContainer_siTIBLow_Token_, SiTIBLowContainer );
400  if (!SiTIBLowContainer.isValid()) {
401  edm::LogError("TrackerHitProducer::analyze")
402  << "Unable to find TrackerHitsTIBLowTof in event!";
403  return;
404  }
406  // extract TIB high container
407  edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
408  e.getByToken( edmPSimHitContainer_siTIBHigh_Token_, SiTIBHighContainer );
409  if (!SiTIBHighContainer.isValid()) {
410  edm::LogError("TrackerHitProducer::analyze")
411  << "Unable to find TrackerHitsTIBHighTof in event!";
412  return;
413  }
415  // get Silicon TOB information
417  // extract TOB low container
418  edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
419  e.getByToken( edmPSimHitContainer_siTOBLow_Token_, SiTOBLowContainer );
420  if (!SiTOBLowContainer.isValid()) {
421  edm::LogError("TrackerHitProducer::analyze")
422  << "Unable to find TrackerHitsTOBLowTof in event!";
423  return;
424  }
426  // extract TOB high container
427  edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
428  e.getByToken( edmPSimHitContainer_siTOBHigh_Token_, SiTOBHighContainer );
429  if (!SiTOBHighContainer.isValid()) {
430  edm::LogError("TrackerHitProducer::analyze")
431  << "Unable to find TrackerHitsTOBHighTof in event!";
432  return;
433  }
434 
436  // get Silicon TID information
438  // extract TID low container
439  edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
440  e.getByToken( edmPSimHitContainer_siTIDLow_Token_, SiTIDLowContainer );
441  if (!SiTIDLowContainer.isValid()) {
442  edm::LogError("TrackerHitProducer::analyze")
443  << "Unable to find TrackerHitsTIDLowTof in event!";
444  return;
445  }
447  // extract TID high container
448  edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
449  e.getByToken( edmPSimHitContainer_siTIDHigh_Token_, SiTIDHighContainer );
450  if (!SiTIDHighContainer.isValid()) {
451  edm::LogError("TrackerHitProducer::analyze")
452  << "Unable to find TrackerHitsTIDHighTof in event!";
453  return;
454  }
456  // get Silicon TEC information
458  // extract TEC low container
459  edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
460  e.getByToken( edmPSimHitContainer_siTECLow_Token_, SiTECLowContainer );
461  if (!SiTECLowContainer.isValid()) {
462  edm::LogError("TrackerHitProducer::analyze")
463  << "Unable to find TrackerHitsTECLowTof in event!";
464  return;
465  }
467  // extract TEC high container
468  edm::Handle<edm::PSimHitContainer> SiTECHighContainer;
469  e.getByToken( edmPSimHitContainer_siTECHigh_Token_, 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.getByToken( edmSimTrackContainerToken_, 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 // std::cout << "itTrk = "<< itTrk << std::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 // edm::LogInfo("EventInfo") << " eta = " << eta << " ir = " << ir;
529 // std::cout << " " << std::endl;
530 // std::cout << "eta " << eta << " ir = " << ir << std::endl;
531 // std::cout << " " << std::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
MonitorElement * h1e[12]
EventNumber_t event() const
Definition: EventID.h:44
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 * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * h4ex[12]
edm::EDGetTokenT< edm::SimTrackContainer > edmSimTrackContainerToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
MonitorElement * htofeta_profile
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * h1ez[12]
MonitorElement * htofr_profile
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_
MonitorElement * htofphi_profile
T eta() const
MonitorElement * htofr
MonitorElement * h6ly[12]
MonitorElement * h5ex[12]
MonitorElement * h5ly[12]
void Fill(long long x)
MonitorElement * htofz_profile
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:48
MonitorElement * h1ex[12]
T z() const
Definition: PV3DBase.h:64
MonitorElement * h2e[12]
Region
Definition: Region.h:7
MonitorElement * h6ey[12]
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
MonitorElement * h4lx[12]
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
~TrackerHitAnalyzer()
Destructor.
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1186
void setVerbose(unsigned level)
Definition: DQMStore.cc:548
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
bool isValid() const
Definition: HandleBase.h:76
MonitorElement * h2ex[12]
MonitorElement * h6ez[12]
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_siTIDLow_Token_
MonitorElement * h2ez[12]
MonitorElement * htofz
Definition: DetId.h:18
MonitorElement * htofphi
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlBrlHigh_Token_
MonitorElement * h5lx[12]
MonitorElement * h4ey[12]
MonitorElement * h1ly[12]
const T & get() const
Definition: EventSetup.h:55
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:56
MonitorElement * h3ey[12]
MonitorElement * h2ey[12]
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:2961
edm::EDGetTokenT< edm::PSimHitContainer > edmPSimHitContainer_pxlFwdHigh_Token_
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
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 beginRun(edm::Run const &, edm::EventSetup const &)
Begin Run.
MonitorElement * h5e[12]
MonitorElement * h6lx[12]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
Definition: Run.h:41
MonitorElement * h4ez[12]