Skip to content

Commit

Permalink
Merge pull request #6 from Sam-Harper/HGCal_ShowerShapes_11_2_0_pre7_…
Browse files Browse the repository at this point in the history
…WithExample

updating with code checks
  • Loading branch information
SohamBhattacharya committed Jan 5, 2021
2 parents 994d7f9 + 5612e4d commit de4af6a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ EgammaHLTHGCalIDVarProducer::EgammaHLTHGCalIDVarProducer(const edm::ParameterSet
consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"))),
hgcalRecHitToken_(consumes<reco::PFRecHitCollection>(config.getParameter<edm::InputTag>("hgcalRecHits"))),
layerClusterToken_(consumes<reco::CaloClusterCollection>(config.getParameter<edm::InputTag>("layerClusters"))),
ssCalc_(consumesCollector())
{
ssCalc_(consumesCollector()) {
pcaAssocMaps_.emplace_back(PCAAssocMap(&HGCalShowerShapeHelper::ShowerWidths::sigma2xx, "sigma2xx"));
pcaAssocMaps_.emplace_back(PCAAssocMap(&HGCalShowerShapeHelper::ShowerWidths::sigma2yy, "sigma2yy"));
pcaAssocMaps_.emplace_back(PCAAssocMap(&HGCalShowerShapeHelper::ShowerWidths::sigma2zz, "sigma2zz"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "RecoEgamma/EgammaTools/interface/HGCalClusterTools.h"


template <typename T1>
class HLTHGCalLayerClusterIsolationProducer : public edm::stream::EDProducer<> {
typedef std::vector<T1> T1Collection;
Expand Down Expand Up @@ -69,7 +68,8 @@ class HLTHGCalLayerClusterIsolationProducer : public edm::stream::EDProducer<> {

template <typename T1>
HLTHGCalLayerClusterIsolationProducer<T1>::HLTHGCalLayerClusterIsolationProducer(const edm::ParameterSet& config)
: layerClusterProducer_(consumes<reco::CaloClusterCollection>(config.getParameter<edm::InputTag>("layerClusterProducer"))),
: layerClusterProducer_(
consumes<reco::CaloClusterCollection>(config.getParameter<edm::InputTag>("layerClusterProducer"))),
rhoProducer_(consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"))),
drMax_(config.getParameter<double>("drMax")),
drVetoEM_(config.getParameter<double>("drVetoEM")),
Expand All @@ -85,7 +85,8 @@ HLTHGCalLayerClusterIsolationProducer<T1>::HLTHGCalLayerClusterIsolationProducer
effectiveAreas_(config.getParameter<std::vector<double>>("effectiveAreas")) {
if (doRhoCorrection_) {
if (effectiveAreas_.size() != 2)
throw cms::Exception("IncompatibleVects") << "effectiveAreas should have two elements for em and had components. \n";
throw cms::Exception("IncompatibleVects")
<< "effectiveAreas should have two elements for em and had components. \n";
}

std::string recoCandidateProducerName = "recoCandidateProducer";
Expand Down Expand Up @@ -134,7 +135,7 @@ void HLTHGCalLayerClusterIsolationProducer<T1>::produce(edm::Event& iEvent, cons
rho = *(rhoHandle.product());
}

rho = std::min(rho,rhoMax_);
rho = std::min(rho, rhoMax_);
rho = rho * rhoScale_;

edm::Handle<T1Collection> recoCandHandle;
Expand All @@ -152,19 +153,25 @@ void HLTHGCalLayerClusterIsolationProducer<T1>::produce(edm::Event& iEvent, cons
for (unsigned int iReco = 0; iReco < recoCandHandle->size(); iReco++) {
T1Ref candRef(recoCandHandle, iReco);

float sumEm = HGCalClusterTools::emEnergyInCone(candRef->eta(), candRef->phi(),
layerClusters,
drVetoEM_, drMax_,
minEtEM_, minEnergyEM_,
useEt_ ? HGCalClusterTools::EType::ET :
HGCalClusterTools::EType::ENERGY );

float sumHad = HGCalClusterTools::hadEnergyInCone(candRef->eta(), candRef->phi(),
layerClusters,
drVetoHad_, drMax_,
minEtHad_, minEnergyHad_,
useEt_ ? HGCalClusterTools::EType::ET :
HGCalClusterTools::EType::ENERGY );
float sumEm =
HGCalClusterTools::emEnergyInCone(candRef->eta(),
candRef->phi(),
layerClusters,
drVetoEM_,
drMax_,
minEtEM_,
minEnergyEM_,
useEt_ ? HGCalClusterTools::EType::ET : HGCalClusterTools::EType::ENERGY);

float sumHad =
HGCalClusterTools::hadEnergyInCone(candRef->eta(),
candRef->phi(),
layerClusters,
drVetoHad_,
drMax_,
minEtHad_,
minEnergyHad_,
useEt_ ? HGCalClusterTools::EType::ET : HGCalClusterTools::EType::ENERGY);

if (doRhoCorrection_) {
sumEm = sumEm - rho * effectiveAreas_.at(0);
Expand All @@ -179,8 +186,8 @@ void HLTHGCalLayerClusterIsolationProducer<T1>::produce(edm::Event& iEvent, cons
}

iEvent.put(std::make_unique<T1IsolationMap>(recoCandMap));
iEvent.put(std::make_unique<T1IsolationMap>(recoCandMapEm),"em");
iEvent.put(std::make_unique<T1IsolationMap>(recoCandMapHad),"had");
iEvent.put(std::make_unique<T1IsolationMap>(recoCandMapEm), "em");
iEvent.put(std::make_unique<T1IsolationMap>(recoCandMapHad), "had");
}

typedef HLTHGCalLayerClusterIsolationProducer<reco::RecoEcalCandidate> EgammaHLTHGCalLayerClusterIsolationProducer;
Expand Down
2 changes: 0 additions & 2 deletions RecoEgamma/EgammaTools/interface/HGCalShowerShapeHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "RecoParticleFlow/PFClusterProducer/interface/InitialClusteringStepBase.h"

class HGCalShowerShapeHelper {

// Good to filter/compute/store this stuff beforehand as they are common to the shower shape variables.
// No point in filtering, computing layer-wise centroids, etc. for each variable again and again.
// Once intitialized, one can the calculate different variables one after another for a given object.
Expand Down Expand Up @@ -127,7 +126,6 @@ class HGCalShowerShapeHelper {
ROOT::Math::XYZVector centroid_;
std::vector<double> layerEnergies_;
std::vector<ROOT::Math::XYZVector> layerCentroids_;

};

#endif

0 comments on commit de4af6a

Please sign in to comment.