00001 #include "Validation/TrackerHits/interface/TrackerHitProducer.h"
00002 #include <cmath>
00003
00004 TrackerHitProducer::TrackerHitProducer(const edm::ParameterSet& iPSet) :
00005 fName(""), verbosity(0), label(""), getAllProvenances(false),
00006 printProvenanceInfo(false), nRawGenPart(0), config_(iPSet), count(0)
00007 {
00008
00009 fName = iPSet.getUntrackedParameter<std::string>("Name");
00010 verbosity = iPSet.getUntrackedParameter<int>("Verbosity");
00011 label = iPSet.getParameter<std::string>("Label");
00012 edm::ParameterSet m_Prov =
00013 iPSet.getParameter<edm::ParameterSet>("ProvenanceLookup");
00014 getAllProvenances =
00015 m_Prov.getUntrackedParameter<bool>("GetAllProvenances");
00016 printProvenanceInfo =
00017 m_Prov.getUntrackedParameter<bool>("PrintProvenanceInfo");
00018
00019
00020 PxlBrlLowSrc_ = iPSet.getParameter<edm::InputTag>("PxlBrlLowSrc");
00021 PxlBrlHighSrc_ = iPSet.getParameter<edm::InputTag>("PxlBrlHighSrc");
00022 PxlFwdLowSrc_ = iPSet.getParameter<edm::InputTag>("PxlFwdLowSrc");
00023 PxlFwdHighSrc_ = iPSet.getParameter<edm::InputTag>("PxlFwdHighSrc");
00024
00025 SiTIBLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTIBLowSrc");
00026 SiTIBHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTIBHighSrc");
00027 SiTOBLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTOBLowSrc");
00028 SiTOBHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTOBHighSrc");
00029 SiTIDLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTIDLowSrc");
00030 SiTIDHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTIDHighSrc");
00031 SiTECLowSrc_ = iPSet.getParameter<edm::InputTag>("SiTECLowSrc");
00032 SiTECHighSrc_ = iPSet.getParameter<edm::InputTag>("SiTECHighSrc");
00033
00034
00035
00036 verbosity %= 10;
00037
00038
00039 produces<PTrackerSimHit>(label);
00040
00041
00042 if (verbosity > 0) {
00043 edm::LogInfo ("TrackerHitProducer::TrackerHitProducer")
00044 << "\n===============================\n"
00045 << "Initialized as EDProducer with parameter values:\n"
00046 << " Name =" << fName << "\n"
00047 << " Verbosity =" << verbosity << "\n"
00048 << " Label =" << label << "\n"
00049 << " GetProv =" << getAllProvenances << "\n"
00050 << " PrintProv =" << printProvenanceInfo << "\n"
00051 << " PxlBrlLowSrc = " << PxlBrlLowSrc_.label()
00052 << ":" << PxlBrlLowSrc_.instance() << "\n"
00053 << " PxlBrlHighSrc = " << PxlBrlHighSrc_.label()
00054 << ":" << PxlBrlHighSrc_.instance() << "\n"
00055 << " PxlFwdLowSrc = " << PxlFwdLowSrc_.label()
00056 << ":" << PxlBrlLowSrc_.instance() << "\n"
00057 << " PxlFwdHighSrc = " << PxlFwdHighSrc_.label()
00058 << ":" << PxlBrlHighSrc_.instance() << "\n"
00059 << " SiTIBLowSrc = " << SiTIBLowSrc_.label()
00060 << ":" << SiTIBLowSrc_.instance() << "\n"
00061 << " SiTIBHighSrc = " << SiTIBHighSrc_.label()
00062 << ":" << SiTIBHighSrc_.instance() << "\n"
00063 << " SiTOBLowSrc = " << SiTOBLowSrc_.label()
00064 << ":" << SiTOBLowSrc_.instance() << "\n"
00065 << " SiTOBHighSrc = " << SiTOBHighSrc_.label()
00066 << ":" << SiTOBHighSrc_.instance() << "\n"
00067 << " SiTIDLowSrc = " << SiTIDLowSrc_.label()
00068 << ":" << SiTIDLowSrc_.instance() << "\n"
00069 << " SiTIDHighSrc = " << SiTIDHighSrc_.label()
00070 << ":" << SiTIDHighSrc_.instance() << "\n"
00071 << " SiTECLowSrc = " << SiTECLowSrc_.label()
00072 << ":" << SiTECLowSrc_.instance() << "\n"
00073 << " SiTECHighSrc = " << SiTECHighSrc_.label()
00074 << ":" << SiTECHighSrc_.instance() << "\n"
00075 << "===============================\n"; }
00076 }
00077
00078 TrackerHitProducer::~TrackerHitProducer()
00079 {
00080 }
00081
00082 void TrackerHitProducer::beginJob()
00083 {
00084 if (verbosity > 0)
00085 edm::LogInfo ("TrackerHitProducer::beginJob")
00086 << "Starting the job...";
00087 clear();
00088 return;
00089 }
00090
00091 void TrackerHitProducer::endJob()
00092 {
00093 if (verbosity > 0)
00094 edm::LogInfo ("TrackerHitProducer::endJob")
00095 << "Terminating having processed" << count << "events.";
00096 return;
00097 }
00098
00099 void TrackerHitProducer::produce(edm::Event& iEvent,
00100 const edm::EventSetup& iSetup)
00101 {
00102
00103 ++count;
00104
00105
00106 int nrun = iEvent.id().run();
00107 int nevt = iEvent.id().event();
00108
00109
00110
00111
00112
00113 if (verbosity > 0) {
00114 edm::LogInfo ("TrackerHitProducer::produce")
00115 << "Processing run" << nrun << "," << "event " << nevt;
00116 }
00117
00118
00119 clear();
00120
00121
00122 if (getAllProvenances) {
00123
00124 std::vector<const edm::Provenance*> AllProv;
00125 iEvent.getAllProvenance(AllProv);
00126
00127 if (verbosity > 0)
00128 edm::LogInfo ("TrackerHitProducer::produce")
00129 << "Number of Provenances =" << AllProv.size();
00130
00131 if (printProvenanceInfo && (verbosity > 0)) {
00132 TString eventout("\nProvenance info:\n");
00133
00134 for (unsigned int i = 0; i < AllProv.size(); ++i) {
00135 eventout += "\n ******************************";
00136 eventout += "\n Module : ";
00137 eventout += AllProv[i]->moduleLabel();
00138 eventout += "\n ProductID process index: ";
00139 eventout += AllProv[i]->productID().processIndex();
00140 eventout += "\n ProductID product index: ";
00141 eventout += AllProv[i]->productID().productIndex();
00142 eventout += "\n ClassName : ";
00143 eventout += AllProv[i]->className();
00144 eventout += "\n InstanceName : ";
00145 eventout += AllProv[i]->productInstanceName();
00146 eventout += "\n BranchName : ";
00147 eventout += AllProv[i]->branchName();
00148 }
00149 eventout += " ******************************\n";
00150 edm::LogInfo("TrackerHitProducer::produce") << eventout;
00151 }
00152 }
00153
00154
00155
00156 fillG4MC(iEvent);
00157
00158 fillTrk(iEvent,iSetup);
00159
00160 if (verbosity > 0)
00161 edm::LogInfo ("TrackerHitProducer::produce")
00162 << "Done gathering data from event.";
00163
00164
00165 std::auto_ptr<PTrackerSimHit> pOut(new PTrackerSimHit);
00166
00167 if (verbosity > 2)
00168 edm::LogInfo ("TrackerHitProducer::produce")
00169 << "Saving event contents:";
00170
00171
00172
00173 storeG4MC(*pOut);
00174
00175 storeTrk(*pOut);
00176
00177
00178 iEvent.put(pOut,label);
00179
00180 return;
00181 }
00182
00183
00184 void TrackerHitProducer::fillG4MC(edm::Event& iEvent)
00185 {
00186
00187 TString eventout;
00188 if (verbosity > 0)
00189 eventout = "\nGathering info:";
00190
00192
00194 edm::Handle<edm::HepMCProduct> HepMCEvt;
00195
00196 static std::string HepMClabel = config_.getUntrackedParameter<std::string>("HepMCProductLabel","source");
00197 static std::string HepMCinstance = config_.getUntrackedParameter<std::string>("HepMCInputInstance","");
00198 iEvent.getByLabel(HepMClabel, HepMCinstance ,HepMCEvt);
00199 if (!HepMCEvt.isValid()) {
00200 edm::LogError("TrackerHitProducer::fillG4MC")
00201 << "Unable to find HepMCProduct in event!";
00202 return;
00203 }
00204 const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
00205 nRawGenPart = MCEvt->particles_size();
00206
00207 if (verbosity > 1) {
00208 eventout += "\n Number of Raw Particles collected: ";
00209 eventout += nRawGenPart;
00210 }
00211
00213
00215 edm::Handle<edm::SimVertexContainer> G4VtxContainer;
00216 iEvent.getByType(G4VtxContainer);
00217 if (!G4VtxContainer.isValid()) {
00218 edm::LogError("TrackerHitProducer::fillG4MC")
00219 << "Unable to find SimVertex in event!";
00220 return;
00221 }
00222 int i = 0;
00223 edm::SimVertexContainer::const_iterator itVtx;
00224 for (itVtx = G4VtxContainer->begin(); itVtx != G4VtxContainer->end();
00225 ++itVtx) {
00226
00227 ++i;
00228
00229 const CLHEP::HepLorentzVector& G4Vtx = CLHEP::HepLorentzVector(itVtx->position().x(),
00230 itVtx->position().y(),
00231 itVtx->position().z(),
00232 itVtx->position().e());
00233 G4VtxX.push_back(G4Vtx[0]/micrometer);
00234 G4VtxY.push_back(G4Vtx[1]/micrometer);
00235 G4VtxZ.push_back(G4Vtx[2]/millimeter);
00236 }
00237
00238 if (verbosity > 1) {
00239 eventout += "\n Number of G4Vertices collected: ";
00240 eventout += i;
00241 }
00242
00244
00246 edm::Handle<edm::SimTrackContainer> G4TrkContainer;
00247 iEvent.getByType(G4TrkContainer);
00248 if (!G4TrkContainer.isValid()) {
00249 edm::LogError("TrackerHitProducer::fillG4MC")
00250 << "Unable to find SimTrack in event!";
00251 return;
00252 }
00253 i = 0;
00254 edm::SimTrackContainer::const_iterator itTrk;
00255 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end();
00256 ++itTrk) {
00257
00258 ++i;
00259
00260 double etaInit =0, phiInit =0, pInit =0;
00261 const CLHEP::HepLorentzVector& G4Trk = CLHEP::HepLorentzVector(itTrk->momentum().x(),
00262 itTrk->momentum().y(),
00263 itTrk->momentum().z(),
00264 itTrk->momentum().e());
00265 pInit =sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]+G4Trk[2]*G4Trk[2]);
00266 if ( pInit == 0)
00267 edm::LogError("TrackerHitProducer::fillG4MC")
00268 << "TrackerTest::INFO: Primary has p = 0 ";
00269 else {
00270 double costheta = G4Trk[2]/pInit;
00271 double theta = acos(TMath::Min(TMath::Max(costheta, -1.),1.));
00272 etaInit = -log(tan(theta/2));
00273
00274 if ( G4Trk[0] != 0 || G4Trk[1] != 0)
00275 phiInit = atan2(G4Trk[1],G4Trk[0]);
00276 }
00277 G4TrkPt.push_back(sqrt(G4Trk[0]*G4Trk[0]+G4Trk[1]*G4Trk[1]));
00278 G4TrkE.push_back(G4Trk[3]);
00279 G4TrkEta.push_back(etaInit);
00280 G4TrkPhi.push_back(phiInit);
00281 }
00282
00283 if (verbosity > 1) {
00284 eventout += "\n Number of G4Tracks collected: ";
00285 eventout += i;
00286 }
00287
00288 if (verbosity > 0)
00289 edm::LogInfo("TrackerHitProducer::fillG4MC") << eventout;
00290
00291 return;
00292 }
00293
00294 void TrackerHitProducer::storeG4MC(PTrackerSimHit& product)
00295 {
00296
00297 if (verbosity > 2) {
00298 TString eventout("\nnRawGenPart = ");
00299 eventout += nRawGenPart;
00300 eventout += "\n nG4Vtx = ";
00301 eventout += G4VtxX.size();
00302 for (unsigned int i = 0; i < G4VtxX.size(); ++i) {
00303 eventout += "\n (x,y,z) = (";
00304 eventout += G4VtxX[i];
00305 eventout += ", ";
00306 eventout += G4VtxY[i];
00307 eventout += ", ";
00308 eventout += G4VtxZ[i];
00309 eventout += ")";
00310 }
00311 eventout += "\n nG4Trk = ";
00312 eventout += G4TrkPt.size();
00313 for (unsigned int i = 0; i < G4TrkPt.size(); ++i) {
00314 eventout += "\n (pt,e,eta,phi) = (";
00315 eventout += G4TrkPt[i];
00316 eventout += ", ";
00317 eventout += G4TrkE[i];
00318 eventout += ")";
00319 eventout += G4TrkEta[i];
00320 eventout += ")";
00321 eventout += G4TrkPhi[i];
00322 eventout += ")";
00323 }
00324 edm::LogInfo("TrackerHitProducer::storeG4MC") << eventout;
00325 }
00326
00327 product.putRawGenPart(nRawGenPart);
00328 product.putG4Vtx(G4VtxX, G4VtxY, G4VtxZ);
00329 product.putG4Trk(G4TrkPt, G4TrkE, G4TrkEta, G4TrkPhi);
00330
00331 return;
00332 }
00333
00334 void TrackerHitProducer::fillTrk(edm::Event& iEvent,
00335 const edm::EventSetup& iSetup)
00336 {
00337 TString eventout;
00338 int sysID = 0;
00339 if (verbosity > 0)
00340 eventout = "\nGathering info:";
00342
00343 edm::PSimHitContainer::const_iterator itHit;
00344
00345
00347
00349
00350
00351 edm::Handle<edm::PSimHitContainer> PxlBrlLowContainer;
00352 iEvent.getByLabel(PxlBrlLowSrc_,PxlBrlLowContainer);
00353
00354 if (!PxlBrlLowContainer.isValid()) {
00355 edm::LogError("TrackerHitProducer::fillTrk")
00356 << "Unable to find TrackerHitsPixelBarrelLowTof in event!";
00357 return;
00358 }
00359
00360
00361
00362
00363
00364 sysID = 100;
00365 int j = 0;
00366 for (itHit = PxlBrlLowContainer->begin(); itHit != PxlBrlLowContainer->end(); ++itHit) {
00367
00368
00369
00370 ++j;
00371 HitsSysID.push_back(sysID);
00372 HitsDuID.push_back(itHit->detUnitId());
00373 HitsTkID.push_back(itHit->trackId());
00374 HitsProT.push_back(itHit->processType());
00375 HitsParT.push_back(itHit->particleType());
00376 HitsP.push_back(itHit->pabs());
00377
00378 HitsLpX.push_back(itHit->localPosition().x());
00379 HitsLpY.push_back(itHit->localPosition().y());
00380 HitsLpZ.push_back(itHit->localPosition().z());
00381
00382 HitsLdX.push_back(itHit->localDirection().x());
00383 HitsLdY.push_back(itHit->localDirection().y());
00384 HitsLdZ.push_back(itHit->localDirection().z());
00385 HitsLdTheta.push_back(itHit->localDirection().theta());
00386 HitsLdPhi.push_back(itHit->localDirection().phi());
00387
00388 HitsExPx.push_back(itHit->exitPoint().x());
00389 HitsExPy.push_back(itHit->exitPoint().y());
00390 HitsExPz.push_back(itHit->exitPoint().z());
00391
00392 HitsEnPx.push_back(itHit->entryPoint().x());
00393 HitsEnPy.push_back(itHit->entryPoint().y());
00394 HitsEnPz.push_back(itHit->entryPoint().z());
00395
00396 HitsEloss.push_back(itHit->energyLoss());
00397 HitsToF.push_back(itHit->tof());
00398
00399 }
00400
00401 if (verbosity > 1) {
00402 eventout += "\n Number of Pixel Barrel Low TOF Hits collected: ";
00403 eventout += j;
00404 }
00405
00406
00407
00408
00409 edm::Handle<edm::PSimHitContainer> PxlBrlHighContainer;
00410
00411 iEvent.getByLabel(PxlBrlHighSrc_,PxlBrlHighContainer);
00412 if (!PxlBrlHighContainer.isValid()) {
00413 edm::LogError("TrackerHitProducer::fillTrk")
00414 << "Unable to find TrackerHitsPixelBarrelHighTof in event!";
00415 return;
00416 }
00417
00418
00419 sysID = 200;
00420 j = 0;
00421 for (itHit = PxlBrlHighContainer->begin(); itHit != PxlBrlHighContainer->end(); ++itHit) {
00422
00423
00424 ++j;
00425 HitsSysID.push_back(sysID);
00426 HitsDuID.push_back(itHit->detUnitId());
00427 HitsTkID.push_back(itHit->trackId());
00428 HitsProT.push_back(itHit->processType());
00429 HitsParT.push_back(itHit->particleType());
00430 HitsP.push_back(itHit->pabs());
00431
00432 HitsLpX.push_back(itHit->localPosition().x());
00433 HitsLpY.push_back(itHit->localPosition().y());
00434 HitsLpZ.push_back(itHit->localPosition().z());
00435
00436 HitsLdX.push_back(itHit->localDirection().x());
00437 HitsLdY.push_back(itHit->localDirection().y());
00438 HitsLdZ.push_back(itHit->localDirection().z());
00439 HitsLdTheta.push_back(itHit->localDirection().theta());
00440 HitsLdPhi.push_back(itHit->localDirection().phi());
00441
00442 HitsExPx.push_back(itHit->exitPoint().x());
00443 HitsExPy.push_back(itHit->exitPoint().y());
00444 HitsExPz.push_back(itHit->exitPoint().z());
00445
00446 HitsEnPx.push_back(itHit->entryPoint().x());
00447 HitsEnPy.push_back(itHit->entryPoint().y());
00448 HitsEnPz.push_back(itHit->entryPoint().z());
00449
00450 HitsEloss.push_back(itHit->energyLoss());
00451 HitsToF.push_back(itHit->tof());
00452
00453 }
00454
00455 if (verbosity > 1) {
00456 eventout += "\n Number of Pixel Barrel High TOF Hits collected: ";
00457 eventout += j;
00458 }
00459
00460
00462
00464
00465 edm::Handle<edm::PSimHitContainer> PxlFwdLowContainer;
00466
00467 iEvent.getByLabel(PxlFwdLowSrc_,PxlFwdLowContainer);
00468 if (!PxlFwdLowContainer.isValid()) {
00469 edm::LogError("TrackerHitProducer::fillTrk")
00470 << "Unable to find TrackerHitsPixelEndcapLowTof in event!";
00471 return;
00472 }
00473
00474 sysID = 300;
00475 j = 0;
00476 for (itHit = PxlFwdLowContainer->begin(); itHit != PxlFwdLowContainer->end(); ++itHit) {
00477
00478
00479 ++j;
00480 HitsSysID.push_back(sysID);
00481 HitsDuID.push_back(itHit->detUnitId());
00482 HitsTkID.push_back(itHit->trackId());
00483 HitsProT.push_back(itHit->processType());
00484 HitsParT.push_back(itHit->particleType());
00485 HitsP.push_back(itHit->pabs());
00486
00487 HitsLpX.push_back(itHit->localPosition().x());
00488 HitsLpY.push_back(itHit->localPosition().y());
00489 HitsLpZ.push_back(itHit->localPosition().z());
00490
00491 HitsLdX.push_back(itHit->localDirection().x());
00492 HitsLdY.push_back(itHit->localDirection().y());
00493 HitsLdZ.push_back(itHit->localDirection().z());
00494 HitsLdTheta.push_back(itHit->localDirection().theta());
00495 HitsLdPhi.push_back(itHit->localDirection().phi());
00496
00497 HitsExPx.push_back(itHit->exitPoint().x());
00498 HitsExPy.push_back(itHit->exitPoint().y());
00499 HitsExPz.push_back(itHit->exitPoint().z());
00500
00501 HitsEnPx.push_back(itHit->entryPoint().x());
00502 HitsEnPy.push_back(itHit->entryPoint().y());
00503 HitsEnPz.push_back(itHit->entryPoint().z());
00504
00505 HitsEloss.push_back(itHit->energyLoss());
00506 HitsToF.push_back(itHit->tof());
00507
00508 }
00509
00510 if (verbosity > 1) {
00511 eventout += "\n Number of Pixel Forward Low TOF Hits collected: ";
00512 eventout += j;
00513 }
00514
00515
00516
00517 edm::Handle<edm::PSimHitContainer> PxlFwdHighContainer;
00518
00519 iEvent.getByLabel(PxlFwdHighSrc_,PxlFwdHighContainer);
00520 if (!PxlFwdHighContainer.isValid()) {
00521 edm::LogError("TrackerHitProducer::fillTrk")
00522 << "Unable to find TrackerHitsPixelEndcapHighTof in event!";
00523 return;
00524 }
00525
00526 sysID = 400;
00527 j = 0;
00528 for (itHit = PxlFwdHighContainer->begin(); itHit != PxlFwdHighContainer->end(); ++itHit) {
00529
00530
00531 ++j;
00532 HitsSysID.push_back(sysID);
00533 HitsDuID.push_back(itHit->detUnitId());
00534 HitsTkID.push_back(itHit->trackId());
00535 HitsProT.push_back(itHit->processType());
00536 HitsParT.push_back(itHit->particleType());
00537 HitsP.push_back(itHit->pabs());
00538
00539 HitsLpX.push_back(itHit->localPosition().x());
00540 HitsLpY.push_back(itHit->localPosition().y());
00541 HitsLpZ.push_back(itHit->localPosition().z());
00542
00543 HitsLdX.push_back(itHit->localDirection().x());
00544 HitsLdY.push_back(itHit->localDirection().y());
00545 HitsLdZ.push_back(itHit->localDirection().z());
00546 HitsLdTheta.push_back(itHit->localDirection().theta());
00547 HitsLdPhi.push_back(itHit->localDirection().phi());
00548
00549 HitsExPx.push_back(itHit->exitPoint().x());
00550 HitsExPy.push_back(itHit->exitPoint().y());
00551 HitsExPz.push_back(itHit->exitPoint().z());
00552
00553 HitsEnPx.push_back(itHit->entryPoint().x());
00554 HitsEnPy.push_back(itHit->entryPoint().y());
00555 HitsEnPz.push_back(itHit->entryPoint().z());
00556
00557 HitsEloss.push_back(itHit->energyLoss());
00558 HitsToF.push_back(itHit->tof());
00559
00560 }
00561
00562 if (verbosity > 1) {
00563 eventout += "\n Number of Pixel Forward High TOF Hits collected: ";
00564 eventout += j;
00565 }
00566
00567
00569
00571
00572 edm::Handle<edm::PSimHitContainer> SiTIBLowContainer;
00573
00574 iEvent.getByLabel(SiTIBLowSrc_,SiTIBLowContainer);
00575 if (!SiTIBLowContainer.isValid()) {
00576 edm::LogError("TrackerHitProducer::fillTrk")
00577 << "Unable to find TrackerHitsTIBLowTof in event!";
00578 return;
00579 }
00580
00581 sysID = 10;
00582 j = 0;
00583 for (itHit = SiTIBLowContainer->begin(); itHit != SiTIBLowContainer->end(); ++itHit) {
00584
00585
00586 ++j;
00587 HitsSysID.push_back(sysID);
00588 HitsDuID.push_back(itHit->detUnitId());
00589 HitsTkID.push_back(itHit->trackId());
00590 HitsProT.push_back(itHit->processType());
00591 HitsParT.push_back(itHit->particleType());
00592 HitsP.push_back(itHit->pabs());
00593
00594 HitsLpX.push_back(itHit->localPosition().x());
00595 HitsLpY.push_back(itHit->localPosition().y());
00596 HitsLpZ.push_back(itHit->localPosition().z());
00597
00598 HitsLdX.push_back(itHit->localDirection().x());
00599 HitsLdY.push_back(itHit->localDirection().y());
00600 HitsLdZ.push_back(itHit->localDirection().z());
00601 HitsLdTheta.push_back(itHit->localDirection().theta());
00602 HitsLdPhi.push_back(itHit->localDirection().phi());
00603
00604 HitsExPx.push_back(itHit->exitPoint().x());
00605 HitsExPy.push_back(itHit->exitPoint().y());
00606 HitsExPz.push_back(itHit->exitPoint().z());
00607
00608 HitsEnPx.push_back(itHit->entryPoint().x());
00609 HitsEnPy.push_back(itHit->entryPoint().y());
00610 HitsEnPz.push_back(itHit->entryPoint().z());
00611
00612 HitsEloss.push_back(itHit->energyLoss());
00613 HitsToF.push_back(itHit->tof());
00614
00615 }
00616
00617 if (verbosity > 1) {
00618 eventout += "\n Number of TIB low TOF Hits collected: ";
00619 eventout += j;
00620 }
00621
00622
00623
00624 edm::Handle<edm::PSimHitContainer> SiTIBHighContainer;
00625
00626 iEvent.getByLabel(SiTIBHighSrc_,SiTIBHighContainer);
00627 if (!SiTIBHighContainer.isValid()) {
00628 edm::LogError("TrackerHitProducer::fillTrk")
00629 << "Unable to find TrackerHitsTIBHighTof in event!";
00630 return;
00631 }
00632
00633 sysID = 20;
00634 j = 0;
00635 for (itHit = SiTIBHighContainer->begin(); itHit != SiTIBHighContainer->end(); ++itHit) {
00636
00637
00638 ++j;
00639 HitsSysID.push_back(sysID);
00640 HitsDuID.push_back(itHit->detUnitId());
00641 HitsTkID.push_back(itHit->trackId());
00642 HitsProT.push_back(itHit->processType());
00643 HitsParT.push_back(itHit->particleType());
00644 HitsP.push_back(itHit->pabs());
00645
00646 HitsLpX.push_back(itHit->localPosition().x());
00647 HitsLpY.push_back(itHit->localPosition().y());
00648 HitsLpZ.push_back(itHit->localPosition().z());
00649
00650 HitsLdX.push_back(itHit->localDirection().x());
00651 HitsLdY.push_back(itHit->localDirection().y());
00652 HitsLdZ.push_back(itHit->localDirection().z());
00653 HitsLdTheta.push_back(itHit->localDirection().theta());
00654 HitsLdPhi.push_back(itHit->localDirection().phi());
00655
00656 HitsExPx.push_back(itHit->exitPoint().x());
00657 HitsExPy.push_back(itHit->exitPoint().y());
00658 HitsExPz.push_back(itHit->exitPoint().z());
00659
00660 HitsEnPx.push_back(itHit->entryPoint().x());
00661 HitsEnPy.push_back(itHit->entryPoint().y());
00662 HitsEnPz.push_back(itHit->entryPoint().z());
00663
00664 HitsEloss.push_back(itHit->energyLoss());
00665 HitsToF.push_back(itHit->tof());
00666
00667 }
00668
00669 if (verbosity > 1) {
00670 eventout += "\n Number of TIB high TOF Hits collected: ";
00671 eventout += j;
00672 }
00673
00675
00677
00678 edm::Handle<edm::PSimHitContainer> SiTOBLowContainer;
00679
00680 iEvent.getByLabel(SiTOBLowSrc_,SiTOBLowContainer);
00681 if (!SiTOBLowContainer.isValid()) {
00682 edm::LogError("TrackerHitProducer::fillTrk")
00683 << "Unable to find TrackerHitsTOBLowTof in event!";
00684 return;
00685 }
00686
00687 sysID = 30;
00688 j = 0;
00689 for (itHit = SiTOBLowContainer->begin(); itHit != SiTOBLowContainer->end(); ++itHit) {
00690
00691
00692 ++j;
00693 HitsSysID.push_back(sysID);
00694 HitsDuID.push_back(itHit->detUnitId());
00695 HitsTkID.push_back(itHit->trackId());
00696 HitsProT.push_back(itHit->processType());
00697 HitsParT.push_back(itHit->particleType());
00698 HitsP.push_back(itHit->pabs());
00699
00700 HitsLpX.push_back(itHit->localPosition().x());
00701 HitsLpY.push_back(itHit->localPosition().y());
00702 HitsLpZ.push_back(itHit->localPosition().z());
00703
00704 HitsLdX.push_back(itHit->localDirection().x());
00705 HitsLdY.push_back(itHit->localDirection().y());
00706 HitsLdZ.push_back(itHit->localDirection().z());
00707 HitsLdTheta.push_back(itHit->localDirection().theta());
00708 HitsLdPhi.push_back(itHit->localDirection().phi());
00709
00710 HitsExPx.push_back(itHit->exitPoint().x());
00711 HitsExPy.push_back(itHit->exitPoint().y());
00712 HitsExPz.push_back(itHit->exitPoint().z());
00713
00714 HitsEnPx.push_back(itHit->entryPoint().x());
00715 HitsEnPy.push_back(itHit->entryPoint().y());
00716 HitsEnPz.push_back(itHit->entryPoint().z());
00717
00718 HitsEloss.push_back(itHit->energyLoss());
00719 HitsToF.push_back(itHit->tof());
00720
00721 }
00722
00723 if (verbosity > 1) {
00724 eventout += "\n Number of TOB low TOF Hits collected: ";
00725 eventout += j;
00726 }
00727
00728
00729 edm::Handle<edm::PSimHitContainer> SiTOBHighContainer;
00730
00731 iEvent.getByLabel(SiTOBHighSrc_,SiTOBHighContainer);
00732 if (!SiTOBHighContainer.isValid()) {
00733 edm::LogError("TrackerHitProducer::fillTrk")
00734 << "Unable to find TrackerHitsTOBHighTof in event!";
00735 return;
00736 }
00737
00738 sysID = 40;
00739 j = 0;
00740 for (itHit = SiTOBHighContainer->begin(); itHit != SiTOBHighContainer->end(); ++itHit) {
00741
00742
00743 ++j;
00744 HitsSysID.push_back(sysID);
00745 HitsDuID.push_back(itHit->detUnitId());
00746 HitsTkID.push_back(itHit->trackId());
00747 HitsProT.push_back(itHit->processType());
00748 HitsParT.push_back(itHit->particleType());
00749 HitsP.push_back(itHit->pabs());
00750
00751 HitsLpX.push_back(itHit->localPosition().x());
00752 HitsLpY.push_back(itHit->localPosition().y());
00753 HitsLpZ.push_back(itHit->localPosition().z());
00754
00755 HitsLdX.push_back(itHit->localDirection().x());
00756 HitsLdY.push_back(itHit->localDirection().y());
00757 HitsLdZ.push_back(itHit->localDirection().z());
00758 HitsLdTheta.push_back(itHit->localDirection().theta());
00759 HitsLdPhi.push_back(itHit->localDirection().phi());
00760
00761 HitsExPx.push_back(itHit->exitPoint().x());
00762 HitsExPy.push_back(itHit->exitPoint().y());
00763 HitsExPz.push_back(itHit->exitPoint().z());
00764
00765 HitsEnPx.push_back(itHit->entryPoint().x());
00766 HitsEnPy.push_back(itHit->entryPoint().y());
00767 HitsEnPz.push_back(itHit->entryPoint().z());
00768
00769 HitsEloss.push_back(itHit->energyLoss());
00770 HitsToF.push_back(itHit->tof());
00771
00772 }
00773
00774 if (verbosity > 1) {
00775 eventout += "\n Number of TOB high TOF Hits collected: ";
00776 eventout += j;
00777 }
00778
00780
00782
00783 edm::Handle<edm::PSimHitContainer> SiTIDLowContainer;
00784
00785 iEvent.getByLabel(SiTIDLowSrc_,SiTIDLowContainer);
00786 if (!SiTIDLowContainer.isValid()) {
00787 edm::LogError("TrackerHitProducer::fillTrk")
00788 << "Unable to find TrackerHitsTIDLowTof in event!";
00789 return;
00790 }
00791
00792 sysID = 50;
00793 j = 0;
00794 for (itHit = SiTIDLowContainer->begin(); itHit != SiTIDLowContainer->end(); ++itHit) {
00795
00796
00797 ++j;
00798 HitsSysID.push_back(sysID);
00799 HitsDuID.push_back(itHit->detUnitId());
00800 HitsTkID.push_back(itHit->trackId());
00801 HitsProT.push_back(itHit->processType());
00802 HitsParT.push_back(itHit->particleType());
00803 HitsP.push_back(itHit->pabs());
00804
00805 HitsLpX.push_back(itHit->localPosition().x());
00806 HitsLpY.push_back(itHit->localPosition().y());
00807 HitsLpZ.push_back(itHit->localPosition().z());
00808
00809 HitsLdX.push_back(itHit->localDirection().x());
00810 HitsLdY.push_back(itHit->localDirection().y());
00811 HitsLdZ.push_back(itHit->localDirection().z());
00812 HitsLdTheta.push_back(itHit->localDirection().theta());
00813 HitsLdPhi.push_back(itHit->localDirection().phi());
00814
00815 HitsExPx.push_back(itHit->exitPoint().x());
00816 HitsExPy.push_back(itHit->exitPoint().y());
00817 HitsExPz.push_back(itHit->exitPoint().z());
00818
00819 HitsEnPx.push_back(itHit->entryPoint().x());
00820 HitsEnPy.push_back(itHit->entryPoint().y());
00821 HitsEnPz.push_back(itHit->entryPoint().z());
00822
00823 HitsEloss.push_back(itHit->energyLoss());
00824 HitsToF.push_back(itHit->tof());
00825
00826 }
00827
00828 if (verbosity > 1) {
00829 eventout += "\n Number of TID low TOF Hits collected: ";
00830 eventout += j;
00831 }
00832
00833
00834 edm::Handle<edm::PSimHitContainer> SiTIDHighContainer;
00835
00836 iEvent.getByLabel(SiTIDHighSrc_,SiTIDHighContainer);
00837 if (!SiTIDHighContainer.isValid()) {
00838 edm::LogError("TrackerHitProducer::fillTrk")
00839 << "Unable to find TrackerHitsTIDHighTof in event!";
00840 return;
00841 }
00842
00843 sysID = 60;
00844 j = 0;
00845 for (itHit = SiTIDHighContainer->begin(); itHit != SiTIDHighContainer->end(); ++itHit) {
00846
00847
00848 ++j;
00849 HitsSysID.push_back(sysID);
00850 HitsDuID.push_back(itHit->detUnitId());
00851 HitsTkID.push_back(itHit->trackId());
00852 HitsProT.push_back(itHit->processType());
00853 HitsParT.push_back(itHit->particleType());
00854 HitsP.push_back(itHit->pabs());
00855
00856 HitsLpX.push_back(itHit->localPosition().x());
00857 HitsLpY.push_back(itHit->localPosition().y());
00858 HitsLpZ.push_back(itHit->localPosition().z());
00859
00860 HitsLdX.push_back(itHit->localDirection().x());
00861 HitsLdY.push_back(itHit->localDirection().y());
00862 HitsLdZ.push_back(itHit->localDirection().z());
00863 HitsLdTheta.push_back(itHit->localDirection().theta());
00864 HitsLdPhi.push_back(itHit->localDirection().phi());
00865
00866 HitsExPx.push_back(itHit->exitPoint().x());
00867 HitsExPy.push_back(itHit->exitPoint().y());
00868 HitsExPz.push_back(itHit->exitPoint().z());
00869
00870 HitsEnPx.push_back(itHit->entryPoint().x());
00871 HitsEnPy.push_back(itHit->entryPoint().y());
00872 HitsEnPz.push_back(itHit->entryPoint().z());
00873
00874 HitsEloss.push_back(itHit->energyLoss());
00875 HitsToF.push_back(itHit->tof());
00876
00877 }
00878
00879 if (verbosity > 1) {
00880 eventout += "\n Number of TID high TOF Hits collected: ";
00881 eventout += j;
00882 }
00883
00885
00887
00888 edm::Handle<edm::PSimHitContainer> SiTECLowContainer;
00889
00890 iEvent.getByLabel(SiTECLowSrc_,SiTECLowContainer);
00891 if (!SiTECLowContainer.isValid()) {
00892 edm::LogError("TrackerHitProducer::fillTrk")
00893 << "Unable to find TrackerHitsTECLowTof in event!";
00894 return;
00895 }
00896
00897 sysID = 70;
00898 j = 0;
00899 for (itHit = SiTECLowContainer->begin(); itHit != SiTECLowContainer->end(); ++itHit) {
00900
00901
00902 ++j;
00903 HitsSysID.push_back(sysID);
00904 HitsDuID.push_back(itHit->detUnitId());
00905 HitsTkID.push_back(itHit->trackId());
00906 HitsProT.push_back(itHit->processType());
00907 HitsParT.push_back(itHit->particleType());
00908 HitsP.push_back(itHit->pabs());
00909
00910 HitsLpX.push_back(itHit->localPosition().x());
00911 HitsLpY.push_back(itHit->localPosition().y());
00912 HitsLpZ.push_back(itHit->localPosition().z());
00913
00914 HitsLdX.push_back(itHit->localDirection().x());
00915 HitsLdY.push_back(itHit->localDirection().y());
00916 HitsLdZ.push_back(itHit->localDirection().z());
00917 HitsLdTheta.push_back(itHit->localDirection().theta());
00918 HitsLdPhi.push_back(itHit->localDirection().phi());
00919
00920 HitsExPx.push_back(itHit->exitPoint().x());
00921 HitsExPy.push_back(itHit->exitPoint().y());
00922 HitsExPz.push_back(itHit->exitPoint().z());
00923
00924 HitsEnPx.push_back(itHit->entryPoint().x());
00925 HitsEnPy.push_back(itHit->entryPoint().y());
00926 HitsEnPz.push_back(itHit->entryPoint().z());
00927
00928 HitsEloss.push_back(itHit->energyLoss());
00929 HitsToF.push_back(itHit->tof());
00930
00931 }
00932
00933 if (verbosity > 1) {
00934 eventout += "\n Number of TEC low TOF Hits collected: ";
00935 eventout += j;
00936 }
00937
00938
00939
00940 edm::Handle<edm::PSimHitContainer> SiTECHighContainer;
00941
00942 iEvent.getByLabel(SiTECHighSrc_,SiTECHighContainer);
00943 if (!SiTECHighContainer.isValid()) {
00944 edm::LogError("TrackerHitProducer::fillTrk")
00945 << "Unable to find TrackerHitsTECHighTof in event!";
00946 return;
00947 }
00948 sysID = 80;
00949 j = 0;
00950 for (itHit = SiTECHighContainer->begin(); itHit != SiTECHighContainer->end(); ++itHit) {
00951
00952
00953 ++j;
00954 HitsSysID.push_back(sysID);
00955 HitsDuID.push_back(itHit->detUnitId());
00956 HitsTkID.push_back(itHit->trackId());
00957 HitsProT.push_back(itHit->processType());
00958 HitsParT.push_back(itHit->particleType());
00959 HitsP.push_back(itHit->pabs());
00960
00961 HitsLpX.push_back(itHit->localPosition().x());
00962 HitsLpY.push_back(itHit->localPosition().y());
00963 HitsLpZ.push_back(itHit->localPosition().z());
00964
00965 HitsLdX.push_back(itHit->localDirection().x());
00966 HitsLdY.push_back(itHit->localDirection().y());
00967 HitsLdZ.push_back(itHit->localDirection().z());
00968 HitsLdTheta.push_back(itHit->localDirection().theta());
00969 HitsLdPhi.push_back(itHit->localDirection().phi());
00970
00971 HitsExPx.push_back(itHit->exitPoint().x());
00972 HitsExPy.push_back(itHit->exitPoint().y());
00973 HitsExPz.push_back(itHit->exitPoint().z());
00974
00975 HitsEnPx.push_back(itHit->entryPoint().x());
00976 HitsEnPy.push_back(itHit->entryPoint().y());
00977 HitsEnPz.push_back(itHit->entryPoint().z());
00978
00979 HitsEloss.push_back(itHit->energyLoss());
00980 HitsToF.push_back(itHit->tof());
00981
00982 }
00983
00984 if (verbosity > 1) {
00985 eventout += "\n Number of TEC high TOF Hits collected: ";
00986 eventout += j;
00987 }
00988
00989 if (verbosity > 0)
00990 edm::LogInfo("TrackerHitProducer::fillTrk") << eventout;
00991
00992 return;
00993 }
00994
00995 void TrackerHitProducer::storeTrk(PTrackerSimHit& product)
00996 {
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055 product.putHits(HitsSysID, HitsDuID, HitsTkID, HitsProT, HitsParT, HitsP,
01056 HitsLpX, HitsLpY, HitsLpZ,
01057 HitsLdX, HitsLdY, HitsLdZ, HitsLdTheta, HitsLdPhi,
01058 HitsExPx, HitsExPy, HitsExPz,
01059 HitsEnPx, HitsEnPy, HitsEnPz,
01060 HitsEloss, HitsToF);
01061
01062 return;
01063 }
01064
01065 void TrackerHitProducer::clear()
01066 {
01067 if (verbosity > 0)
01068 edm::LogInfo("GlobalValProducer::clear")
01069 << "Clearing event holders";
01070
01071
01072 nRawGenPart = 0;
01073 G4VtxX.clear();
01074 G4VtxY.clear();
01075 G4VtxZ.clear();
01076 G4TrkPt.clear();
01077 G4TrkE.clear();
01078 G4TrkEta.clear();
01079 G4TrkPhi.clear();
01080
01081 HitsSysID.clear();
01082 HitsDuID.clear();
01083 HitsTkID.clear();
01084 HitsProT.clear();
01085 HitsParT.clear();
01086 HitsP.clear();
01087 HitsLpX.clear();
01088 HitsLpY.clear();
01089 HitsLpZ.clear();
01090 HitsLdX.clear();
01091 HitsLdY.clear();
01092 HitsLdZ.clear();
01093 HitsLdTheta.clear();
01094 HitsLdPhi.clear();
01095 HitsExPx.clear();
01096 HitsExPy.clear();
01097 HitsExPz.clear();
01098 HitsEnPx.clear();
01099 HitsEnPy.clear();
01100 HitsEnPz.clear();
01101 HitsEloss.clear();
01102 HitsToF.clear();
01103
01104 return;
01105 }
01106
01107
01108 DEFINE_FWK_MODULE(TrackerHitProducer);