Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run3-alca213 Complete the validation of the new AlCaReco for HcalIsoTrackFilter #36621

Merged
merged 4 commits into from Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -125,7 +125,8 @@ class AlCaHcalIsotrkProducer : public edm::stream::EDProducer<edm::GlobalCache<a
const HcalRespCorrs* respCorrs,
const edm::Handle<reco::MuonCollection>& muonh,
std::vector<HcalIsoTrkCalibVariables>& hocalib,
HcalIsoTrkEventVariables& hocalibEvent);
HcalIsoTrkEventVariables& hocalibEvent,
const edm::EventID& eventId);
double dR(math::XYZTLorentzVector&, math::XYZTLorentzVector&);
double trackP(const reco::Track*, const edm::Handle<reco::GenParticleCollection>&);
double rhoh(const edm::Handle<CaloTowerCollection>&);
Expand Down Expand Up @@ -615,7 +616,8 @@ void AlCaHcalIsotrkProducer::produce(edm::Event& iEvent, edm::EventSetup const&
respCorrs,
muonh,
*outputHcalIsoTrackColl,
isoTrkEvent);
isoTrkEvent,
iEvent.id());
isoTrkEvent.tracksSaved_ = ntksave[0];
isoTrkEvent.tracksLoose_ = ntksave[1];
isoTrkEvent.tracksTight_ = ntksave[2];
Expand Down Expand Up @@ -701,7 +703,8 @@ void AlCaHcalIsotrkProducer::produce(edm::Event& iEvent, edm::EventSetup const&
respCorrs,
muonh,
*outputHcalIsoTrackColl,
isoTrkEvent);
isoTrkEvent,
iEvent.id());
isoTrkEvent.tracksSaved_ += ntksave[0];
isoTrkEvent.tracksLoose_ += ntksave[1];
isoTrkEvent.tracksTight_ += ntksave[2];
Expand Down Expand Up @@ -772,7 +775,8 @@ std::array<int, 3> AlCaHcalIsotrkProducer::getProducts(int goodPV,
const HcalRespCorrs* respCorrs,
const edm::Handle<reco::MuonCollection>& muonh,
std::vector<HcalIsoTrkCalibVariables>& hocalib,
HcalIsoTrkEventVariables& hocalibEvent) {
HcalIsoTrkEventVariables& hocalibEvent,
const edm::EventID& eventId) {
int nSave(0), nLoose(0), nTight(0);
unsigned int nTracks(0), nselTracks(0);
double rhohEV = (tower.isValid()) ? rhoh(tower) : 0;
Expand Down Expand Up @@ -1155,6 +1159,8 @@ std::array<int, 3> AlCaHcalIsotrkProducer::getProducts(int goodPV,
}
#endif
if (accept) {
edm::LogVerbatim("HcalIsoTrackX")
<< "Run " << eventId.run() << " Event " << eventId.event() << " Track " << nTracks << " p " << isoTk.p_;
hocalib.emplace_back(isoTk);
nSave++;
int type(0);
Expand Down
Expand Up @@ -4,7 +4,7 @@
#AlCaReco filtering for HCAL isotrk:
#------------------------------------------------

from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkProducer_cfi import *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changed? The .cfi should be used, and it should be created by the fillDescribtion method in the producer .cc file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some parameters which depend on the run period. The condition of EE changed over years due to radiation damage. So we need to modify some of the parameters which are ERA dependent. So all parameters are defined through the cfi created by fillDescription and the ERA dependence is put in the cff file which started from the cfi file.

from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkProducer_cff import *
from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkFilter_cfi import *

seqALCARECOHcalCalIsoTrkProducerFilter = cms.Sequence(alcaHcalIsotrkProducer * alcaHcalIsotrkFilter)
Expand Down
@@ -0,0 +1,27 @@
import FWCore.ParameterSet.Config as cms

from Calibration.HcalAlCaRecoProducers.alcaHcalIsotrkProducer_cfi import *

from Configuration.Eras.Modifier_run2_ECAL_2017_cff import run2_ECAL_2017

run2_ECAL_2017.toModify(alcaHcalIsotrkProducer,
EBHitEnergyThreshold = 0.18,
EEHitEnergyThreshold0 = -206.074,
EEHitEnergyThreshold1 = 357.671,
EEHitEnergyThreshold2 = -204.978,
EEHitEnergyThreshold3 = 39.033,
EEHitEnergyThresholdLow = 1.25,
EEHitEnergyThresholdHigh= 10.0
)

from Configuration.Eras.Modifier_run2_HCAL_2018_cff import run2_HCAL_2018

run2_HCAL_2018.toModify(alcaHcalIsotrkProducer,
EBHitEnergyThreshold = 0.10,
EEHitEnergyThreshold0 = -41.0664,
EEHitEnergyThreshold1 = 68.795,
EEHitEnergyThreshold2 = -38.1483,
EEHitEnergyThreshold3 = 7.04303,
EEHitEnergyThresholdLow = 0.11,
EEHitEnergyThresholdHigh= 15.4
)
Expand Up @@ -72,13 +72,8 @@
process.endjob_step = cms.EndPath(process.endOfProcess)
process.ALCARECOStreamHcalCalIsoTrkFilterOutPath = cms.EndPath(process.ALCARECOStreamHcalCalIsoTrkFilter)

process.alcaIsoTracksFilter.debugEvents = [640818633, 640797426, 641251898]
#process.alcaIsoTracksFilter.debugEvents = [641031809, 641092744, 640862532,
# 640874735, 641845581, 641144982,
# 641124886, 641240201, 640856725,
# 641709599, 641406943, 640794164,
# 641820644, 641053143, 641458751,
# 641554667, 641621481]
process.alcaIsoTracksFilter.debugEvents = [640818633, 640797426, 641251898,
641261804, 641172007, 641031809]

# Schedule definition
process.schedule = cms.Schedule(process.pathALCARECOHcalCalIsoTrkFilterNoHLT,process.endjob_step,process.ALCARECOStreamHcalCalIsoTrkFilterOutPath)
Expand Down
6 changes: 2 additions & 4 deletions Calibration/HcalCalibAlgos/plugins/HcalIsoTrackAnalyzer.cc
Expand Up @@ -121,9 +121,9 @@ void HcalIsoTrackAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup con
if (debug)
edm::LogVerbatim("HcalIsoTrack") << "Finds HcalIsoTrkCalibVariablesCollection with " << isotrkCalib->size()
<< " entries";
int k(0);
#endif
for (auto itr = isotrkCalib->begin(); itr != isotrkCalib->end(); ++itr) {
int k(0);
for (auto itr = isotrkCalib->begin(); itr != isotrkCalib->end(); ++itr, ++k) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be a range based loop, right?

Suggested change
for (auto itr = isotrkCalib->begin(); itr != isotrkCalib->end(); ++itr, ++k) {
for (auto isotrkCalib : isotrkCalibColl) {

And then you'll also not need the line
auto isotrkCalib = isotrkCalibColl.product(); from earlier

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be done more systematically in all the HCAL for loops, let me know if you prefer to do that, or fix the cases in the HcalIsoTrackFilter alone

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I shall do this later systematically in other loops. Let this PR to be merged now

t_ieta = itr->ieta_;
t_iphi = itr->iphi_;
t_goodPV = itr->goodPV_;
Expand All @@ -134,7 +134,6 @@ void HcalIsoTrackAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup con
t_pt = itr->pt_;
t_phi = itr->phi_;
#ifdef EDM_ML_DEBUG
++k;
if (debug)
edm::LogVerbatim("HcalIsoTrack") << "Track " << k << " p:pt:phi " << t_p << ":" << t_pt << ":" << t_phi
<< " nvtx:ntrk:goodPV:wt " << t_nVtx << ":" << t_nTrk << ":" << t_goodPV << ":"
Expand Down Expand Up @@ -216,7 +215,6 @@ void HcalIsoTrackAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup con
edm::LogVerbatim("HcalIsoTrack") << "eHcal:eHcal10:eHCal30 " << t_eHcal << ":" << t_eHcal10 << t_eHcal30;
#endif
tree->Fill();
edm::LogVerbatim("HcalIsoTrackX") << "Run " << t_Run << " Event " << t_Event;

if (t_p < pTrackLow_) {
++nLow_;
Expand Down
9 changes: 5 additions & 4 deletions Calibration/HcalCalibAlgos/plugins/HcalIsoTrkAnalyzer.cc
Expand Up @@ -1255,15 +1255,15 @@ std::array<int, 3> HcalIsoTrkAnalyzer::fillTree(std::vector<math::XYZTLorentzVec
<< " Quality " << t_qltyMissFlag << ":" << t_qltyPVFlag << ":" << t_selectTk;
for (unsigned int ll = 0; ll < t_DetIds->size(); ll++) {
edm::LogVerbatim("HcalIsoTrack")
<< "det id is = " << t_DetIds->at(ll) << " hit enery is = " << t_HitEnergies->at(ll);
<< "det id is = " << HcalDetId(t_DetIds->at(ll)) << " hit enery is = " << t_HitEnergies->at(ll);
}
for (unsigned int ll = 0; ll < t_DetIds1->size(); ll++) {
edm::LogVerbatim("HcalIsoTrack")
<< "det id is = " << t_DetIds1->at(ll) << " hit enery is = " << t_HitEnergies1->at(ll);
<< "det id is = " << HcalDetId(t_DetIds1->at(ll)) << " hit enery is = " << t_HitEnergies1->at(ll);
}
for (unsigned int ll = 0; ll < t_DetIds3->size(); ll++) {
edm::LogVerbatim("HcalIsoTrack")
<< "det id is = " << t_DetIds3->at(ll) << " hit enery is = " << t_HitEnergies3->at(ll);
<< "det id is = " << HcalDetId(t_DetIds3->at(ll)) << " hit enery is = " << t_HitEnergies3->at(ll);
}
}
#endif
Expand All @@ -1287,7 +1287,8 @@ std::array<int, 3> HcalIsoTrkAnalyzer::fillTree(std::vector<math::XYZTLorentzVec
}
if (accept) {
tree->Fill();
edm::LogVerbatim("HcalIsoTrackX") << "Run " << t_RunNo << " Event " << t_EventNo;
edm::LogVerbatim("HcalIsoTrackX")
<< "Run " << t_RunNo << " Event " << t_EventNo << " Track " << nTracks << " p " << t_p;
nSave++;
int type(0);
if (t_eMipDR < 1.0) {
Expand Down
Expand Up @@ -31,7 +31,8 @@
process.HcalIsoTrkAnalyzer.triggers = []
process.HcalIsoTrkAnalyzer.useRaw = 0 # 1 for Raw
process.HcalIsoTrkAnalyzer.ignoreTriggers = True
process.HcalIsoTrkAnalyzer.debugEvents = [640818633, 640797426, 641251898]
process.HcalIsoTrkAnalyzer.debugEvents = [640818633, 640797426, 641251898,
641261804, 641172007, 641031809]

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring('file:oldPoolOutput.root')
Expand Down
Expand Up @@ -21,7 +21,8 @@

process.load('Calibration.HcalCalibAlgos.hcalIsoTrackAnalyzer_cfi')
process.hcalIsoTrackAnalyzer.useRaw = 0 # 1 for Raw
process.hcalIsoTrackAnalyzer.debugEvents = [640818633, 640797426, 641251898]
process.hcalIsoTrackAnalyzer.debugEvents = [640818633, 640797426, 641251898,
641261804, 641172007, 641031809]

process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring('file:newPoolOutput.root')
Expand Down