18 getAllProvenances(
false),
19 printProvenanceInfo(
false),
29 std::string MsgLoggerCat =
"GlobalHitsProducer_GlobalHitsProducer";
95 produces<PGlobalSimHit>(
label);
100 <<
"\n===============================\n"
101 <<
"Initialized as EDProducer with parameter values:\n"
102 <<
" Name = " <<
fName <<
"\n"
105 <<
" VtxUnit = " <<
vtxunit <<
"\n"
106 <<
" Label = " <<
label <<
"\n"
128 <<
"===============================\n";
140 std::string MsgLoggerCat =
"GlobalHitsProducer_endJob";
142 edm::LogInfo(MsgLoggerCat) <<
"Terminating having processed " <<
count <<
" events.";
147 std::string MsgLoggerCat =
"GlobalHitsProducer_produce";
157 edm::LogInfo(MsgLoggerCat) <<
"Processing run " << nrun <<
", event " <<
nevt <<
" (" <<
count <<
" events total)";
170 std::vector<const edm::StableProvenance *> AllProv;
171 iEvent.getAllStableProvenance(AllProv);
174 edm::LogInfo(MsgLoggerCat) <<
"Number of Provenances = " << AllProv.size();
177 TString eventout(
"\nProvenance info:\n");
179 for (
unsigned int i = 0;
i < AllProv.size(); ++
i) {
180 eventout +=
"\n ******************************";
181 eventout +=
"\n Module : ";
182 eventout += AllProv[
i]->moduleLabel();
183 eventout +=
"\n ProductID : ";
184 eventout += AllProv[
i]->productID().id();
185 eventout +=
"\n ClassName : ";
186 eventout += AllProv[
i]->className();
187 eventout +=
"\n InstanceName : ";
188 eventout += AllProv[
i]->productInstanceName();
189 eventout +=
"\n BranchName : ";
190 eventout += AllProv[
i]->branchName();
192 eventout +=
"\n ******************************\n";
212 edm::LogInfo(MsgLoggerCat) <<
"Done gathering data from event.";
240 std::string MsgLoggerCat =
"GlobalHitsProducer_fillG4MC";
244 eventout =
"\nGathering info:";
250 std::vector<edm::Handle<edm::HepMCProduct>> AllHepMCEvt;
251 iEvent.getManyByType(AllHepMCEvt);
255 for (
unsigned int i = 0;
i < AllHepMCEvt.size(); ++
i) {
256 HepMCEvt = AllHepMCEvt[
i];
262 edm::LogWarning(MsgLoggerCat) <<
"Unable to find HepMCProduct in event!";
265 eventout +=
"\n Using HepMCProduct: ";
272 eventout +=
"\n Number of Raw Particles collected:......... ";
288 if (!G4VtxContainer.
isValid()) {
293 edm::SimVertexContainer::const_iterator itVtx;
294 for (itVtx = G4VtxContainer->begin(); itVtx != G4VtxContainer->end(); ++itVtx) {
298 itVtx->position().x(), itVtx->position().y(), itVtx->position().z(), itVtx->position().e());
300 G4Vtx1.GetCoordinates(G4Vtx);
302 G4VtxX.push_back((G4Vtx[0] *
unit) / micrometer);
303 G4VtxY.push_back((G4Vtx[1] *
unit) / micrometer);
304 G4VtxZ.push_back((G4Vtx[2] *
unit) / millimeter);
308 eventout +=
"\n Number of G4Vertices collected:............ ";
318 if (!G4TrkContainer.
isValid()) {
323 edm::SimTrackContainer::const_iterator itTrk;
324 for (itTrk = G4TrkContainer->begin(); itTrk != G4TrkContainer->end(); ++itTrk) {
328 itTrk->momentum().x(), itTrk->momentum().y(), itTrk->momentum().z(), itTrk->momentum().e());
330 G4Trk1.GetCoordinates(G4Trk);
332 G4TrkPt.push_back(
sqrt(G4Trk[0] * G4Trk[0] + G4Trk[1] * G4Trk[1]));
333 G4TrkE.push_back(G4Trk[3]);
337 eventout +=
"\n Number of G4Tracks collected:.............. ";
348 std::string MsgLoggerCat =
"GlobalHitsProducer_storeG4MC";
351 TString eventout(
"\n nRawGenPart = ");
353 eventout +=
"\n nG4Vtx = ";
354 eventout +=
G4VtxX.size();
355 for (
unsigned int i = 0;
i <
G4VtxX.size(); ++
i) {
356 eventout +=
"\n (x,y,z) = (";
364 eventout +=
"\n nG4Trk = ";
366 for (
unsigned int i = 0;
i <
G4TrkPt.size(); ++
i) {
367 eventout +=
"\n (pt,e) = (";
384 std::string MsgLoggerCat =
"GlobalHitsProducer_fillTrk";
388 eventout =
"\nGathering info:";
392 if (!theTrackerGeometry.isValid()) {
393 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerDigiGeometryRecord in event!";
399 edm::PSimHitContainer::const_iterator itHit;
408 if (!PxlBrlLowContainer.
isValid()) {
409 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsPixelBarrelLowTof in event!";
415 if (!PxlBrlHighContainer.
isValid()) {
416 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsPixelBarrelHighTof in event!";
420 thePxlBrlHits.insert(thePxlBrlHits.end(), PxlBrlLowContainer->begin(), PxlBrlLowContainer->end());
421 thePxlBrlHits.insert(thePxlBrlHits.end(), PxlBrlHighContainer->begin(), PxlBrlHighContainer->end());
425 for (itHit = thePxlBrlHits.begin(); itHit != thePxlBrlHits.end(); ++itHit) {
429 DetId theDetUnitId(itHit->detUnitId());
439 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from PxlBrlHits for Hit " <<
i;
450 PxlBrlR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
451 PxlBrlPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
452 PxlBrlEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
455 edm::LogWarning(MsgLoggerCat) <<
"PxlBrl PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
462 eventout +=
"\n Number of Pixel Barrel Hits collected:..... ";
473 if (!PxlFwdLowContainer.
isValid()) {
474 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsPixelEndcapLowTof in event!";
480 if (!PxlFwdHighContainer.
isValid()) {
481 edm::LogWarning(
"GlobalHitsProducer_fillTrk") <<
"Unable to find TrackerHitsPixelEndcapHighTof in event!";
485 thePxlFwdHits.insert(thePxlFwdHits.end(), PxlFwdLowContainer->begin(), PxlFwdLowContainer->end());
486 thePxlFwdHits.insert(thePxlFwdHits.end(), PxlFwdHighContainer->begin(), PxlFwdHighContainer->end());
491 for (itHit = thePxlFwdHits.begin(); itHit != thePxlFwdHits.end(); ++itHit) {
495 DetId theDetUnitId(itHit->detUnitId());
505 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from PxlFwdHits for Hit " <<
i;
517 PxlFwdZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
518 PxlFwdPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
519 PxlFwdEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
521 edm::LogWarning(MsgLoggerCat) <<
"PxlFwd PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
528 eventout +=
"\n Number of Pixel Forward Hits collected:.... ";
539 if (!SiTIBLowContainer.
isValid()) {
540 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTIBLowTof in event!";
546 if (!SiTIBHighContainer.
isValid()) {
547 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTIBHighTof in event!";
553 if (!SiTOBLowContainer.
isValid()) {
554 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTOBLowTof in event!";
560 if (!SiTOBHighContainer.
isValid()) {
561 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTOBHighTof in event!";
565 theSiBrlHits.insert(theSiBrlHits.end(), SiTIBLowContainer->begin(), SiTIBLowContainer->end());
566 theSiBrlHits.insert(theSiBrlHits.end(), SiTIBHighContainer->begin(), SiTIBHighContainer->end());
567 theSiBrlHits.insert(theSiBrlHits.end(), SiTOBLowContainer->begin(), SiTOBLowContainer->end());
568 theSiBrlHits.insert(theSiBrlHits.end(), SiTOBHighContainer->begin(), SiTOBHighContainer->end());
573 for (itHit = theSiBrlHits.begin(); itHit != theSiBrlHits.end(); ++itHit) {
577 DetId theDetUnitId(itHit->detUnitId());
587 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from SiBrlHits for Hit " <<
i;
598 SiBrlR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
599 SiBrlPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
600 SiBrlEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
602 edm::LogWarning(MsgLoggerCat) <<
"SiBrl PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
610 eventout +=
"\n Number of Silicon Barrel Hits collected:... ";
621 if (!SiTIDLowContainer.
isValid()) {
622 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTIDLowTof in event!";
628 if (!SiTIDHighContainer.
isValid()) {
629 edm::LogWarning(
"GlobalHitsProducer_fillTrk") <<
"Unable to find TrackerHitsTIDHighTof in event!";
635 if (!SiTECLowContainer.
isValid()) {
636 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTECLowTof in event!";
642 if (!SiTECHighContainer.
isValid()) {
643 edm::LogWarning(MsgLoggerCat) <<
"Unable to find TrackerHitsTECHighTof in event!";
647 theSiFwdHits.insert(theSiFwdHits.end(), SiTIDLowContainer->begin(), SiTIDLowContainer->end());
648 theSiFwdHits.insert(theSiFwdHits.end(), SiTIDHighContainer->begin(), SiTIDHighContainer->end());
649 theSiFwdHits.insert(theSiFwdHits.end(), SiTECLowContainer->begin(), SiTECLowContainer->end());
650 theSiFwdHits.insert(theSiFwdHits.end(), SiTECHighContainer->begin(), SiTECHighContainer->end());
655 for (itHit = theSiFwdHits.begin(); itHit != theSiFwdHits.end(); ++itHit) {
659 DetId theDetUnitId(itHit->detUnitId());
669 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from SiFwdHits Hit " <<
i;
680 SiFwdZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
681 SiFwdPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
682 SiFwdEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
684 edm::LogWarning(MsgLoggerCat) <<
"SiFwd PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dTrk <<
","
692 eventout +=
"\n Number of Silicon Forward Hits collected:.. ";
703 std::string MsgLoggerCat =
"GlobalHitsProducer_storeTrk";
706 TString eventout(
"\n nPxlBrlHits = ");
709 eventout +=
"\n (tof,r,phi,eta) = (";
719 eventout +=
"\n nPxlFwdHits = ";
722 eventout +=
"\n (tof,z,phi,eta) = (";
732 eventout +=
"\n nSiBrlHits = ";
734 for (
unsigned int i = 0;
i <
SiBrlToF.size(); ++
i) {
735 eventout +=
"\n (tof,r,phi,eta) = (";
745 eventout +=
"\n nSiFwdHits = ";
747 for (
unsigned int i = 0;
i <
SiFwdToF.size(); ++
i) {
748 eventout +=
"\n (tof,z,phi,eta) = (";
770 std::string MsgLoggerCat =
"GlobalHitsProducer_fillMuon";
774 eventout =
"\nGathering info:";
777 edm::PSimHitContainer::const_iterator itHit;
785 if (!theCSCGeometry.isValid()) {
786 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonGeometryRecord for the CSCGeometry in event!";
794 if (!MuonCSCContainer.
isValid()) {
795 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonCSCHits in event!";
801 for (itHit = MuonCSCContainer->begin(); itHit != MuonCSCContainer->end(); ++itHit) {
805 DetId theDetUnitId(itHit->detUnitId());
815 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from theCSCMuon for hit " <<
i;
826 MuonCscZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
827 MuonCscPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
828 MuonCscEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
830 edm::LogWarning(MsgLoggerCat) <<
"MuonCsc PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dMuon <<
","
837 eventout +=
"\n Number of CSC muon Hits collected:......... ";
847 if (!theDTGeometry.isValid()) {
848 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonGeometryRecord for the DTGeometry in event!";
856 if (!MuonDtContainer.
isValid()) {
857 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonDTHits in event!";
863 for (itHit = MuonDtContainer->begin(); itHit != MuonDtContainer->end(); ++itHit) {
867 DetId theDetUnitId(itHit->detUnitId());
875 DTWireId wireId(itHit->detUnitId());
878 const DTLayer *theDet = theDTMuon.
layer(wireId.layerId());
881 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from theDtMuon for hit " <<
i;
888 const BoundPlane &bSurface = theDet->surface();
892 MuonDtR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
893 MuonDtPhi.push_back(bSurface.toGlobal(itHit->localPosition()).
phi());
894 MuonDtEta.push_back(bSurface.toGlobal(itHit->localPosition()).
eta());
896 edm::LogWarning(MsgLoggerCat) <<
"MuonDt PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dMuon <<
","
903 eventout +=
"\n Number of DT muon Hits collected:.......... ";
914 if (!theRPCGeometry.isValid()) {
915 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonGeometryRecord for the RPCGeometry in event!";
923 if (!MuonRPCContainer.
isValid()) {
924 edm::LogWarning(MsgLoggerCat) <<
"Unable to find MuonRPCHits in event!";
930 int RPCBrl = 0, RPCFwd = 0;
931 for (itHit = MuonRPCContainer->begin(); itHit != MuonRPCContainer->end(); ++itHit) {
935 DetId theDetUnitId(itHit->detUnitId());
945 int region = RPCId.region();
951 edm::LogWarning(MsgLoggerCat) <<
"Unable to get GeomDetUnit from theRPCMuon for hit " <<
i;
965 MuonRpcFwdZ.push_back(bSurface.toGlobal(itHit->localPosition()).
z());
972 MuonRpcBrlR.push_back(bSurface.toGlobal(itHit->localPosition()).
perp());
980 edm::LogWarning(MsgLoggerCat) <<
"MuonRpc PSimHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dMuon <<
","
987 eventout +=
"\n Number of RPC muon Hits collected:......... ";
989 eventout +=
"\n RPC Barrel muon Hits:............ ";
991 eventout +=
"\n RPC Forward muon Hits:........... ";
1002 std::string MsgLoggerCat =
"GlobalHitsProducer_storeMuon";
1005 TString eventout(
"\n nMuonCSCHits = ");
1008 eventout +=
"\n (tof,z,phi,eta) = (";
1018 eventout +=
"\n nMuonDtHits = ";
1021 eventout +=
"\n (tof,r,phi,eta) = (";
1031 eventout +=
"\n nMuonRpcBrlHits = ";
1034 eventout +=
"\n (tof,r,phi,eta) = (";
1044 eventout +=
"\n nMuonRpcFwdHits = ";
1047 eventout +=
"\n (tof,z,phi,eta) = (";
1069 std::string MsgLoggerCat =
"GlobalHitsProducer_fillECal";
1073 eventout =
"\nGathering info:";
1077 if (!theCaloGeometry.isValid()) {
1078 edm::LogWarning(MsgLoggerCat) <<
"Unable to find CaloGeometryRecord in event!";
1084 edm::PCaloHitContainer::const_iterator itHit;
1094 edm::LogWarning(MsgLoggerCat) <<
"Unable to find EcalHitsEB in event!";
1101 edm::LogWarning(MsgLoggerCat) <<
"Unable to find EcalHitsEE in event!";
1105 theECalHits.insert(theECalHits.end(), EBContainer->begin(), EBContainer->end());
1106 theECalHits.insert(theECalHits.end(), EEContainer->begin(), EEContainer->end());
1110 for (itHit = theECalHits.begin(); itHit != theECalHits.end(); ++itHit) {
1114 DetId theDetUnitId(itHit->id());
1124 edm::LogWarning(MsgLoggerCat) <<
"Unable to get CaloCellGeometry from ECalHits for Hit " <<
i;
1131 const GlobalPoint &globalposition = theDet->getPosition();
1134 ECalE.push_back(itHit->energy());
1135 ECalToF.push_back(itHit->time());
1140 edm::LogWarning(MsgLoggerCat) <<
"ECal PCaloHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dEcal <<
","
1148 eventout +=
"\n Number of ECal Hits collected:............. ";
1158 if (!PreShContainer.
isValid()) {
1159 edm::LogWarning(MsgLoggerCat) <<
"Unable to find EcalHitsES in event!";
1165 for (itHit = PreShContainer->begin(); itHit != PreShContainer->end(); ++itHit) {
1169 DetId theDetUnitId(itHit->id());
1179 edm::LogWarning(MsgLoggerCat) <<
"Unable to get CaloCellGeometry from PreShContainer for Hit " <<
i;
1186 const GlobalPoint &globalposition = theDet->getPosition();
1189 PreShE.push_back(itHit->energy());
1195 edm::LogWarning(MsgLoggerCat) <<
"PreSh PCaloHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dEcal <<
","
1202 eventout +=
"\n Number of PreSh Hits collected:............ ";
1213 std::string MsgLoggerCat =
"GlobalHitsProducer_storeECal";
1216 TString eventout(
"\n nECalHits = ");
1217 eventout +=
ECalE.size();
1218 for (
unsigned int i = 0;
i <
ECalE.size(); ++
i) {
1219 eventout +=
"\n (e,tof,phi,eta) = (";
1229 eventout +=
"\n nPreShHits = ";
1230 eventout +=
PreShE.size();
1231 for (
unsigned int i = 0;
i <
PreShE.size(); ++
i) {
1232 eventout +=
"\n (e,tof,phi,eta) = (";
1252 std::string MsgLoggerCat =
"GlobalHitsProducer_fillHCal";
1256 eventout =
"\nGathering info:";
1260 if (!theCaloGeometry.isValid()) {
1261 edm::LogWarning(MsgLoggerCat) <<
"Unable to find CaloGeometryRecord in event!";
1267 edm::PCaloHitContainer::const_iterator itHit;
1275 if (!HCalContainer.
isValid()) {
1282 for (itHit = HCalContainer->begin(); itHit != HCalContainer->end(); ++itHit) {
1286 DetId theDetUnitId(itHit->id());
1297 edm::LogWarning(MsgLoggerCat) <<
"Unable to get CaloCellGeometry from HCalContainer for Hit " <<
i;
1307 HCalE.push_back(itHit->energy());
1308 HCalToF.push_back(itHit->time());
1313 edm::LogWarning(MsgLoggerCat) <<
"HCal PCaloHit " <<
i <<
" is expected to be (det,subdet) = (" <<
dHcal <<
","
1321 eventout +=
"\n Number of HCal Hits collected:............. ";
1332 std::string MsgLoggerCat =
"GlobalHitsProducer_storeHCal";
1335 TString eventout(
"\n nHCalHits = ");
1336 eventout +=
HCalE.size();
1337 for (
unsigned int i = 0;
i <
HCalE.size(); ++
i) {
1338 eventout +=
"\n (e,tof,phi,eta) = (";
1357 std::string MsgLoggerCat =
"GlobalHitsProducer_clear";
1360 edm::LogInfo(MsgLoggerCat) <<
"Clearing event holders";