CMS 3D CMS Logo

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

Classes

struct  partVars
 

Public Member Functions

 EGRegressionModifierDRN (const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
 
void modifyObject (reco::GsfElectron &) const final
 
void modifyObject (reco::Photon &) const final
 
void modifyObject (pat::Electron &) const final
 
void modifyObject (pat::Photon &) const final
 
void setEvent (const edm::Event &) final
 
void setEventContent (const edm::EventSetup &) final
 
- 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 Attributes

std::unique_ptr< partVars< reco::Photon > > gedPhotons_
 
std::unique_ptr< partVars< reco::GsfElectron > > gsfElectrons_
 
std::unique_ptr< partVars< pat::Electron > > patElectrons_
 
std::unique_ptr< partVars< pat::Photon > > patPhotons_
 

Detailed Description

Definition at line 41 of file EGRegressionModifierDRN.cc.

Constructor & Destructor Documentation

◆ EGRegressionModifierDRN()

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

Definition at line 102 of file EGRegressionModifierDRN.cc.

References gpuPixelDoublets::cc, edm::ParameterSet::exists(), gedPhotons_, edm::ParameterSet::getParameterSet(), gsfElectrons_, patElectrons_, and patPhotons_.

103  : ModifyObjectValueBase(conf) {
104  if (conf.exists("patPhotons")) {
105  patPhotons_ = std::make_unique<partVars<pat::Photon>>(conf.getParameterSet("patPhotons"), cc);
106  }
107 
108  if (conf.exists("gedPhotons")) {
109  gedPhotons_ = std::make_unique<partVars<reco::Photon>>(conf.getParameterSet("gedPhotons"), cc);
110  }
111 
112  if (conf.exists("patElectrons")) {
113  patElectrons_ = std::make_unique<partVars<pat::Electron>>(conf.getParameterSet("patElectrons"), cc);
114  }
115 
116  if (conf.exists("gsfElectrons")) {
117  gsfElectrons_ = std::make_unique<partVars<reco::GsfElectron>>(conf.getParameterSet("gsfElectrons"), cc);
118  }
119 }
std::unique_ptr< partVars< pat::Electron > > patElectrons_
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
bool exists(std::string const &parameterName) const
checks if a parameter exists
ParameterSet const & getParameterSet(std::string const &) const
ModifyObjectValueBase(const edm::ParameterSet &conf)
std::unique_ptr< partVars< reco::GsfElectron > > gsfElectrons_
std::unique_ptr< partVars< pat::Photon > > patPhotons_
std::unique_ptr< partVars< reco::Photon > > gedPhotons_

Member Function Documentation

◆ modifyObject() [1/4]

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

Reimplemented from ModifyObjectValueBase.

Definition at line 149 of file EGRegressionModifierDRN.cc.

References pfMETCorrectionType0_cfi::correction, Exception, gsfElectrons_, reco::GsfElectron::setCorrectedEcalEnergy(), and reco::GsfElectron::setCorrectedEcalEnergyError().

149  {
150  if (!gsfElectrons_)
151  return;
152 
153  const std::pair<float, float>& correction = gsfElectrons_->getCorrection(ele);
154 
155  if (correction.first > 0 && correction.second > 0) {
156  ele.setCorrectedEcalEnergy(correction.first, true);
158  }
159 
160  throw cms::Exception("EGRegressionModifierDRN")
161  << "Electron energy corrections not fully implemented yet:" << std::endl
162  << "Still need E/p combination" << std::endl
163  << "Do not enable DRN for electrons" << std::endl;
164 }
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:170
std::unique_ptr< partVars< reco::GsfElectron > > gsfElectrons_
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:174

◆ modifyObject() [2/4]

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

Reimplemented from ModifyObjectValueBase.

Definition at line 198 of file EGRegressionModifierDRN.cc.

References pfMETCorrectionType0_cfi::correction, gedPhotons_, and reco::Photon::setCorrectedEnergy().

198  {
199  if (!gedPhotons_)
200  return;
201 
202  const std::pair<float, float>& correction = gedPhotons_->getCorrection(pho);
203 
204  if (correction.first > 0 && correction.second > 0) {
205  pho.setCorrectedEnergy(reco::Photon::P4type::regression2, correction.first, correction.second, true);
206  }
207 };
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
std::unique_ptr< partVars< reco::Photon > > gedPhotons_

◆ modifyObject() [3/4]

void EGRegressionModifierDRN::modifyObject ( pat::Electron ele) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 166 of file EGRegressionModifierDRN.cc.

References pfMETCorrectionType0_cfi::correction, Exception, patElectrons_, reco::GsfElectron::setCorrectedEcalEnergy(), and reco::GsfElectron::setCorrectedEcalEnergyError().

166  {
167  if (!patElectrons_)
168  return;
169 
170  const std::pair<float, float>& correction = patElectrons_->getCorrection(ele);
171 
172  if (patElectrons_->userFloat) {
173  patElectrons_->doUserFloat(ele, correction);
174  } else if (correction.first > 0 && correction.second > 0) {
175  ele.setCorrectedEcalEnergy(correction.first, true);
177  }
178 
179  throw cms::Exception("EGRegressionModifierDRN")
180  << "Electron energy corrections not fully implemented yet:" << std::endl
181  << "Still need E/p combination" << std::endl
182  << "Do not enable DRN for electrons" << std::endl;
183 }
std::unique_ptr< partVars< pat::Electron > > patElectrons_
void setCorrectedEcalEnergyError(float newEnergyError)
Definition: GsfElectron.cc:170
void setCorrectedEcalEnergy(float newEnergy)
Definition: GsfElectron.cc:174

◆ modifyObject() [4/4]

void EGRegressionModifierDRN::modifyObject ( pat::Photon pho) const
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 185 of file EGRegressionModifierDRN.cc.

References pfMETCorrectionType0_cfi::correction, patPhotons_, and reco::Photon::setCorrectedEnergy().

185  {
186  if (!patPhotons_)
187  return;
188 
189  const std::pair<float, float>& correction = patPhotons_->getCorrection(pho);
190 
191  if (patPhotons_->userFloat) {
192  patPhotons_->doUserFloat(pho, correction);
193  } else if (correction.first > 0 && correction.second > 0) {
194  pho.setCorrectedEnergy(pat::Photon::P4type::regression2, correction.first, correction.second, true);
195  }
196 }
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
std::unique_ptr< partVars< pat::Photon > > patPhotons_

◆ setEvent()

void EGRegressionModifierDRN::setEvent ( const edm::Event evt)
finalvirtual

Reimplemented from ModifyObjectValueBase.

Definition at line 121 of file EGRegressionModifierDRN.cc.

References gedPhotons_, edm::Event::get(), gsfElectrons_, patElectrons_, and patPhotons_.

121  {
122  if (patElectrons_) {
123  patElectrons_->particles = &evt.get(patElectrons_->token);
124  patElectrons_->corrections = &evt.get(patElectrons_->correctionsToken);
125  patElectrons_->i = 0;
126  }
127 
128  if (patPhotons_) {
129  patPhotons_->particles = &evt.get(patPhotons_->token);
130  patPhotons_->corrections = &evt.get(patPhotons_->correctionsToken);
131  patPhotons_->i = 0;
132  }
133 
134  if (gsfElectrons_) {
135  gsfElectrons_->particles = &evt.get(gsfElectrons_->token);
136  gsfElectrons_->corrections = &evt.get(gsfElectrons_->correctionsToken);
137  gsfElectrons_->i = 0;
138  }
139 
140  if (gedPhotons_) {
141  gedPhotons_->particles = &evt.get(gedPhotons_->token);
142  gedPhotons_->corrections = &evt.get(gedPhotons_->correctionsToken);
143  gedPhotons_->i = 0;
144  }
145 }
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:344
std::unique_ptr< partVars< pat::Electron > > patElectrons_
std::unique_ptr< partVars< reco::GsfElectron > > gsfElectrons_
std::unique_ptr< partVars< pat::Photon > > patPhotons_
std::unique_ptr< partVars< reco::Photon > > gedPhotons_

◆ setEventContent()

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

Reimplemented from ModifyObjectValueBase.

Definition at line 147 of file EGRegressionModifierDRN.cc.

147 {}

Member Data Documentation

◆ gedPhotons_

std::unique_ptr<partVars<reco::Photon> > EGRegressionModifierDRN::gedPhotons_
private

Definition at line 98 of file EGRegressionModifierDRN.cc.

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

◆ gsfElectrons_

std::unique_ptr<partVars<reco::GsfElectron> > EGRegressionModifierDRN::gsfElectrons_
private

Definition at line 99 of file EGRegressionModifierDRN.cc.

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

◆ patElectrons_

std::unique_ptr<partVars<pat::Electron> > EGRegressionModifierDRN::patElectrons_
private

Definition at line 97 of file EGRegressionModifierDRN.cc.

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

◆ patPhotons_

std::unique_ptr<partVars<pat::Photon> > EGRegressionModifierDRN::patPhotons_
private

Definition at line 96 of file EGRegressionModifierDRN.cc.

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