Skip to content

Commit

Permalink
Merge pull request #38602 from arsahasransu/checkEgammaCutforScouting
Browse files Browse the repository at this point in the history
Add EGamma calo ID variable cut to Run 3 Scouting Electrons
  • Loading branch information
cmsbuild authored Jul 13, 2022
2 parents 3809fe3 + a773959 commit 2c96f6e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
45 changes: 42 additions & 3 deletions HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,36 @@ HLTScoutingEgammaProducer::HLTScoutingEgammaProducer(const edm::ParameterSet& iC
egammaPtCut(iConfig.getParameter<double>("egammaPtCut")),
egammaEtaCut(iConfig.getParameter<double>("egammaEtaCut")),
egammaHoverECut(iConfig.getParameter<double>("egammaHoverECut")),
egammaSigmaIEtaIEtaCut(iConfig.getParameter<std::vector<double>>("egammaSigmaIEtaIEtaCut")),
absEtaBinUpperEdges(iConfig.getParameter<std::vector<double>>("absEtaBinUpperEdges")),
mantissaPrecision(iConfig.getParameter<int>("mantissaPrecision")),
saveRecHitTiming(iConfig.getParameter<bool>("saveRecHitTiming")),
rechitMatrixSize(iConfig.getParameter<int>("rechitMatrixSize")), //(2n+1)^2
rechitZeroSuppression(iConfig.getParameter<bool>("rechitZeroSuppression")),
ecalRechitEB_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecalRechitEB"))),
ecalRechitEE_(consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("ecalRechitEE"))) {
// cross-check for compatibility in input vectors
if (absEtaBinUpperEdges.size() != egammaSigmaIEtaIEtaCut.size()) {
throw cms::Exception("IncompatibleVects")
<< "size of \"absEtaBinUpperEdges\" (" << absEtaBinUpperEdges.size() << ") and \"egammaSigmaIEtaIEtaCut\" ("
<< egammaSigmaIEtaIEtaCut.size() << ") differ";
}

for (auto aIt = 1u; aIt < absEtaBinUpperEdges.size(); ++aIt) {
if (absEtaBinUpperEdges[aIt - 1] < 0 || absEtaBinUpperEdges[aIt] < 0) {
throw cms::Exception("IncorrectValue") << "absEtaBinUpperEdges entries should be greater than or equal to zero.";
}
if (absEtaBinUpperEdges[aIt - 1] >= absEtaBinUpperEdges[aIt]) {
throw cms::Exception("ImproperBinning") << "absEtaBinUpperEdges entries should be in increasing order.";
}
}

if (not absEtaBinUpperEdges.empty() and absEtaBinUpperEdges[absEtaBinUpperEdges.size() - 1] < egammaEtaCut) {
throw cms::Exception("IncorrectValue")
<< "Last entry in \"absEtaBinUpperEdges\" (" << absEtaBinUpperEdges[absEtaBinUpperEdges.size() - 1]
<< ") should have a value larger than \"egammaEtaCut\" (" << egammaEtaCut << ").";
}

//register products
produces<Run3ScoutingElectronCollection>();
produces<Run3ScoutingPhotonCollection>();
Expand Down Expand Up @@ -107,6 +131,7 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
return;
}

// Get R9Map
Handle<RecoEcalCandMap> R9Map;
if (!iEvent.getByToken(R9Map_, R9Map)) {
iEvent.put(std::move(outElectrons));
Expand Down Expand Up @@ -232,9 +257,21 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e
}
}

float HoE = 999.;
if (candidate.superCluster()->energy() != 0.)
HoE = (*HoverEMap)[candidateRef] / candidate.superCluster()->energy();
auto const HoE = candidate.superCluster()->energy() != 0.
? ((*HoverEMap)[candidateRef] / candidate.superCluster()->energy())
: 999.;
if (HoE > egammaHoverECut)
continue;

if (not absEtaBinUpperEdges.empty()) {
auto const sinin = candidate.superCluster()->energy() != 0. ? (*SigmaIEtaIEtaMap)[candidateRef] : 999.;
auto etaBinIdx = std::distance(
absEtaBinUpperEdges.begin(),
std::lower_bound(absEtaBinUpperEdges.begin(), absEtaBinUpperEdges.end(), std::abs(candidate.eta())));

if (sinin > egammaSigmaIEtaIEtaCut[etaBinIdx])
continue;
}

float d0 = 0.0;
float dz = 0.0;
Expand Down Expand Up @@ -319,6 +356,8 @@ void HLTScoutingEgammaProducer::fillDescriptions(edm::ConfigurationDescriptions&
desc.add<double>("egammaPtCut", 4.0);
desc.add<double>("egammaEtaCut", 2.5);
desc.add<double>("egammaHoverECut", 1.0);
desc.add<std::vector<double>>("egammaSigmaIEtaIEtaCut", {99999.0, 99999.0});
desc.add<std::vector<double>>("absEtaBinUpperEdges", {1.479, 5.0});
desc.add<bool>("saveRecHitTiming", false);
desc.add<int>("mantissaPrecision", 10)->setComment("default float16, change to 23 for float32");
desc.add<int>("rechitMatrixSize", 10);
Expand Down
2 changes: 2 additions & 0 deletions HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class HLTScoutingEgammaProducer : public edm::global::EDProducer<> {
const double egammaPtCut;
const double egammaEtaCut;
const double egammaHoverECut;
const std::vector<double> egammaSigmaIEtaIEtaCut;
const std::vector<double> absEtaBinUpperEdges;
const int mantissaPrecision;
const bool saveRecHitTiming;
const int rechitMatrixSize;
Expand Down

0 comments on commit 2c96f6e

Please sign in to comment.