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