14 #include <vdt/vdtMath.h>
32 std::vector<std::string>
mean;
61 rhoToken_(
cc.consumes<double>(conf.getParameter<
edm::
InputTag>(
"rhoCollection"))),
62 lowEnergyEcalOnlyThr_(conf.getParameter<double>(
"lowEnergy_ECALonlyThr")),
63 lowEnergyEcalTrackThr_(conf.getParameter<double>(
"lowEnergy_ECALTRKThr")),
64 highEnergyEcalTrackThr_(conf.getParameter<double>(
"highEnergy_ECALTRKThr")),
65 eOverPEcalTrkThr_(conf.getParameter<double>(
"eOverP_ECALTRKThr")),
66 epDiffSigEcalTrackThr_(conf.getParameter<double>(
"epDiffSig_ECALTRKThr")),
67 epSigEcalTrackThr_(conf.getParameter<double>(
"epSig_ECALTRKThr")),
68 forceHighEnergyEcalTrainingIfSaturated_(conf.getParameter<
bool>(
"forceHighEnergyEcalTrainingIfSaturated")) {
71 .
mean =
electrons.getParameter<std::vector<std::string> >(
"regressionKey"),
72 .sigma =
electrons.getParameter<std::vector<std::string> >(
"uncertaintyKey"),
81 .
mean =
photons.getParameter<std::vector<std::string> >(
"regressionKey"),
82 .sigma =
photons.getParameter<std::vector<std::string> >(
"uncertaintyKey"),
116 const int numberOfClusters = superClus->clusters().size();
117 const bool missing_clusters = !superClus->clusters()[numberOfClusters - 1].
isAvailable();
118 if (missing_clusters)
126 const bool isEB = ele.
isEB();
128 std::array<float, 32> eval;
129 const double rawEnergy = superClus->rawEnergy();
130 const double raw_es_energy = superClus->preshowerEnergy();
133 float e5x5Inverse = full5x5_ess.
e5x5 != 0. ? vdt::fast_inv(full5x5_ess.e5x5) : 0.;
136 eval[1] = superClus->etaWidth();
137 eval[2] = superClus->phiWidth();
138 eval[3] = superClus->seed()->energy() / rawEnergy;
139 eval[4] = full5x5_ess.e5x5 / rawEnergy;
142 eval[7] =
seed->eta() - superClus->position().Eta();
144 eval[9] = full5x5_ess.r9;
145 eval[10] = full5x5_ess.sigmaIetaIeta;
146 eval[11] = full5x5_ess.sigmaIetaIphi;
147 eval[12] = full5x5_ess.sigmaIphiIphi;
148 eval[13] = full5x5_ess.eMax * e5x5Inverse;
149 eval[14] = full5x5_ess.e2nd * e5x5Inverse;
150 eval[15] = full5x5_ess.eTop * e5x5Inverse;
151 eval[16] = full5x5_ess.eBottom * e5x5Inverse;
152 eval[17] = full5x5_ess.eLeft * e5x5Inverse;
153 eval[18] = full5x5_ess.eRight * e5x5Inverse;
154 eval[19] = full5x5_ess.e2x5Max * e5x5Inverse;
155 eval[20] = full5x5_ess.e2x5Left * e5x5Inverse;
156 eval[21] = full5x5_ess.e2x5Right * e5x5Inverse;
157 eval[22] = full5x5_ess.e2x5Top * e5x5Inverse;
158 eval[23] = full5x5_ess.e2x5Bottom * e5x5Inverse;
160 eval[25] =
std::max(0, numberOfClusters);
170 int signieta =
ieta > 0 ? +1 : -1;
171 eval[28] = (
ieta - signieta) % 5;
172 eval[29] = (
iphi - 1) % 2;
174 eval[31] = (
iphi - 1) % 20;
183 eval[28] = raw_es_energy / rawEnergy;
188 constexpr
double meanlimlow = -1.0;
189 constexpr
double meanlimhigh = 3.0;
190 constexpr
double meanoffset = meanlimlow + 0.5 * (meanlimhigh - meanlimlow);
191 constexpr
double meanscale = 0.5 * (meanlimhigh - meanlimlow);
193 constexpr
double sigmalimlow = 0.0002;
194 constexpr
double sigmalimhigh = 0.5;
195 constexpr
double sigmaoffset = sigmalimlow + 0.5 * (sigmalimhigh - sigmalimlow);
196 constexpr
double sigmascale = 0.5 * (sigmalimhigh - sigmalimlow);
199 float rawPt = rawEnergy * superClus->position().rho() / superClus->position().r();
219 double mean = meanoffset + meanscale * vdt::fast_sin(rawmean);
220 double sigma = sigmaoffset + sigmascale * vdt::fast_sin(rawsigma);
228 const double ecor =
mean * (rawEnergy + raw_es_energy);
229 const double sigmacor = sigma * ecor;
234 double combinedEnergy = ecor;
235 double combinedEnergyError = sigmacor;
238 const float trkMomentum = el_track->pMode();
239 const float trkEta = el_track->etaMode();
240 const float trkPhi = el_track->phiMode();
241 const float trkMomentumError =
std::abs(el_track->qoverpModeError()) * trkMomentum * trkMomentum;
243 const float eOverP = (rawEnergy + raw_es_energy) *
mean / trkMomentum;
244 const float fbrem = ele.
fbrem();
251 rawPt = ecor / cosh(trkEta);
262 eval[1] = sigma /
mean;
263 eval[2] = trkMomentumError / trkMomentum;
266 eval[5] = full5x5_ess.r9;
271 float ecalEnergyVar = (rawEnergy + raw_es_energy) * sigma;
272 float rawcombNormalization = (trkMomentumError * trkMomentumError + ecalEnergyVar * ecalEnergyVar);
273 float rawcomb = (ecor * trkMomentumError * trkMomentumError + trkMomentum * ecalEnergyVar * ecalEnergyVar) /
274 rawcombNormalization;
277 double rawmean_trk =
eleForestsMean_[coridx]->GetResponse(eval.data());
281 double mean_trk = meanoffset + meanscale * vdt::fast_sin(rawmean_trk);
282 double sigma_trk = sigmaoffset + sigmascale * vdt::fast_sin(rawsigma_trk);
291 combinedEnergy = mean_trk * rawcomb;
292 combinedEnergyError = sigma_trk * rawcomb;
297 oldFourMomentum.y() * combinedEnergy / oldFourMomentum.t(),
298 oldFourMomentum.z() * combinedEnergy / oldFourMomentum.t(),
314 const int numberOfClusters = superClus->clusters().size();
315 const bool missing_clusters = !superClus->clusters()[numberOfClusters - 1].
isAvailable();
316 if (missing_clusters)
319 const bool isEB = pho.
isEB();
321 std::array<float, 32> eval;
322 const double rawEnergy = superClus->rawEnergy();
323 const double raw_es_energy = superClus->preshowerEnergy();
326 float e5x5Inverse = full5x5_pss.
e5x5 != 0. ? vdt::fast_inv(full5x5_pss.e5x5) : 0.;
329 eval[1] = superClus->etaWidth();
330 eval[2] = superClus->phiWidth();
331 eval[3] = superClus->seed()->energy() / rawEnergy;
332 eval[4] = full5x5_pss.e5x5 / rawEnergy;
335 eval[7] =
seed->eta() - superClus->position().Eta();
338 eval[10] = full5x5_pss.sigmaIetaIeta;
339 eval[11] = full5x5_pss.sigmaIetaIphi;
340 eval[12] = full5x5_pss.sigmaIphiIphi;
341 eval[13] = full5x5_pss.maxEnergyXtal * e5x5Inverse;
342 eval[14] = full5x5_pss.e2nd * e5x5Inverse;
343 eval[15] = full5x5_pss.eTop * e5x5Inverse;
344 eval[16] = full5x5_pss.eBottom * e5x5Inverse;
345 eval[17] = full5x5_pss.eLeft * e5x5Inverse;
346 eval[18] = full5x5_pss.eRight * e5x5Inverse;
347 eval[19] = full5x5_pss.e2x5Max * e5x5Inverse;
348 eval[20] = full5x5_pss.e2x5Left * e5x5Inverse;
349 eval[21] = full5x5_pss.e2x5Right * e5x5Inverse;
350 eval[22] = full5x5_pss.e2x5Top * e5x5Inverse;
351 eval[23] = full5x5_pss.e2x5Bottom * e5x5Inverse;
353 eval[25] =
std::max(0, numberOfClusters);
364 int signieta =
ieta > 0 ? +1 : -1;
365 eval[28] = (
ieta - signieta) % 5;
366 eval[29] = (
iphi - 1) % 2;
368 eval[31] = (
iphi - 1) % 20;
377 eval[28] = raw_es_energy / rawEnergy;
382 constexpr
double meanlimlow = -1.0;
383 constexpr
double meanlimhigh = 3.0;
384 constexpr
double meanoffset = meanlimlow + 0.5 * (meanlimhigh - meanlimlow);
385 constexpr
double meanscale = 0.5 * (meanlimhigh - meanlimlow);
387 constexpr
double sigmalimlow = 0.0002;
388 constexpr
double sigmalimhigh = 0.5;
389 constexpr
double sigmaoffset = sigmalimlow + 0.5 * (sigmalimhigh - sigmalimlow);
390 constexpr
double sigmascale = 0.5 * (sigmalimhigh - sigmalimlow);
393 float rawPt = rawEnergy * superClus->position().rho() / superClus->position().r();
413 double mean = meanoffset + meanscale * vdt::fast_sin(rawmean);
414 double sigma = sigmaoffset + sigmascale * vdt::fast_sin(rawsigma);
422 const double ecor =
mean * (rawEnergy + raw_es_energy);
423 const double sigmacor = sigma * ecor;