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

Run2-alca121 Take care of HLT codes for IsoTrackHB/HE in view of increased noise level in EE #22621

Merged
merged 6 commits into from
Mar 23, 2018
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class IsolatedEcalPixelTrackCandidateProducer : public edm::global::EDProducer<>
explicit IsolatedEcalPixelTrackCandidateProducer(const edm::ParameterSet&);
~IsolatedEcalPixelTrackCandidateProducer() override;

static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);

private:
void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;

Expand All @@ -31,8 +33,13 @@ class IsolatedEcalPixelTrackCandidateProducer : public edm::global::EDProducer<>
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> tok_trigcand;
const double coneSizeEta0_;
const double coneSizeEta1_;
const double hitCountEthr_;
const double hitEthr_;
const double hitCountEthrEB_;
const double hitEthrEB_;
const double fachitCountEE_;
const double hitEthrEE0_;
const double hitEthrEE1_;
const double hitEthrEE2_;
const double hitEthrEE3_;
};

#endif

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//
//

//#define DebugLog
//#define EDM_ML_DEBUG
// system include files
#include <memory>

Expand All @@ -40,18 +40,40 @@ IsolatedEcalPixelTrackCandidateProducer::IsolatedEcalPixelTrackCandidateProducer
tok_trigcand( consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("filterLabel")) ),
coneSizeEta0_( conf.getParameter<double>("EcalConeSizeEta0") ),
coneSizeEta1_( conf.getParameter<double>("EcalConeSizeEta1") ),
hitCountEthr_( conf.getParameter<double>("ECHitCountEnergyThreshold") ),
hitEthr_( conf.getParameter<double>("ECHitEnergyThreshold") )
hitCountEthrEB_( conf.getParameter<double>("EBHitCountEnergyThreshold") ),
hitEthrEB_( conf.getParameter<double>("EBHitEnergyThreshold") ),
fachitCountEE_( conf.getParameter<double>("EEFacHitCountEnergyThreshold") ),
hitEthrEE0_( conf.getParameter<double>("EEHitEnergyThreshold0") ),
hitEthrEE1_( conf.getParameter<double>("EEHitEnergyThreshold1") ),
hitEthrEE2_( conf.getParameter<double>("EEHitEnergyThreshold2") ),
hitEthrEE3_( conf.getParameter<double>("EEHitEnergyThreshold3") )
{
// register the products
produces< reco::IsolatedPixelTrackCandidateCollection >();
}

IsolatedEcalPixelTrackCandidateProducer::~IsolatedEcalPixelTrackCandidateProducer() { }

void IsolatedEcalPixelTrackCandidateProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("filterLabel",edm::InputTag("hltIsolPixelTrackL2Filter"));
desc.add<edm::InputTag>("EBRecHitSource",edm::InputTag("hltEcalRecHit", "EcalRecHitsEB"));
desc.add<edm::InputTag>("EERecHitSource",edm::InputTag("hltEcalRecHit", "EcalRecHitsEE"));
desc.add<double>("EBHitEnergyThreshold",0.10);
desc.add<double>("EBHitCountEnergyThreshold",0.5);
desc.add<double>("EEHitEnergyThreshold0",-20.5332);
desc.add<double>("EEHitEnergyThreshold1",34.3975);
desc.add<double>("EEHitEnergyThreshold2",-19.0741);
desc.add<double>("EEHitEnergyThreshold3",3.52151);
desc.add<double>("EEFacHitCountEnergyThreshold",10.0);
desc.add<double>("EcalConeSizeEta0",0.09);
desc.add<double>("EcalConeSizeEta1",0.14);
descriptions.add("isolEcalPixelTrackProd",desc);
}

// ------------ method called to produce the data ------------
void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
#ifdef DebugLog
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "==============Inside IsolatedEcalPixelTrackCandidateProducer";
#endif
edm::ESHandle<CaloGeometry> pG;
Expand All @@ -63,8 +85,9 @@ void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, edm::Event&

edm::Handle<EcalRecHitCollection> ecalEE;
iEvent.getByToken(tok_ee,ecalEE);
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "ecal Collections isValid: " << ecalEB.isValid() << "/" << ecalEE.isValid();
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "ecal Collections isValid: "
<< ecalEB.isValid() << "/" << ecalEE.isValid();
#endif

edm::Handle<trigger::TriggerFilterObjectWithRefs> trigCand;
Expand All @@ -75,8 +98,14 @@ void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, edm::Event&
int nCand=isoPixTrackRefs.size();

auto iptcCollection = std::make_unique<reco::IsolatedPixelTrackCandidateCollection>();
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "coneSize_ " << coneSizeEta0_ << "/"<< coneSizeEta1_ << " hitCountEthr_ " << hitCountEthr_ << " hitEthr_ " << hitEthr_;
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "coneSize_ " << coneSizeEta0_ << "/"
<< coneSizeEta1_ << " hitCountEthrEB_ "
<< hitCountEthrEB_ << " hitEthrEB_ "
<< hitEthrEB_ << " fachitCountEE_ "
<< fachitCountEE_ << " hitEthrEE "
<< hitEthrEE0_ << ":" << hitEthrEE1_ << ":"
<< hitEthrEE2_ << ":" << hitEthrEE3_;
#endif
for (int p=0; p<nCand; p++) {
int nhitIn(0), nhitOut(0);
Expand All @@ -85,41 +114,69 @@ void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, edm::Event&
if (isoPixTrackRefs[p]->etaPhiEcalValid()) etaPhi = isoPixTrackRefs[p]->etaPhiEcal();
double etaAbs = std::abs(etaPhi.first);
double coneSize_ = (etaAbs > 1.5) ? coneSizeEta1_ : (coneSizeEta0_*(1.5-etaAbs)+coneSizeEta1_*etaAbs)/1.5;
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "Track: eta/phi " << etaPhi.first << "/" << etaPhi.second << " pt:" << isoPixTrackRefs[p]->track()->pt() << " cone " << coneSize_ << "\n" << "rechit size EB/EE : " << ecalEB->size() << "/" << ecalEE->size() << " coneSize_: " << coneSize_;
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "Track: eta/phi " << etaPhi.first << "/"
<< etaPhi.second << " pt:"
<< isoPixTrackRefs[p]->track()->pt()
<< " cone " << coneSize_ << "\n"
<< "rechit size EB/EE : " << ecalEB->size()
<< "/" << ecalEE->size() << " coneSize_: "
<< coneSize_;
#endif
if (etaAbs<1.7) {
for (EcalRecHitCollection::const_iterator eItr=ecalEB->begin(); eItr!=ecalEB->end(); eItr++) {
const GlobalPoint& pos = geo->getPosition(eItr->detid());
int nin(0), nout(0);
for (auto eItr : *(ecalEB.product())) {
const GlobalPoint& pos = geo->getPosition(eItr.detid());
double R = reco::deltaR(pos.eta(),pos.phi(),etaPhi.first,etaPhi.second);
if (R < coneSize_) {
nhitIn++;
inEnergy += (eItr->energy());
if (eItr->energy() > hitCountEthr_) nhitOut++;
if (eItr->energy() > hitEthr_) outEnergy += (eItr->energy());
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "Rechit Close to the track has energy " << eItr->energy() << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R;
inEnergy += (eItr.energy());
++nin;
if (eItr.energy() > hitCountEthrEB_) nhitOut++;
if (eItr.energy() > hitEthrEB_) {
outEnergy += (eItr.energy());
++nout;
}
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "EBRechit close to the track has E "
<< eItr.energy() << " eta/phi: "
<< pos.eta() << "/" << pos.phi()
<< " deltaR: " << R;
#endif
}
}
}
if (etaAbs>1.25) {
for (EcalRecHitCollection::const_iterator eItr=ecalEE->begin(); eItr!=ecalEE->end(); eItr++) {
const GlobalPoint& pos = geo->getPosition(eItr->detid());
int nin(0), nout(0);
for (auto eItr : *(ecalEE.product())) {
const GlobalPoint& pos = geo->getPosition(eItr.detid());
double R = reco::deltaR(pos.eta(),pos.phi(),etaPhi.first,etaPhi.second);
if (R < coneSize_) {
double eta = std::abs(pos.eta());
double hitEthr = (((eta*hitEthrEE3_+hitEthrEE2_)*eta+hitEthrEE1_)*eta+
hitEthrEE0_);
if (hitEthr < hitEthrEB_) hitEthr = hitEthrEB_;
nhitIn++;
inEnergy += (eItr->energy());
if (eItr->energy() > hitCountEthr_) nhitOut++;
if (eItr->energy() > hitEthr_) outEnergy += (eItr->energy());
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "Rechit Close to the track has energy " << eItr->energy() << " eta/phi: " << pos.eta() << "/" << pos.phi() << " deltaR: " << R;
inEnergy += (eItr.energy());
++nin;
if (eItr.energy() > fachitCountEE_*hitEthr) nhitOut++;
if (eItr.energy() > hitEthr) {
outEnergy += (eItr.energy());
++nout;
}
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "EERechit close to the track has E "
<< eItr.energy() << " eta/phi: "
<< pos.eta() << "/" << pos.phi()
<< " deltaR: " << R;
#endif
}
}
}
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "nhitIn:" << nhitIn << " inEnergy:" << inEnergy << " nhitOut:" << nhitOut << " outEnergy:" << outEnergy;
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "nhitIn:" << nhitIn << " inEnergy:"
<< inEnergy << " nhitOut:" << nhitOut
<< " outEnergy:" << outEnergy;
#endif
reco::IsolatedPixelTrackCandidate newca(*isoPixTrackRefs[p]);
newca.setEnergyIn(inEnergy);
Expand All @@ -128,8 +185,9 @@ void IsolatedEcalPixelTrackCandidateProducer::produce(edm::StreamID, edm::Event&
newca.setNHitOut(nhitOut);
iptcCollection->push_back(newca);
}
#ifdef DebugLog
edm::LogInfo("HcalIsoTrack") << "ncand:" << nCand << " outcollction size:" << iptcCollection->size();
#ifdef EDM_ML_DEBUG
edm::LogInfo("HcalIsoTrack") << "ncand:" << nCand << " outcollction size:"
<< iptcCollection->size();
#endif
iEvent.put(std::move(iptcCollection));
}
29 changes: 29 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@ def customiseForUncollapsed(process):
return process


def customiseFor22621_forIsoTrackHBHE(process):
"""Adapt the HLT to run with different setting
of thresholds for EB/EE in """

for producer in producers_by_type(process, "IsolatedEcalPixelTrackCandidateProducer"):
del producer.ECHitEnergyThreshold
del producer.ECHitCountEnergyThreshold
del producer.EcalConeSizeEta0
del producer.EcalConeSizeEta1
producer.EBHitEnergyThreshold = cms.double(0.10)
producer.EBHitCountEnergyThreshold = cms.double(0.5)
producer.EEHitEnergyThreshold0 = cms.double(-20.5332)
producer.EEHitEnergyThreshold1 = cms.double(34.3975)
producer.EEHitEnergyThreshold2 = cms.double(-19.0741)
producer.EEHitEnergyThreshold3 = cms.double(3.52151)
producer.EEFacHitCountEnergyThreshold= cms.double(10.0)
producer.EcalConeSizeEta0 = cms.double(0.09)
producer.EcalConeSizeEta1 = cms.double(0.14)

for filter in filters_by_type(process, "HLTEcalPixelIsolTrackFilter"):
del filter.MaxEnergyIn
del filter.MaxEnergyOut
filter.MaxEnergyInEB = cms.double( 2.0 )
filter.MaxEnergyOutEB = cms.double( 1.2 )
filter.MaxEnergyInEE = cms.double( 2.0 )
filter.MaxEnergyOutEE = cms.double( 1.2 )

return process


def customiseFor21664_forMahiOn(process):
Expand Down Expand Up @@ -196,5 +224,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):

# add call to action function in proper order: newest last!
# process = customiseFor12718(process)
process = customiseFor22621_forIsoTrackHBHE(process)

return process
26 changes: 17 additions & 9 deletions HLTrigger/special/plugins/HLTEcalPixelIsolTrackFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"

HLTEcalPixelIsolTrackFilter::HLTEcalPixelIsolTrackFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig) {
candTag_ = iConfig.getParameter<edm::InputTag> ("candTag");
maxEnergyIn_ = iConfig.getParameter<double> ("MaxEnergyIn");
maxEnergyOut_ = iConfig.getParameter<double> ("MaxEnergyOut");
nMaxTrackCandidates_ = iConfig.getParameter<int>("NMaxTrackCandidates");
dropMultiL2Event_ = iConfig.getParameter<bool> ("DropMultiL2Event");
HLTEcalPixelIsolTrackFilter::HLTEcalPixelIsolTrackFilter(const edm::ParameterSet& iConfig) :
HLTFilter(iConfig),
candTag_( iConfig.getParameter<edm::InputTag> ("candTag")),
maxEnergyInEB_(iConfig.getParameter<double> ("MaxEnergyInEB")),
maxEnergyInEE_(iConfig.getParameter<double> ("MaxEnergyInEE")),
maxEnergyOutEB_(iConfig.getParameter<double> ("MaxEnergyOutEB")),
maxEnergyOutEE_(iConfig.getParameter<double> ("MaxEnergyOutEE")),
nMaxTrackCandidates_(iConfig.getParameter<int>("NMaxTrackCandidates")),
dropMultiL2Event_(iConfig.getParameter<bool> ("DropMultiL2Event")) {
candTok = consumes<reco::IsolatedPixelTrackCandidateCollection>(candTag_);
}

Expand All @@ -22,8 +25,10 @@ void HLTEcalPixelIsolTrackFilter::fillDescriptions(edm::ConfigurationDescription
edm::ParameterSetDescription desc;
makeHLTFilterDescription(desc);
desc.add<edm::InputTag>("candTag",edm::InputTag("hltIsolEcalPixelTrackProd"));
desc.add<double>("MaxEnergyIn",1.2);
desc.add<double>("MaxEnergyOut",1.2);
desc.add<double>("MaxEnergyInEB",1.2);
desc.add<double>("MaxEnergyInEE",2.0);
desc.add<double>("MaxEnergyOutEB",1.2);
desc.add<double>("MaxEnergyOutEE",2.0);
desc.add<int>("NMaxTrackCandidates",10);
desc.add<bool>("DropMultiL2Event",false);
descriptions.add("isolEcalPixelTrackFilter",desc);
Expand All @@ -47,8 +52,11 @@ bool HLTEcalPixelIsolTrackFilter::hltFilter(edm::Event& iEvent, const edm::Event
LogDebug("IsoTrk") << "candref.track().isNull() " << candref->track().isNull() << "\n";
if(candref->track().isNull()) continue;
// select on transverse momentum
double etaAbs = std::abs(candref->track()->eta());
double maxEnergyIn = (etaAbs < 1.479) ? maxEnergyInEB_ : maxEnergyInEE_;
double maxEnergyOut= (etaAbs < 1.479) ? maxEnergyOutEB_ : maxEnergyOutEE_;
LogDebug("IsoTrk") << "energyin/out: " << candref->energyIn() << "/" << candref->energyOut() << "\n";
if (candref->energyIn()<maxEnergyIn_&& candref->energyOut()<maxEnergyOut_) {
if (candref->energyIn()<maxEnergyIn && candref->energyOut()<maxEnergyOut) {
filterproduct.addObject(trigger::TriggerTrack, candref);
n++;
LogDebug("IsoTrk") << "EcalIsol:Candidate[" << n <<"] pt|eta|phi "
Expand Down
10 changes: 6 additions & 4 deletions HLTrigger/special/plugins/HLTEcalPixelIsolTrackFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ class HLTEcalPixelIsolTrackFilter : public HLTFilter {
private:
edm::EDGetTokenT<reco::IsolatedPixelTrackCandidateCollection> candTok;
edm::InputTag candTag_;
double maxEnergyIn_;
double maxEnergyOut_;
int nMaxTrackCandidates_;
bool dropMultiL2Event_;
const double maxEnergyInEB_;
const double maxEnergyInEE_;
const double maxEnergyOutEB_;
const double maxEnergyOutEE_;
const int nMaxTrackCandidates_;
const bool dropMultiL2Event_;
};

#endif