32 #include "CLHEP/Units/GlobalSystemOfUnits.h"
33 #include <CLHEP/Vector/LorentzVector.h>
41 : verbose_(ps.getUntrackedParameter<
bool>(
"Verbosity",
false)),
42 edmPSimHitContainer_pxlBrlLow_Token_(
44 edmPSimHitContainer_pxlBrlHigh_Token_(
46 edmPSimHitContainer_pxlFwdLow_Token_(
48 edmPSimHitContainer_pxlFwdHigh_Token_(
50 edmPSimHitContainer_siTIBLow_Token_(
52 edmPSimHitContainer_siTIBHigh_Token_(
54 edmPSimHitContainer_siTOBLow_Token_(
56 edmPSimHitContainer_siTOBHigh_Token_(
58 edmPSimHitContainer_siTIDLow_Token_(
60 edmPSimHitContainer_siTIDHigh_Token_(
62 edmPSimHitContainer_siTECLow_Token_(
64 edmPSimHitContainer_siTECHigh_Token_(
70 fOutputFile(ps.getUntrackedParameter<
std::
string>(
"outputFile",
"TrackerHitHisto.root")),
77 Char_t hname1[50], htitle1[80];
78 Char_t hname2[50], htitle2[80];
79 Char_t hname3[50], htitle3[80];
80 Char_t hname4[50], htitle4[80];
81 Char_t hname5[50], htitle5[80];
82 Char_t hname6[50], htitle6[80];
84 if (
fDBE !=
nullptr) {
92 htofeta = ibooker.
book2D(
"tof_eta",
"Time of flight vs eta",
nbin, -3.0, 3.0, 200, -100, 100);
93 htofphi = ibooker.
book2D(
"tof_phi",
"Time of flight vs phi",
nbin, -180, 180, 200, -100, 100);
94 htofr = ibooker.
book2D(
"tof_r",
"Time of flight vs r",
nbin, 0, 300, 200, -100, 100);
95 htofz = ibooker.
book2D(
"tof_z",
"Time of flight vs z",
nbin, -280, 280, 200, -100, 100);
97 const float E2NEL = 1.;
99 const char *
Region[] = {
"005",
"051",
"115",
"152",
"225",
"253",
"-050",
"-105",
"-151",
"-215",
"-252",
"-325"};
103 for (
int i = 0;
i < 12;
i++) {
104 sprintf(htitle1,
"Energy loss in TIB %s",
Region[
i]);
105 sprintf(htitle2,
"Energy loss in TOB %s",
Region[
i]);
106 sprintf(htitle3,
"Energy loss in TID %s",
Region[
i]);
107 sprintf(htitle4,
"Energy loss in TEC %s",
Region[
i]);
109 sprintf(htitle5,
"Energy loss in BPIX %s",
Region[
i]);
111 sprintf(htitle6,
"Energy loss in FPIX %s",
Region[
i]);
113 sprintf(hname1,
"Eloss_TIB_%i",
i + 1);
114 sprintf(hname2,
"Eloss_TOB_%i",
i + 1);
115 sprintf(hname3,
"Eloss_TID_%i",
i + 1);
116 sprintf(hname4,
"Eloss_TEC_%i",
i + 1);
118 sprintf(hname5,
"Eloss_BPIX_%i",
i + 1);
120 sprintf(hname6,
"Eloss_FPIX_%i",
i + 1);
123 h1e[
i] = ibooker.
book1D(hname1, htitle1,
nbin, 0.0, 0.001 * E2NEL);
125 h2e[
i] = ibooker.
book1D(hname2, htitle2,
nbin, 0.0, 0.001 * E2NEL);
127 h3e[
i] = ibooker.
book1D(hname3, htitle3,
nbin, 0.0, 0.001 * E2NEL);
129 h4e[
i] = ibooker.
book1D(hname4, htitle4,
nbin, 0.0, 0.001 * E2NEL);
132 h5e[
i] = ibooker.
book1D(hname5, htitle5,
nbin, 0.0, 0.001 * E2NEL);
134 h6e[
i] = ibooker.
book1D(hname6, htitle6,
nbin, 0.0, 0.001 * E2NEL);
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};
142 for (
int i = 0;
i < 12;
i++) {
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]);
148 sprintf(htitle5,
"Entryx-Exitx in BPIX %s",
Region[
i]);
150 sprintf(htitle6,
"Entryx-Exitx in FPIX %s",
Region[
i]);
152 sprintf(hname1,
"Entryx-Exitx_TIB_%i",
i + 1);
153 sprintf(hname2,
"Entryx-Exitx_TOB_%i",
i + 1);
154 sprintf(hname3,
"Entryx-Exitx_TID_%i",
i + 1);
155 sprintf(hname4,
"Entryx-Exitx_TEC_%i",
i + 1);
157 sprintf(hname5,
"Entryx-Exitx_BPIX_%i",
i + 1);
159 sprintf(hname6,
"Entryx-Exitx_FPIX_%i",
i + 1);
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};
180 for (
int i = 0;
i < 12;
i++) {
181 sprintf(htitle1,
"Entryy-Exity in TIB %s",
Region[
i]);
182 sprintf(htitle2,
"Entryy-Exity in TOB %s",
Region[
i]);
183 sprintf(htitle3,
"Entryy-Exity in TID %s",
Region[
i]);
184 sprintf(htitle4,
"Entryy-Exity in TEC %s",
Region[
i]);
186 sprintf(htitle5,
"Entryy-Exity in BPIX %s",
Region[
i]);
188 sprintf(htitle6,
"Entryy-Exity in FPIX %s",
Region[
i]);
190 sprintf(hname1,
"Entryy-Exity_TIB_%i",
i + 1);
191 sprintf(hname2,
"Entryy-Exity_TOB_%i",
i + 1);
192 sprintf(hname3,
"Entryy-Exity_TID_%i",
i + 1);
193 sprintf(hname4,
"Entryy-Exity_TEC_%i",
i + 1);
195 sprintf(hname5,
"Entryy-Exity_BPIX_%i",
i + 1);
197 sprintf(hname6,
"Entryy-Exity_FPIX_%i",
i + 1);
215 const float high1[] = {0.05, 0.06, 0.05, 0.06, 0.05, 0.05};
216 const float low1[] = {0., 0., 0., 0., 0., 0.};
218 for (
int i = 0;
i < 12;
i++) {
219 sprintf(htitle1,
"abs(Entryz-Exitz) in TIB %s",
Region[
i]);
220 sprintf(htitle2,
"abs(Entryz-Exitz) in TOB %s",
Region[
i]);
221 sprintf(htitle3,
"abs(Entryz-Exitz) in TID %s",
Region[
i]);
222 sprintf(htitle4,
"abs(Entryz-Exitz) in TEC %s",
Region[
i]);
224 sprintf(htitle5,
"abs(Entryz-Exitz) in BPIX %s",
Region[
i]);
226 sprintf(htitle6,
"abs(Entryz-Exitz) in FPIX %s",
Region[
i]);
228 sprintf(hname1,
"Entryz-Exitz_TIB_%i",
i + 1);
229 sprintf(hname2,
"Entryz-Exitz_TOB_%i",
i + 1);
230 sprintf(hname3,
"Entryz-Exitz_TID_%i",
i + 1);
231 sprintf(hname4,
"Entryz-Exitz_TEC_%i",
i + 1);
233 sprintf(hname5,
"Entryz-Exitz_BPIX_%i",
i + 1);
235 sprintf(hname6,
"Entryz-Exitz_FPIX_%i",
i + 1);
253 const float high2[] = {3.2, 5.0, 5.5, 6.2, 0.85, 0.5};
254 const float low2[] = {-3.2, -5.0, -5.5, -6.2, -0.85, -0.5};
256 for (
int i = 0;
i < 12;
i++) {
257 sprintf(htitle1,
"Localx in TIB %s",
Region[
i]);
258 sprintf(htitle2,
"Localx in TOB %s",
Region[
i]);
259 sprintf(htitle3,
"Localx in TID %s",
Region[
i]);
260 sprintf(htitle4,
"Localx in TEC %s",
Region[
i]);
262 sprintf(htitle5,
"Localx in BPIX %s",
Region[
i]);
264 sprintf(htitle6,
"Localx in FPIX %s",
Region[
i]);
266 sprintf(hname1,
"Localx_TIB_%i",
i + 1);
267 sprintf(hname2,
"Localx_TOB_%i",
i + 1);
268 sprintf(hname3,
"Localx_TID_%i",
i + 1);
269 sprintf(hname4,
"Localx_TEC_%i",
i + 1);
271 sprintf(hname5,
"Localx_BPIX_%i",
i + 1);
273 sprintf(hname6,
"Localx_FPIX_%i",
i + 1);
291 const float high3[] = {6.0, 10., 5.6, 10.5, 3.4, 0.52};
292 const float low3[] = {-6.0, -10., -5.6, -10.5, -3.4, -0.52};
294 for (
int i = 0;
i < 12;
i++) {
295 sprintf(htitle1,
"Localy in TIB %s",
Region[
i]);
296 sprintf(htitle2,
"Localy in TOB %s",
Region[
i]);
297 sprintf(htitle3,
"Localy in TID %s",
Region[
i]);
298 sprintf(htitle4,
"Localy in TEC %s",
Region[
i]);
300 sprintf(htitle5,
"Localy in BPIX %s",
Region[
i]);
302 sprintf(htitle6,
"Localy in FPIX %s",
Region[
i]);
304 sprintf(hname1,
"Localy_TIB_%i",
i + 1);
305 sprintf(hname2,
"Localy_TOB_%i",
i + 1);
306 sprintf(hname3,
"Localy_TID_%i",
i + 1);
307 sprintf(hname4,
"Localy_TEC_%i",
i + 1);
309 sprintf(hname5,
"Localy_BPIX_%i",
i + 1);
311 sprintf(hname6,
"Localy_FPIX_%i",
i + 1);
336 edm::LogInfo(
"EventInfo") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
339 edm::PSimHitContainer::const_iterator itHit;
346 if (!PxlBrlLowContainer.
isValid()) {
347 edm::LogError(
"TrackerHitAnalyzer::analyze") <<
"Unable to find TrackerHitsPixelBarrelLowTof in event!";
353 if (!PxlBrlHighContainer.
isValid()) {
354 edm::LogError(
"TrackerHitAnalyzer::analyze") <<
"Unable to find TrackerHitsPixelBarrelHighTof in event!";
363 if (!PxlFwdLowContainer.
isValid()) {
364 edm::LogError(
"TrackerHitAnalyzer::analyze") <<
"Unable to find TrackerHitsPixelEndcapLowTof in event!";
370 if (!PxlFwdHighContainer.
isValid()) {
371 edm::LogError(
"TrackerHitAnalyzer::analyze") <<
"Unable to find TrackerHitsPixelEndcapHighTof in event!";
380 if (!SiTIBLowContainer.
isValid()) {
381 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTIBLowTof in event!";
388 if (!SiTIBHighContainer.
isValid()) {
389 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTIBHighTof in event!";
398 if (!SiTOBLowContainer.
isValid()) {
399 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTOBLowTof in event!";
406 if (!SiTOBHighContainer.
isValid()) {
407 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTOBHighTof in event!";
417 if (!SiTIDLowContainer.
isValid()) {
418 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTIDLowTof in event!";
425 if (!SiTIDHighContainer.
isValid()) {
426 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTIDHighTof in event!";
435 if (!SiTECLowContainer.
isValid()) {
436 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTECLowTof in event!";
443 if (!SiTECHighContainer.
isValid()) {
444 edm::LogError(
"TrackerHitProducer::analyze") <<
"Unable to find TrackerHitsTECHighTof in event!";
454 if (!G4TrkContainer.
isValid()) {
455 edm::LogError(
"TrackerHitAnalyzer::analyze") <<
"Unable to find SimTrack in event!";
465 edm::SimTrackContainer::const_iterator itTrk;
466 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end(); ++itTrk) {
468 double eta = 0,
p = 0;
469 const CLHEP::HepLorentzVector &G4Trk = CLHEP::HepLorentzVector(
470 itTrk->momentum().x(), itTrk->momentum().y(), itTrk->momentum().z(), itTrk->momentum().e());
471 p =
sqrt(G4Trk[0] * G4Trk[0] + G4Trk[1] * G4Trk[1] + G4Trk[2] * G4Trk[2]);
473 edm::LogError(
"TrackerHitAnalyzer::analyze") <<
"TrackerTest::INFO: Primary has p = 0 ";
475 double costheta = G4Trk[2] /
p;
479 if (
eta > 0.0 &&
eta <= 0.5)
481 if (
eta > 0.5 &&
eta <= 1.0)
483 if (
eta > 1.0 &&
eta <= 1.5)
485 if (
eta > 1.5 &&
eta <= 2.0)
487 if (
eta > 2.0 &&
eta <= 2.5)
492 if (
eta > -0.5 &&
eta <= 0.0)
494 if (
eta > -1.0 &&
eta <= -0.5)
496 if (
eta > -1.5 &&
eta <= -1.0)
498 if (
eta > -2.0 &&
eta <= -1.5)
500 if (
eta > -2.5 &&
eta <= -2.0)
517 for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
520 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
526 h5e[ir]->
Fill(itHit->energyLoss());
527 h5ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
528 h5ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
529 h5ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
530 h5lx[ir]->
Fill(itHit->localPosition().x());
531 h5ly[ir]->
Fill(itHit->localPosition().y());
533 for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->end(); ++itHit) {
536 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
542 h5e[ir]->
Fill(itHit->energyLoss());
543 h5ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
544 h5ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
545 h5ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
546 h5lx[ir]->
Fill(itHit->localPosition().x());
547 h5ly[ir]->
Fill(itHit->localPosition().y());
549 for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
552 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
558 h6e[ir]->
Fill(itHit->energyLoss());
559 h6ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
560 h6ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
561 h6ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
562 h6lx[ir]->
Fill(itHit->localPosition().x());
563 h6ly[ir]->
Fill(itHit->localPosition().y());
565 for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
568 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
574 h6e[ir]->
Fill(itHit->energyLoss());
575 h6ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
576 h6ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
577 h6ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
578 h6lx[ir]->
Fill(itHit->localPosition().x());
579 h6ly[ir]->
Fill(itHit->localPosition().y());
585 for (itHit = SiTIBLowContainer->begin(); itHit != SiTIBLowContainer->end(); ++itHit) {
588 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
594 h1e[ir]->
Fill(itHit->energyLoss());
595 h1ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
596 h1ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
597 h1ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
598 h1lx[ir]->
Fill(itHit->localPosition().x());
599 h1ly[ir]->
Fill(itHit->localPosition().y());
601 for (itHit = SiTIBHighContainer->begin(); itHit != SiTIBHighContainer->end(); ++itHit) {
604 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
610 h1e[ir]->
Fill(itHit->energyLoss());
611 h1ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
612 h1ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
613 h1ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
614 h1lx[ir]->
Fill(itHit->localPosition().x());
615 h1ly[ir]->
Fill(itHit->localPosition().y());
620 for (itHit = SiTOBLowContainer->begin(); itHit != SiTOBLowContainer->end(); ++itHit) {
623 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
629 h2e[ir]->
Fill(itHit->energyLoss());
630 h2ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
631 h2ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
632 h2ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
633 h2lx[ir]->
Fill(itHit->localPosition().x());
634 h2ly[ir]->
Fill(itHit->localPosition().y());
636 for (itHit = SiTOBHighContainer->begin(); itHit != SiTOBHighContainer->end(); ++itHit) {
639 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
645 h2e[ir]->
Fill(itHit->energyLoss());
646 h2ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
647 h2ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
648 h2ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
649 h2lx[ir]->
Fill(itHit->localPosition().x());
650 h2ly[ir]->
Fill(itHit->localPosition().y());
655 for (itHit = SiTIDLowContainer->begin(); itHit != SiTIDLowContainer->end(); ++itHit) {
658 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
664 h3e[ir]->
Fill(itHit->energyLoss());
665 h3ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
666 h3ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
667 h3ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
668 h3lx[ir]->
Fill(itHit->localPosition().x());
669 h3ly[ir]->
Fill(itHit->localPosition().y());
671 for (itHit = SiTIDHighContainer->begin(); itHit != SiTIDHighContainer->end(); ++itHit) {
674 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
680 h3e[ir]->
Fill(itHit->energyLoss());
681 h3ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
682 h3ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
683 h3ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
684 h3lx[ir]->
Fill(itHit->localPosition().x());
685 h3ly[ir]->
Fill(itHit->localPosition().y());
690 for (itHit = SiTECLowContainer->begin(); itHit != SiTECLowContainer->end(); ++itHit) {
693 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
699 h4e[ir]->
Fill(itHit->energyLoss());
700 h4ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
701 h4ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
702 h4ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
703 h4lx[ir]->
Fill(itHit->localPosition().x());
704 h4ly[ir]->
Fill(itHit->localPosition().y());
706 for (itHit = SiTECHighContainer->begin(); itHit != SiTECHighContainer->end(); ++itHit) {
709 GlobalPoint gpos = det->toGlobal(itHit->localPosition());
715 h4e[ir]->
Fill(itHit->energyLoss());
716 h4ex[ir]->
Fill(itHit->entryPoint().x() - itHit->exitPoint().x());
717 h4ey[ir]->
Fill(itHit->entryPoint().y() - itHit->exitPoint().y());
718 h4ez[ir]->
Fill(std::fabs(itHit->entryPoint().z() - itHit->exitPoint().z()));
719 h4lx[ir]->
Fill(itHit->localPosition().x());
720 h4ly[ir]->
Fill(itHit->localPosition().y());