16 #include <vdt/vdtMath.h> 73 ,
rhoToken_(cc.consumes<double>(conf.getParameter<
edm::InputTag>(
"rhoCollection")))
83 .sigma50ns = electrons.
getParameter<std::vector<std::string> >(
"uncertaintyKey_50ns"),
84 .mean25ns = electrons.
getParameter<std::vector<std::string> >(
"regressionKey_25ns"),
85 .sigma25ns = electrons.
getParameter<std::vector<std::string> >(
"uncertaintyKey_25ns")
92 .
mean50ns = photons.getParameter<std::vector<std::string>>(
"regressionKey_50ns"),
93 .sigma50ns = photons.getParameter<std::vector<std::string>>(
"uncertaintyKey_50ns"),
94 .mean25ns = photons.getParameter<std::vector<std::string>>(
"regressionKey_25ns"),
95 .sigma25ns = photons.getParameter<std::vector<std::string>>(
"uncertaintyKey_25ns")
136 const int numberOfClusters = superClus->clusters().size();
137 const bool missing_clusters = !superClus->clusters()[numberOfClusters-1].
isAvailable();
139 if( missing_clusters )
return ;
141 std::array<float, 33> eval;
142 const double rawEnergy = superClus->rawEnergy();
148 eval[2] = superClus->eta();
149 eval[3] = superClus->phi();
150 eval[4] = superClus->etaWidth();
151 eval[5] = superClus->phiWidth();
153 eval[7] = theseed->
energy()/rawEnergy;
154 eval[8] = ess.eMax/rawEnergy;
155 eval[9] = ess.e2nd/rawEnergy;
156 eval[10] = (ess.eLeft + ess.eRight != 0.f ? (ess.eLeft-ess.eRight)/(ess.eLeft+ess.eRight) : 0.f);
157 eval[11] = (ess.eTop + ess.eBottom != 0.f ? (ess.eTop-ess.eBottom)/(ess.eTop+ess.eBottom) : 0.f);
158 eval[12] = ess.sigmaIetaIeta;
159 eval[13] = ess.sigmaIetaIphi;
160 eval[14] = ess.sigmaIphiIphi;
161 eval[15] =
std::max(0,numberOfClusters-1);
164 std::vector<float> clusterRawEnergy;
165 clusterRawEnergy.resize(
std::max(3, numberOfClusters), 0);
166 std::vector<float> clusterDEtaToSeed;
167 clusterDEtaToSeed.resize(
std::max(3, numberOfClusters), 0);
168 std::vector<float> clusterDPhiToSeed;
169 clusterDPhiToSeed.resize(
std::max(3, numberOfClusters), 0);
170 float clusterMaxDR = 999.;
171 float clusterMaxDRDPhi = 999.;
172 float clusterMaxDRDEta = 999.;
173 float clusterMaxDRRawEnergy = 0.;
178 for (
auto const& pclus : superClus->clusters())
180 if(theseed == pclus )
182 clusterRawEnergy[iclus] = pclus->energy();
184 clusterDEtaToSeed[iclus] = pclus->eta() - theseed->
eta();
190 clusterMaxDR =
maxDR;
191 clusterMaxDRDPhi = clusterDPhiToSeed[iclus];
192 clusterMaxDRDEta = clusterDEtaToSeed[iclus];
193 clusterMaxDRRawEnergy = clusterRawEnergy[iclus];
198 eval[16] = clusterMaxDR;
199 eval[17] = clusterMaxDRDPhi;
200 eval[18] = clusterMaxDRDEta;
201 eval[19] = clusterMaxDRRawEnergy/rawEnergy;
202 eval[20] = clusterRawEnergy[0]/rawEnergy;
203 eval[21] = clusterRawEnergy[1]/rawEnergy;
204 eval[22] = clusterRawEnergy[2]/rawEnergy;
205 eval[23] = clusterDPhiToSeed[0];
206 eval[24] = clusterDPhiToSeed[1];
207 eval[25] = clusterDPhiToSeed[2];
208 eval[26] = clusterDEtaToSeed[0];
209 eval[27] = clusterDEtaToSeed[1];
210 eval[28] = clusterDEtaToSeed[2];
213 const bool isEB = ele.
isEB();
232 eval[29] = superClus->preshowerEnergy()/superClus->rawEnergy();
239 constexpr double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
240 constexpr double meanscale = 0.5*(meanlimhigh-meanlimlow);
244 constexpr double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
245 constexpr double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
247 const int coridx = isEB ? 0 : 1;
254 double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
255 double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
259 double ecor = mean*(eval[1]);
261 ecor = mean*(eval[1]+superClus->preshowerEnergy());
262 const double sigmacor = sigma*ecor;
268 std::array<float, 11> eval_ep;
271 const float tot_energy = superClus->rawEnergy()+superClus->preshowerEnergy();
274 const float eOverP = tot_energy*mean/ep;
275 eval_ep[0] = tot_energy*
mean;
276 eval_ep[1] = sigma/
mean;
278 eval_ep[3] = trkMomentumRelError;
279 eval_ep[4] = sigma/mean/trkMomentumRelError;
280 eval_ep[5] = tot_energy*mean/ep;
281 eval_ep[6] = tot_energy*mean/ep*
sqrt(sigma/mean*sigma/mean+trkMomentumRelError*trkMomentumRelError);
295 if ( eOverP > 0.025 &&
296 std::abs(ep-ecor) < 15.*
std::sqrt( momentumError*momentumError + sigmacor*sigmacor ) &&
308 oldMomentum.y()*combinedMomentum/oldMomentum.t(),
309 oldMomentum.z()*combinedMomentum/oldMomentum.t(),
318 std::array<float, 35> eval;
322 const int numberOfClusters = superClus->clusters().size();
323 const bool missing_clusters = !superClus->clusters()[numberOfClusters-1].
isAvailable();
325 if( missing_clusters )
return ;
327 const double rawEnergy = superClus->rawEnergy();
333 eval[2] = superClus->etaWidth();
334 eval[3] = superClus->phiWidth();
335 eval[4] =
std::max(0,numberOfClusters - 1);
339 eval[8] = theseed->
eta()-superClus->position().Eta();
341 eval[10] = theseed->
energy()/rawEnergy;
342 eval[11] = ess.e3x3/ess.e5x5;
343 eval[12] = ess.sigmaIetaIeta;
344 eval[13] = ess.sigmaIphiIphi;
345 eval[14] = ess.sigmaIetaIphi/(ess.sigmaIphiIphi*ess.sigmaIetaIeta);
346 eval[15] = ess.maxEnergyXtal/ess.e5x5;
347 eval[16] = ess.e2nd/ess.e5x5;
348 eval[17] = ess.eTop/ess.e5x5;
349 eval[18] = ess.eBottom/ess.e5x5;
350 eval[19] = ess.eLeft/ess.e5x5;
351 eval[20] = ess.eRight/ess.e5x5;
352 eval[21] = ess.e2x5Max/ess.e5x5;
353 eval[22] = ess.e2x5Left/ess.e5x5;
354 eval[23] = ess.e2x5Right/ess.e5x5;
355 eval[24] = ess.e2x5Top/ess.e5x5;
356 eval[25] = ess.e2x5Bottom/ess.e5x5;
358 const bool isEB = pho.
isEB();
362 int ieta = ebseedid.ieta();
363 int iphi = ebseedid.iphi();
366 int signieta = ieta > 0 ? +1 : -1;
367 eval[29] = (ieta-signieta)%5;
368 eval[30] = (iphi-1)%2;
369 eval[31] = (
abs(ieta)<=25)*((ieta-signieta)) + (
abs(ieta)>25)*((ieta-26*signieta)%20);
370 eval[32] = (iphi-1)%20;
375 eval[26] = superClus->preshowerEnergy()/rawEnergy;
376 eval[27] = superClus->preshowerEnergyPlane1()/rawEnergy;
377 eval[28] = superClus->preshowerEnergyPlane2()/rawEnergy;
378 eval[29] = eeseedid.ix();
379 eval[30] = eeseedid.iy();
384 const double meanlimlow = 0.2;
385 const double meanlimhigh = 2.0;
386 const double meanoffset = meanlimlow + 0.5*(meanlimhigh-meanlimlow);
387 const double meanscale = 0.5*(meanlimhigh-meanlimlow);
389 const double sigmalimlow = 0.0002;
390 const double sigmalimhigh = 0.5;
391 const double sigmaoffset = sigmalimlow + 0.5*(sigmalimhigh-sigmalimlow);
392 const double sigmascale = 0.5*(sigmalimhigh-sigmalimlow);
394 const int coridx = isEB ? 0 : 1;
397 const double rawmean =
phoForestsMean_[coridx]->GetResponse(eval.data());
400 const double mean = meanoffset + meanscale*vdt::fast_sin(rawmean);
401 const double sigma = sigmaoffset + sigmascale*vdt::fast_sin(rawsigma);
405 const double ecor = isEB ? mean*eval[0] : mean*(eval[0]+superClus->preshowerEnergy());
407 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)
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_
const edm::EventSetup * iSetup_
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