CMS 3D CMS Logo

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

Public Member Functions

 EG8XObjectUpdateModifier (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
 
 ~EG8XObjectUpdateModifier () 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 ()
 

Private Member Functions

std::pair< int, bool > getSaturationInfo (const reco::SuperCluster &superClus) const
 

Private Attributes

CaloTopology const * caloTopo_ = nullptr
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordcaloTopoToken_
 
EcalRecHitCollection const * ecalRecHitsEB_ = nullptr
 
edm::EDGetTokenT< EcalRecHitCollectionecalRecHitsEBToken_
 
EcalRecHitCollection const * ecalRecHitsEE_ = nullptr
 
edm::EDGetTokenT< EcalRecHitCollectionecalRecHitsEEToken_
 

Detailed Description

Definition at line 20 of file EG8XObjectUpdateModifier.cc.

Constructor & Destructor Documentation

◆ EG8XObjectUpdateModifier()

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

Definition at line 46 of file EG8XObjectUpdateModifier.cc.

References edm::ConsumesCollector::esConsumes().

47  : ModifyObjectValueBase(conf),
49  ecalRecHitsEBToken_(cc.consumes(conf.getParameter<edm::InputTag>("ecalRecHitsEB"))),
50  ecalRecHitsEEToken_(cc.consumes(conf.getParameter<edm::InputTag>("ecalRecHitsEE"))) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEBToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ModifyObjectValueBase(const edm::ParameterSet &conf)
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEEToken_

◆ ~EG8XObjectUpdateModifier()

EG8XObjectUpdateModifier::~EG8XObjectUpdateModifier ( )
inlineoverride

Definition at line 23 of file EG8XObjectUpdateModifier.cc.

23 {}

Member Function Documentation

◆ getSaturationInfo()

std::pair< int, bool > EG8XObjectUpdateModifier::getSaturationInfo ( const reco::SuperCluster superClus) const
private

Definition at line 94 of file EG8XObjectUpdateModifier.cc.

References EcalBarrel, ecalRecHitsEB_, ecalRecHitsEE_, and reco::SuperCluster::seed().

Referenced by modifyObject().

94  {
95  bool isEB = superClus.seed()->seed().subdetId() == EcalBarrel;
96  const auto& ecalRecHits = isEB ? *ecalRecHitsEB_ : *ecalRecHitsEE_;
97 
98  int nrSatCrys = 0;
99  bool seedSaturated = false;
100  const auto& hitsAndFractions = superClus.seed()->hitsAndFractions();
101  for (const auto& hitFractionPair : hitsAndFractions) {
102  auto ecalRecHitIt = ecalRecHits.find(hitFractionPair.first);
103  if (ecalRecHitIt != ecalRecHits.end() && ecalRecHitIt->checkFlag(EcalRecHit::Flags::kSaturated)) {
104  nrSatCrys++;
105  if (hitFractionPair.first == superClus.seed()->seed())
106  seedSaturated = true;
107  }
108  }
109  return {nrSatCrys, seedSaturated};
110 }
EcalRecHitCollection const * ecalRecHitsEE_
EcalRecHitCollection const * ecalRecHitsEB_
const CaloClusterPtr & seed() const
seed BasicCluster
Definition: SuperCluster.h:77

◆ modifyObject() [1/4]

void EG8XObjectUpdateModifier::modifyObject ( reco::GsfElectron ele) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 61 of file EG8XObjectUpdateModifier.cc.

References caloTopo_, EcalClusterToolsT< noZS >::e2x5Bottom(), EcalClusterToolsT< noZS >::e2x5Left(), reco::GsfElectron::ShowerShape::e2x5Left, EcalClusterToolsT< noZS >::e2x5Right(), EcalClusterToolsT< noZS >::e2x5Top(), ecalRecHitsEB_, ecalRecHitsEE_, reco::GsfElectron::full5x5_setShowerShape(), reco::GsfElectron::full5x5_showerShape(), getSaturationInfo(), reco::GsfElectron::isEB(), reco::GsfElectron::SaturationInfo::isSeedSaturated, reco::GsfElectron::SaturationInfo::nSaturatedXtals, reco::GsfElectron::setSaturationInfo(), reco::GsfElectron::setShowerShape(), reco::GsfElectron::showerShape(), and reco::GsfElectron::superCluster().

61  {
62  const reco::CaloCluster& seedClus = *(ele.superCluster()->seed());
63  const EcalRecHitCollection* ecalRecHits = ele.isEB() ? ecalRecHitsEB_ : ecalRecHitsEE_;
64 
65  auto full5x5ShowerShapes = ele.full5x5_showerShape();
66  full5x5ShowerShapes.e2x5Left = noZS::EcalClusterTools::e2x5Left(seedClus, ecalRecHits, caloTopo_);
67  full5x5ShowerShapes.e2x5Right = noZS::EcalClusterTools::e2x5Right(seedClus, ecalRecHits, caloTopo_);
68  full5x5ShowerShapes.e2x5Top = noZS::EcalClusterTools::e2x5Top(seedClus, ecalRecHits, caloTopo_);
69  full5x5ShowerShapes.e2x5Bottom = noZS::EcalClusterTools::e2x5Bottom(seedClus, ecalRecHits, caloTopo_);
70  ele.full5x5_setShowerShape(full5x5ShowerShapes);
71 
72  auto showerShapes = ele.showerShape();
73  showerShapes.e2x5Left = EcalClusterTools::e2x5Left(seedClus, ecalRecHits, caloTopo_);
74  showerShapes.e2x5Right = EcalClusterTools::e2x5Right(seedClus, ecalRecHits, caloTopo_);
75  showerShapes.e2x5Top = EcalClusterTools::e2x5Top(seedClus, ecalRecHits, caloTopo_);
76  showerShapes.e2x5Bottom = EcalClusterTools::e2x5Bottom(seedClus, ecalRecHits, caloTopo_);
77  ele.setShowerShape(showerShapes);
78 
80  auto satInfo = getSaturationInfo(*ele.superCluster());
81  eleSatInfo.nSaturatedXtals = satInfo.first;
82  eleSatInfo.isSeedSaturated = satInfo.second;
83  ele.setSaturationInfo(eleSatInfo);
84 }
static float e2x5Bottom(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
void setSaturationInfo(const SaturationInfo &s)
Definition: GsfElectron.h:522
void setShowerShape(const ShowerShape &s)
Definition: GsfElectron.h:491
static float e2x5Top(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
bool isEB() const
Definition: GsfElectron.h:328
EcalRecHitCollection const * ecalRecHitsEE_
const ShowerShape & full5x5_showerShape() const
Definition: GsfElectron.h:488
static float e2x5Right(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
EcalRecHitCollection const * ecalRecHitsEB_
std::pair< int, bool > getSaturationInfo(const reco::SuperCluster &superClus) const
static float e2x5Left(const reco::BasicCluster &cluster, const EcalRecHitCollection *recHits, const CaloTopology *topology)
const ShowerShape & showerShape() const
Definition: GsfElectron.h:467
void full5x5_setShowerShape(const ShowerShape &s)
Definition: GsfElectron.h:492
SuperClusterRef superCluster() const override
reference to a SuperCluster
Definition: GsfElectron.h:155

◆ modifyObject() [2/4]

void EG8XObjectUpdateModifier::modifyObject ( reco::Photon pho) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 86 of file EG8XObjectUpdateModifier.cc.

References getSaturationInfo(), reco::Photon::SaturationInfo::isSeedSaturated, reco::Photon::SaturationInfo::nSaturatedXtals, reco::Photon::setSaturationInfo(), and reco::Photon::superCluster().

86  {
88  auto satInfo = getSaturationInfo(*pho.superCluster());
89  phoSatInfo.nSaturatedXtals = satInfo.first;
90  phoSatInfo.isSeedSaturated = satInfo.second;
91  pho.setSaturationInfo(phoSatInfo);
92 }
void setSaturationInfo(const SaturationInfo &s)
Definition: Photon.h:312
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
std::pair< int, bool > getSaturationInfo(const reco::SuperCluster &superClus) const

◆ modifyObject() [3/4]

void EG8XObjectUpdateModifier::modifyObject ( pat::Electron ele) const
inlinefinalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 31 of file EG8XObjectUpdateModifier.cc.

References modifyObject().

Referenced by modifyObject().

31 { return modifyObject(static_cast<reco::GsfElectron&>(ele)); }
void modifyObject(reco::GsfElectron &ele) const final

◆ modifyObject() [4/4]

void EG8XObjectUpdateModifier::modifyObject ( pat::Photon pho) const
inlinefinalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 32 of file EG8XObjectUpdateModifier.cc.

References modifyObject().

Referenced by modifyObject().

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

◆ setEvent()

void EG8XObjectUpdateModifier::setEvent ( const edm::Event iEvent)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 52 of file EG8XObjectUpdateModifier.cc.

References ecalRecHitsEB_, ecalRecHitsEBToken_, ecalRecHitsEE_, ecalRecHitsEEToken_, and iEvent.

52  {
55 }
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEBToken_
EcalRecHitCollection const * ecalRecHitsEE_
int iEvent
Definition: GenABIO.cc:224
EcalRecHitCollection const * ecalRecHitsEB_
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitsEEToken_

◆ setEventContent()

void EG8XObjectUpdateModifier::setEventContent ( const edm::EventSetup iSetup)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 57 of file EG8XObjectUpdateModifier.cc.

References caloTopo_, caloTopoToken_, and edm::EventSetup::getData().

57  {
58  caloTopo_ = &iSetup.getData(caloTopoToken_);
59 }
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopoToken_

Member Data Documentation

◆ caloTopo_

CaloTopology const* EG8XObjectUpdateModifier::caloTopo_ = nullptr
private

Definition at line 37 of file EG8XObjectUpdateModifier.cc.

Referenced by modifyObject(), and setEventContent().

◆ caloTopoToken_

edm::ESGetToken<CaloTopology, CaloTopologyRecord> EG8XObjectUpdateModifier::caloTopoToken_
private

Definition at line 41 of file EG8XObjectUpdateModifier.cc.

Referenced by setEventContent().

◆ ecalRecHitsEB_

EcalRecHitCollection const* EG8XObjectUpdateModifier::ecalRecHitsEB_ = nullptr
private

Definition at line 38 of file EG8XObjectUpdateModifier.cc.

Referenced by getSaturationInfo(), modifyObject(), and setEvent().

◆ ecalRecHitsEBToken_

edm::EDGetTokenT<EcalRecHitCollection> EG8XObjectUpdateModifier::ecalRecHitsEBToken_
private

Definition at line 42 of file EG8XObjectUpdateModifier.cc.

Referenced by setEvent().

◆ ecalRecHitsEE_

EcalRecHitCollection const* EG8XObjectUpdateModifier::ecalRecHitsEE_ = nullptr
private

Definition at line 39 of file EG8XObjectUpdateModifier.cc.

Referenced by getSaturationInfo(), modifyObject(), and setEvent().

◆ ecalRecHitsEEToken_

edm::EDGetTokenT<EcalRecHitCollection> EG8XObjectUpdateModifier::ecalRecHitsEEToken_
private

Definition at line 43 of file EG8XObjectUpdateModifier.cc.

Referenced by setEvent().