16 #include <vdt/vdtMath.h> 72 ,
rhoToken_(cc.consumes<double>(conf.getParameter<
edm::InputTag>(
"rhoCollection")))
82 .sigma50ns = electrons.
getParameter<std::vector<std::string> >(
"uncertaintyKey_50ns"),
83 .mean25ns = electrons.
getParameter<std::vector<std::string> >(
"regressionKey_25ns"),
84 .sigma25ns = electrons.
getParameter<std::vector<std::string> >(
"uncertaintyKey_25ns")
91 .
mean50ns = photons.getParameter<std::vector<std::string>>(
"regressionKey_50ns"),
92 .sigma50ns = photons.getParameter<std::vector<std::string>>(
"uncertaintyKey_50ns"),
93 .mean25ns = photons.getParameter<std::vector<std::string>>(
"regressionKey_25ns"),
94 .sigma25ns = photons.getParameter<std::vector<std::string>>(
"uncertaintyKey_25ns")
135 const int numberOfClusters = superClus->clusters().size();
136 const bool missing_clusters = !superClus->clusters()[numberOfClusters-1].
isAvailable();
138 if( missing_clusters )
return ;
140 std::array<float, 33> eval;
141 const double rawEnergy = superClus->rawEnergy();
147 eval[2] = superClus->eta();
148 eval[3] = superClus->phi();
149 eval[4] = superClus->etaWidth();
150 eval[5] = superClus->phiWidth();
152 eval[7] = theseed->
energy()/rawEnergy;
153 eval[8] = ess.eMax/rawEnergy;
154 eval[9] = ess.e2nd/rawEnergy;
155 eval[10] = (ess.eLeft + ess.eRight != 0.f ? (ess.eLeft-ess.eRight)/(ess.eLeft+ess.eRight) : 0.f);
156 eval[11] = (ess.eTop + ess.eBottom != 0.f ? (ess.eTop-ess.eBottom)/(ess.eTop+ess.eBottom) : 0.f);
157 eval[12] = ess.sigmaIetaIeta;
158 eval[13] = ess.sigmaIetaIphi;
159 eval[14] = ess.sigmaIphiIphi;
160 eval[15] =
std::max(0,numberOfClusters-1);
163 std::vector<float> clusterRawEnergy;
164 clusterRawEnergy.resize(
std::max(3, numberOfClusters), 0);
165 std::vector<float> clusterDEtaToSeed;
166 clusterDEtaToSeed.resize(
std::max(3, numberOfClusters), 0);
167 std::vector<float> clusterDPhiToSeed;
168 clusterDPhiToSeed.resize(
std::max(3, numberOfClusters), 0);
169 float clusterMaxDR = 999.;
170 float clusterMaxDRDPhi = 999.;
171 float clusterMaxDRDEta = 999.;
172 float clusterMaxDRRawEnergy = 0.;
177 for (
auto const& pclus : superClus->clusters())
179 if(theseed == pclus )
181 clusterRawEnergy[iclus] = pclus->energy();
183 clusterDEtaToSeed[iclus] = pclus->eta() - theseed->
eta();
189 clusterMaxDR =
maxDR;
190 clusterMaxDRDPhi = clusterDPhiToSeed[iclus];
191 clusterMaxDRDEta = clusterDEtaToSeed[iclus];
192 clusterMaxDRRawEnergy = clusterRawEnergy[iclus];
197 eval[16] = clusterMaxDR;
198 eval[17] = clusterMaxDRDPhi;
199 eval[18] = clusterMaxDRDEta;
200 eval[19] = clusterMaxDRRawEnergy/rawEnergy;
201 eval[20] = clusterRawEnergy[0]/rawEnergy;
202 eval[21] = clusterRawEnergy[1]/rawEnergy;
203 eval[22] = clusterRawEnergy[2]/rawEnergy;
204 eval[23] = clusterDPhiToSeed[0];
205 eval[24] = clusterDPhiToSeed[1];
206 eval[25] = clusterDPhiToSeed[2];
207 eval[26] = clusterDEtaToSeed[0];
208 eval[27] = clusterDEtaToSeed[1];
209 eval[28] = clusterDEtaToSeed[2];
212 const bool isEB = ele.
isEB();
229 eval[29] = superClus->preshowerEnergy()/superClus->rawEnergy();
236 constexpr double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
237 constexpr double meanscale = 0.5*(meanlimhigh-meanlimlow);
241 constexpr double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
242 constexpr double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
244 const int coridx = isEB ? 0 : 1;
251 double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
252 double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
256 double ecor = mean*(eval[1]);
258 ecor = mean*(eval[1]+superClus->preshowerEnergy());
259 const double sigmacor = sigma*ecor;
265 std::array<float, 11> eval_ep;
268 const float tot_energy = superClus->rawEnergy()+superClus->preshowerEnergy();
271 const float eOverP = tot_energy*mean/ep;
272 eval_ep[0] = tot_energy*
mean;
273 eval_ep[1] = sigma/
mean;
275 eval_ep[3] = trkMomentumRelError;
276 eval_ep[4] = sigma/mean/trkMomentumRelError;
277 eval_ep[5] = tot_energy*mean/ep;
278 eval_ep[6] = tot_energy*mean/ep*
sqrt(sigma/mean*sigma/mean+trkMomentumRelError*trkMomentumRelError);
292 if ( eOverP > 0.025 &&
293 std::abs(ep-ecor) < 15.*
std::sqrt( momentumError*momentumError + sigmacor*sigmacor ) &&
305 oldMomentum.y()*combinedMomentum/oldMomentum.t(),
306 oldMomentum.z()*combinedMomentum/oldMomentum.t(),
315 std::array<float, 35> eval;
319 const int numberOfClusters = superClus->clusters().size();
320 const bool missing_clusters = !superClus->clusters()[numberOfClusters-1].
isAvailable();
322 if( missing_clusters )
return ;
324 const double rawEnergy = superClus->rawEnergy();
330 eval[2] = superClus->etaWidth();
331 eval[3] = superClus->phiWidth();
332 eval[4] =
std::max(0,numberOfClusters - 1);
336 eval[8] = theseed->
eta()-superClus->position().Eta();
338 eval[10] = theseed->
energy()/rawEnergy;
339 eval[11] = ess.e3x3/ess.e5x5;
340 eval[12] = ess.sigmaIetaIeta;
341 eval[13] = ess.sigmaIphiIphi;
342 eval[14] = ess.sigmaIetaIphi/(ess.sigmaIphiIphi*ess.sigmaIetaIeta);
343 eval[15] = ess.maxEnergyXtal/ess.e5x5;
344 eval[16] = ess.e2nd/ess.e5x5;
345 eval[17] = ess.eTop/ess.e5x5;
346 eval[18] = ess.eBottom/ess.e5x5;
347 eval[19] = ess.eLeft/ess.e5x5;
348 eval[20] = ess.eRight/ess.e5x5;
349 eval[21] = ess.e2x5Max/ess.e5x5;
350 eval[22] = ess.e2x5Left/ess.e5x5;
351 eval[23] = ess.e2x5Right/ess.e5x5;
352 eval[24] = ess.e2x5Top/ess.e5x5;
353 eval[25] = ess.e2x5Bottom/ess.e5x5;
355 const bool isEB = pho.
isEB();
359 int ieta = ebseedid.ieta();
360 int iphi = ebseedid.iphi();
363 int signieta = ieta > 0 ? +1 : -1;
364 eval[29] = (ieta-signieta)%5;
365 eval[30] = (iphi-1)%2;
366 eval[31] = (
abs(ieta)<=25)*((ieta-signieta)) + (
abs(ieta)>25)*((ieta-26*signieta)%20);
367 eval[32] = (iphi-1)%20;
372 eval[26] = superClus->preshowerEnergy()/rawEnergy;
373 eval[27] = superClus->preshowerEnergyPlane1()/rawEnergy;
374 eval[28] = superClus->preshowerEnergyPlane2()/rawEnergy;
375 eval[29] = eeseedid.ix();
376 eval[30] = eeseedid.iy();
381 const double meanlimlow = 0.2;
382 const double meanlimhigh = 2.0;
383 const double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
384 const double meanscale = 0.5*(meanlimhigh-meanlimlow);
386 const double sigmalimlow = 0.0002;
387 const double sigmalimhigh = 0.5;
388 const double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
389 const double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
391 const int coridx = isEB ? 0 : 1;
394 const double rawmean =
phoForestsMean_[coridx]->GetResponse(eval.data());
397 const double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
398 const double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
402 const double ecor = isEB ? mean*eval[0] : mean*(eval[0]+superClus->preshowerEnergy());
404 const double sigmacor = sigma*ecor;
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
double GetResponse(const float *vector) const
constexpr double deltaPhi(double phi1, double phi2)
const ShowerShape & showerShape() const
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Analysis-level Photon class.
void setEventContent(const edm::EventSetup &) final
EGRegressionModifierV1(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
float trackMomentumError() const
edm::Handle< reco::VertexCollection > vtxH_
std::vector< std::string > sigma25ns
const LorentzVector & p4(P4Kind kind) const
std::vector< std::string > mean25ns
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
edm::ESHandle< CaloGeometry > caloGeomH_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
math::XYZVectorF trackMomentumAtVtx() const
std::vector< Vertex > VertexCollection
collection of Vertex objects
const bool autoDetectBunchSpacing_
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
double eta() const
pseudorapidity of cluster centroid
void setEvent(const edm::Event &) final
std::vector< const GBRForestD * > phoForestsMean_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
void setCorrectedEcalEnergyError(float newEnergyError)
std::vector< std::string > sigma50ns
std::string condNamesWeight50ns_
std::vector< const GBRForestD * > retrieveGBRForests(edm::EventSetup const &evs, std::vector< std::string > const &names)
void modifyObject(pat::Electron &ele) const final
std::vector< const GBRForestD * > eleForestsSigma_
std::vector< const GBRForestD * > eleForestsMean_
Abs< T >::type abs(const T &t)
double energy() const
cluster energy
edm::EDGetTokenT< double > rhoToken_
float hadronicOverEm() const
the total hadronic over electromagnetic fraction
void modifyObject(reco::GsfElectron &) const final
std::vector< std::string > mean50ns
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const GBRForest * epForest_
std::vector< const GBRForestD * > phoForestsSigma_
DetId seed() const
return DetId of seed
Classification classification() const
Analysis-level electron class.
void setCorrectedEcalEnergy(float newEnergy)
SuperClusterRef superCluster() const override
reference to a SuperCluster
bool trackerDrivenSeed() const
#define DEFINE_EDM_PLUGIN(factory, type, name)
double phi() const
azimuthal angle of cluster centroid
void modifyObject(pat::Photon &pho) const final
const bool applyExtraHighEnergyProtection_
edm::EDGetTokenT< unsigned int > bunchSpacingToken_
const ShowerShape & showerShapeVariables() const
std::string condNamesWeight25ns_
T const * product() const