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 Attributes
EgammaHLTPFNeutralIsolationProducer Class Reference

#include <EgammaHLTPFNeutralIsolationProducer.h>

Inheritance diagram for EgammaHLTPFNeutralIsolationProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 EgammaHLTPFNeutralIsolationProducer (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 
 ~EgammaHLTPFNeutralIsolationProducer ()
 
- 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 Attributes

bool doRhoCorrection_
 
double drMax_
 
double drVetoBarrel_
 
double drVetoEndcap_
 
float effectiveAreaBarrel_
 
float effectiveAreaEndcap_
 
edm::EDGetTokenT
< reco::ElectronCollection
electronProducer_
 
double energyBarrel_
 
double energyEndcap_
 
double etaStripBarrel_
 
double etaStripEndcap_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
pfCandidateProducer_
 
int pfToUse_
 
edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
recoEcalCandidateProducer_
 
float rhoMax_
 
edm::EDGetTokenT< double > rhoProducer_
 
float rhoScale_
 
bool useSCRefs_
 

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

Definition at line 32 of file EgammaHLTPFNeutralIsolationProducer.h.

Constructor & Destructor Documentation

EgammaHLTPFNeutralIsolationProducer::EgammaHLTPFNeutralIsolationProducer ( const edm::ParameterSet config)
explicit
Author
Matteo Sani (UCSD)

$Id:

Definition at line 26 of file EgammaHLTPFNeutralIsolationProducer.cc.

References doRhoCorrection_, drMax_, drVetoBarrel_, drVetoEndcap_, effectiveAreaBarrel_, effectiveAreaEndcap_, electronProducer_, energyBarrel_, energyEndcap_, etaStripBarrel_, etaStripEndcap_, edm::ParameterSet::getParameter(), pfCandidateProducer_, pfToUse_, recoEcalCandidateProducer_, rhoMax_, rhoProducer_, rhoScale_, and useSCRefs_.

26  {
27 
28  pfCandidateProducer_ = consumes<reco::PFCandidateCollection>(config.getParameter<edm::InputTag>("pfCandidatesProducer"));
29 
30  useSCRefs_ = config.getParameter<bool>("useSCRefs");
31 
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  pfToUse_ = config.getParameter<int>("pfCandidateType");
40 
41  doRhoCorrection_ = config.getParameter<bool>("doRhoCorrection");
42  if (doRhoCorrection_)
43  rhoProducer_ = consumes<double>(config.getParameter<edm::InputTag>("rhoProducer"));
44 
45  rhoMax_ = config.getParameter<double>("rhoMax");
46  rhoScale_ = config.getParameter<double>("rhoScale");
47  effectiveAreaBarrel_ = config.getParameter<double>("effectiveAreaBarrel");
48  effectiveAreaEndcap_ = config.getParameter<double>("effectiveAreaEndcap");
49 
50  if(useSCRefs_) {
51  produces < reco::RecoEcalCandidateIsolationMap >();
52  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
53  } else {
54  produces < reco::ElectronIsolationMap >();
55  electronProducer_ = consumes<reco::ElectronCollection>(config.getParameter<edm::InputTag>("electronProducer"));
56  }
57 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateProducer_
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
EgammaHLTPFNeutralIsolationProducer::~EgammaHLTPFNeutralIsolationProducer ( )
inline

Definition at line 35 of file EgammaHLTPFNeutralIsolationProducer.h.

35 {};

Member Function Documentation

void EgammaHLTPFNeutralIsolationProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 59 of file EgammaHLTPFNeutralIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), and edm::ParameterSetDescription::add().

59  {
61  desc.add<edm::InputTag>("electronProducer", edm::InputTag("hltEle27WP80PixelMatchElectronsL1SeededPF"));
62  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidatePF"));
63  desc.add<edm::InputTag>("pfCandidatesProducer", edm::InputTag("hltParticleFlowReg"));
64  desc.add<edm::InputTag>("rhoProducer", edm::InputTag("fixedGridRhoFastjetAllCalo"));
65  desc.add<bool>("doRhoCorrection", false);
66  desc.add<double>("rhoMax", 9.9999999E7);
67  desc.add<double>("rhoScale", 1.0);
68  desc.add<double>("effectiveAreaBarrel", 0.101);
69  desc.add<double>("effectiveAreaEndcap", 0.046);
70  desc.add<bool>("useSCRefs", false);
71  desc.add<double>("drMax", 0.3);
72  desc.add<double>("drVetoBarrel", 0.0);
73  desc.add<double>("drVetoEndcap", 0.0);
74  desc.add<double>("etaStripBarrel", 0.0);
75  desc.add<double>("etaStripEndcap", 0.0);
76  desc.add<double>("energyBarrel", 0.0);
77  desc.add<double>("energyEndcap", 0.0);
78  desc.add<int>("pfCandidateType", 5);
79  descriptions.add(("hltEgammaHLTPFNeutralIsolationProducer"), desc);
80 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTPFNeutralIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 82 of file EgammaHLTPFNeutralIsolationProducer.cc.

References deltaR(), doRhoCorrection_, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, drMax_, drVetoBarrel_, drVetoEndcap_, effectiveAreaBarrel_, effectiveAreaEndcap_, electronProducer_, reco::LeafCandidate::energy(), energyBarrel_, energyEndcap_, etaStripBarrel_, etaStripEndcap_, edm::Event::getByToken(), i, edm::AssociationMap< Tag >::insert(), reco::LeafCandidate::momentum(), reco::PFCandidate::particleId(), pfCandidateProducer_, pfToUse_, edm::Handle< T >::product(), reco::LeafCandidate::pt(), edm::Event::put(), recoEcalCandidateProducer_, rho, rhoMax_, rhoProducer_, rhoScale_, useSCRefs_, and reco::PFCandidate::vertex().

82  {
83 
84  edm::Handle<double> rhoHandle;
85  double rho = 0.0;
86  if (doRhoCorrection_) {
87  iEvent.getByToken(rhoProducer_, rhoHandle);
88  rho = *(rhoHandle.product());
89  }
90 
91  if (rho > rhoMax_)
92  rho = rhoMax_;
93 
94  rho = rho*rhoScale_;
95 
99 
100  iEvent.getByToken(pfCandidateProducer_, pfHandle);
101  const reco::PFCandidateCollection* forIsolation = pfHandle.product();
102 
104  reco::RecoEcalCandidateIsolationMap recoEcalCandMap;
105 
106  if(useSCRefs_) {
107 
108  iEvent.getByToken(recoEcalCandidateProducer_,recoecalcandHandle);
109 
110  float dRVeto = -1.;
111  float etaStrip = -1;
112 
113  for (unsigned int iReco = 0; iReco < recoecalcandHandle->size(); iReco++) {
114  reco::RecoEcalCandidateRef candRef(recoecalcandHandle, iReco);
115 
116  if (fabs(candRef->eta()) < 1.479) {
117  dRVeto = drVetoBarrel_;
118  etaStrip = etaStripBarrel_;
119  } else {
120  dRVeto = drVetoEndcap_;
121  etaStrip = etaStripEndcap_;
122  }
123 
124  float sum = 0;
125 
126  // Loop over the PFCandidates
127  for(unsigned i=0; i<forIsolation->size(); i++) {
128  const reco::PFCandidate& pfc = (*forIsolation)[i];
129 
130  //require that the PFCandidate is a neutral hadron
131  if (pfc.particleId() == pfToUse_) {
132 
133  if (fabs(candRef->eta()) < 1.479) {
134  if (fabs(pfc.pt()) < energyBarrel_)
135  continue;
136  } else {
137  if (fabs(pfc.energy()) < energyEndcap_)
138  continue;
139  }
140 
141  // Shift the RecoEcalCandidate direction vector according to the PF vertex
142  math::XYZPoint pfvtx = pfc.vertex();
143  math::XYZVector candDirectionWrtVtx(candRef->superCluster()->x() - pfvtx.x(),
144  candRef->superCluster()->y() - pfvtx.y(),
145  candRef->superCluster()->z() - pfvtx.z());
146 
147  float dEta = fabs(candDirectionWrtVtx.Eta() - pfc.momentum().Eta());
148  if(dEta < etaStrip) continue;
149 
150  float dR = deltaR(candDirectionWrtVtx.Eta(), candDirectionWrtVtx.Phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
151  if(dR > drMax_ || dR < dRVeto) continue;
152 
153  sum += pfc.pt();
154  }
155  }
156 
157  if (doRhoCorrection_) {
158  if (fabs(candRef->eta()) < 1.479)
159  sum = sum - rho*effectiveAreaBarrel_;
160  else
161  sum = sum - rho*effectiveAreaEndcap_;
162  }
163 
164  recoEcalCandMap.insert(candRef, sum);
165  }
166 
167  } else {
168 
169  iEvent.getByToken(electronProducer_,electronHandle);
170 
171  float dRVeto = -1.;
172  float etaStrip = -1;
173 
174  for(unsigned int iEl=0; iEl<electronHandle->size(); iEl++) {
175  reco::ElectronRef eleRef(electronHandle, iEl);
176 
177  if (fabs(eleRef->eta()) < 1.479) {
178  dRVeto = drVetoBarrel_;
179  etaStrip = etaStripBarrel_;
180  } else {
181  dRVeto = drVetoEndcap_;
182  etaStrip = etaStripEndcap_;
183  }
184 
185  float sum = 0;
186 
187  // Loop over the PFCandidates
188  for(unsigned i=0; i<forIsolation->size(); i++) {
189  const reco::PFCandidate& pfc = (*forIsolation)[i];
190 
191  //require that the PFCandidate is a neutral hadron
192  if (pfc.particleId() == pfToUse_) {
193 
194  if (fabs(eleRef->eta()) < 1.479) {
195  if (fabs(pfc.pt()) < energyBarrel_)
196  continue;
197  } else {
198  if (fabs(pfc.energy()) < energyEndcap_)
199  continue;
200  }
201 
202  float dEta = fabs(eleRef->eta() - pfc.momentum().Eta());
203  if(dEta < etaStrip) continue;
204 
205  float dR = deltaR(eleRef->eta(), eleRef->phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
206  if(dR > drMax_ || dR < dRVeto) continue;
207 
208  sum += pfc.pt();
209  }
210  }
211 
212  if (doRhoCorrection_) {
213  if (fabs(eleRef->superCluster()->eta()) < 1.479)
214  sum = sum - rho*effectiveAreaBarrel_;
215  else
216  sum = sum - rho*effectiveAreaEndcap_;
217  }
218 
219  eleMap.insert(eleRef, sum);
220  }
221 
222  }
223 
224  if(useSCRefs_){
225  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> mapForEvent(new reco::RecoEcalCandidateIsolationMap(recoEcalCandMap));
226  iEvent.put(mapForEvent);
227  }else{
228  std::auto_ptr<reco::ElectronIsolationMap> mapForEvent(new reco::ElectronIsolationMap(eleMap));
229  iEvent.put(mapForEvent);
230  }
231 }
int i
Definition: DBlmapReader.cc:9
virtual float pt() const
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
Definition: DDAxes.h:10
virtual Vector momentum() const
spatial momentum vector
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
virtual double energy() const
energy
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateProducer_
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
virtual const Point & vertex() const
vertex position (overwritten by PF...)
Definition: PFCandidate.cc:643
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
void insert(const key_type &k, const data_type &v)
insert an association
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
T const * product() const
Definition: Handle.h:81
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:38
virtual ParticleType particleId() const
Definition: PFCandidate.h:355

Member Data Documentation

bool EgammaHLTPFNeutralIsolationProducer::doRhoCorrection_
private
double EgammaHLTPFNeutralIsolationProducer::drMax_
private
double EgammaHLTPFNeutralIsolationProducer::drVetoBarrel_
private
double EgammaHLTPFNeutralIsolationProducer::drVetoEndcap_
private
float EgammaHLTPFNeutralIsolationProducer::effectiveAreaBarrel_
private
float EgammaHLTPFNeutralIsolationProducer::effectiveAreaEndcap_
private
edm::EDGetTokenT<reco::ElectronCollection> EgammaHLTPFNeutralIsolationProducer::electronProducer_
private
double EgammaHLTPFNeutralIsolationProducer::energyBarrel_
private
double EgammaHLTPFNeutralIsolationProducer::energyEndcap_
private
double EgammaHLTPFNeutralIsolationProducer::etaStripBarrel_
private
double EgammaHLTPFNeutralIsolationProducer::etaStripEndcap_
private
edm::EDGetTokenT<reco::PFCandidateCollection> EgammaHLTPFNeutralIsolationProducer::pfCandidateProducer_
private
int EgammaHLTPFNeutralIsolationProducer::pfToUse_
private
edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTPFNeutralIsolationProducer::recoEcalCandidateProducer_
private
float EgammaHLTPFNeutralIsolationProducer::rhoMax_
private
edm::EDGetTokenT<double> EgammaHLTPFNeutralIsolationProducer::rhoProducer_
private
float EgammaHLTPFNeutralIsolationProducer::rhoScale_
private
bool EgammaHLTPFNeutralIsolationProducer::useSCRefs_
private