18 getAllProvenances(
false),
19 printProvenanceInfo(
false),
30 std::string MsgLoggerCat =
"GlobalHitsProducer_GlobalHitsProducer";
96 produces<PGlobalSimHit>(
label);
101 <<
"\n===============================\n"
102 <<
"Initialized as EDProducer with parameter values:\n"
103 <<
" Name = " <<
fName <<
"\n"
106 <<
" VtxUnit = " <<
vtxunit <<
"\n"
107 <<
" Label = " <<
label <<
"\n"
129 <<
"===============================\n";
141 std::string MsgLoggerCat =
"GlobalHitsProducer_endJob";
143 edm::LogInfo(MsgLoggerCat) <<
"Terminating having processed " <<
count <<
" events.";
148 std::string MsgLoggerCat =
"GlobalHitsProducer_produce";
158 edm::LogInfo(MsgLoggerCat) <<
"Processing run " << nrun <<
", event " <<
nevt <<
" (" <<
count <<
" events total)";
171 std::vector<const edm::StableProvenance *> AllProv;
172 iEvent.getAllStableProvenance(AllProv);
175 edm::LogInfo(MsgLoggerCat) <<
"Number of Provenances = " << AllProv.size();
178 TString eventout(
"\nProvenance info:\n");
180 for (
unsigned int i = 0;
i < AllProv.size(); ++
i) {
181 eventout +=
"\n ******************************";
182 eventout +=
"\n Module : ";
183 eventout += AllProv[
i]->moduleLabel();
184 eventout +=
"\n ProductID : ";
185 eventout += AllProv[
i]->productID().id();
186 eventout +=
"\n ClassName : ";
187 eventout += AllProv[
i]->className();
188 eventout +=
"\n InstanceName : ";
189 eventout += AllProv[
i]->productInstanceName();
190 eventout +=
"\n BranchName : ";
191 eventout += AllProv[
i]->branchName();
193 eventout +=
"\n ******************************\n";
213 edm::LogInfo(MsgLoggerCat) <<
"Done gathering data from event.";
241 std::string MsgLoggerCat =
"GlobalHitsProducer_fillG4MC";
245 eventout =
"\nGathering info:";
251 std::vector<edm::Handle<edm::HepMCProduct>> AllHepMCEvt;
252 iEvent.getManyByType(AllHepMCEvt);
256 for (
unsigned int i = 0;
i < AllHepMCEvt.size(); ++
i) {
257 HepMCEvt = AllHepMCEvt[
i];
263 edm::LogWarning(MsgLoggerCat) <<
"Unable to find HepMCProduct in event!";
266 eventout +=
"\n Using HepMCProduct: ";
273 eventout +=
"\n Number of Raw Particles collected:......... ";
289 if (!G4VtxContainer.
isValid()) {
294 edm::SimVertexContainer::const_iterator itVtx;
295 for (itVtx = G4VtxContainer->begin(); itVtx != G4VtxContainer->end(); ++itVtx) {
299 itVtx->position().x(), itVtx->position().y(), itVtx->position().z(), itVtx->position().e());
301 G4Vtx1.GetCoordinates(G4Vtx);
303 G4VtxX.push_back((G4Vtx[0] *
unit) / micrometer);
304 G4VtxY.push_back((G4Vtx[1] *
unit) / micrometer);
305 G4VtxZ.push_back((G4Vtx[2] *
unit) / millimeter);
309 eventout +=
"\n Number of G4Vertices collected:............ ";
319 if (!G4TrkContainer.
isValid()) {
324 edm::SimTrackContainer::const_iterator itTrk;
325 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end(); ++itTrk) {
329 itTrk->momentum().x(), itTrk->momentum().y(), itTrk->momentum().z(), itTrk->momentum().e());
331 G4Trk1.GetCoordinates(G4Trk);
333 G4TrkPt.push_back(
sqrt(G4Trk[0] * G4Trk[0] + G4Trk[1] * G4Trk[1]));
334 G4TrkE.push_back(G4Trk[3]);
338 eventout +=
"\n Number of G4Tracks collected:.............. ";
349 std::string MsgLoggerCat =
"GlobalHitsProducer_storeG4MC";
352 TString eventout(
"\n nRawGenPart = ");
354 eventout +=
"\n nG4Vtx = ";
355 eventout +=
G4VtxX.size();
356 for (
unsigned int i = 0;
i <
G4VtxX.size(); ++
i) {
357 eventout +=
"\n (x,y,z) = (";
365 eventout +=
"\n nG4Trk = ";
367 for (
unsigned int i = 0;
i <
G4TrkPt.size(); ++
i) {
368 eventout +=
"\n (pt,e) = (";
385 std::string MsgLoggerCat =
"GlobalHitsProducer_fillTrk";
389 eventout =
"\nGathering info:";
394 if (!theTrackerGeometry.
isValid()) {
395 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerDigiGeometryRecord in event!";
401 edm::PSimHitContainer::const_iterator itHit;
410 if (!PxlBrlLowContainer.
isValid()) {
411 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsPixelBarrelLowTof in event!";
417 if (!PxlBrlHighContainer.
isValid()) {
418 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsPixelBarrelHighTof in event!";
422 thePxlBrlHits.insert(thePxlBrlHits.end(), PxlBrlLowContainer->begin(), PxlBrlLowContainer->end());
423 thePxlBrlHits.insert(thePxlBrlHits.end(), PxlBrlHighContainer->begin(), PxlBrlHighContainer->end());
427 for (itHit = thePxlBrlHits.begin(); itHit != thePxlBrlHits.end(); ++itHit) {
431 DetId theDetUnitId(itHit->detUnitId());
441 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from PxlBrlHits for Hit " <<
i;
452 PxlBrlR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
453 PxlBrlPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
454 PxlBrlEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
457 edm::LogWarning(MsgLoggerCat) <<
"PxlBrl PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
464 eventout +=
"\n Number of Pixel Barrel Hits collected:..... ";
475 if (!PxlFwdLowContainer.
isValid()) {
476 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsPixelEndcapLowTof in event!";
482 if (!PxlFwdHighContainer.
isValid()) {
483 edm::LogWarning(
"GlobalHitsProducer_fillTrk") <<
"Unable to find TrackerHitsPixelEndcapHighTof in event!";
487 thePxlFwdHits.insert(thePxlFwdHits.end(), PxlFwdLowContainer->begin(), PxlFwdLowContainer->end());
488 thePxlFwdHits.insert(thePxlFwdHits.end(), PxlFwdHighContainer->begin(), PxlFwdHighContainer->end());
493 for (itHit = thePxlFwdHits.begin(); itHit != thePxlFwdHits.end(); ++itHit) {
497 DetId theDetUnitId(itHit->detUnitId());
507 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from PxlFwdHits for Hit " <<
i;
519 PxlFwdZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
520 PxlFwdPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
521 PxlFwdEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
523 edm::LogWarning(MsgLoggerCat) <<
"PxlFwd PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
530 eventout +=
"\n Number of Pixel Forward Hits collected:.... ";
541 if (!SiTIBLowContainer.
isValid()) {
542 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTIBLowTof in event!";
548 if (!SiTIBHighContainer.
isValid()) {
549 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTIBHighTof in event!";
555 if (!SiTOBLowContainer.
isValid()) {
556 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTOBLowTof in event!";
562 if (!SiTOBHighContainer.
isValid()) {
563 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTOBHighTof in event!";
567 theSiBrlHits.insert(theSiBrlHits.end(), SiTIBLowContainer->begin(), SiTIBLowContainer->end());
568 theSiBrlHits.insert(theSiBrlHits.end(), SiTIBHighContainer->begin(), SiTIBHighContainer->end());
569 theSiBrlHits.insert(theSiBrlHits.end(), SiTOBLowContainer->begin(), SiTOBLowContainer->end());
570 theSiBrlHits.insert(theSiBrlHits.end(), SiTOBHighContainer->begin(), SiTOBHighContainer->end());
575 for (itHit = theSiBrlHits.begin(); itHit != theSiBrlHits.end(); ++itHit) {
579 DetId theDetUnitId(itHit->detUnitId());
589 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from SiBrlHits for Hit " <<
i;
600 SiBrlR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
601 SiBrlPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
602 SiBrlEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
604 edm::LogWarning(MsgLoggerCat) <<
"SiBrl PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
612 eventout +=
"\n Number of Silicon Barrel Hits collected:... ";
623 if (!SiTIDLowContainer.
isValid()) {
624 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTIDLowTof in event!";
630 if (!SiTIDHighContainer.
isValid()) {
631 edm::LogWarning(
"GlobalHitsProducer_fillTrk") <<
"Unable to find TrackerHitsTIDHighTof in event!";
637 if (!SiTECLowContainer.
isValid()) {
638 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTECLowTof in event!";
644 if (!SiTECHighContainer.
isValid()) {
645 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTECHighTof in event!";
649 theSiFwdHits.insert(theSiFwdHits.end(), SiTIDLowContainer->begin(), SiTIDLowContainer->end());
650 theSiFwdHits.insert(theSiFwdHits.end(), SiTIDHighContainer->begin(), SiTIDHighContainer->end());
651 theSiFwdHits.insert(theSiFwdHits.end(), SiTECLowContainer->begin(), SiTECLowContainer->end());
652 theSiFwdHits.insert(theSiFwdHits.end(), SiTECHighContainer->begin(), SiTECHighContainer->end());
657 for (itHit = theSiFwdHits.begin(); itHit != theSiFwdHits.end(); ++itHit) {
661 DetId theDetUnitId(itHit->detUnitId());
671 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from SiFwdHits Hit " <<
i;
682 SiFwdZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
683 SiFwdPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
684 SiFwdEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
686 edm::LogWarning(MsgLoggerCat) <<
"SiFwd PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
694 eventout +=
"\n Number of Silicon Forward Hits collected:.. ";
705 std::string MsgLoggerCat =
"GlobalHitsProducer_storeTrk";
708 TString eventout(
"\n nPxlBrlHits = ");
711 eventout +=
"\n (tof,r,phi,eta) = (";
721 eventout +=
"\n nPxlFwdHits = ";
724 eventout +=
"\n (tof,z,phi,eta) = (";
734 eventout +=
"\n nSiBrlHits = ";
736 for (
unsigned int i = 0;
i <
SiBrlToF.size(); ++
i) {
737 eventout +=
"\n (tof,r,phi,eta) = (";
747 eventout +=
"\n nSiFwdHits = ";
749 for (
unsigned int i = 0;
i <
SiFwdToF.size(); ++
i) {
750 eventout +=
"\n (tof,z,phi,eta) = (";
772 std::string MsgLoggerCat =
"GlobalHitsProducer_fillMuon";
776 eventout =
"\nGathering info:";
779 edm::PSimHitContainer::const_iterator itHit;
788 if (!theCSCGeometry.
isValid()) {
789 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonGeometryRecord for the CSCGeometry in event!";
797 if (!MuonCSCContainer.
isValid()) {
798 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonCSCHits in event!";
804 for (itHit = MuonCSCContainer->begin(); itHit != MuonCSCContainer->end(); ++itHit) {
808 DetId theDetUnitId(itHit->detUnitId());
818 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from theCSCMuon for hit " <<
i;
829 MuonCscZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
830 MuonCscPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
831 MuonCscEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
833 edm::LogWarning(MsgLoggerCat) <<
"MuonCsc PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dMuon <<
","
840 eventout +=
"\n Number of CSC muon Hits collected:......... ";
851 if (!theDTGeometry.
isValid()) {
852 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonGeometryRecord for the DTGeometry in event!";
860 if (!MuonDtContainer.
isValid()) {
861 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonDTHits in event!";
867 for (itHit = MuonDtContainer->begin(); itHit != MuonDtContainer->end(); ++itHit) {
871 DetId theDetUnitId(itHit->detUnitId());
879 DTWireId wireId(itHit->detUnitId());
882 const DTLayer *theDet = theDTMuon.
layer(wireId.layerId());
885 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from theDtMuon for hit " <<
i;
892 const BoundPlane &bSurface = theDet->surface();
896 MuonDtR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
897 MuonDtPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
898 MuonDtEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
900 edm::LogWarning(MsgLoggerCat) <<
"MuonDt PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dMuon <<
","
907 eventout +=
"\n Number of DT muon Hits collected:.......... ";
919 if (!theRPCGeometry.
isValid()) {
920 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonGeometryRecord for the RPCGeometry in event!";
928 if (!MuonRPCContainer.
isValid()) {
929 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonRPCHits in event!";
935 int RPCBrl = 0, RPCFwd = 0;
936 for (itHit = MuonRPCContainer->begin(); itHit != MuonRPCContainer->end(); ++itHit) {
940 DetId theDetUnitId(itHit->detUnitId());
950 int region = RPCId.region();
956 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from theRPCMuon for hit " <<
i;
970 MuonRpcFwdZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
977 MuonRpcBrlR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
985 edm::LogWarning(MsgLoggerCat) <<
"MuonRpc PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dMuon <<
","
992 eventout +=
"\n Number of RPC muon Hits collected:......... ";
994 eventout +=
"\n RPC Barrel muon Hits:............ ";
996 eventout +=
"\n RPC Forward muon Hits:........... ";
1007 std::string MsgLoggerCat =
"GlobalHitsProducer_storeMuon";
1010 TString eventout(
"\n nMuonCSCHits = ");
1013 eventout +=
"\n (tof,z,phi,eta) = (";
1023 eventout +=
"\n nMuonDtHits = ";
1026 eventout +=
"\n (tof,r,phi,eta) = (";
1036 eventout +=
"\n nMuonRpcBrlHits = ";
1039 eventout +=
"\n (tof,r,phi,eta) = (";
1049 eventout +=
"\n nMuonRpcFwdHits = ";
1052 eventout +=
"\n (tof,z,phi,eta) = (";
1074 std::string MsgLoggerCat =
"GlobalHitsProducer_fillECal";
1078 eventout =
"\nGathering info:";
1083 if (!theCaloGeometry.
isValid()) {
1084 edm::LogWarning(MsgLoggerCat) <<
"Unable to find CaloGeometryRecord in event!";
1090 edm::PCaloHitContainer::const_iterator itHit;
1100 edm::LogWarning(MsgLoggerCat) <<
"Unable to find EcalHitsEB in event!";
1107 edm::LogWarning(MsgLoggerCat) <<
"Unable to find EcalHitsEE in event!";
1111 theECalHits.insert(theECalHits.end(), EBContainer->begin(), EBContainer->end());
1112 theECalHits.insert(theECalHits.end(), EEContainer->begin(), EEContainer->end());
1116 for (itHit = theECalHits.begin(); itHit != theECalHits.end(); ++itHit) {
1120 DetId theDetUnitId(itHit->id());
1130 edm::LogWarning(MsgLoggerCat) <<
"Unable to get CaloCellGeometry from ECalHits for Hit " <<
i;
1137 const GlobalPoint &globalposition = theDet->getPosition();
1140 ECalE.push_back(itHit->energy());
1141 ECalToF.push_back(itHit->time());
1146 edm::LogWarning(MsgLoggerCat) <<
"ECal PCaloHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dEcal <<
","
1154 eventout +=
"\n Number of ECal Hits collected:............. ";
1164 if (!PreShContainer.
isValid()) {
1165 edm::LogWarning(MsgLoggerCat) <<
"Unable to find EcalHitsES in event!";
1171 for (itHit = PreShContainer->begin(); itHit != PreShContainer->end(); ++itHit) {
1175 DetId theDetUnitId(itHit->id());
1185 edm::LogWarning(MsgLoggerCat) <<
"Unable to get CaloCellGeometry from PreShContainer for Hit " <<
i;
1192 const GlobalPoint &globalposition = theDet->getPosition();
1195 PreShE.push_back(itHit->energy());
1201 edm::LogWarning(MsgLoggerCat) <<
"PreSh PCaloHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dEcal <<
","
1208 eventout +=
"\n Number of PreSh Hits collected:............ ";
1219 std::string MsgLoggerCat =
"GlobalHitsProducer_storeECal";
1222 TString eventout(
"\n nECalHits = ");
1223 eventout +=
ECalE.size();
1224 for (
unsigned int i = 0;
i <
ECalE.size(); ++
i) {
1225 eventout +=
"\n (e,tof,phi,eta) = (";
1235 eventout +=
"\n nPreShHits = ";
1236 eventout +=
PreShE.size();
1237 for (
unsigned int i = 0;
i <
PreShE.size(); ++
i) {
1238 eventout +=
"\n (e,tof,phi,eta) = (";
1258 std::string MsgLoggerCat =
"GlobalHitsProducer_fillHCal";
1262 eventout =
"\nGathering info:";
1267 if (!theCaloGeometry.
isValid()) {
1268 edm::LogWarning(MsgLoggerCat) <<
"Unable to find CaloGeometryRecord in event!";
1274 edm::PCaloHitContainer::const_iterator itHit;
1282 if (!HCalContainer.
isValid()) {
1289 for (itHit = HCalContainer->begin(); itHit != HCalContainer->end(); ++itHit) {
1293 DetId theDetUnitId(itHit->id());
1304 edm::LogWarning(MsgLoggerCat) <<
"Unable to get CaloCellGeometry from HCalContainer for Hit " <<
i;
1314 HCalE.push_back(itHit->energy());
1315 HCalToF.push_back(itHit->time());
1320 edm::LogWarning(MsgLoggerCat) <<
"HCal PCaloHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dHcal <<
","
1328 eventout +=
"\n Number of HCal Hits collected:............. ";
1339 std::string MsgLoggerCat =
"GlobalHitsProducer_storeHCal";
1342 TString eventout(
"\n nHCalHits = ");
1343 eventout +=
HCalE.size();
1344 for (
unsigned int i = 0;
i <
HCalE.size(); ++
i) {
1345 eventout +=
"\n (e,tof,phi,eta) = (";
1364 std::string MsgLoggerCat =
"GlobalHitsProducer_clear";
1367 edm::LogInfo(MsgLoggerCat) <<
"Clearing event holders";