CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Private Member Functions | Private Attributes
EG9X105XObjectUpdateModifier Class Reference
Inheritance diagram for EG9X105XObjectUpdateModifier:
ModifyObjectValueBase

Classes

class  TokenHandlePair
 

Public Member Functions

 EG9X105XObjectUpdateModifier (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
void modifyObject (reco::GsfElectron &ele) const final
 
void modifyObject (reco::Photon &pho) const final
 
void modifyObject (pat::Electron &ele) const final
 
void modifyObject (pat::Photon &pho) const final
 
void setEvent (const edm::Event &) final
 
void setEventContent (const edm::EventSetup &) final
 
 ~EG9X105XObjectUpdateModifier () override
 
- Public Member Functions inherited from ModifyObjectValueBase
virtual void modifyObject (reco::Muon &) const
 
virtual void modifyObject (reco::BaseTau &) const
 
virtual void modifyObject (reco::Jet &) const
 
virtual void modifyObject (pat::Muon &) const
 
virtual void modifyObject (pat::Tau &) const
 
virtual void modifyObject (pat::Jet &) const
 
 ModifyObjectValueBase (const edm::ParameterSet &conf)
 
const std::string & name () const
 
virtual ~ModifyObjectValueBase ()
 

Static Private Member Functions

template<typename ObjType >
static edm::Ptr< ObjType > getPtrForValueMap (const ObjType &obj, const edm::Handle< edm::View< ObjType > > &objsVMIsKeyedTo)
 

Private Attributes

bool allowGsfTrkMatchForConvs_
 
TokenHandlePair< reco::BeamSpotbeamspot_
 
TokenHandlePair< reco::ConversionCollectionconversions_
 
TokenHandlePair< EcalRecHitCollectionecalRecHitsEB_
 
TokenHandlePair< EcalRecHitCollectionecalRecHitsEE_
 
TokenHandlePair< edm::View< reco::GsfElectron > > eleCollVMsAreKeyedTo_
 
TokenHandlePair< edm::ValueMap< float > > eleTrkIso04_
 
TokenHandlePair< edm::ValueMap< float > > eleTrkIso_
 
TokenHandlePair< edm::ValueMap< float > > phoChargedHadIso_
 
TokenHandlePair< edm::ValueMap< float > > phoChargedHadPFPVIso_
 
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxConeVetoIso_
 
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxIso_
 
TokenHandlePair< edm::View< reco::Photon > > phoCollVMsAreKeyedTo_
 
TokenHandlePair< edm::ValueMap< float > > phoNeutralHadIso_
 
TokenHandlePair< edm::ValueMap< float > > phoPhotonIso_
 
bool updateChargedHadPFPVIso_
 

Detailed Description

Definition at line 24 of file EG9X105XObjectUpdateModifier.cc.

Constructor & Destructor Documentation

EG9X105XObjectUpdateModifier::EG9X105XObjectUpdateModifier ( const edm::ParameterSet conf,
edm::ConsumesCollector cc 
)

Definition at line 89 of file EG9X105XObjectUpdateModifier.cc.

89  :
91  eleCollVMsAreKeyedTo_(conf,"eleCollVMsAreKeyedTo",cc),
92  phoCollVMsAreKeyedTo_(conf,"phoCollVMsAreKeyedTo",cc),
93  conversions_(conf,"conversions",cc),
94  beamspot_(conf,"beamspot",cc),
95  ecalRecHitsEB_(conf,"ecalRecHitsEB",cc),
96  ecalRecHitsEE_(conf,"ecalRecHitsEE",cc),
97  eleTrkIso_(conf,"eleTrkIso",cc),
98  eleTrkIso04_(conf,"eleTrkIso04",cc),
99  phoPhotonIso_(conf,"phoPhotonIso",cc),
100  phoNeutralHadIso_(conf,"phoNeutralHadIso",cc),
101  phoChargedHadIso_(conf,"phoChargedHadIso",cc),
102  phoChargedHadWorstVtxIso_(conf,"phoChargedHadWorstVtxIso",cc),
103  phoChargedHadWorstVtxConeVetoIso_(conf,"phoChargedHadWorstVtxConeVetoIso",cc),
104  phoChargedHadPFPVIso_(conf,"phoChargedHadPFPVIso",cc),
105  allowGsfTrkMatchForConvs_(conf.getParameter<bool>("allowGsfTrackForConvs")),
106  updateChargedHadPFPVIso_(conf.getParameter<bool>("updateChargedHadPFPVIso"))
107 {
108 
109 
110 }
T getParameter(std::string const &) const
TokenHandlePair< edm::ValueMap< float > > eleTrkIso04_
TokenHandlePair< edm::ValueMap< float > > phoPhotonIso_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxIso_
TokenHandlePair< edm::View< reco::Photon > > phoCollVMsAreKeyedTo_
TokenHandlePair< reco::BeamSpot > beamspot_
TokenHandlePair< EcalRecHitCollection > ecalRecHitsEE_
TokenHandlePair< EcalRecHitCollection > ecalRecHitsEB_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxConeVetoIso_
TokenHandlePair< edm::ValueMap< float > > eleTrkIso_
ModifyObjectValueBase(const edm::ParameterSet &conf)
TokenHandlePair< reco::ConversionCollection > conversions_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadPFPVIso_
TokenHandlePair< edm::View< reco::GsfElectron > > eleCollVMsAreKeyedTo_
TokenHandlePair< edm::ValueMap< float > > phoNeutralHadIso_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadIso_
EG9X105XObjectUpdateModifier::~EG9X105XObjectUpdateModifier ( )
inlineoverride

Definition at line 41 of file EG9X105XObjectUpdateModifier.cc.

References modifyObject(), setEvent(), and setEventContent().

41 {}

Member Function Documentation

template<typename ObjType >
edm::Ptr< ObjType > EG9X105XObjectUpdateModifier::getPtrForValueMap ( const ObjType &  obj,
const edm::Handle< edm::View< ObjType > > &  objsVMIsKeyedTo 
)
staticprivate

Definition at line 196 of file EG9X105XObjectUpdateModifier.cc.

References DEFINE_EDM_PLUGIN.

Referenced by modifyObject().

198 {
199  for(auto& objVMPtr : objsVMIsKeyedTo->ptrs()){
200  if(obj.superCluster()->seed()->seed()==objVMPtr->superCluster()->seed()->seed()) return objVMPtr;
201  }
202  return edm::Ptr<ObjType>(objsVMIsKeyedTo.id()); //return null ptr if not found
203 }
ProductID id() const
Definition: HandleBase.cc:15
void EG9X105XObjectUpdateModifier::modifyObject ( reco::GsfElectron ele) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 135 of file EG9X105XObjectUpdateModifier.cc.

References allowGsfTrkMatchForConvs_, beamspot_, reco::GsfElectron::conversionRejectionVariables(), conversions_, reco::GsfElectron::core(), reco::GsfElectron::dr03IsolationVariables(), reco::GsfElectron::dr04IsolationVariables(), MillePedeFileConverter_cfg::e, eleCollVMsAreKeyedTo_, eleTrkIso04_, eleTrkIso_, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), Exception, getPtrForValueMap(), ConversionTools::getVtxFitProb(), EG9X105XObjectUpdateModifier::TokenHandlePair< T >::handle(), edm::Ptr< T >::isNull(), ConversionTools::matchedConversion(), reco::BeamSpot::position(), reco::GsfElectron::setConversionRejectionVariables(), reco::GsfElectron::setDr03Isolation(), reco::GsfElectron::setDr04Isolation(), reco::GsfElectron::superCluster(), reco::GsfElectron::IsolationVariables::tkSumPtHEEP, and reco::GsfElectron::ConversionRejection::vtxFitProb.

Referenced by ~EG9X105XObjectUpdateModifier().

136 {
138  if(ptrForVM.isNull()){
139  throw cms::Exception("LogicError") <<" in EG9X105ObjectUpdateModifier, line "<<__LINE__<<" electron "<<ele.et()<<" "<<ele.eta()<<" "<<ele.superCluster()->seed()->seed().rawId()<<" failed to match to the electrons the key map was keyed to, check the map collection is correct";
140  }
144  }else{
145  //its rather important to use the core function here to get the org trk ref
147  }
148  ele.setConversionRejectionVariables(convRejVars);
149 
151  isolVars03.tkSumPtHEEP = (*eleTrkIso_.handle())[ptrForVM];
152  ele.setDr03Isolation(isolVars03);
154  isolVars04.tkSumPtHEEP = (*eleTrkIso04_.handle())[ptrForVM];
155  ele.setDr04Isolation(isolVars04);
156 }
void setDr04Isolation(const IsolationVariables &dr04)
Definition: GsfElectron.h:577
static reco::Conversion const * matchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
TokenHandlePair< edm::ValueMap< float > > eleTrkIso04_
double eta() const final
momentum pseudorapidity
TokenHandlePair< reco::BeamSpot > beamspot_
void setConversionRejectionVariables(const ConversionRejection &convRej)
Definition: GsfElectron.h:623
void setDr03Isolation(const IsolationVariables &dr03)
Definition: GsfElectron.h:576
const IsolationVariables & dr04IsolationVariables() const
Definition: GsfElectron.h:573
static edm::Ptr< ObjType > getPtrForValueMap(const ObjType &obj, const edm::Handle< edm::View< ObjType > > &objsVMIsKeyedTo)
TokenHandlePair< edm::ValueMap< float > > eleTrkIso_
static float getVtxFitProb(const reco::Conversion *conv)
double et() const final
transverse energy
bool isNull() const
Checks for null.
Definition: Ptr.h:164
TokenHandlePair< reco::ConversionCollection > conversions_
virtual GsfElectronCoreRef core() const
Definition: GsfElectron.cc:8
const IsolationVariables & dr03IsolationVariables() const
Definition: GsfElectron.h:561
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:185
const Point & position() const
position
Definition: BeamSpot.h:62
const ConversionRejection & conversionRejectionVariables() const
Definition: GsfElectron.h:622
TokenHandlePair< edm::View< reco::GsfElectron > > eleCollVMsAreKeyedTo_
void EG9X105XObjectUpdateModifier::modifyObject ( reco::Photon pho) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 158 of file EG9X105XObjectUpdateModifier.cc.

References Cluster2ndMoments::alpha, reco::Photon::PflowIsolationVariables::chargedHadronIso, reco::Photon::PflowIsolationVariables::chargedHadronPFPVIso, reco::Photon::PflowIsolationVariables::chargedHadronWorstVtxGeomVetoIso, reco::Photon::PflowIsolationVariables::chargedHadronWorstVtxIso, EcalClusterToolsT< noZS >::cluster2ndMoments(), EcalBarrel, ecalRecHitsEB_, ecalRecHitsEE_, reco::LeafCandidate::et(), reco::LeafCandidate::eta(), Exception, reco::Photon::full5x5_setShowerShapeVariables(), reco::Photon::full5x5_showerShapeVariables(), reco::Photon::getPflowIsolationVariables(), getPtrForValueMap(), EG9X105XObjectUpdateModifier::TokenHandlePair< T >::handle(), edm::Ptr< T >::isNull(), reco::Photon::PflowIsolationVariables::neutralHadronIso, phoChargedHadIso_, phoChargedHadPFPVIso_, phoChargedHadWorstVtxConeVetoIso_, phoChargedHadWorstVtxIso_, phoCollVMsAreKeyedTo_, phoNeutralHadIso_, phoPhotonIso_, reco::Photon::PflowIsolationVariables::photonIso, reco::Photon::setPflowIsolationVariables(), reco::Photon::setShowerShapeVariables(), reco::Photon::showerShapeVariables(), Cluster2ndMoments::sMaj, reco::Photon::ShowerShape::smAlpha, Cluster2ndMoments::sMin, reco::Photon::ShowerShape::smMajor, reco::Photon::ShowerShape::smMinor, reco::Photon::superCluster(), and updateChargedHadPFPVIso_.

159 {
161  if(ptrForVM.isNull()){
162  throw cms::Exception("LogicError") <<" in EG9X105ObjectUpdateModifier, line "<<__LINE__<<" photon "<<pho.et()<<" "<<pho.eta()<<" "<<pho.superCluster()->seed()->seed().rawId()<<" failed to match to the photons the key map was keyed to, check the map collection is correct";
163  }
164 
166  pfIso.photonIso = (*phoPhotonIso_.handle())[ptrForVM];
167  pfIso.neutralHadronIso = (*phoNeutralHadIso_.handle())[ptrForVM];
168  pfIso.chargedHadronIso = (*phoChargedHadIso_.handle())[ptrForVM];
172  pfIso.chargedHadronPFPVIso = (*phoChargedHadPFPVIso_.handle())[ptrForVM];
173  }
174  pho.setPflowIsolationVariables(pfIso);
175 
178 
179  const reco::CaloClusterPtr seedClus = pho.superCluster()->seed();
180  const bool isEB = seedClus->seed().subdetId()==EcalBarrel;
181  const auto& recHits = isEB ? *ecalRecHitsEB_.handle() : *ecalRecHitsEE_.handle();
182  Cluster2ndMoments clus2ndMomFrac = EcalClusterTools::cluster2ndMoments(*seedClus,recHits);
183  Cluster2ndMoments clus2ndMomFull = noZS::EcalClusterTools::cluster2ndMoments(*seedClus,recHits);
184  fracSS.smMajor = clus2ndMomFrac.sMaj;
185  fracSS.smMinor = clus2ndMomFrac.sMin;
186  fracSS.smAlpha = clus2ndMomFrac.alpha;
187  fullSS.smMajor = clus2ndMomFull.sMaj;
188  fullSS.smMinor = clus2ndMomFull.sMin;
189  fullSS.smAlpha = clus2ndMomFull.alpha;
190  pho.setShowerShapeVariables(fracSS);
192 
193 }
void setPflowIsolationVariables(const PflowIsolationVariables &pfisol)
Set Particle Flow Isolation variables.
Definition: Photon.h:509
TokenHandlePair< edm::ValueMap< float > > phoPhotonIso_
double eta() const final
momentum pseudorapidity
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxIso_
TokenHandlePair< edm::View< reco::Photon > > phoCollVMsAreKeyedTo_
TokenHandlePair< EcalRecHitCollection > ecalRecHitsEE_
TokenHandlePair< EcalRecHitCollection > ecalRecHitsEB_
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxConeVetoIso_
static edm::Ptr< ObjType > getPtrForValueMap(const ObjType &obj, const edm::Handle< edm::View< ObjType > > &objsVMIsKeyedTo)
double et() const final
transverse energy
bool isNull() const
Checks for null.
Definition: Ptr.h:164
void setShowerShapeVariables(const ShowerShape &a)
Definition: Photon.h:208
static Cluster2ndMoments cluster2ndMoments(const reco::BasicCluster &basicCluster, const EcalRecHitCollection &recHits, double phiCorrectionFactor=0.8, double w0=4.7, bool useLogWeights=true)
void full5x5_setShowerShapeVariables(const ShowerShape &a)
Definition: Photon.h:209
const ShowerShape & full5x5_showerShapeVariables() const
Definition: Photon.h:206
TokenHandlePair< edm::ValueMap< float > > phoChargedHadPFPVIso_
const PflowIsolationVariables & getPflowIsolationVariables() const
Get Particle Flow Isolation variables block.
Definition: Photon.h:506
const ShowerShape & showerShapeVariables() const
Definition: Photon.h:205
TokenHandlePair< edm::ValueMap< float > > phoNeutralHadIso_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadIso_
void EG9X105XObjectUpdateModifier::modifyObject ( pat::Electron ele) const
inlinefinalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 49 of file EG9X105XObjectUpdateModifier.cc.

References modifyObject().

Referenced by modifyObject().

49 {return modifyObject(static_cast<reco::GsfElectron&>(ele));}
void modifyObject(reco::GsfElectron &ele) const final
void EG9X105XObjectUpdateModifier::modifyObject ( pat::Photon pho) const
inlinefinalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 50 of file EG9X105XObjectUpdateModifier.cc.

References getPtrForValueMap(), modifyObject(), and hgcalPlots::obj.

Referenced by modifyObject().

50 {return modifyObject(static_cast<reco::Photon&>(pho));}
void modifyObject(reco::GsfElectron &ele) const final
void EG9X105XObjectUpdateModifier::setEvent ( const edm::Event iEvent)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 112 of file EG9X105XObjectUpdateModifier.cc.

References beamspot_, conversions_, ecalRecHitsEB_, ecalRecHitsEE_, eleCollVMsAreKeyedTo_, eleTrkIso04_, eleTrkIso_, phoChargedHadIso_, phoChargedHadPFPVIso_, phoChargedHadWorstVtxConeVetoIso_, phoChargedHadWorstVtxIso_, phoCollVMsAreKeyedTo_, phoNeutralHadIso_, phoPhotonIso_, EG9X105XObjectUpdateModifier::TokenHandlePair< T >::setHandle(), and updateChargedHadPFPVIso_.

Referenced by ~EG9X105XObjectUpdateModifier().

113 {
116  conversions_.setHandle(iEvent);
117  beamspot_.setHandle(iEvent);
118  ecalRecHitsEB_.setHandle(iEvent);
119  ecalRecHitsEE_.setHandle(iEvent);
120  eleTrkIso_.setHandle(iEvent);
121  eleTrkIso04_.setHandle(iEvent);
122  phoPhotonIso_.setHandle(iEvent);
128 }
TokenHandlePair< edm::ValueMap< float > > eleTrkIso04_
TokenHandlePair< edm::ValueMap< float > > phoPhotonIso_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxIso_
TokenHandlePair< edm::View< reco::Photon > > phoCollVMsAreKeyedTo_
TokenHandlePair< reco::BeamSpot > beamspot_
TokenHandlePair< EcalRecHitCollection > ecalRecHitsEE_
TokenHandlePair< EcalRecHitCollection > ecalRecHitsEB_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadWorstVtxConeVetoIso_
TokenHandlePair< edm::ValueMap< float > > eleTrkIso_
TokenHandlePair< reco::ConversionCollection > conversions_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadPFPVIso_
TokenHandlePair< edm::View< reco::GsfElectron > > eleCollVMsAreKeyedTo_
TokenHandlePair< edm::ValueMap< float > > phoNeutralHadIso_
TokenHandlePair< edm::ValueMap< float > > phoChargedHadIso_
void EG9X105XObjectUpdateModifier::setEventContent ( const edm::EventSetup iSetup)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 130 of file EG9X105XObjectUpdateModifier.cc.

Referenced by ~EG9X105XObjectUpdateModifier().

131 {
132 
133 }

Member Data Documentation

bool EG9X105XObjectUpdateModifier::allowGsfTrkMatchForConvs_
private

Definition at line 79 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject().

TokenHandlePair<reco::BeamSpot> EG9X105XObjectUpdateModifier::beamspot_
private

Definition at line 61 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<reco::ConversionCollection> EG9X105XObjectUpdateModifier::conversions_
private

Definition at line 60 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<EcalRecHitCollection> EG9X105XObjectUpdateModifier::ecalRecHitsEB_
private

Definition at line 62 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<EcalRecHitCollection> EG9X105XObjectUpdateModifier::ecalRecHitsEE_
private

Definition at line 63 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::View<reco::GsfElectron> > EG9X105XObjectUpdateModifier::eleCollVMsAreKeyedTo_
private

Definition at line 57 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::eleTrkIso04_
private

Definition at line 66 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::eleTrkIso_
private

Definition at line 65 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::phoChargedHadIso_
private

Definition at line 69 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::phoChargedHadPFPVIso_
private

Definition at line 72 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::phoChargedHadWorstVtxConeVetoIso_
private

Definition at line 71 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::phoChargedHadWorstVtxIso_
private

Definition at line 70 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::View<reco::Photon> > EG9X105XObjectUpdateModifier::phoCollVMsAreKeyedTo_
private

Definition at line 58 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::phoNeutralHadIso_
private

Definition at line 68 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

TokenHandlePair<edm::ValueMap<float> > EG9X105XObjectUpdateModifier::phoPhotonIso_
private

Definition at line 67 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().

bool EG9X105XObjectUpdateModifier::updateChargedHadPFPVIso_
private

Definition at line 85 of file EG9X105XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEvent().