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
 
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

edm::EDGetTokenT< reco::BeamSpotbeamSpotProducer_
 
double drMax_
 
double drVetoBarrel_
 
double drVetoEndcap_
 
double dxyMax_
 
double dzMax_
 
edm::EDGetTokenT
< reco::ElectronCollection
electronProducer_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
pfCandidateProducer_
 
int pfToUse_
 
double ptMin_
 
edm::EDGetTokenT
< reco::RecoEcalCandidateCollection
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 31 of file EgammaHLTPFChargedIsolationProducer.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file EgammaHLTPFChargedIsolationProducer.cc.

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

24  {
25 
26  pfCandidateProducer_ = consumes<reco::PFCandidateCollection>(config.getParameter<edm::InputTag>("pfCandidatesProducer"));
27  beamSpotProducer_ = consumes<reco::BeamSpot>(config.getParameter<edm::InputTag>("beamSpotProducer"));
28 
29  useGsfTrack_ = config.getParameter<bool>("useGsfTrack");
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  ptMin_ = config.getParameter<double>("ptMin");
36  dzMax_ = config.getParameter<double>("dzMax");
37  dxyMax_ = config.getParameter<double>("dxyMax");
38  pfToUse_ = config.getParameter<int>("pfCandidateType");
39 
40  if(useSCRefs_) {
41  recoEcalCandidateProducer_ = consumes<reco::RecoEcalCandidateCollection>(config.getParameter<edm::InputTag>("recoEcalCandidateProducer"));
42  produces < reco::RecoEcalCandidateIsolationMap >();
43  } else {
44  electronProducer_ = consumes<reco::ElectronCollection>(config.getParameter<edm::InputTag>("electronProducer"));
45  produces < reco::ElectronIsolationMap >();
46  }
47 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BeamSpot > beamSpotProducer_
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateProducer_
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
EgammaHLTPFChargedIsolationProducer::~EgammaHLTPFChargedIsolationProducer ( )
inline

Definition at line 34 of file EgammaHLTPFChargedIsolationProducer.h.

34 {};

Member Function Documentation

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

Definition at line 49 of file EgammaHLTPFChargedIsolationProducer.cc.

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

49  {
51  desc.add<edm::InputTag>("electronProducer", edm::InputTag("hltEle27WP80PixelMatchElectronsL1SeededPF"));
52  desc.add<edm::InputTag>("recoEcalCandidateProducer", edm::InputTag("hltL1SeededRecoEcalCandidatePF"));
53  desc.add<edm::InputTag>("pfCandidatesProducer", edm::InputTag("hltParticleFlowReg"));
54  desc.add<edm::InputTag>("beamSpotProducer", edm::InputTag("hltOnlineBeamSpot"));
55  desc.add<bool>("useGsfTrack", false);
56  desc.add<bool>("useSCRefs", false);
57  desc.add<double>("drMax", 0.3);
58  desc.add<double>("drVetoBarrel", 0.02);
59  desc.add<double>("drVetoEndcap", 0.02);
60  desc.add<double>("ptMin", 0.0);
61  desc.add<double>("dzMax", 0.2);
62  desc.add<double>("dxyMax", 0.1);
63  desc.add<int>("pfCandidateType", 1);
64  descriptions.add(("hltEgammaHLTPFChargedIsolationProducer"), desc);
65 }
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 67 of file EgammaHLTPFChargedIsolationProducer.cc.

References beamSpotProducer_, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, drMax_, drVetoBarrel_, drVetoEndcap_, dxyMax_, dzMax_, electronProducer_, edm::Event::getByToken(), 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_.

67  {
68 
72  edm::Handle<reco::BeamSpot> recoBeamSpotHandle;
73 
74  iEvent.getByToken(pfCandidateProducer_, pfHandle);
75  const reco::PFCandidateCollection* forIsolation = pfHandle.product();
76 
79 
80  if(useSCRefs_) {
81 
82  iEvent.getByToken(recoEcalCandidateProducer_, recoEcalCandHandle);
83  iEvent.getByToken(beamSpotProducer_, recoBeamSpotHandle);
84  const reco::BeamSpot::Point& beamSpotPosition = recoBeamSpotHandle->position();
85 
86  float dRveto = -1;
87 
88  for(unsigned int iReco=0; iReco<recoEcalCandHandle->size(); iReco++) {
89  reco::RecoEcalCandidateRef candRef(recoEcalCandHandle, iReco);
90 
91  if (fabs(candRef->eta())<1.479)
92  dRveto = drVetoBarrel_;
93  else
94  dRveto = drVetoEndcap_;
95 
96  // Shift the RecoEcalCandidate direction vector according to the vertex
97  math::XYZVector candDirectionWrtVtx(candRef->superCluster()->x() - beamSpotPosition.x(),
98  candRef->superCluster()->y() - beamSpotPosition.y(),
99  candRef->superCluster()->z() - beamSpotPosition.z());
100 
101  float sum = 0;
102 
103  // Loop over the PFCandidates
104  for(unsigned i=0; i<forIsolation->size(); i++) {
105  const reco::PFCandidate& pfc = (*forIsolation)[i];
106 
107  //require that the PFCandidate is a charged hadron
108  if (pfc.particleId() == pfToUse_) {
109 
110  if(pfc.pt() < ptMin_) continue;
111 
112  float dz = fabs(pfc.trackRef()->dz(beamSpotPosition));
113  if(dz > dzMax_) continue;
114 
115  float dxy = fabs(pfc.trackRef()->dxy(beamSpotPosition));
116  if(fabs(dxy) > dxyMax_) continue;
117 
118  float dR = deltaR(candDirectionWrtVtx.Eta(), candDirectionWrtVtx.Phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
119  if(dR > drMax_ || dR < dRveto) continue;
120 
121  sum += pfc.pt();
122  }
123  }
124 
125  recoEcalCandMap.insert(candRef, sum);
126  }
127 
128  } else {
129 
130  iEvent.getByToken(electronProducer_,electronHandle);
131 
132  float dRveto = -1;
133 
134  for(unsigned int iEl=0; iEl<electronHandle->size(); iEl++) {
135  reco::ElectronRef eleRef(electronHandle, iEl);
136  //const reco::Track* eleTrk = useGsfTrack_ ? &*eleRef->gsfTrack() : &*eleRef->track();
137 
138  if (fabs(eleRef->eta())<1.479)
139  dRveto = drVetoBarrel_;
140  else
141  dRveto = drVetoEndcap_;
142 
143  float sum = 0;
144 
145  // Loop over the PFCandidates
146  for(unsigned i=0; i<forIsolation->size(); i++) {
147  const reco::PFCandidate& pfc = (*forIsolation)[i];
148 
149  //require that the PFCandidate is a charged hadron
150  if (pfc.particleId() == pfToUse_) {
151 
152  if(pfc.pt() < ptMin_) continue;
153 
154  float dz = fabs(pfc.trackRef()->dz(eleRef->vertex()));
155  if(dz > dzMax_) continue;
156 
157  float dxy = fabs(pfc.trackRef()->dxy(eleRef->vertex()));
158  if(fabs(dxy) > dxyMax_) continue;
159 
160  float dR = deltaR(eleRef->eta(), eleRef->phi(), pfc.momentum().Eta(), pfc.momentum().Phi());
161  if(dR > drMax_ || dR < dRveto) continue;
162 
163  sum += pfc.pt();
164  }
165  }
166 
167  eleMap.insert(eleRef, sum);
168  }
169 
170  }
171 
172  if(useSCRefs_){
173  std::auto_ptr<reco::RecoEcalCandidateIsolationMap> mapForEvent(new reco::RecoEcalCandidateIsolationMap(recoEcalCandMap));
174  iEvent.put(mapForEvent);
175  }else{
176  std::auto_ptr<reco::ElectronIsolationMap> mapForEvent(new reco::ElectronIsolationMap(eleMap));
177  iEvent.put(mapForEvent);
178  }
179 }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:29
edm::EDGetTokenT< reco::BeamSpot > beamSpotProducer_
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:429
edm::EDGetTokenT< reco::RecoEcalCandidateCollection > recoEcalCandidateProducer_
edm::EDGetTokenT< reco::PFCandidateCollection > pfCandidateProducer_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
edm::EDGetTokenT< reco::ElectronCollection > electronProducer_
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::EDGetTokenT<reco::BeamSpot> EgammaHLTPFChargedIsolationProducer::beamSpotProducer_
private
double EgammaHLTPFChargedIsolationProducer::drMax_
private
double EgammaHLTPFChargedIsolationProducer::drVetoBarrel_
private
double EgammaHLTPFChargedIsolationProducer::drVetoEndcap_
private
double EgammaHLTPFChargedIsolationProducer::dxyMax_
private
double EgammaHLTPFChargedIsolationProducer::dzMax_
private
edm::EDGetTokenT<reco::ElectronCollection> EgammaHLTPFChargedIsolationProducer::electronProducer_
private
edm::EDGetTokenT<reco::PFCandidateCollection> EgammaHLTPFChargedIsolationProducer::pfCandidateProducer_
private
int EgammaHLTPFChargedIsolationProducer::pfToUse_
private
double EgammaHLTPFChargedIsolationProducer::ptMin_
private
edm::EDGetTokenT<reco::RecoEcalCandidateCollection> EgammaHLTPFChargedIsolationProducer::recoEcalCandidateProducer_
private
bool EgammaHLTPFChargedIsolationProducer::useGsfTrack_
private
bool EgammaHLTPFChargedIsolationProducer::useSCRefs_
private