CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HLTEcalPFClusterIsolationProducer< T1 > Class Template Reference

#include <HLTEcalPFClusterIsolationProducer.h>

Inheritance diagram for HLTEcalPFClusterIsolationProducer< T1 >:
edm::stream::EDProducer<>

Public Member Functions

 HLTEcalPFClusterIsolationProducer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HLTEcalPFClusterIsolationProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::vector< T1 > T1Collection
 
typedef edm::AssociationMap< edm::OneToValue< std::vector< T1 >, float > > T1IsolationMap
 
typedef edm::Ref< T1CollectionT1Ref
 

Private Member Functions

bool computedRVeto (T1Ref candRef, reco::PFClusterRef pfclu)
 

Private Attributes

const std::vector< double > absEtaLowEdges_
 
const bool doRhoCorrection_
 
const double drMax_
 
double drVeto2_
 
const double drVetoBarrel_
 
const double drVetoEndcap_
 
const std::vector< double > effectiveAreas_
 
const double energyBarrel_
 
const double energyEndcap_
 
const double etaStripBarrel_
 
const double etaStripEndcap_
 
const edm::EDGetTokenT< reco::PFClusterCollectionpfClusterProducer_
 
edm::EDGetTokenT< T1CollectionrecoCandidateProducer_
 
const double rhoMax_
 
const edm::EDGetTokenT< double > rhoProducer_
 
const double rhoScale_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

template<typename T1>
class HLTEcalPFClusterIsolationProducer< T1 >

Definition at line 28 of file HLTEcalPFClusterIsolationProducer.h.

Member Typedef Documentation

template<typename T1 >
typedef std::vector<T1> HLTEcalPFClusterIsolationProducer< T1 >::T1Collection
private

Definition at line 30 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
typedef edm::AssociationMap<edm::OneToValue<std::vector<T1>, float > > HLTEcalPFClusterIsolationProducer< T1 >::T1IsolationMap
private

Definition at line 32 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
typedef edm::Ref<T1Collection> HLTEcalPFClusterIsolationProducer< T1 >::T1Ref
private

Definition at line 31 of file HLTEcalPFClusterIsolationProducer.h.

Constructor & Destructor Documentation

template<typename T1 >
HLTEcalPFClusterIsolationProducer< T1 >::HLTEcalPFClusterIsolationProducer ( const edm::ParameterSet config)
explicit

Definition at line 29 of file HLTEcalPFClusterIsolationProducer.cc.

References HLTEcalPFClusterIsolationProducer< T1 >::absEtaLowEdges_, HLTEcalPFClusterIsolationProducer< T1 >::doRhoCorrection_, HLTEcalPFClusterIsolationProducer< T1 >::effectiveAreas_, Exception, edm::ParameterSet::getParameter(), HLTEcalPFClusterIsolationProducer< T1 >::recoCandidateProducer_, and AlCaHLTBitMon_QueryRunRegistry::string.

29  :
30  pfClusterProducer_ (consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducer"))),
31  rhoProducer_ (consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"))),
32  drMax_ (config.getParameter<double>("drMax")),
33  drVetoBarrel_ (config.getParameter<double>("drVetoBarrel")),
34  drVetoEndcap_ (config.getParameter<double>("drVetoEndcap")),
35  etaStripBarrel_ (config.getParameter<double>("etaStripBarrel")),
36  etaStripEndcap_ (config.getParameter<double>("etaStripEndcap")),
37  energyBarrel_ (config.getParameter<double>("energyBarrel")),
38  energyEndcap_ (config.getParameter<double>("energyEndcap")),
39  doRhoCorrection_ (config.getParameter<bool>("doRhoCorrection")),
40  rhoMax_ (config.getParameter<double>("rhoMax")),
41  rhoScale_ (config.getParameter<double>("rhoScale")),
42  effectiveAreas_ (config.getParameter<std::vector<double> >("effectiveAreas")),
43  absEtaLowEdges_ (config.getParameter<std::vector<double> >("absEtaLowEdges")) {
44 
45  if (doRhoCorrection_) {
46  if (absEtaLowEdges_.size() != effectiveAreas_.size())
47  throw cms::Exception("IncompatibleVects") << "absEtaLowEdges and effectiveAreas should be of the same size. \n";
48 
49  if (absEtaLowEdges_.at(0) != 0.0)
50  throw cms::Exception("IncompleteCoverage") << "absEtaLowEdges should start from 0. \n";
51 
52  for (unsigned int aIt = 0; aIt < absEtaLowEdges_.size() - 1; aIt++) {
53  if ( !(absEtaLowEdges_.at( aIt ) < absEtaLowEdges_.at( aIt + 1 )) )
54  throw cms::Exception("ImproperBinning") << "absEtaLowEdges entries should be in increasing order. \n";
55  }
56  }
57 
58  std::string recoCandidateProducerName = "recoCandidateProducer";
59  if ((typeid(HLTEcalPFClusterIsolationProducer<T1>) == typeid(HLTEcalPFClusterIsolationProducer<reco::RecoEcalCandidate>))) recoCandidateProducerName = "recoEcalCandidateProducer";
60 
61  recoCandidateProducer_ = consumes<T1Collection>(config.getParameter<edm::InputTag>(recoCandidateProducerName));
62  produces <T1IsolationMap>();
63 
64 }
T getParameter(std::string const &) const
edm::EDGetTokenT< T1Collection > recoCandidateProducer_
const edm::EDGetTokenT< double > rhoProducer_
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducer_
template<typename T1 >
HLTEcalPFClusterIsolationProducer< T1 >::~HLTEcalPFClusterIsolationProducer ( )
override

Definition at line 67 of file HLTEcalPFClusterIsolationProducer.cc.

68 {}

Member Function Documentation

template<typename T1 >
bool HLTEcalPFClusterIsolationProducer< T1 >::computedRVeto ( T1Ref  candRef,
reco::PFClusterRef  pfclu 
)
private
template<typename T1 >
void HLTEcalPFClusterIsolationProducer< T1 >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 71 of file HLTEcalPFClusterIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), defaultModuleLabel(), and AlCaHLTBitMon_QueryRunRegistry::string.

71  {
72 
73  std::string recoCandidateProducerName = "recoCandidateProducer";
74  if ((typeid(HLTEcalPFClusterIsolationProducer<T1>) == typeid(HLTEcalPFClusterIsolationProducer<reco::RecoEcalCandidate>))) recoCandidateProducerName = "recoEcalCandidateProducer";
75 
77  desc.add<edm::InputTag>(recoCandidateProducerName, edm::InputTag("hltL1SeededRecoEcalCandidatePF"));
78  desc.add<edm::InputTag>("pfClusterProducer", edm::InputTag("hltParticleFlowClusterECAL"));
79  desc.add<edm::InputTag>("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo"));
80  desc.add<bool>("doRhoCorrection", false);
81  desc.add<double>("rhoMax", 9.9999999E7);
82  desc.add<double>("rhoScale", 1.0);
83  desc.add<double>("drMax", 0.3);
84  desc.add<double>("drVetoBarrel", 0.0);
85  desc.add<double>("drVetoEndcap", 0.0);
86  desc.add<double>("etaStripBarrel", 0.0);
87  desc.add<double>("etaStripEndcap", 0.0);
88  desc.add<double>("energyBarrel", 0.0);
89  desc.add<double>("energyEndcap", 0.0);
90  desc.add<std::vector<double> >("effectiveAreas", {0.29, 0.21}); // 2016 post-ichep sinEle default
91  desc.add<std::vector<double> >("absEtaLowEdges", {0.0, 1.479}); // Barrel, Endcap
93 }
std::string defaultModuleLabel()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename T1 >
void HLTEcalPFClusterIsolationProducer< T1 >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 96 of file HLTEcalPFClusterIsolationProducer.cc.

References funct::abs(), HLTEcalPFClusterIsolationProducer< T1 >::absEtaLowEdges_, HLTEcalPFClusterIsolationProducer< T1 >::doRhoCorrection_, HLTEcalPFClusterIsolationProducer< T1 >::drMax_, HLTEcalPFClusterIsolationProducer< T1 >::drVetoBarrel_, HLTEcalPFClusterIsolationProducer< T1 >::drVetoEndcap_, HLTEcalPFClusterIsolationProducer< T1 >::effectiveAreas_, HLTEcalPFClusterIsolationProducer< T1 >::energyBarrel_, HLTEcalPFClusterIsolationProducer< T1 >::energyEndcap_, HLTEcalPFClusterIsolationProducer< T1 >::etaStripBarrel_, HLTEcalPFClusterIsolationProducer< T1 >::etaStripEndcap_, edm::Event::getByToken(), EcalPFClusterIsolation< T1 >::getSum(), edm::AssociationMap< Tag >::insert(), HLTEcalPFClusterIsolationProducer< T1 >::pfClusterProducer_, edm::Handle< T >::product(), edm::Event::put(), HLTEcalPFClusterIsolationProducer< T1 >::recoCandidateProducer_, rho, HLTEcalPFClusterIsolationProducer< T1 >::rhoMax_, HLTEcalPFClusterIsolationProducer< T1 >::rhoProducer_, and HLTEcalPFClusterIsolationProducer< T1 >::rhoScale_.

96  {
97 
98  edm::Handle<double> rhoHandle;
99  double rho = 0.0;
100  if (doRhoCorrection_) {
101  iEvent.getByToken(rhoProducer_, rhoHandle);
102  rho = *(rhoHandle.product());
103  }
104 
105  if (rho > rhoMax_)
106  rho = rhoMax_;
107 
108  rho = rho*rhoScale_;
109 
110  edm::Handle<T1Collection> recoCandHandle;
112 
113  iEvent.getByToken(recoCandidateProducer_,recoCandHandle);
114  iEvent.getByToken(pfClusterProducer_, clusterHandle);
115 
117  T1IsolationMap recoCandMap(recoCandHandle);
118 
119  for (unsigned int iReco = 0; iReco < recoCandHandle->size(); iReco++) {
120  T1Ref candRef(recoCandHandle, iReco);
121 
122  float sum = isoAlgo.getSum(candRef, clusterHandle);
123 
124  if (doRhoCorrection_) {
125  int iEA = -1;
126  auto cEta = std::abs(candRef->eta());
127  for (int bIt = absEtaLowEdges_.size() - 1; bIt > -1; bIt--) {
128  if ( cEta > absEtaLowEdges_.at(bIt) ) {
129  iEA = bIt;
130  break;
131  }
132  }
133 
134  sum = sum - rho*effectiveAreas_.at(iEA);
135  }
136 
137  recoCandMap.insert(candRef, sum);
138  }
139 
140  iEvent.put(std::make_unique<T1IsolationMap>(recoCandMap));
141 }
edm::EDGetTokenT< T1Collection > recoCandidateProducer_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
const edm::EDGetTokenT< double > rhoProducer_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
T const * product() const
Definition: Handle.h:81
edm::AssociationMap< edm::OneToValue< std::vector< T1 >, float > > T1IsolationMap
const edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducer_

Member Data Documentation

template<typename T1 >
const std::vector<double> HLTEcalPFClusterIsolationProducer< T1 >::absEtaLowEdges_
private
template<typename T1 >
const bool HLTEcalPFClusterIsolationProducer< T1 >::doRhoCorrection_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::drMax_
private
template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::drVeto2_
private

Definition at line 49 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::drVetoBarrel_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::drVetoEndcap_
private
template<typename T1 >
const std::vector<double> HLTEcalPFClusterIsolationProducer< T1 >::effectiveAreas_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::energyBarrel_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::energyEndcap_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::etaStripBarrel_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::etaStripEndcap_
private
template<typename T1 >
const edm::EDGetTokenT<reco::PFClusterCollection> HLTEcalPFClusterIsolationProducer< T1 >::pfClusterProducer_
private
template<typename T1 >
edm::EDGetTokenT<T1Collection> HLTEcalPFClusterIsolationProducer< T1 >::recoCandidateProducer_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::rhoMax_
private
template<typename T1 >
const edm::EDGetTokenT<double> HLTEcalPFClusterIsolationProducer< T1 >::rhoProducer_
private
template<typename T1 >
const double HLTEcalPFClusterIsolationProducer< T1 >::rhoScale_
private