diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc index 4b1322d8f0e14..12e1244bb599c 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHBHEMuonFilter.cc @@ -34,7 +34,7 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -//#define DebugLog +//#define EDM_ML_DEBUG // // class declaration // @@ -76,6 +76,8 @@ class AlCaHBHEMuonFilter : public edm::stream::EDFilter tok_trigEvt; edm::EDGetTokenT tok_trigRes_; edm::EDGetTokenT tok_Muon_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_magField_; }; // @@ -107,11 +109,15 @@ AlCaHBHEMuonFilter::AlCaHBHEMuonFilter(edm::ParameterSet const& iConfig, const A // define tokens for access tok_trigRes_ = consumes(triggerResults_); tok_Muon_ = consumes(labelMuon_); - edm::LogInfo("HBHEMuon") << "Parameters read from config file \n" - << "Process " << processName_ << " Prescale " << preScale_ << " Isolation Cuts " - << trackIsoCut_ << ":" << caloIsoCut_ << "\n"; + + tok_geom_ = esConsumes(); + tok_magField_ = esConsumes(); + + edm::LogVerbatim("HBHEMuon") << "Parameters read from config file \n" + << "Process " << processName_ << " Prescale " << preScale_ << " Isolation Cuts " + << trackIsoCut_ << ":" << caloIsoCut_ << "\n"; for (unsigned int k = 0; k < trigNames_.size(); ++k) - edm::LogInfo("HBHEMuon") << "Trigger[" << k << "] " << trigNames_[k] << "\n"; + edm::LogVerbatim("HBHEMuon") << "Trigger[" << k << "] " << trigNames_[k] << "\n"; } // AlCaHBHEMuonFilter::AlCaHBHEMuonFilter constructor AlCaHBHEMuonFilter::~AlCaHBHEMuonFilter() {} @@ -124,10 +130,10 @@ AlCaHBHEMuonFilter::~AlCaHBHEMuonFilter() {} bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) { bool accept(false); ++nAll_; -#ifdef DebugLog - edm::LogInfo("HBHEMuon") << "AlCaHBHEMuonFilter::Run " << iEvent.id().run() << " Event " << iEvent.id().event() - << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() - << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Run " << iEvent.id().run() << " Event " << iEvent.id().event() + << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() + << std::endl; #endif //Step1: Find if the event passes one of the chosen triggers /////////////////////////////TriggerResults @@ -145,45 +151,39 @@ bool AlCaHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetu if (hlt > 0) { ok = true; } -#ifdef DebugLog - edm::LogInfo("HBHEMuon") << "AlCaHBHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt << ":" - << ok << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt + << ":" << ok << std::endl; #endif } } } if (ok) { //Step2: Get geometry/B-field information - //Get magnetic field - edm::ESHandle bFieldH; - iSetup.get().get(bFieldH); - const MagneticField* bField = bFieldH.product(); - // get handles to calogeometry - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); + const MagneticField* bField = &(iSetup.getData(tok_magField_)); + const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); // Relevant blocks from iEvent edm::Handle _Muon; iEvent.getByToken(tok_Muon_, _Muon); -#ifdef DebugLog - edm::LogInfo("HBHEMuon") << "AlCaHBHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; #endif if (_Muon.isValid()) { for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { -#ifdef DebugLog - edm::LogInfo("HBHEMuon") << "AlCaHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() - << " innerTrack " << RecMuon->innerTrack().isNonnull() << " outerTrack " - << RecMuon->outerTrack().isNonnull() << " globalTrack " - << RecMuon->globalTrack().isNonnull() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() + << " innerTrack " << RecMuon->innerTrack().isNonnull() << " outerTrack " + << RecMuon->outerTrack().isNonnull() << " globalTrack " + << RecMuon->globalTrack().isNonnull() << std::endl; #endif if ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) && (RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())) { const reco::Track* pTrack = (RecMuon->innerTrack()).get(); spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, false); -#ifdef DebugLog - edm::LogInfo("HBHEMuon") << "AlCaHBHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " - << trackID.okHCAL << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HBHEMuon") << "AlCaHBHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " + << trackID.okHCAL << std::endl; #endif double trackIso = RecMuon->isolationR03().sumPt; double caloIso = RecMuon->isolationR03().emEt + RecMuon->isolationR03().hadEt; @@ -224,20 +224,20 @@ void AlCaHBHEMuonFilter::endStream() { } void AlCaHBHEMuonFilter::globalEndJob(const AlCaHBHEMuons::Counters* count) { - edm::LogInfo("HBHEMuon") << "Selects " << count->nFinal_ << " out of " << count->nGood_ << " good events out of " - << count->nAll_ << " total # of events\n"; + edm::LogVerbatim("HBHEMuon") << "Selects " << count->nFinal_ << " out of " << count->nGood_ << " good events out of " + << count->nAll_ << " total # of events\n"; } // ------------ method called when starting to processes a run ------------ void AlCaHBHEMuonFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed); - edm::LogInfo("HBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; + edm::LogVerbatim("HBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; } // ------------ method called when ending the processing of a run ------------ void AlCaHBHEMuonFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { - edm::LogInfo("HBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n"; + edm::LogVerbatim("HBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n"; nRun_++; } diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc index bc6d942ee070b..6ba6617073ffe 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaHEMuonFilter.cc @@ -34,7 +34,7 @@ #include "Geometry/CaloGeometry/interface/CaloGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" -//#define DebugLog +//#define EDM_ML_DEBUG // // class declaration // @@ -76,6 +76,8 @@ class AlCaHEMuonFilter : public edm::stream::EDFilter tok_trigEvt; edm::EDGetTokenT tok_trigRes_; edm::EDGetTokenT tok_Muon_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_magField_; }; // @@ -109,11 +111,15 @@ AlCaHEMuonFilter::AlCaHEMuonFilter(edm::ParameterSet const& iConfig, const AlCaH // define tokens for access tok_trigRes_ = consumes(triggerResults_); tok_Muon_ = consumes(labelMuon_); - edm::LogInfo("HEMuon") << "Parameters read from config file \n" - << "Process " << processName_ << " Prescale " << preScale_ << " Isolation Cuts " - << trackIsoCut_ << ":" << caloIsoCut_ << "\n"; + + tok_geom_ = esConsumes(); + tok_magField_ = esConsumes(); + + edm::LogVerbatim("HEMuon") << "Parameters read from config file \n" + << "Process " << processName_ << " Prescale " << preScale_ << " Isolation Cuts " + << trackIsoCut_ << ":" << caloIsoCut_ << "\n"; for (unsigned int k = 0; k < trigNames_.size(); ++k) - edm::LogInfo("HEMuon") << "Trigger[" << k << "] " << trigNames_[k] << "\n"; + edm::LogVerbatim("HEMuon") << "Trigger[" << k << "] " << trigNames_[k] << "\n"; } // AlCaHEMuonFilter::AlCaHEMuonFilter constructor AlCaHEMuonFilter::~AlCaHEMuonFilter() {} @@ -126,10 +132,10 @@ AlCaHEMuonFilter::~AlCaHEMuonFilter() {} bool AlCaHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) { bool accept(false); ++nAll_; -#ifdef DebugLog - edm::LogInfo("HEMuon") << "AlCaHEMuonFilter::Run " << iEvent.id().run() << " Event " << iEvent.id().event() - << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() - << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Run " << iEvent.id().run() << " Event " << iEvent.id().event() + << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() + << std::endl; #endif //Step1: Find if the event passes one of the chosen triggers /////////////////////////////TriggerResults @@ -147,9 +153,9 @@ bool AlCaHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) if (hlt > 0) { ok = true; } -#ifdef DebugLog - edm::LogInfo("HEMuon") << "AlCaHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt << ":" << ok - << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt << ":" + << ok << std::endl; #endif } } @@ -157,27 +163,22 @@ bool AlCaHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) if (ok) { //Step2: Get geometry/B-field information //Get magnetic field - edm::ESHandle bFieldH; - iSetup.get().get(bFieldH); - const MagneticField* bField = bFieldH.product(); - // get handles to calogeometry - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); + const MagneticField* bField = &(iSetup.getData(tok_magField_)); + const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); // Relevant blocks from iEvent edm::Handle _Muon; iEvent.getByToken(tok_Muon_, _Muon); -#ifdef DebugLog - edm::LogInfo("HEMuon") << "AlCaHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Muon Handle " << _Muon.isValid() << std::endl; #endif if (_Muon.isValid()) { for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { -#ifdef DebugLog - edm::LogInfo("HEMuon") << "AlCaHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() << " innerTrack " - << RecMuon->innerTrack().isNonnull() << " outerTrack " - << RecMuon->outerTrack().isNonnull() << " globalTrack " - << RecMuon->globalTrack().isNonnull() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() + << " innerTrack " << RecMuon->innerTrack().isNonnull() << " outerTrack " + << RecMuon->outerTrack().isNonnull() << " globalTrack " + << RecMuon->globalTrack().isNonnull() << std::endl; #endif if ((RecMuon->track().isNonnull()) && (RecMuon->innerTrack().isNonnull()) && (RecMuon->outerTrack().isNonnull()) && (RecMuon->globalTrack().isNonnull())) { @@ -188,9 +189,9 @@ bool AlCaHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) const reco::Track* pTrack = (RecMuon->innerTrack()).get(); spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, false); -#ifdef DebugLog - edm::LogInfo("HEMuon") << "AlCaHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " - << trackID.okHCAL << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HEMuon") << "AlCaHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " + << trackID.okHCAL << std::endl; #endif double trackIso = RecMuon->isolationR03().sumPt; double caloIso = RecMuon->isolationR03().emEt + RecMuon->isolationR03().hadEt; @@ -231,20 +232,20 @@ void AlCaHEMuonFilter::endStream() { } void AlCaHEMuonFilter::globalEndJob(const AlCaHEMuons::Counters* count) { - edm::LogInfo("HEMuon") << "Selects " << count->nFinal_ << " out of " << count->nGood_ << " good events out of " - << count->nAll_ << " total # of events\n"; + edm::LogVerbatim("HEMuon") << "Selects " << count->nFinal_ << " out of " << count->nGood_ << " good events out of " + << count->nAll_ << " total # of events\n"; } // ------------ method called when starting to processes a run ------------ void AlCaHEMuonFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed); - edm::LogInfo("HEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; + edm::LogVerbatim("HEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; } // ------------ method called when ending the processing of a run ------------ void AlCaHEMuonFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { - edm::LogInfo("HEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n"; + edm::LogVerbatim("HEMuon") << "endRun[" << nRun_ << "] " << iRun.run() << "\n"; nRun_++; } diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc index e1fd38325418f..ff8b3ea2304c8 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksFilter.cc @@ -110,6 +110,8 @@ class AlCaIsoTracksFilter : public edm::stream::EDFilter tok_EB_; edm::EDGetTokenT tok_EE_; edm::EDGetTokenT tok_hbhe_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_magField_; }; // @@ -190,26 +192,30 @@ AlCaIsoTracksFilter::AlCaIsoTracksFilter(const edm::ParameterSet& iConfig, const tok_EE_ = consumes(labelEE_); tok_hbhe_ = consumes(labelHBHE_); - edm::LogInfo("HcalIsoTrack") << "Parameters read from config file \n" - << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality " << theTrackQuality_ - << "\t minQuality " << selectionParameter_.minQuality << "\t maxDxyPV " - << selectionParameter_.maxDxyPV << "\t maxDzPV " << selectionParameter_.maxDzPV - << "\t maxChi2 " << selectionParameter_.maxChi2 << "\t maxDpOverP " - << selectionParameter_.maxDpOverP << "\t minOuterHit " << selectionParameter_.minOuterHit - << "\t minLayerCrossed " << selectionParameter_.minLayerCrossed << "\t maxInMiss " - << selectionParameter_.maxInMiss << "\t maxOutMiss " << selectionParameter_.maxOutMiss - << "\n" - << "\t a_coneR " << a_coneR_ << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR " - << a_mipR_ << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ " - << slopeRestrictionP_ << "\t eIsolate_ " << eIsolate_ << "\n" - << "\t Precale factor " << preScale_ << "\t in momentum range " << pTrackLow_ << ":" - << pTrackHigh_ << " and prescale factor " << preScaleH_ << " for p > " << pTrackH_ - << " Threshold for EB " << hitEthrEB_ << " EE " << hitEthrEE0_ << ":" << hitEthrEE1_ - << ":" << hitEthrEE2_ << ":" << hitEthrEE3_ << ":" << hitEthrEELo_ << ":" - << hitEthrEEHi_; + tok_geom_ = esConsumes(); + tok_magField_ = esConsumes(); + + edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n" + << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality " + << theTrackQuality_ << "\t minQuality " << selectionParameter_.minQuality + << "\t maxDxyPV " << selectionParameter_.maxDxyPV << "\t maxDzPV " + << selectionParameter_.maxDzPV << "\t maxChi2 " << selectionParameter_.maxChi2 + << "\t maxDpOverP " << selectionParameter_.maxDpOverP << "\t minOuterHit " + << selectionParameter_.minOuterHit << "\t minLayerCrossed " + << selectionParameter_.minLayerCrossed << "\t maxInMiss " + << selectionParameter_.maxInMiss << "\t maxOutMiss " + << selectionParameter_.maxOutMiss << "\n" + << "\t a_coneR " << a_coneR_ << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR " + << a_mipR_ << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ " + << slopeRestrictionP_ << "\t eIsolate_ " << eIsolate_ << "\n" + << "\t Precale factor " << preScale_ << "\t in momentum range " << pTrackLow_ << ":" + << pTrackHigh_ << " and prescale factor " << preScaleH_ << " for p > " << pTrackH_ + << " Threshold for EB " << hitEthrEB_ << " EE " << hitEthrEE0_ << ":" << hitEthrEE1_ + << ":" << hitEthrEE2_ << ":" << hitEthrEE3_ << ":" << hitEthrEELo_ << ":" + << hitEthrEEHi_; for (unsigned int k = 0; k < trigNames_.size(); ++k) - edm::LogInfo("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k]; + edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k]; } // AlCaIsoTracksFilter::AlCaIsoTracksFilter constructor AlCaIsoTracksFilter::~AlCaIsoTracksFilter() {} @@ -265,13 +271,8 @@ bool AlCaIsoTracksFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSet //Step2: Get geometry/B-field information if (triggerSatisfied) { //Get magnetic field - edm::ESHandle bFieldH; - iSetup.get().get(bFieldH); - const MagneticField* bField = bFieldH.product(); - // get handles to calogeometry and calotopology - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); + const MagneticField* bField = &(iSetup.getData(tok_magField_)); + const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); //Also relevant information to extrapolate tracks to Hcal surface bool foundCollections(true); @@ -429,14 +430,14 @@ void AlCaIsoTracksFilter::globalEndJob(const AlCaIsoTracks::Counters* count) { // ------------ method called when starting to processes a run ------------ void AlCaIsoTracksFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); - edm::LogInfo("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " - << hltConfig_.init(iRun, iSetup, processName_, changed); + edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " + << hltConfig_.init(iRun, iSetup, processName_, changed); } // ------------ method called when ending the processing of a run ------------ void AlCaIsoTracksFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { ++nRun_; - edm::LogInfo("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run(); + edm::LogVerbatim("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run(); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc index 68f1c69206ab0..754886ac18382 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsoTracksProducerFilter.cc @@ -73,10 +73,10 @@ AlCaIsoTracksProducerFilter::AlCaIsoTracksProducerFilter(const edm::ParameterSet // define tokens for access tok_trigRes_ = consumes(triggerResultsLabel_); - edm::LogInfo("HcalIsoTrack") << "Use process name " << processName_ << " Labels " << triggerResultsLabel_ - << " selecting " << trigNames_.size() << " triggers\n"; + edm::LogVerbatim("HcalIsoTrack") << "Use process name " << processName_ << " Labels " << triggerResultsLabel_ + << " selecting " << trigNames_.size() << " triggers\n"; for (unsigned int k = 0; k < trigNames_.size(); ++k) { - edm::LogInfo("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k] << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k] << std::endl; } } @@ -84,8 +84,8 @@ AlCaIsoTracksProducerFilter::~AlCaIsoTracksProducerFilter() {} bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) { ++nAll_; - edm::LogInfo("HcalIsoTrack") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " - << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " + << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; //Find if the event passes one of the chosen triggers bool triggerSatisfied(false); @@ -102,8 +102,8 @@ bool AlCaIsoTracksProducerFilter::filter(edm::Event& iEvent, edm::EventSetup con int hlt = triggerResults->accept(iHLT); for (unsigned int i = 0; i < trigNames_.size(); ++i) { if (triggerNames_[iHLT].find(trigNames_[i]) != std::string::npos) { - edm::LogInfo("HcalIsoTrack") << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" - << triggerSatisfied << std::endl; + edm::LogVerbatim("HcalIsoTrack") + << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << triggerSatisfied << std::endl; if (hlt > 0) { triggerSatisfied = true; break; @@ -126,18 +126,18 @@ void AlCaIsoTracksProducerFilter::endStream() { } void AlCaIsoTracksProducerFilter::globalEndJob(const AlCaIsoTracksProdFilter::Counters* count) { - edm::LogInfo("HcalIsoTrack") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events " << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events " << std::endl; } void AlCaIsoTracksProducerFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed); - edm::LogInfo("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag << std::endl; } void AlCaIsoTracksProducerFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { ++nRun_; - edm::LogInfo("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; + edm::LogVerbatim("HcalIsoTrack") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; } void AlCaIsoTracksProducerFilter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc index 48bf8662d7a13..34dc963286a33 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchFilter.cc @@ -26,7 +26,7 @@ // class declaration // -//#define DebugLog +//#define EDM_ML_DEBUG namespace AlCaIsolatedBunch { struct Counters { @@ -77,13 +77,13 @@ AlCaIsolatedBunchFilter::AlCaIsolatedBunchFilter(const edm::ParameterSet& iConfi // define tokens for access tok_trigRes_ = consumes(theTriggerResultsLabel_); - edm::LogInfo("AlCaIsoBunch") << "Input tag for trigger results " << theTriggerResultsLabel_ << " with " - << trigIsoBunchNames_.size() << ":" << trigJetNames_.size() << " trigger names and" - << " process " << processName_ << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Input tag for trigger results " << theTriggerResultsLabel_ << " with " + << trigIsoBunchNames_.size() << ":" << trigJetNames_.size() << " trigger names and" + << " process " << processName_ << std::endl; for (unsigned int k = 0; k < trigIsoBunchNames_.size(); ++k) - edm::LogInfo("AlCaIsoBunch") << "Isolated Bunch[" << k << "] " << trigIsoBunchNames_[k] << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Isolated Bunch[" << k << "] " << trigIsoBunchNames_[k] << std::endl; for (unsigned int k = 0; k < trigJetNames_.size(); ++k) - edm::LogInfo("AlCaIsoBunch") << "Jet Trigger[" << k << "] " << trigJetNames_[k] << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Jet Trigger[" << k << "] " << trigJetNames_[k] << std::endl; } AlCaIsolatedBunchFilter::~AlCaIsolatedBunchFilter() {} @@ -96,9 +96,9 @@ AlCaIsolatedBunchFilter::~AlCaIsolatedBunchFilter() {} bool AlCaIsolatedBunchFilter::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) { bool accept(false); ++nAll_; -#ifdef DebugLog - edm::LogInfo("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " - << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " + << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; #endif //Step1: Find if the event passes one of the chosen triggers if ((trigIsoBunchNames_.empty()) && (trigJetNames_.empty())) { @@ -119,8 +119,8 @@ bool AlCaIsolatedBunchFilter::filter(edm::Event& iEvent, edm::EventSetup const& if (hlt > 0) jet = true; if (jet) { -#ifdef DebugLog - edm::LogInfo("AlCaIsoBunch") +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("AlCaIsoBunch") << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << jet << ":" << isobunch << std::endl; #endif break; @@ -134,8 +134,8 @@ bool AlCaIsolatedBunchFilter::filter(edm::Event& iEvent, edm::EventSetup const& if (hlt > 0) isobunch = true; if (isobunch) { -#ifdef DebugLog - edm::LogInfo("AlCaIsoBunch") +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("AlCaIsoBunch") << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << jet << ":" << isobunch << std::endl; #endif break; @@ -164,19 +164,19 @@ void AlCaIsolatedBunchFilter::endStream() { } void AlCaIsolatedBunchFilter::globalEndJob(const AlCaIsolatedBunch::Counters* count) { - edm::LogInfo("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl; } // ------------ method called when starting to processes a run ------------ void AlCaIsolatedBunchFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); - edm::LogInfo("AlCaIsoBunch") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " - << hltConfig_.init(iRun, iSetup, processName_, changed) << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " + << hltConfig_.init(iRun, iSetup, processName_, changed) << std::endl; } // ------------ method called when ending the processing of a run ------------ void AlCaIsolatedBunchFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { ++nRun_; - edm::LogInfo("AlCaIsoBunch") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc index 494ad0b4bc1a3..54332a05caa61 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaIsolatedBunchSelector.cc @@ -26,7 +26,7 @@ // class declaration // -//#define DebugLog +//#define EDM_ML_DEBUG namespace AlCaIsolatedBunch { struct Counters { @@ -76,8 +76,9 @@ AlCaIsolatedBunchSelector::AlCaIsolatedBunchSelector(const edm::ParameterSet& iC // define tokens for access tok_trigRes_ = consumes(theTriggerResultsLabel_); - edm::LogInfo("AlCaIsoBunch") << "Input tag for trigger results " << theTriggerResultsLabel_ << " with trigger name " - << trigName_ << " and process " << processName_ << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Input tag for trigger results " << theTriggerResultsLabel_ + << " with trigger name " << trigName_ << " and process " << processName_ + << std::endl; } AlCaIsolatedBunchSelector::~AlCaIsolatedBunchSelector() {} @@ -90,9 +91,9 @@ AlCaIsolatedBunchSelector::~AlCaIsolatedBunchSelector() {} bool AlCaIsolatedBunchSelector::filter(edm::Event& iEvent, edm::EventSetup const& iSetup) { bool accept(false); ++nAll_; -#ifdef DebugLog - edm::LogInfo("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " - << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("AlCaIsoBunch") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " + << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing() << std::endl; #endif //Step1: Find if the event passes the chosen trigger edm::Handle triggerResults; @@ -105,9 +106,9 @@ bool AlCaIsolatedBunchSelector::filter(edm::Event& iEvent, edm::EventSetup const if (triggerNames_[iHLT].find(trigName_) != std::string::npos) { if (hlt > 0) { accept = true; -#ifdef DebugLog - edm::LogInfo("AlCaIsoBunch") << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << accept - << std::endl; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("AlCaIsoBunch") + << triggerNames_[iHLT] << " has got HLT flag " << hlt << ":" << accept << std::endl; #endif break; } @@ -128,19 +129,19 @@ void AlCaIsolatedBunchSelector::endStream() { } void AlCaIsolatedBunchSelector::globalEndJob(const AlCaIsolatedBunch::Counters* count) { - edm::LogInfo("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Selects " << count->nGood_ << " in " << count->nAll_ << " events" << std::endl; } // ------------ method called when starting to processes a run ------------ void AlCaIsolatedBunchSelector::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); - edm::LogInfo("AlCaIsoBunch") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " - << hltConfig_.init(iRun, iSetup, processName_, changed) << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " + << hltConfig_.init(iRun, iSetup, processName_, changed) << std::endl; } // ------------ method called when ending the processing of a run ------------ void AlCaIsolatedBunchSelector::endRun(edm::Run const& iRun, edm::EventSetup const&) { ++nRun_; - edm::LogInfo("AlCaIsoBunch") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; + edm::LogVerbatim("AlCaIsoBunch") << "endRun[" << nRun_ << "] " << iRun.run() << std::endl; } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ diff --git a/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc b/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc index da1acfaeedea8..781be61d8cdef 100644 --- a/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc +++ b/Calibration/HcalAlCaRecoProducers/plugins/AlCaLowPUHBHEMuonFilter.cc @@ -76,6 +76,8 @@ class AlCaLowPUHBHEMuonFilter : public edm::stream::EDFilter tok_trigEvt; edm::EDGetTokenT tok_trigRes_; edm::EDGetTokenT tok_Muon_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_magField_; }; // @@ -100,15 +102,20 @@ AlCaLowPUHBHEMuonFilter::AlCaLowPUHBHEMuonFilter(edm::ParameterSet const& iConfi pfIsoCut_ = iConfig.getParameter("pfIsolationCut"); minimumMuonpT_ = iConfig.getParameter("minimumMuonpT"); minimumMuoneta_ = iConfig.getParameter("minimumMuoneta"); + // define tokens for access tok_trigRes_ = consumes(triggerResults_); tok_Muon_ = consumes(labelMuon_); - edm::LogInfo("LowPUHBHEMuon") << "Parameters read from config file \n" - << "Process " << processName_ << " PF Isolation Cuts " << pfIsoCut_ - << " minimum Muon pT cut " << minimumMuonpT_ << " minimum Muon eta cut " - << minimumMuoneta_; + + tok_geom_ = esConsumes(); + tok_magField_ = esConsumes(); + + edm::LogVerbatim("LowPUHBHEMuon") << "Parameters read from config file \n" + << "Process " << processName_ << " PF Isolation Cuts " << pfIsoCut_ + << " minimum Muon pT cut " << minimumMuonpT_ << " minimum Muon eta cut " + << minimumMuoneta_; for (unsigned int k = 0; k < trigNames_.size(); ++k) - edm::LogInfo("LowPUHBHEMuon") << "Trigger[" << k << "] " << trigNames_[k]; + edm::LogVerbatim("LowPUHBHEMuon") << "Trigger[" << k << "] " << trigNames_[k]; } // AlCaLowPUHBHEMuonFilter::AlCaLowPUHBHEMuonFilter constructor AlCaLowPUHBHEMuonFilter::~AlCaLowPUHBHEMuonFilter() {} @@ -122,9 +129,9 @@ bool AlCaLowPUHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& bool accept(false); ++nAll_; #ifdef EDM_ML_DEBUG - edm::LogInfo("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Run " << iEvent.id().run() << " Event " - << iEvent.id().event() << " Luminosity " << iEvent.luminosityBlock() << " Bunch " - << iEvent.bunchCrossing(); + edm::LogVerbatim("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Run " << iEvent.id().run() << " Event " + << iEvent.id().event() << " Luminosity " << iEvent.luminosityBlock() << " Bunch " + << iEvent.bunchCrossing(); #endif //Step1: Find if the event passes one of the chosen triggers /////////////////////////////TriggerResults @@ -144,36 +151,30 @@ bool AlCaLowPUHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& if (hlt > 0) ok = true; #ifdef EDM_ML_DEBUG - edm::LogInfo("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt - << ":" << ok; + edm::LogVerbatim("LowPUHBHEMuon") + << "AlCaLowPUHBHEMuonFilter::Trigger " << triggerNames_[iHLT] << " Flag " << hlt << ":" << ok; #endif } } } if (ok) { //Step2: Get geometry/B-field information - //Get magnetic field - edm::ESHandle bFieldH; - iSetup.get().get(bFieldH); - const MagneticField* bField = bFieldH.product(); - // get handles to calogeometry - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); + const MagneticField* bField = &(iSetup.getData(tok_magField_)); + const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); // Relevant blocks from iEvent edm::Handle _Muon; iEvent.getByToken(tok_Muon_, _Muon); #ifdef EDM_ML_DEBUG - edm::LogInfo("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Muon Handle " << _Muon.isValid(); + edm::LogVerbatim("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Muon Handle " << _Muon.isValid(); #endif if (_Muon.isValid()) { for (reco::MuonCollection::const_iterator RecMuon = _Muon->begin(); RecMuon != _Muon->end(); ++RecMuon) { #ifdef EDM_ML_DEBUG - edm::LogInfo("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() - << " innerTrack " << RecMuon->innerTrack().isNonnull() << " outerTrack " - << RecMuon->outerTrack().isNonnull() << " globalTrack " - << RecMuon->globalTrack().isNonnull(); + edm::LogVerbatim("LowPUHBHEMuon") + << "AlCaLowPUHBHEMuonFilter::Muon:Track " << RecMuon->track().isNonnull() << " innerTrack " + << RecMuon->innerTrack().isNonnull() << " outerTrack " << RecMuon->outerTrack().isNonnull() + << " globalTrack " << RecMuon->globalTrack().isNonnull(); #endif if ((RecMuon->pt() < minimumMuonpT_) || fabs(RecMuon->eta() < minimumMuoneta_)) continue; @@ -182,7 +183,7 @@ bool AlCaLowPUHBHEMuonFilter::filter(edm::Event& iEvent, edm::EventSetup const& const reco::Track* pTrack = (RecMuon->innerTrack()).get(); spr::propagatedTrackID trackID = spr::propagateCALO(pTrack, geo, bField, false); #ifdef EDM_ML_DEBUG - edm::LogInfo("LowPUHBHEMuon") + edm::LogVerbatim("LowPUHBHEMuon") << "AlCaLowPUHBHEMuonFilter::Propagate: ECAL " << trackID.okECAL << " to HCAL " << trackID.okHCAL; #endif double isolR04 = @@ -216,20 +217,20 @@ void AlCaLowPUHBHEMuonFilter::endStream() { } void AlCaLowPUHBHEMuonFilter::globalEndJob(const AlCaLowPUHBHEMuons::Counters* count) { - edm::LogInfo("LowPUHBHEMuon") << "Selects " << count->nGood_ << " good events out of " << count->nAll_ - << " total # of events"; + edm::LogVerbatim("LowPUHBHEMuon") << "Selects " << count->nGood_ << " good events out of " << count->nAll_ + << " total # of events"; } // ------------ method called when starting to processes a run ------------ void AlCaLowPUHBHEMuonFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); bool flag = hltConfig_.init(iRun, iSetup, processName_, changed); - edm::LogInfo("LowPUHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag; + edm::LogVerbatim("LowPUHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " << flag; } // ------------ method called when ending the processing of a run ------------ void AlCaLowPUHBHEMuonFilter::endRun(edm::Run const& iRun, edm::EventSetup const&) { - edm::LogInfo("LowPUHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run(); + edm::LogVerbatim("LowPUHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run(); nRun_++; } diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc index 83a4c7841645d..1bde66ae4bd2c 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaDiJetsProducer.cc @@ -97,7 +97,7 @@ AlCaDiJetsProducer::~AlCaDiJetsProducer() {} void AlCaDiJetsProducer::beginJob() {} void AlCaDiJetsProducer::endJob() { - edm::LogInfo("AlcaDiJets") << "Accepts " << nSelect_ << " events from a total of " << nAll_ << " events"; + edm::LogVerbatim("AlcaDiJets") << "Accepts " << nSelect_ << " events from a total of " << nAll_ << " events"; } bool AlCaDiJetsProducer::select(reco::PFJetCollection jt) { diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc index 209d0a1145de1..f9624f7e77575 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaHBHEMuonProducer.cc @@ -1,5 +1,5 @@ // -*- C++ -*- -//#define DebugLog +//#define EDM_ML_DEBUG // system include files #include @@ -96,9 +96,10 @@ AlCaHBHEMuonProducer::AlCaHBHEMuonProducer(edm::ParameterSet const& iConfig, con tok_HBHE_ = consumes(labelHBHE_); tok_Muon_ = consumes(labelMuon_); - edm::LogInfo("HcalHBHEMuon") << "Parameters read from config file \n" - << "\t minP of muon " << pMuonMin_ << "\t input labels " << labelBS_ << " " << labelVtx_ - << " " << labelEB_ << " " << labelEE_ << " " << labelHBHE_ << " " << labelMuon_; + edm::LogVerbatim("HcalHBHEMuon") << "Parameters read from config file \n" + << "\t minP of muon " << pMuonMin_ << "\t input labels " << labelBS_ << " " + << labelVtx_ << " " << labelEB_ << " " << labelEE_ << " " << labelHBHE_ << " " + << labelMuon_; //saves the following collections produces(labelBS_.label()); @@ -114,9 +115,10 @@ AlCaHBHEMuonProducer::~AlCaHBHEMuonProducer() {} void AlCaHBHEMuonProducer::produce(edm::Event& iEvent, edm::EventSetup const& iSetup) { ++nAll_; bool valid(true); -#ifdef DebugLog - edm::LogInfo("HcalHBHEMuon") << "AlCaHBHEMuonProducer::Run " << iEvent.id().run() << " Event " << iEvent.id().event() - << " Luminosity " << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalHBHEMuon") << "AlCaHBHEMuonProducer::Run " << iEvent.id().run() << " Event " + << iEvent.id().event() << " Luminosity " << iEvent.luminosityBlock() << " Bunch " + << iEvent.bunchCrossing(); #endif //Step1: Get all the relevant containers @@ -162,8 +164,8 @@ void AlCaHBHEMuonProducer::produce(edm::Event& iEvent, edm::EventSetup const& iS valid = false; } -#ifdef DebugLog - edm::LogInfo("HcalHBHEMuon") << "AlCaHBHEMuonProducer::obtained the collections with validity flag " << valid; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalHBHEMuon") << "AlCaHBHEMuonProducer::obtained the collections with validity flag " << valid; #endif //For accepted events @@ -220,16 +222,16 @@ void AlCaHBHEMuonProducer::endStream() { } void AlCaHBHEMuonProducer::globalEndJob(const AlCaHBHEMuons::Counters* count) { - edm::LogInfo("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events"; + edm::LogVerbatim("HcalHBHEMuon") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events"; } void AlCaHBHEMuonProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { - edm::LogInfo("HcalHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run(); + edm::LogVerbatim("HcalHBHEMuon") << "Run[" << nRun_ << "] " << iRun.run(); } void AlCaHBHEMuonProducer::endRun(edm::Run const& iRun, edm::EventSetup const&) { ++nRun_; - edm::LogInfo("HcalHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run(); + edm::LogVerbatim("HcalHBHEMuon") << "endRun[" << nRun_ << "] " << iRun.run(); } bool AlCaHBHEMuonProducer::select(const reco::MuonCollection& muons) { diff --git a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc b/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc index 3705529357c77..157129f9ceab3 100644 --- a/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc @@ -1,6 +1,5 @@ - // -*- C++ -*- -//#define DebugLog +//#define EDM_ML_DEBUG // system include files #include @@ -144,6 +143,8 @@ class AlCaIsoTracksProducer : public edm::stream::EDProducer tok_EB_; edm::EDGetTokenT tok_EE_; edm::EDGetTokenT tok_hbhe_; + edm::ESGetToken tok_geom_; + edm::ESGetToken tok_magField_; }; AlCaIsoTracksProducer::AlCaIsoTracksProducer(edm::ParameterSet const& iConfig, const AlCaIsoTracks::Counters* counters) @@ -204,25 +205,29 @@ AlCaIsoTracksProducer::AlCaIsoTracksProducer(edm::ParameterSet const& iConfig, c tok_EB_ = consumes(labelEB_); tok_EE_ = consumes(labelEE_); tok_hbhe_ = consumes(labelHBHE_); - - edm::LogInfo("HcalIsoTrack") << "Parameters read from config file \n" - << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality " << theTrackQuality_ - << "\t minQuality " << selectionParameter_.minQuality << "\t maxDxyPV " - << selectionParameter_.maxDxyPV << "\t maxDzPV " << selectionParameter_.maxDzPV - << "\t maxChi2 " << selectionParameter_.maxChi2 << "\t maxDpOverP " - << selectionParameter_.maxDpOverP << "\t minOuterHit " << selectionParameter_.minOuterHit - << "\t minLayerCrossed " << selectionParameter_.minLayerCrossed << "\t maxInMiss " - << selectionParameter_.maxInMiss << "\t maxOutMiss " << selectionParameter_.maxOutMiss - << "\n" - << "\t a_coneR " << a_coneR_ << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR " - << a_mipR_ << "\t pTrackMin " << pTrackMin_ << "\t eEcalMax " << eEcalMax_ - << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ " - << slopeRestrictionP_ << "\t eIsolate_ " << eIsolate_ << "\t Process " << processName_ - << "\n" - << "\t Precale factor " << preScale_ << "\t in momentum range " << pTrackLow_ << ":" - << pTrackHigh_; + // for event setup + tok_geom_ = esConsumes(); + tok_magField_ = esConsumes(); + + edm::LogVerbatim("HcalIsoTrack") << "Parameters read from config file \n" + << "\t minPt " << selectionParameter_.minPt << "\t theTrackQuality " + << theTrackQuality_ << "\t minQuality " << selectionParameter_.minQuality + << "\t maxDxyPV " << selectionParameter_.maxDxyPV << "\t maxDzPV " + << selectionParameter_.maxDzPV << "\t maxChi2 " << selectionParameter_.maxChi2 + << "\t maxDpOverP " << selectionParameter_.maxDpOverP << "\t minOuterHit " + << selectionParameter_.minOuterHit << "\t minLayerCrossed " + << selectionParameter_.minLayerCrossed << "\t maxInMiss " + << selectionParameter_.maxInMiss << "\t maxOutMiss " + << selectionParameter_.maxOutMiss << "\n" + << "\t a_coneR " << a_coneR_ << "\t a_charIsoR " << a_charIsoR_ << "\t a_mipR " + << a_mipR_ << "\t pTrackMin " << pTrackMin_ << "\t eEcalMax " << eEcalMax_ + << "\t maxRestrictionP_ " << maxRestrictionP_ << "\t slopeRestrictionP_ " + << slopeRestrictionP_ << "\t eIsolate_ " << eIsolate_ << "\t Process " + << processName_ << "\n" + << "\t Precale factor " << preScale_ << "\t in momentum range " << pTrackLow_ << ":" + << pTrackHigh_; for (unsigned int k = 0; k < trigNames_.size(); ++k) - edm::LogInfo("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k]; + edm::LogVerbatim("HcalIsoTrack") << "Trigger[" << k << "] " << trigNames_[k]; //create also IsolatedPixelTrackCandidateCollection which contains isolation info and reference to primary track produces(labelIsoTk_); @@ -231,13 +236,13 @@ AlCaIsoTracksProducer::AlCaIsoTracksProducer(edm::ParameterSet const& iConfig, c produces(labelEE_.instance()); produces(labelHBHE_.label()); - edm::LogInfo("HcalIsoTrack") << " Expected to produce the collections:\n" - << "reco::HcalIsolatedTrackCandidateCollection " - << " with label HcalIsolatedTrackCollection\n" - << "reco::VertexCollection with label " << labelRecVtx_.label() << "\n" - << "EcalRecHitCollection with label EcalRecHitsEB\n" - << "EcalRecHitCollection with label EcalRecHitsEE\n" - << "HBHERecHitCollection with label " << labelHBHE_.label(); + edm::LogVerbatim("HcalIsoTrack") << " Expected to produce the collections:\n" + << "reco::HcalIsolatedTrackCandidateCollection " + << " with label HcalIsolatedTrackCollection\n" + << "reco::VertexCollection with label " << labelRecVtx_.label() << "\n" + << "EcalRecHitCollection with label EcalRecHitsEB\n" + << "EcalRecHitCollection with label EcalRecHitsEE\n" + << "HBHERecHitCollection with label " << labelHBHE_.label(); } AlCaIsoTracksProducer::~AlCaIsoTracksProducer() {} @@ -288,9 +293,9 @@ void AlCaIsoTracksProducer::fillDescriptions(edm::ConfigurationDescriptions& des void AlCaIsoTracksProducer::produce(edm::Event& iEvent, edm::EventSetup const& iSetup) { nAll_++; -#ifdef DebugLog - edm::LogInfo("HcalIsoTrack") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " - << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Run " << iEvent.id().run() << " Event " << iEvent.id().event() << " Luminosity " + << iEvent.luminosityBlock() << " Bunch " << iEvent.bunchCrossing(); #endif bool valid(true); //Step1: Get all the relevant containers @@ -332,8 +337,8 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, edm::EventSetup const& i leadPV = beamSpotH->position(); } } -#ifdef DebugLog - edm::LogInfo("HcalIsoTrack") << "Primary Vertex " << leadPV; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "Primary Vertex " << leadPV; #endif edm::Handle barrelRecHitsHandle; @@ -400,8 +405,9 @@ void AlCaIsoTracksProducer::produce(edm::Event& iEvent, edm::EventSetup const& i ptL1, etaL1, phiL1); -#ifdef DebugLog - edm::LogInfo("HcalIsoTrack") << "AlCaIsoTracksProducer::select returns " << isotk->size() << " isolated tracks"; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "AlCaIsoTracksProducer::select returns " << isotk->size() + << " isolated tracks"; #endif if (!isotk->empty()) { @@ -460,25 +466,21 @@ void AlCaIsoTracksProducer::endStream() { } void AlCaIsoTracksProducer::globalEndJob(const AlCaIsoTracks::Counters* count) { - edm::LogInfo("HcalIsoTrack") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events and " - << count->nRange_ << " events in the momentum raange"; + edm::LogVerbatim("HcalIsoTrack") << "Finds " << count->nGood_ << " good tracks in " << count->nAll_ << " events and " + << count->nRange_ << " events in the momentum raange"; } void AlCaIsoTracksProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) { bool changed(false); - edm::LogInfo("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " - << hltConfig_.init(iRun, iSetup, processName_, changed); - - edm::ESHandle bFieldH; - iSetup.get().get(bFieldH); - bField = bFieldH.product(); - edm::ESHandle pG; - iSetup.get().get(pG); - geo = pG.product(); + edm::LogVerbatim("HcalIsoTrack") << "Run[" << nRun_ << "] " << iRun.run() << " hltconfig.init " + << hltConfig_.init(iRun, iSetup, processName_, changed); + + bField = &(iSetup.getData(tok_magField_)); + geo = &(iSetup.getData(tok_geom_)); } void AlCaIsoTracksProducer::endRun(edm::Run const& iRun, edm::EventSetup const&) { - edm::LogInfo("HcalIsoTrack") << "endRun [" << nRun_ << "] " << iRun.run(); + edm::LogVerbatim("HcalIsoTrack") << "endRun [" << nRun_ << "] " << iRun.run(); ++nRun_; } @@ -504,8 +506,8 @@ reco::HcalIsolatedTrackCandidateCollection* AlCaIsoTracksProducer::select( if (hlt > 0) { ok = true; } - edm::LogInfo("HcalIsoTrack") << "The trigger we are looking for " << triggerNames_[iHLT] << " Flag " << hlt - << ":" << ok; + edm::LogVerbatim("HcalIsoTrack") << "The trigger we are looking for " << triggerNames_[iHLT] << " Flag " << hlt + << ":" << ok; } } } @@ -520,15 +522,15 @@ reco::HcalIsolatedTrackCandidateCollection* AlCaIsoTracksProducer::select( trkDetItr++, nTracks++) { const reco::Track* pTrack = &(*(trkDetItr->trkItr)); math::XYZTLorentzVector v4(pTrack->px(), pTrack->py(), pTrack->pz(), pTrack->p()); -#ifdef DebugLog - edm::LogInfo("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" - << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p(); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" + << pTrack->eta() << "|" << pTrack->phi() << "|" << pTrack->p(); #endif //Selection of good track bool qltyFlag = spr::goodTrack(pTrack, leadPV, selectionParameter_, false); -#ifdef DebugLog - edm::LogInfo("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|" - << trkDetItr->okHCAL; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "qltyFlag|okECAL|okHCAL : " << qltyFlag << "|" << trkDetItr->okECAL << "|" + << trkDetItr->okHCAL; #endif if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) { double t_p = pTrack->p(); @@ -548,10 +550,10 @@ reco::HcalIsolatedTrackCandidateCollection* AlCaIsoTracksProducer::select( double eIsolation = (maxRestrictionP_ * exp(slopeRestrictionP_ * ((double)(ieta)))); if (eIsolation < eIsolate_) eIsolation = eIsolate_; -#ifdef DebugLog - edm::LogInfo("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" - << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p << " e_MIP " << eMipDR - << " Chg Isolation " << hmaxNearP << ":" << eIsolation; +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalIsoTrack") << "This track : " << nTracks << " (pt|eta|phi|p) :" << pTrack->pt() << "|" + << pTrack->eta() << "|" << pTrack->phi() << "|" << t_p << " e_MIP " << eMipDR + << " Chg Isolation " << hmaxNearP << ":" << eIsolation; #endif if (t_p > pTrackMin_ && eMipDR < eEcalMax_ && hmaxNearP < eIsolation) { reco::HcalIsolatedTrackCandidate newCandidate(v4); diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc index f4633d6078e2d..fadac8bf6beb7 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc +++ b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.cc @@ -50,6 +50,8 @@ namespace cms { tok_hbheProd_ = consumes(edm::InputTag(nameProd_, hbheInput_)); tok_hbhe_ = consumes(edm::InputTag(hbheInput_)); + + tok_geom_ = esConsumes(); } ProducerAnalyzer::~ProducerAnalyzer() { @@ -69,9 +71,7 @@ namespace cms { void ProducerAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle pG; - iSetup.get().get(pG); - const CaloGeometry* geo = pG.product(); + const CaloGeometry* geo = &(iSetup.getData(tok_geom_)); std::vector theProvenance; iEvent.getAllStableProvenance(theProvenance); diff --git a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h index 8104a44d0c372..3f404ce48c0f0 100644 --- a/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h +++ b/Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h @@ -26,6 +26,9 @@ #include "DataFormats/TrackReco/interface/TrackFwd.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" + namespace edm { class ParameterSet; class Event; @@ -73,6 +76,8 @@ namespace cms { edm::EDGetTokenT tok_hbhe_; edm::EDGetTokenT tok_hbheProd_; + + edm::ESGetToken tok_geom_; }; } // end namespace cms #endif