20 #include <vdt/vdtMath.h> 72 "EGRegressionModifierV3");
75 edm::ConsumesCollector& cc) :
78 rhoToken_(cc.consumes<
double>(conf.getParameter<
edm::InputTag>("
rhoTag"))),
83 if(conf.exists(
"eleRegs")) {
84 eleRegs_ = std::make_unique<EleRegs>(conf.getParameter<
edm::ParameterSet>(
"eleRegs"));
86 if(conf.exists(
"phoRegs")) {
87 phoRegs_ = std::make_unique<PhoRegs>(conf.getParameter<
edm::ParameterSet>(
"phoRegs"));
119 bool rescaleDependentValues = superClus->clusters().
isAvailable();
126 const float rawEnergy = superClus->rawEnergy();
127 const float rawESEnergy = superClus->preshowerEnergy();
129 const float rawEt = rawEnergy*superClus->position().rho()/superClus->position().r();
133 const float ecalMeanCorr = ecalMean > 0. ? ecalMean : 1.0;
139 eleRegs_->ecalOnlySigma.useLowEtBin(rawEt,isSaturated)){
143 eleRegs_->ecalOnlySigma.useLowEtBin(rawEt,isSaturated)){
148 const float corrEnergy = (rawEnergy + rawESEnergy)*ecalMeanCorr;
149 const float corrEnergyErr = corrEnergy*ecalSigma;
154 std::pair<float,float> combEnergyAndErr =
eleRegs_->epComb.combine(ele);
180 const float rawEnergy = superClus->rawEnergy();
181 const float rawESEnergy = superClus->preshowerEnergy();
183 const float rawEt = rawEnergy*superClus->position().rho()/superClus->position().r();
186 const float ecalMeanCorr = ecalMean > 0. ? ecalMean : 1.0;
190 phoRegs_->ecalOnlySigma.useLowEtBin(rawEt,isSaturated)){
194 phoRegs_->ecalOnlySigma.useLowEtBin(rawEt,isSaturated)){
199 const double corrEnergy = (rawEnergy + rawESEnergy)*ecalMeanCorr;
200 const double corrEnergyErr = corrEnergy*ecalSigma;
202 pho.
setCorrectedEnergy(reco::Photon::P4type::regression2, corrEnergy, corrEnergyErr,
true);
211 std::array<float, 32>
data;
216 const bool isEB = ele.
isEB();
217 const double rawEnergy = superClus->rawEnergy();
218 const double rawESEnergy = superClus->preshowerEnergy();
219 const int numberOfClusters = superClus->clusters().size();
222 float e5x5Inverse = ssFull5x5.
e5x5 != 0. ? vdt::fast_inv(ssFull5x5.e5x5) : 0.;
225 data[1] = superClus->etaWidth();
226 data[2] = superClus->phiWidth();
227 data[3] = superClus->seed()->energy()/rawEnergy;
228 data[4] = ssFull5x5.e5x5/rawEnergy;
231 data[7] = seedClus->
eta() - superClus->position().Eta();
233 data[9] = ssFull5x5.r9;
234 data[10] = ssFull5x5.sigmaIetaIeta;
235 data[11] = ssFull5x5.sigmaIetaIphi;
236 data[12] = ssFull5x5.sigmaIphiIphi;
237 data[13] = ssFull5x5.eMax*e5x5Inverse;
238 data[14] = ssFull5x5.e2nd*e5x5Inverse;
239 data[15] = ssFull5x5.eTop*e5x5Inverse;
240 data[16] = ssFull5x5.eBottom*e5x5Inverse;
241 data[17] = ssFull5x5.eLeft*e5x5Inverse;
242 data[18] = ssFull5x5.eRight*e5x5Inverse;
243 data[19] = ssFull5x5.e2x5Max*e5x5Inverse;
244 data[20] = ssFull5x5.e2x5Left*e5x5Inverse;
245 data[21] = ssFull5x5.e2x5Right*e5x5Inverse;
246 data[22] = ssFull5x5.e2x5Top*e5x5Inverse;
247 data[23] = ssFull5x5.e2x5Bottom*e5x5Inverse;
249 data[25] =
std::max(0,numberOfClusters);
254 int signIEta = iEta > 0 ? +1 : -1;
257 data[28] = (iEta-signIEta)%5;
258 data[29] = (iPhi-1)%2;
259 const int iEtaCorr = iEta - (iEta > 0 ? +1 : -1);
260 const int iEtaCorr26 = iEta - (iEta > 0 ? +26 : -26);
261 data[30] =
std::abs(iEta)<=25 ? iEtaCorr%20 : iEtaCorr26%20;
262 data[31] = (iPhi-1)%20;
268 data[28] = rawESEnergy/rawEnergy;
276 std::array<float, 32>
data;
281 const bool isEB = pho.
isEB();
282 const double rawEnergy = superClus->rawEnergy();
283 const double rawESEnergy = superClus->preshowerEnergy();
284 const int numberOfClusters = superClus->clusters().size();
287 float e5x5Inverse = ssFull5x5.
e5x5 != 0. ? vdt::fast_inv(ssFull5x5.e5x5) : 0.;
290 data[1] = superClus->etaWidth();
291 data[2] = superClus->phiWidth();
292 data[3] = superClus->seed()->energy()/rawEnergy;
293 data[4] = ssFull5x5.e5x5/rawEnergy;
298 data[7] = seedClus->
eta() - superClus->position().Eta();
301 data[10] = ssFull5x5.sigmaIetaIeta;
304 data[11] = ssFull5x5.sigmaIetaIphi;
305 data[12] = ssFull5x5.sigmaIphiIphi;
306 data[13] = ssFull5x5.maxEnergyXtal*e5x5Inverse;
307 data[14] = ssFull5x5.e2nd*e5x5Inverse;
308 data[15] = ssFull5x5.eTop*e5x5Inverse;
309 data[16] = ssFull5x5.eBottom*e5x5Inverse;
310 data[17] = ssFull5x5.eLeft*e5x5Inverse;
311 data[18] = ssFull5x5.eRight*e5x5Inverse;
312 data[19] = ssFull5x5.e2x5Max*e5x5Inverse;
313 data[20] = ssFull5x5.e2x5Left*e5x5Inverse;
314 data[21] = ssFull5x5.e2x5Right*e5x5Inverse;
315 data[22] = ssFull5x5.e2x5Top*e5x5Inverse;
316 data[23] = ssFull5x5.e2x5Bottom*e5x5Inverse;
318 data[25] =
std::max(0,numberOfClusters);
325 int signIEta = iEta > 0 ? +1 : -1;
326 data[28] = (iEta-signIEta)%5;
327 data[29] = (iPhi-1)%2;
328 const int iEtaCorr = iEta - (iEta > 0 ? +1 : -1);
329 const int iEtaCorr26 = iEta - (iEta > 0 ? +26 : -26);
330 data[30] =
std::abs(iEta)<=25 ? iEtaCorr%20 : iEtaCorr26%20;
331 data[31] = (iPhi-1)%20;
337 data[28] = rawESEnergy/rawEnergy;
354 iEtaOrX, iPhiOrY, dummy, dummy);
357 iEtaOrX, iPhiOrY, dummy, dummy);
362 iEtaOrX = ebId.
ieta();
363 iPhiOrY = ebId.iphi();
constexpr double deltaPhi(double phi1, double phi2)
void setEventContent(const edm::EventSetup &iSetup)
maxRawEnergyForLowPtEBSigma
Analysis-level Photon class.
float nSaturatedXtals() const
float maxRawEnergyForLowPtEBSigma_
float trackMomentumError() const
const LorentzVector & p4(P4Kind kind) const
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setEventContent(const edm::EventSetup &iSetup)
EgammaRegressionContainer ecalOnlySigma
edm::EDGetTokenT< double > rhoToken_
EgammaRegressionContainer ecalOnlyMean
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
useClosestToCentreSeedCrysDef
void modifyObject(reco::GsfElectron &) const final
std::unique_ptr< PhoRegs > phoRegs_
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
EgammaRegressionContainer ecalOnlySigma
double eta() const
pseudorapidity of cluster centroid
EgammaRegressionContainer ecalOnlyMean
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setCorrectedEcalEnergyError(float newEnergyError)
void getSeedCrysCoord(const reco::CaloCluster &clus, int &iEtaOrX, int &iPhiOrY) const
void setEventContent(const edm::EventSetup &iSetup)
EGRegressionModifierV3(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
EleRegs(const edm::ParameterSet &iConfig)
edm::ESHandle< CaloGeometry > caloGeomHandle_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
float hcalOverEcalBc() const
std::unique_ptr< EleRegs > eleRegs_
DetId seed() const
return DetId of seed
void setEventContent(const edm::EventSetup &) final
Analysis-level electron class.
~EGRegressionModifierV3() override
float maxRawEnergyForLowPtEESigma_
void setCorrectedEcalEnergy(float newEnergy)
maxRawEnergyForLowPtEESigma
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
const ShowerShape & full5x5_showerShape() const
char data[epos_bytes_allocation]
const ShowerShape & full5x5_showerShapeVariables() const
void setEvent(const edm::Event &) final
SuperClusterRef superCluster() const override
reference to a SuperCluster
std::array< float, 32 > getRegData(const reco::GsfElectron &ele) const
static float kDefaultValue
#define DEFINE_EDM_PLUGIN(factory, type, name)
bool useClosestToCentreSeedCrysDef_
PhoRegs(const edm::ParameterSet &iConfig)
double phi() const
azimuthal angle of cluster centroid
float nSaturatedXtals() const