CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HLTEcalPFClusterIsolationProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~HLTEcalPFClusterIsolationProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (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)
 
template<>
bool computedRVeto (T1Ref candRef, reco::PFClusterRef pfclu)
 

Private Attributes

bool doRhoCorrection_
 
double drMax_
 
double drVeto2_
 
double drVetoBarrel_
 
double drVetoEndcap_
 
float effectiveAreaBarrel_
 
float effectiveAreaEndcap_
 
double energyBarrel_
 
double energyEndcap_
 
double etaStripBarrel_
 
double etaStripEndcap_
 
edm::EDGetTokenT
< reco::PFClusterCollection
pfClusterProducer_
 
edm::EDGetTokenT< T1CollectionrecoCandidateProducer_
 
float rhoMax_
 
edm::EDGetTokenT< double > rhoProducer_
 
float rhoScale_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 30 of file HLTEcalPFClusterIsolationProducer.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
31  std::string recoCandidateProducerName = "recoCandidateProducer";
32  if ((typeid(HLTEcalPFClusterIsolationProducer<T1>) == typeid(HLTEcalPFClusterIsolationProducer<reco::RecoEcalCandidate>))) recoCandidateProducerName = "recoEcalCandidateProducer";
33 
34  recoCandidateProducer_ = consumes<T1Collection>(config.getParameter<edm::InputTag>(recoCandidateProducerName));
35  pfClusterProducer_ = consumes<reco::PFClusterCollection>(config.getParameter<edm::InputTag>("pfClusterProducer"));
36 
37  drMax_ = config.getParameter<double>("drMax");
38  drVetoBarrel_ = config.getParameter<double>("drVetoBarrel");
39  drVetoEndcap_ = config.getParameter<double>("drVetoEndcap");
40  etaStripBarrel_ = config.getParameter<double>("etaStripBarrel");
41  etaStripEndcap_ = config.getParameter<double>("etaStripEndcap");
42  energyBarrel_ = config.getParameter<double>("energyBarrel");
43  energyEndcap_ = config.getParameter<double>("energyEndcap");
44 
45  doRhoCorrection_ = config.getParameter<bool>("doRhoCorrection");
46  if (doRhoCorrection_)
47  rhoProducer_ = consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"));
48 
49  rhoMax_ = config.getParameter<double>("rhoMax");
50  rhoScale_ = config.getParameter<double>("rhoScale");
51  effectiveAreaBarrel_ = config.getParameter<double>("effectiveAreaBarrel");
52  effectiveAreaEndcap_ = config.getParameter<double>("effectiveAreaEndcap");
53 
54  produces <T1IsolationMap>();
55 
56 }
T getParameter(std::string const &) const
edm::EDGetTokenT< T1Collection > recoCandidateProducer_
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducer_

Definition at line 59 of file HLTEcalPFClusterIsolationProducer.cc.

60 {}

Member Function Documentation

template<typename T1 >
bool HLTEcalPFClusterIsolationProducer< T1 >::computedRVeto ( T1Ref  candRef,
reco::PFClusterRef  pfclu 
)
private

Definition at line 107 of file HLTEcalPFClusterIsolationProducer.cc.

References reco::deltaR2().

107  {
108 
109  float dR2 = deltaR2(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
110  if(dR2 > (drMax_*drMax_) || dR2 < drVeto2_)
111  return false;
112  else
113  return true;
114 }
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
template<>
bool HLTEcalPFClusterIsolationProducer< reco::RecoEcalCandidate >::computedRVeto ( T1Ref  candRef,
reco::PFClusterRef  pfclu 
)
private

Definition at line 88 of file HLTEcalPFClusterIsolationProducer.cc.

References reco::deltaR2(), and edm::Ref< C, T, F >::isNonnull().

88  {
89 
90  float dR2 = deltaR2(candRef->eta(), candRef->phi(), pfclu->eta(), pfclu->phi());
91  if(dR2 > (drMax_*drMax_))
92  return false;
93 
94  if (candRef->superCluster().isNonnull()) {
95  // Exclude clusters that are part of the candidate
96  for (reco::CaloCluster_iterator it = candRef->superCluster()->clustersBegin(); it != candRef->superCluster()->clustersEnd(); ++it) {
97  if ((*it)->seed() == pfclu->seed()) {
98  return false;
99  }
100  }
101  }
102 
103  return true;
104 }
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
template<typename T1 >
void HLTEcalPFClusterIsolationProducer< T1 >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 63 of file HLTEcalPFClusterIsolationProducer.cc.

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

63  {
64 
65  std::string recoCandidateProducerName = "recoCandidateProducer";
66  if ((typeid(HLTEcalPFClusterIsolationProducer<T1>) == typeid(HLTEcalPFClusterIsolationProducer<reco::RecoEcalCandidate>))) recoCandidateProducerName = "recoEcalCandidateProducer";
67 
69  desc.add<edm::InputTag>(recoCandidateProducerName, edm::InputTag("hltL1SeededRecoEcalCandidatePF"));
70  desc.add<edm::InputTag>("pfClusterProducer", edm::InputTag("hltParticleFlowClusterECAL"));
71  desc.add<edm::InputTag>("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo"));
72  desc.add<bool>("doRhoCorrection", false);
73  desc.add<double>("rhoMax", 9.9999999E7);
74  desc.add<double>("rhoScale", 1.0);
75  desc.add<double>("effectiveAreaBarrel", 0.101);
76  desc.add<double>("effectiveAreaEndcap", 0.046);
77  desc.add<double>("drMax", 0.3);
78  desc.add<double>("drVetoBarrel", 0.0);
79  desc.add<double>("drVetoEndcap", 0.0);
80  desc.add<double>("etaStripBarrel", 0.0);
81  desc.add<double>("etaStripEndcap", 0.0);
82  desc.add<double>("energyBarrel", 0.0);
83  desc.add<double>("energyEndcap", 0.0);
84  descriptions.add(std::string("hlt")+std::string(typeid(HLTEcalPFClusterIsolationProducer<T1>).name()), desc);
85 }
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 
)
virtual

Implements edm::EDProducer.

Definition at line 117 of file HLTEcalPFClusterIsolationProducer.cc.

References edm::Event::getByToken(), i, edm::AssociationMap< Tag >::insert(), edm::Handle< T >::product(), edm::Event::put(), and rho.

117  {
118 
119  edm::Handle<double> rhoHandle;
120  double rho = 0.0;
121  if (doRhoCorrection_) {
122  iEvent.getByToken(rhoProducer_, rhoHandle);
123  rho = *(rhoHandle.product());
124  }
125 
126  if (rho > rhoMax_)
127  rho = rhoMax_;
128 
129  rho = rho*rhoScale_;
130 
131  edm::Handle<T1Collection> recoCandHandle;
133 
134  iEvent.getByToken(recoCandidateProducer_,recoCandHandle);
135  iEvent.getByToken(pfClusterProducer_, clusterHandle);
136 
137  T1IsolationMap recoCandMap;
138 
139  drVeto2_ = -1.;
140  float etaStrip = -1;
141 
142  for (unsigned int iReco = 0; iReco < recoCandHandle->size(); iReco++) {
143  T1Ref candRef(recoCandHandle, iReco);
144 
145  if (fabs(candRef->eta()) < 1.479) {
147  etaStrip = etaStripBarrel_;
148  } else {
150  etaStrip = etaStripEndcap_;
151  }
152 
153  float sum = 0;
154  for (size_t i=0; i<clusterHandle->size(); i++) {
155  reco::PFClusterRef pfclu(clusterHandle, i);
156 
157  if (fabs(candRef->eta()) < 1.479) {
158  if (fabs(pfclu->pt()) < energyBarrel_)
159  continue;
160  } else {
161  if (fabs(pfclu->energy()) < energyEndcap_)
162  continue;
163  }
164 
165  float dEta = fabs(candRef->eta() - pfclu->eta());
166  if(dEta < etaStrip) continue;
167  if (not computedRVeto(candRef, pfclu))
168  continue;
169 
170  sum += pfclu->pt();
171  }
172 
173  if (doRhoCorrection_) {
174  if (fabs(candRef->eta()) < 1.479)
175  sum = sum - rho*effectiveAreaBarrel_;
176  else
177  sum = sum - rho*effectiveAreaEndcap_;
178  }
179 
180  recoCandMap.insert(candRef, sum);
181  }
182 
183  std::auto_ptr<T1IsolationMap> mapForEvent(new T1IsolationMap(recoCandMap));
184  iEvent.put(mapForEvent);
185 }
edm::EDGetTokenT< T1Collection > recoCandidateProducer_
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
Definition: DDAxes.h:10
bool computedRVeto(T1Ref candRef, reco::PFClusterRef pfclu)
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterProducer_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T const * product() const
Definition: Handle.h:81
edm::AssociationMap< edm::OneToValue< std::vector< T1 >, float > > T1IsolationMap

Member Data Documentation

template<typename T1 >
bool HLTEcalPFClusterIsolationProducer< T1 >::doRhoCorrection_
private

Definition at line 60 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::drMax_
private

Definition at line 50 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::drVeto2_
private

Definition at line 49 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::drVetoBarrel_
private

Definition at line 51 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::drVetoEndcap_
private

Definition at line 52 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
float HLTEcalPFClusterIsolationProducer< T1 >::effectiveAreaBarrel_
private

Definition at line 58 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
float HLTEcalPFClusterIsolationProducer< T1 >::effectiveAreaEndcap_
private

Definition at line 59 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::energyBarrel_
private

Definition at line 55 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::energyEndcap_
private

Definition at line 56 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::etaStripBarrel_
private

Definition at line 53 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
double HLTEcalPFClusterIsolationProducer< T1 >::etaStripEndcap_
private

Definition at line 54 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
edm::EDGetTokenT<reco::PFClusterCollection> HLTEcalPFClusterIsolationProducer< T1 >::pfClusterProducer_
private

Definition at line 46 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
edm::EDGetTokenT<T1Collection> HLTEcalPFClusterIsolationProducer< T1 >::recoCandidateProducer_
private

Definition at line 45 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
float HLTEcalPFClusterIsolationProducer< T1 >::rhoMax_
private

Definition at line 62 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
edm::EDGetTokenT<double> HLTEcalPFClusterIsolationProducer< T1 >::rhoProducer_
private

Definition at line 47 of file HLTEcalPFClusterIsolationProducer.h.

template<typename T1 >
float HLTEcalPFClusterIsolationProducer< T1 >::rhoScale_
private

Definition at line 61 of file HLTEcalPFClusterIsolationProducer.h.