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
EgammaHLTPFChargedIsolationProducer Class Reference

#include <EgammaHLTPFChargedIsolationProducer.h>

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

Public Member Functions

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

edm::InputTag beamSpotProducer_
 
double drMax_
 
double drVetoBarrel_
 
double drVetoEndcap_
 
double dxyMax_
 
double dzMax_
 
edm::InputTag electronProducer_
 
edm::InputTag pfCandidateProducer_
 
int pfToUse_
 
double ptMin_
 
edm::InputTag recoEcalCandidateProducer_
 
bool useGsfTrack_
 
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 22 of file EgammaHLTPFChargedIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 35 of file EgammaHLTPFChargedIsolationProducer.cc.

References beamSpotProducer_, drMax_, drVetoBarrel_, drVetoEndcap_, dxyMax_, dzMax_, electronProducer_, edm::ParameterSet::getParameter(), pfCandidateProducer_, pfToUse_, ptMin_, recoEcalCandidateProducer_, useGsfTrack_, and useSCRefs_.

35  {
36 
37  electronProducer_ = config.getParameter<edm::InputTag>("electronProducer");
38  pfCandidateProducer_ = config.getParameter<edm::InputTag>("pfCandidatesProducer");
39  recoEcalCandidateProducer_ = config.getParameter<edm::InputTag>("recoEcalCandidateProducer");
40  beamSpotProducer_ = config.getParameter<edm::InputTag>("beamSpotProducer");
41 
42  useGsfTrack_ = config.getParameter<bool>("useGsfTrack");
43  useSCRefs_ = config.getParameter<bool>("useSCRefs");
44 
45  drMax_ = config.getParameter<double>("drMax");
46  drVetoBarrel_ = config.getParameter<double>("drVetoBarrel");
47  drVetoEndcap_ = config.getParameter<double>("drVetoEndcap");
48  ptMin_ = config.getParameter<double>("ptMin");
49  dzMax_ = config.getParameter<double>("dzMax");
50  dxyMax_ = config.getParameter<double>("dxyMax");
51  pfToUse_ = config.getParameter<int>("pfCandidateType");
52 
53  //register your products
54  if(useSCRefs_)
55  produces < reco::RecoEcalCandidateIsolationMap >();
56  else
57  produces < reco::ElectronIsolationMap >();
58 }
T getParameter(std::string const &) const
EgammaHLTPFChargedIsolationProducer::~EgammaHLTPFChargedIsolationProducer ( )

Definition at line 61 of file EgammaHLTPFChargedIsolationProducer.cc.

62 {}

Member Function Documentation

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

Definition at line 64 of file EgammaHLTPFChargedIsolationProducer.cc.

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

64  {
66  desc.add<edm::InputTag>("pfCandidatesProducer", edm::InputTag("hltParticleFlowReg"));
67  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidatePF"));
68  desc.add<edm::InputTag>("electronProducer", edm::InputTag("hltEle27WP80PixelMatchElectronsL1SeededPF"));
69  desc.add<edm::InputTag>("beamSpotProducer", edm::InputTag("hltOnlineBeamSpot"));
70  desc.add<bool>("useGsfTrack", false);
71  desc.add<bool>("useSCRefs", false);
72  desc.add<double>("drMax", 0.3);
73  desc.add<double>("drVetoBarrel", 0.02);
74  desc.add<double>("drVetoEndcap", 0.02);
75  desc.add<double>("ptMin", 0.0);
76  desc.add<double>("dzMax", 0.2);
77  desc.add<double>("dxyMax", 0.1);
78  desc.add<int>("pfCandidateType", 1);
79  descriptions.add(("hltEgammaHLTPFChargedIsolationProducer"), desc);
80 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EgammaHLTPFChargedIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDProducer.

Definition at line 82 of file EgammaHLTPFChargedIsolationProducer.cc.

References beamSpotProducer_, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, drMax_, drVetoBarrel_, drVetoEndcap_, dxyMax_, dzMax_, electronProducer_, edm::Event::getByLabel(), i, edm::AssociationMap< Tag >::insert(), reco::LeafCandidate::momentum(), reco::PFCandidate::particleId(), pfCandidateProducer_, pfToUse_, edm::Handle< T >::product(), reco::LeafCandidate::pt(), ptMin_, edm::Event::put(), recoEcalCandidateProducer_, reco::PFCandidate::trackRef(), and useSCRefs_.

82  {
83 
85  iEvent.getByLabel(electronProducer_,electronHandle);
86 
87  // Get the general tracks
89  iEvent.getByLabel(pfCandidateProducer_, pfHandle);
90 
93 
94  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
95 
96  if(useSCRefs_) {
98  iEvent.getByLabel(recoEcalCandidateProducer_, recoEcalCandHandle);
99 
100  iEvent.getByLabel(beamSpotProducer_, recoBeamSpotHandle);
101  const reco::BeamSpot::Point& beamSpotPosition = recoBeamSpotHandle->position();
102 
103  for(unsigned int iReco=0; iReco<recoEcalCandHandle->size(); iReco++) {
104 
105  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle, iReco);
106 
107  float dRveto = -1;
108  if (fabs(candRef->eta())<1.479)
109  dRveto = drVetoBarrel_;
110  else
111  dRveto = drVetoEndcap_;
112 
113  const reco::PFCandidateCollection* forIsolation = pfHandle.product();
114 
115  // Shift the photon according to the vertex
116  math::XYZVector photon_directionWrtVtx(candRef->superCluster()->x() - beamSpotPosition.x(),
117  candRef->superCluster()->y() - beamSpotPosition.y(),
118  candRef->superCluster()->z() - beamSpotPosition.z());
119 
120  float sum = 0;
121  // Loop over the PFCandidates
122  for(unsigned i=0; i<forIsolation->size(); i++) {
123 
124  const reco::PFCandidate& pfc = (*forIsolation)[i];
125 
126  //require that PFCandidate is a charged hadron
127  if (pfc.particleId() == pfToUse_) {
128  if (pfc.pt() < ptMin_)
129  continue;
130 
131  float dz = fabs(pfc.trackRef()->dz(beamSpotPosition));
132  if (dz > dzMax_) continue;
133 
134  float dxy = fabs(pfc.trackRef()->dxy(beamSpotPosition));
135  if(fabs(dxy) > dxyMax_) continue;
136 
137  float dR = deltaR(photon_directionWrtVtx.Eta(), photon_directionWrtVtx.Phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
138  if(dR > drMax_ || dR < dRveto) continue;
139 
140  sum += pfc.pt();
141  }
142  }
143 
144  recoEcalCandMap.insert(candRef, sum);
145  }
146  } else {
147  for(unsigned int iEl=0; iEl<electronHandle->size(); iEl++) {
148  reco::ElectronRef eleRef(electronHandle, iEl);
149 
150  //const reco::Track* eleTrk = useGsfTrack_ ? &*eleRef->gsfTrack() : &*eleRef->track();
151  float dRveto = -1;
152  if (fabs(eleRef->eta())<1.479)
153  dRveto = drVetoBarrel_;
154  else
155  dRveto = drVetoEndcap_;
156 
157  const reco::PFCandidateCollection* forIsolation = pfHandle.product();
158 
159  float sum = 0;
160  // Loop over the PFCandidates
161  for(unsigned i=0; i<forIsolation->size(); i++) {
162 
163  const reco::PFCandidate& pfc = (*forIsolation)[i];
164 
165  // FIXME Rimuovi la traccia dell'elettrone esplicitamente
166  //require that PFCandidate is a charged hadron
167  if (pfc.particleId() == pfToUse_) {
168  if (pfc.pt() < ptMin_)
169  continue;
170 
171  float dz = fabs(pfc.trackRef()->dz(eleRef->vertex()));
172  if (dz > dzMax_) continue;
173 
174  float dxy = fabs(pfc.trackRef()->dxy(eleRef->vertex()));
175  if(fabs(dxy) > dxyMax_) continue;
176 
177  float dR = deltaR(eleRef->eta(), eleRef->phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
178  if(dR > drMax_ || dR < dRveto) continue;
179 
180  sum += pfc.pt();
181  }
182  }
183 
184  eleMap.insert(eleRef, sum);
185  }
186  }
187 
188  if(useSCRefs_){
189  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> mapForEvent(new reco::RecoEcalCandidateIsolationMap(recoEcalCandMap));
190  iEvent.put(mapForEvent);
191  }else{
192  std::auto_ptr<reco::ElectronIsolationMap> mapForEvent(new reco::ElectronIsolationMap(eleMap));
193  iEvent.put(mapForEvent);
194  }
195 }
int i
Definition: DBlmapReader.cc:9
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:429
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
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
virtual Vector momentum() const GCC11_FINAL
spatial momentum vector
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
virtual float pt() const GCC11_FINAL
transverse momentum

Member Data Documentation

edm::InputTag EgammaHLTPFChargedIsolationProducer::beamSpotProducer_
private
double EgammaHLTPFChargedIsolationProducer::drMax_
private
double EgammaHLTPFChargedIsolationProducer::drVetoBarrel_
private
double EgammaHLTPFChargedIsolationProducer::drVetoEndcap_
private
double EgammaHLTPFChargedIsolationProducer::dxyMax_
private
double EgammaHLTPFChargedIsolationProducer::dzMax_
private
edm::InputTag EgammaHLTPFChargedIsolationProducer::electronProducer_
private
edm::InputTag EgammaHLTPFChargedIsolationProducer::pfCandidateProducer_
private
int EgammaHLTPFChargedIsolationProducer::pfToUse_
private
double EgammaHLTPFChargedIsolationProducer::ptMin_
private
edm::InputTag EgammaHLTPFChargedIsolationProducer::recoEcalCandidateProducer_
private
bool EgammaHLTPFChargedIsolationProducer::useGsfTrack_
private
bool EgammaHLTPFChargedIsolationProducer::useSCRefs_
private