00001 #include "Validation/TrackerHits/interface/TrackerHitAnalyzer.h"
00002
00003
00004 #include "DataFormats/Common/interface/Handle.h"
00005
00006
00007 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00008 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
00009 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
00010 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00011 #include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
00012 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00013
00014
00015 #include "SimDataFormats/ValidationFormats/interface/PValidationFormats.h"
00016 #include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"
00017
00018 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00019 #include "SimDataFormats/TrackingHit/interface/PSimHitContainer.h"
00020 #include "SimDataFormats/EncodedEventId/interface/EncodedEventId.h"
00021 #include "SimDataFormats/Track/interface/SimTrack.h"
00022 #include "SimDataFormats/Vertex/interface/SimVertex.h"
00023 #include "DataFormats/Math/interface/LorentzVector.h"
00024
00025
00026 #include <CLHEP/Vector/LorentzVector.h>
00027 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00028
00029
00030 #include <iostream>
00031 #include "DQMServices/Core/interface/DQMStore.h"
00032 using namespace edm;
00033 using namespace std;
00034
00035 TrackerHitAnalyzer::TrackerHitAnalyzer(const edm::ParameterSet& ps) :
00036 G4TrkSrc_(ps.getParameter<edm::InputTag>("G4TrkSrc")) {
00037
00038 fDBE = Service<DQMStore>().operator->();
00039 fOutputFile = ps.getUntrackedParameter<string>("outputFile", "TrackerHitHisto.root");
00040 verbose_ = ps.getUntrackedParameter<bool>("Verbosity",false);
00041
00042 PxlBrlLowSrc_ = ps.getParameter<edm::InputTag>("PxlBrlLowSrc");
00043 PxlBrlHighSrc_ = ps.getParameter<edm::InputTag>("PxlBrlHighSrc");
00044 PxlFwdLowSrc_ = ps.getParameter<edm::InputTag>("PxlFwdLowSrc");
00045 PxlFwdHighSrc_ = ps.getParameter<edm::InputTag>("PxlFwdHighSrc");
00046
00047 SiTIBLowSrc_ = ps.getParameter<edm::InputTag>("SiTIBLowSrc");
00048 SiTIBHighSrc_ = ps.getParameter<edm::InputTag>("SiTIBHighSrc");
00049 SiTOBLowSrc_ = ps.getParameter<edm::InputTag>("SiTOBLowSrc");
00050 SiTOBHighSrc_ = ps.getParameter<edm::InputTag>("SiTOBHighSrc");
00051 SiTIDLowSrc_ = ps.getParameter<edm::InputTag>("SiTIDLowSrc");
00052 SiTIDHighSrc_ = ps.getParameter<edm::InputTag>("SiTIDHighSrc");
00053 SiTECLowSrc_ = ps.getParameter<edm::InputTag>("SiTECLowSrc");
00054 SiTECHighSrc_ = ps.getParameter<edm::InputTag>("SiTECHighSrc");
00055
00056
00058
00059 Char_t hname1[50], htitle1[80];
00060 Char_t hname2[50], htitle2[80];
00061 Char_t hname3[50], htitle3[80];
00062 Char_t hname4[50], htitle4[80];
00063 Char_t hname5[50], htitle5[80];
00064 Char_t hname6[50], htitle6[80];
00065
00066 if ( fDBE ) {
00067 if ( verbose_ ) {
00068 fDBE->setVerbose(1);
00069 } else {
00070 fDBE->setVerbose(0);
00071 }
00072 }
00073
00074 if ( fDBE) {
00075 if ( verbose_ ) fDBE->showDirStructure();
00076 }
00077
00078 if ( fDBE != NULL ) {
00079
00080
00081
00082
00083 int nbin = 5000;
00084
00085 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/");
00086 htofeta = fDBE->book2D ("tof_eta", "Time of flight vs eta", nbin , -3.0 , 3.0,200,-100,100);
00087 htofphi = fDBE->book2D("tof_phi", "Time of flight vs phi", nbin,-180,180,200,-100,100);
00088 htofr = fDBE->book2D("tof_r", "Time of flight vs r", nbin , 0 , 300, 200, -100,100);
00089 htofz = fDBE->book2D("tof_z", "Time of flight vs z", nbin , -280 , 280, 200, -100,100);
00090
00091
00092 const float E2NEL = 1.;
00093
00094 const char *Region[] = {"005","051","115","152","225","253",
00095 "-050","-105","-151","-215","-252","-325"};
00096 nbin = 10000;
00097
00098
00099 for(int i=0; i<12; i++) {
00100
00101 sprintf (htitle1,"Energy loss in TIB %s", Region[i]);
00102 sprintf (htitle2,"Energy loss in TOB %s", Region[i]);
00103 sprintf (htitle3,"Energy loss in TID %s", Region[i]);
00104 sprintf (htitle4,"Energy loss in TEC %s", Region[i]);
00105 sprintf (htitle5,"Energy loss in BPIX %s", Region[i]);
00106 sprintf (htitle6,"Energy loss in FPIX %s", Region[i]);
00107
00108 sprintf (hname1,"Eloss_TIB_%i",i+1);
00109 sprintf (hname2,"Eloss_TOB_%i",i+1);
00110 sprintf (hname3,"Eloss_TID_%i",i+1);
00111 sprintf (hname4,"Eloss_TEC_%i",i+1);
00112 sprintf (hname5,"Eloss_BPIX_%i",i+1);
00113 sprintf (hname6,"Eloss_FPIX_%i",i+1);
00114
00115 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
00116 h1e[i] = fDBE->book1D (hname1, htitle1, nbin , 0.0 , 0.001*E2NEL);
00117 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
00118 h2e[i] = fDBE->book1D (hname2, htitle2, nbin , 0.0 , 0.001*E2NEL);
00119 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
00120 h3e[i] = fDBE->book1D (hname3, htitle3, nbin , 0.0 , 0.001*E2NEL);
00121 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
00122 h4e[i] = fDBE->book1D (hname4, htitle4, nbin , 0.0 , 0.001*E2NEL);
00123 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
00124 h5e[i] = fDBE->book1D (hname5, htitle5, nbin , 0.0 , 0.001*E2NEL);
00125 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
00126 h6e[i] = fDBE->book1D (hname6, htitle6, nbin , 0.0 , 0.001*E2NEL);
00127
00128 }
00129
00130
00131 const float high[] = {0.03, 0.03, 0.02, 0.03, 0.03, 0.03};
00132 const float low[] = {-0.03, -0.03, -0.02, -0.03, -0.03, -0.03};
00133
00134 for(int i=0; i<12; i++) {
00135
00136 sprintf (htitle1,"Entryx-Exitx in TIB %s", Region[i]);
00137 sprintf (htitle2,"Entryx-Exitx in TOB %s", Region[i]);
00138 sprintf (htitle3,"Entryx-Exitx in TID %s", Region[i]);
00139 sprintf (htitle4,"Entryx-Exitx in TEC %s", Region[i]);
00140 sprintf (htitle5,"Entryx-Exitx in BPIX %s", Region[i]);
00141 sprintf (htitle6,"Entryx-Exitx in FPIX %s", Region[i]);
00142
00143 sprintf (hname1,"Entryx-Exitx_TIB_%i",i+1);
00144 sprintf (hname2,"Entryx-Exitx_TOB_%i",i+1);
00145 sprintf (hname3,"Entryx-Exitx_TID_%i",i+1);
00146 sprintf (hname4,"Entryx-Exitx_TEC_%i",i+1);
00147 sprintf (hname5,"Entryx-Exitx_BPIX_%i",i+1);
00148 sprintf (hname6,"Entryx-Exitx_FPIX_%i",i+1);
00149
00150 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
00151 h1ex[i] = fDBE->book1D (hname1, htitle1, nbin , low[0] , high[0]);
00152 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
00153 h2ex[i] = fDBE->book1D (hname2, htitle2, nbin , low[1] , high[1]);
00154 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
00155 h3ex[i] = fDBE->book1D (hname3, htitle3, nbin , low[2] , high[2]);
00156 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
00157 h4ex[i] = fDBE->book1D (hname4, htitle4, nbin , low[3] , high[3]);
00158 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
00159 h5ex[i] = fDBE->book1D (hname5, htitle5, nbin , low[4] , high[4]);
00160 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
00161 h6ex[i] = fDBE->book1D (hname6, htitle6, nbin , low[5] , high[5]);
00162
00163 }
00164
00165 const float high0[] = {0.05, 0.06, 0.03, 0.03, 0.03, 0.03};
00166 const float low0[] = {-0.05, -0.06, -0.03, -0.03, -0.03, -0.03};
00167
00168 for(int i=0; i<12; i++) {
00169
00170 sprintf (htitle1,"Entryy-Exity in TIB %s", Region[i]);
00171 sprintf (htitle2,"Entryy-Exity in TOB %s", Region[i]);
00172 sprintf (htitle3,"Entryy-Exity in TID %s", Region[i]);
00173 sprintf (htitle4,"Entryy-Exity in TEC %s", Region[i]);
00174 sprintf (htitle5,"Entryy-Exity in BPIX %s", Region[i]);
00175 sprintf (htitle6,"Entryy-Exity in FPIX %s", Region[i]);
00176
00177 sprintf (hname1,"Entryy-Exity_TIB_%i",i+1);
00178 sprintf (hname2,"Entryy-Exity_TOB_%i",i+1);
00179 sprintf (hname3,"Entryy-Exity_TID_%i",i+1);
00180 sprintf (hname4,"Entryy-Exity_TEC_%i",i+1);
00181 sprintf (hname5,"Entryy-Exity_BPIX_%i",i+1);
00182 sprintf (hname6,"Entryy-Exity_FPIX_%i",i+1);
00183
00184 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
00185 h1ey[i] = fDBE->book1D (hname1, htitle1, nbin , low0[0] , high0[0]);
00186 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
00187 h2ey[i] = fDBE->book1D (hname2, htitle2, nbin , low0[1] , high0[1]);
00188 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
00189 h3ey[i] = fDBE->book1D (hname3, htitle3, nbin , low0[2] , high0[2]);
00190 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
00191 h4ey[i] = fDBE->book1D (hname4, htitle4, nbin , low0[3] , high0[3]);
00192 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
00193 h5ey[i] = fDBE->book1D (hname5, htitle5, nbin , low0[4] , high0[4]);
00194 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
00195 h6ey[i] = fDBE->book1D (hname6, htitle6, nbin , low0[5] , high0[5]);
00196
00197 }
00198
00199 const float high1[] = {0.05, 0.06, 0.05, 0.06, 0.05, 0.05};
00200 const float low1[] = {0.,0.,0.,0.,0.,0.};
00201
00202 for(int i=0; i<12; i++) {
00203
00204 sprintf (htitle1,"abs(Entryz-Exitz) in TIB %s", Region[i]);
00205 sprintf (htitle2,"abs(Entryz-Exitz) in TOB %s", Region[i]);
00206 sprintf (htitle3,"abs(Entryz-Exitz) in TID %s", Region[i]);
00207 sprintf (htitle4,"abs(Entryz-Exitz) in TEC %s", Region[i]);
00208 sprintf (htitle5,"abs(Entryz-Exitz) in BPIX %s", Region[i]);
00209 sprintf (htitle6,"abs(Entryz-Exitz) in FPIX %s", Region[i]);
00210
00211 sprintf (hname1,"Entryz-Exitz_TIB_%i",i+1);
00212 sprintf (hname2,"Entryz-Exitz_TOB_%i",i+1);
00213 sprintf (hname3,"Entryz-Exitz_TID_%i",i+1);
00214 sprintf (hname4,"Entryz-Exitz_TEC_%i",i+1);
00215 sprintf (hname5,"Entryz-Exitz_BPIX_%i",i+1);
00216 sprintf (hname6,"Entryz-Exitz_FPIX_%i",i+1);
00217
00218 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
00219 h1ez[i] = fDBE->book1D (hname1, htitle1, nbin , low1[0] , high1[0]);
00220 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
00221 h2ez[i] = fDBE->book1D (hname2, htitle2, nbin , low1[1] , high1[1]);
00222 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
00223 h3ez[i] = fDBE->book1D (hname3, htitle3, nbin , low1[2] , high1[2]);
00224 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
00225 h4ez[i] = fDBE->book1D (hname4, htitle4, nbin , low1[3] , high1[3]);
00226 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
00227 h5ez[i] = fDBE->book1D (hname5, htitle5, nbin , low1[4] , high1[4]);
00228 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
00229 h6ez[i] = fDBE->book1D (hname6, htitle6, nbin , low1[5] , high1[5]);
00230
00231 }
00232
00233
00234 const float high2[] = {3.2, 5.0, 5.5, 6.2, 0.85, 0.5};
00235 const float low2[] = {-3.2, -5.0, -5.5, -6.2, -0.85, -0.5};
00236
00237 for(int i=0; i<12; i++) {
00238
00239 sprintf (htitle1,"Localx in TIB %s", Region[i]);
00240 sprintf (htitle2,"Localx in TOB %s", Region[i]);
00241 sprintf (htitle3,"Localx in TID %s", Region[i]);
00242 sprintf (htitle4,"Localx in TEC %s", Region[i]);
00243 sprintf (htitle5,"Localx in BPIX %s", Region[i]);
00244 sprintf (htitle6,"Localx in FPIX %s", Region[i]);
00245
00246 sprintf (hname1,"Localx_TIB_%i",i+1);
00247 sprintf (hname2,"Localx_TOB_%i",i+1);
00248 sprintf (hname3,"Localx_TID_%i",i+1);
00249 sprintf (hname4,"Localx_TEC_%i",i+1);
00250 sprintf (hname5,"Localx_BPIX_%i",i+1);
00251 sprintf (hname6,"Localx_FPIX_%i",i+1);
00252
00253 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
00254 h1lx[i] = fDBE->book1D (hname1, htitle1, nbin , low2[0] , high2[0]);
00255 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
00256 h2lx[i] = fDBE->book1D (hname2, htitle2, nbin , low2[1] , high2[1]);
00257 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
00258 h3lx[i] = fDBE->book1D (hname3, htitle3, nbin , low2[2] , high2[2]);
00259 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
00260 h4lx[i] = fDBE->book1D (hname4, htitle4, nbin , low2[3] , high2[3]);
00261 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
00262 h5lx[i] = fDBE->book1D (hname5, htitle5, nbin , low2[4] , high2[4]);
00263 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
00264 h6lx[i] = fDBE->book1D (hname6, htitle6, nbin , low2[5] , high2[5]);
00265
00266 }
00267
00268
00269 const float high3[] = {6.0, 10., 5.6, 10.5, 3.4, 0.52};
00270 const float low3[] = {-6.0, -10., -5.6, -10.5, -3.4, -0.52};
00271
00272 for(int i=0; i<12; i++) {
00273
00274 sprintf (htitle1,"Localy in TIB %s", Region[i]);
00275 sprintf (htitle2,"Localy in TOB %s", Region[i]);
00276 sprintf (htitle3,"Localy in TID %s", Region[i]);
00277 sprintf (htitle4,"Localy in TEC %s", Region[i]);
00278 sprintf (htitle5,"Localy in BPIX %s", Region[i]);
00279 sprintf (htitle6,"Localy in FPIX %s", Region[i]);
00280
00281 sprintf (hname1,"Localy_TIB_%i",i+1);
00282 sprintf (hname2,"Localy_TOB_%i",i+1);
00283 sprintf (hname3,"Localy_TID_%i",i+1);
00284 sprintf (hname4,"Localy_TEC_%i",i+1);
00285 sprintf (hname5,"Localy_BPIX_%i",i+1);
00286 sprintf (hname6,"Localy_FPIX_%i",i+1);
00287
00288 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIBHit");
00289 h1ly[i] = fDBE->book1D (hname1, htitle1, nbin , low3[0] , high3[0]);
00290 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TOBHit");
00291 h2ly[i] = fDBE->book1D (hname2, htitle2, nbin , low3[1] , high3[1]);
00292 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TIDHit");
00293 h3ly[i] = fDBE->book1D (hname3, htitle3, nbin , low3[2] , high3[2]);
00294 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/TECHit");
00295 h4ly[i] = fDBE->book1D (hname4, htitle4, nbin , low3[3] , high3[3]);
00296 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/BPIXHit");
00297 h5ly[i] = fDBE->book1D (hname5, htitle5, nbin , low3[4] , high3[4]);
00298 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/FPIXHit");
00299 h6ly[i] = fDBE->book1D (hname6, htitle6, nbin , low3[5] , high3[5]);
00300
00301 }
00302
00303
00304 }
00305 }
00306
00307 TrackerHitAnalyzer::~TrackerHitAnalyzer()
00308 {
00309
00310 }
00311
00312
00313
00314 void TrackerHitAnalyzer::endJob()
00315 {
00316
00317
00318
00319 if( fDBE )
00320 {
00321
00322 if (! fDBE->get("TrackerHitsV/TrackerHit/tof_eta")) return;
00323 }
00324 else
00325 return;
00326
00327 fDBE->setCurrentFolder("TrackerHitsV/TrackerHit/");
00328 htofeta_profile = fDBE->bookProfile ("tof_eta_profile",htofeta->getTH2F()->ProfileX());
00329 htofphi_profile = fDBE->bookProfile("tof_phi_profile", htofphi->getTH2F()->ProfileX());
00330 htofr_profile = fDBE->bookProfile("tof_r_profile",htofr->getTH2F()->ProfileX());
00331 htofz_profile = fDBE->bookProfile("tof_z_profile", htofz->getTH2F()->ProfileX());
00332
00333
00334 if ( fOutputFile.size() != 0 && fDBE ) fDBE->save(fOutputFile);
00335
00336 return ;
00337
00338 }
00339
00340
00341 void TrackerHitAnalyzer::analyze(const edm::Event& e, const edm::EventSetup& c)
00342 {
00343
00344 LogInfo("EventInfo") << " Run = " << e.id().run() << " Event = " << e.id().event();
00345
00346
00347 edm::PSimHitContainer::const_iterator itHit;
00349
00351
00352 edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
00353 e.getByLabel(PxlBrlLowSrc_,PxlBrlLowContainer);
00354 if (!PxlBrlLowContainer.isValid()) {
00355 edm::LogError("TrackerHitAnalyzer::analyze")
00356 << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
00357 return;
00358 }
00359
00360 edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
00361 e.getByLabel(PxlBrlHighSrc_,PxlBrlHighContainer);
00362 if (!PxlBrlHighContainer.isValid()) {
00363 edm::LogError("TrackerHitAnalyzer::analyze")
00364 << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
00365 return;
00366 }
00368
00370
00371 edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
00372 e.getByLabel(PxlFwdLowSrc_,PxlFwdLowContainer);
00373 if (!PxlFwdLowContainer.isValid()) {
00374 edm::LogError("TrackerHitAnalyzer::analyze")
00375 << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
00376 return;
00377 }
00378
00379 edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
00380 e.getByLabel(PxlFwdHighSrc_,PxlFwdHighContainer);
00381 if (!PxlFwdHighContainer.isValid()) {
00382 edm::LogError("TrackerHitAnalyzer::analyze")
00383 << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
00384 return;
00385 }
00386
00388
00390
00391 edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
00392
00393 e.getByLabel(SiTIBLowSrc_,SiTIBLowContainer);
00394 if (!SiTIBLowContainer.isValid()) {
00395 edm::LogError("TrackerHitProducer::analyze")
00396 << "Unable to find TrackerHitsTIBLowTof in event!";
00397 return;
00398 }
00400
00401 edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
00402
00403 e.getByLabel(SiTIBHighSrc_,SiTIBHighContainer);
00404 if (!SiTIBHighContainer.isValid()) {
00405 edm::LogError("TrackerHitProducer::analyze")
00406 << "Unable to find TrackerHitsTIBHighTof in event!";
00407 return;
00408 }
00410
00412
00413 edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
00414
00415 e.getByLabel(SiTOBLowSrc_,SiTOBLowContainer);
00416 if (!SiTOBLowContainer.isValid()) {
00417 edm::LogError("TrackerHitProducer::analyze")
00418 << "Unable to find TrackerHitsTOBLowTof in event!";
00419 return;
00420 }
00422
00423 edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
00424
00425 e.getByLabel(SiTOBHighSrc_,SiTOBHighContainer);
00426 if (!SiTOBHighContainer.isValid()) {
00427 edm::LogError("TrackerHitProducer::analyze")
00428 << "Unable to find TrackerHitsTOBHighTof in event!";
00429 return;
00430 }
00431
00433
00435
00436 edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
00437
00438 e.getByLabel(SiTIDLowSrc_,SiTIDLowContainer);
00439 if (!SiTIDLowContainer.isValid()) {
00440 edm::LogError("TrackerHitProducer::analyze")
00441 << "Unable to find TrackerHitsTIDLowTof in event!";
00442 return;
00443 }
00445
00446 edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
00447
00448 e.getByLabel(SiTIDHighSrc_,SiTIDHighContainer);
00449 if (!SiTIDHighContainer.isValid()) {
00450 edm::LogError("TrackerHitProducer::analyze")
00451 << "Unable to find TrackerHitsTIDHighTof in event!";
00452 return;
00453 }
00455
00457
00458 edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
00459
00460 e.getByLabel(SiTECLowSrc_,SiTECLowContainer);
00461 if (!SiTECLowContainer.isValid()) {
00462 edm::LogError("TrackerHitProducer::analyze")
00463 << "Unable to find TrackerHitsTECLowTof in event!";
00464 return;
00465 }
00467
00468 edm ::Handle<edm::PSimHitContainer> SiTECHighContainer;
00469
00470 e.getByLabel(SiTECHighSrc_,SiTECHighContainer);
00471 if (!SiTECHighContainer.isValid()) {
00472 edm::LogError("TrackerHitProducer::analyze")
00473 << "Unable to find TrackerHitsTECHighTof in event!";
00474 return;
00475 }
00476
00478
00480
00481 edm::Handle<edm::SimTrackContainer> G4TrkContainer;
00482 e.getByLabel(G4TrkSrc_, G4TrkContainer);
00483 if (!G4TrkContainer.isValid()) {
00484 edm::LogError("TrackerHitAnalyzer::analyze")
00485 << "Unable to find SimTrack in event!";
00486 return;
00487 }
00488
00489
00490
00491 edm::ESHandle<TrackerGeometry> tracker;
00492 c.get<TrackerDigiGeometryRecord>().get( tracker );
00493
00494
00495
00496 int ir = -100;
00497 edm::SimTrackContainer::const_iterator itTrk;
00498 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
00499 ++itTrk) {
00500
00501
00502 double eta =0, p =0;
00503 const CLHEP::HepLorentzVector& G4Trk = CLHEP::HepLorentzVector(itTrk->momentum().x(),
00504 itTrk->momentum().y(),
00505 itTrk->momentum().z(),
00506 itTrk->momentum().e());
00507 p =sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]+G4Trk[2]*G4Trk[2]);
00508 if ( p == 0)
00509 edm::LogError("TrackerHitAnalyzer::analyze")
00510 << "TrackerTest::INFO: Primary has p = 0 ";
00511 else {
00512 double costheta = G4Trk[2]/p;
00513 double theta = acos(TMath::Min(TMath::Max(costheta, -1.),1.));
00514 eta = -log(tan(theta/2));
00515
00516 if (eta>0.0 && eta<=0.5) ir = 0;
00517 if (eta>0.5 && eta<=1.0) ir = 1;
00518 if (eta>1.0 && eta<=1.5) ir = 2;
00519 if (eta>1.5 && eta<=2.0) ir = 3;
00520 if (eta>2.0 && eta<=2.5) ir = 4;
00521 if (eta>2.5) ir = 5;
00522
00523 if (eta>-0.5 && eta<= 0.0) ir = 6;
00524 if (eta>-1.0 && eta<=-0.5) ir = 7;
00525 if (eta>-1.5 && eta<=-1.0) ir = 8;
00526 if (eta>-2.0 && eta<=-1.5) ir = 9;
00527 if (eta>-2.5 && eta<=-2.0) ir = 10;
00528 if (eta<=-2.5) ir = 11;
00529
00530
00531
00532
00533 }
00534 }
00536
00538 for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
00539 DetId detid=DetId(itHit->detUnitId());
00540 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00541 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00542 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00543 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00544 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00545 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00546
00547 h5e[ir]->Fill(itHit->energyLoss());
00548 h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00549 h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00550 h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00551 h5lx[ir]->Fill(itHit->localPosition().x());
00552 h5ly[ir]->Fill(itHit->localPosition().y());
00553 }
00554 for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->end(); ++itHit) {
00555 DetId detid=DetId(itHit->detUnitId());
00556 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00557 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00558 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00559 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00560 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00561 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00562
00563
00564 h5e[ir]->Fill(itHit->energyLoss());
00565 h5ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00566 h5ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00567 h5ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00568 h5lx[ir]->Fill(itHit->localPosition().x());
00569 h5ly[ir]->Fill(itHit->localPosition().y());
00570 }
00571 for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
00572 DetId detid=DetId(itHit->detUnitId());
00573 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00574 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00575 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00576 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00577 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00578 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00579
00580
00581 h6e[ir]->Fill(itHit->energyLoss());
00582 h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00583 h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00584 h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00585 h6lx[ir]->Fill(itHit->localPosition().x());
00586 h6ly[ir]->Fill(itHit->localPosition().y());
00587 }
00588 for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
00589 DetId detid=DetId(itHit->detUnitId());
00590 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00591 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00592 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00593 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00594 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00595 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00596
00597
00598 h6e[ir]->Fill(itHit->energyLoss());
00599 h6ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00600 h6ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00601 h6ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00602 h6lx[ir]->Fill(itHit->localPosition().x());
00603 h6ly[ir]->Fill(itHit->localPosition().y());
00604 }
00606
00608 for (itHit = SiTIBLowContainer->begin(); itHit != SiTIBLowContainer->end(); ++itHit) {
00609 DetId detid=DetId(itHit->detUnitId());
00610 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00611 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00612 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00613 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00614 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00615 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00616
00617
00618 h1e[ir]->Fill(itHit->energyLoss());
00619 h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00620 h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00621 h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00622 h1lx[ir]->Fill(itHit->localPosition().x());
00623 h1ly[ir]->Fill(itHit->localPosition().y());
00624 }
00625 for (itHit = SiTIBHighContainer->begin(); itHit != SiTIBHighContainer->end(); ++itHit) {
00626 DetId detid=DetId(itHit->detUnitId());
00627 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00628 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00629 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00630 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00631 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00632 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00633
00634
00635 h1e[ir]->Fill(itHit->energyLoss());
00636 h1ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00637 h1ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00638 h1ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00639 h1lx[ir]->Fill(itHit->localPosition().x());
00640 h1ly[ir]->Fill(itHit->localPosition().y());
00641 }
00643
00645 for (itHit = SiTOBLowContainer->begin(); itHit != SiTOBLowContainer->end(); ++itHit) {
00646 DetId detid=DetId(itHit->detUnitId());
00647 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00648 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00649 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00650 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00651 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00652 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00653
00654
00655 h2e[ir]->Fill(itHit->energyLoss());
00656 h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00657 h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00658 h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00659 h2lx[ir]->Fill(itHit->localPosition().x());
00660 h2ly[ir]->Fill(itHit->localPosition().y());
00661 }
00662 for (itHit = SiTOBHighContainer->begin(); itHit != SiTOBHighContainer->end(); ++itHit) {
00663 DetId detid=DetId(itHit->detUnitId());
00664 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00665 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00666 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00667 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00668 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00669 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00670
00671 h2e[ir]->Fill(itHit->energyLoss());
00672 h2ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00673 h2ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00674 h2ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00675 h2lx[ir]->Fill(itHit->localPosition().x());
00676 h2ly[ir]->Fill(itHit->localPosition().y());
00677 }
00679
00681 for (itHit = SiTIDLowContainer->begin(); itHit != SiTIDLowContainer->end(); ++itHit) {
00682 DetId detid=DetId(itHit->detUnitId());
00683 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00684 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00685 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00686 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00687 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00688 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00689
00690 h3e[ir]->Fill(itHit->energyLoss());
00691 h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00692 h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00693 h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00694 h3lx[ir]->Fill(itHit->localPosition().x());
00695 h3ly[ir]->Fill(itHit->localPosition().y());
00696 }
00697 for (itHit = SiTIDHighContainer->begin(); itHit != SiTIDHighContainer->end(); ++itHit) {
00698 DetId detid=DetId(itHit->detUnitId());
00699 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00700 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00701 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00702 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00703 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00704 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00705
00706 h3e[ir]->Fill(itHit->energyLoss());
00707 h3ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00708 h3ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00709 h3ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00710 h3lx[ir]->Fill(itHit->localPosition().x());
00711 h3ly[ir]->Fill(itHit->localPosition().y());
00712 }
00714
00716 for (itHit = SiTECLowContainer->begin(); itHit != SiTECLowContainer->end(); ++itHit) {
00717 DetId detid=DetId(itHit->detUnitId());
00718 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00719 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00720 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00721 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00722 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00723 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00724
00725 h4e[ir]->Fill(itHit->energyLoss());
00726 h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00727 h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00728 h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00729 h4lx[ir]->Fill(itHit->localPosition().x());
00730 h4ly[ir]->Fill(itHit->localPosition().y());
00731 }
00732 for (itHit = SiTECHighContainer->begin(); itHit != SiTECHighContainer->end(); ++itHit) {
00733 DetId detid=DetId(itHit->detUnitId());
00734 const GeomDetUnit * det=(const GeomDetUnit*)tracker->idToDetUnit( detid );
00735 GlobalPoint gpos=det->toGlobal(itHit->localPosition());
00736 htofeta->Fill(gpos.eta(), itHit->timeOfFlight());
00737 htofphi->Fill(gpos.phi().degrees(), itHit->timeOfFlight());
00738 htofr->Fill(gpos.mag(), itHit->timeOfFlight());
00739 htofz->Fill(gpos.z(), itHit->timeOfFlight());
00740
00741 h4e[ir]->Fill(itHit->energyLoss());
00742 h4ex[ir]->Fill(itHit->entryPoint().x()-itHit->exitPoint().x());
00743 h4ey[ir]->Fill(itHit->entryPoint().y()-itHit->exitPoint().y());
00744 h4ez[ir]->Fill(std::fabs(itHit->entryPoint().z()-itHit->exitPoint().z()));
00745 h4lx[ir]->Fill(itHit->localPosition().x());
00746 h4ly[ir]->Fill(itHit->localPosition().y());
00747 }
00748
00749
00750 return ;
00751
00752 }
00753
00754 DEFINE_FWK_MODULE(TrackerHitAnalyzer);
00755