a hit can be ZS or forced ZS. A hit can be in Full readout or Forced to be FULL readout if it is ZS, then clusFlag (in binary) = 0001 if it is forced ZS, then clusFlag (in binary) = 0101 if it is FR, then clusFlag (in binary) = 0011 if it is forced FR, then clusFlag (in binary) = 0111 i.e 3rd bit is set. Even if it is forced, we should mark it is as ZS or FR. To take care of it, just check the LSB and second LSB(SLSB)
154 for (
unsigned int idx = 0; idx <
cs.size(); ++idx) {
157 float ePS1 = 0., ePS2 = 0.;
171 int bunchspacing = 450;
175 bunchspacing = *bunchSpacingH;
182 std::vector<edm::ESHandle<GBRForestD> > forestH_mean(ncor);
183 std::vector<edm::ESHandle<GBRForestD> > forestH_sigma(ncor);
185 if (bunchspacing == 25) {
186 for (
unsigned int icor = 0; icor < ncor; ++icor) {
191 for (
unsigned int icor = 0; icor < ncor; ++icor) {
197 std::array<float, 5> eval;
198 for (
unsigned int idx = 0; idx <
cs.size(); ++idx) {
201 float ePS1 = 0., ePS2 = 0.;
206 double pt = cluster.
pt();
211 double invE = (e == 0.) ? 0. : 1. /
e;
212 int size = lazyTool.n5x5(cluster);
218 ietaix = ebseed.
ieta();
219 iphiiy = ebseed.iphi();
222 ietaix = eeseed.
ix();
223 iphiiy = eeseed.iy();
240 const GBRForestD &meanforest = *forestH_mean[coridx].product();
241 const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
248 eval[3] = ePS1 * invE;
249 eval[4] = ePS2 * invE;
253 double rawmean = meanforest.
GetResponse(eval.data());
254 double rawsigma = sigmaforest.
GetResponse(eval.data());
264 double ecor = vdt::fast_exp(mean) *
e;
265 double sigmacor = sigma * ecor;
283 <<
"This version of PFCluster corrections requires the SrFlagCollection information to proceed!\n";
286 std::vector<edm::ESHandle<GBRForestD> > forestH_mean(ncor);
287 std::vector<edm::ESHandle<GBRForestD> > forestH_sigma(ncor);
289 for (
unsigned int icor = 0; icor < ncor; ++icor) {
294 std::array<float, 6> evalEB;
295 std::array<float, 5> evalEE;
297 for (
unsigned int idx = 0; idx <
cs.size(); ++idx) {
300 float ePS1 = 0., ePS2 = 0.;
304 double e = cluster.
energy();
305 double pt = cluster.
pt();
310 double invE = (e == 0.) ? 0. : 1. /
e;
311 int size = lazyTool.n5x5(cluster);
312 int reducedHits =
size;
320 ietaix = ebseed.
ieta();
321 iphiiy = ebseed.iphi();
324 ietaix = eeseed.
ix();
325 iphiiy = eeseed.iy();
329 int signeta = (ietaix > 0) ? 1 : -1;
330 int ietamod20 = (
std::abs(ietaix) < 26) ? ietaix - signeta : (ietaix - 26 * signeta) % 20;
331 int iphimod20 = (iphiiy - 1) % 20;
335 auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EBDetId>(cluster.
seed()));
337 if (srf != ebSrFlags->end())
338 clusFlag = srf->value();
342 auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EEDetId>(cluster.
seed()));
344 if (srf != eeSrFlags->end())
345 clusFlag = srf->value();
365 int ZS_bit = clusFlag >> 0 & 1;
366 int FR_bit = clusFlag >> 1 & 1;
368 if (ZS_bit != 0 && FR_bit == 0)
373 else if (pt >= 2.5 && pt < 6.)
378 if (ZS_bit == 0 || clusFlag > 7) {
380 <<
"We can only correct regions readout in ZS (flag 1,5) or FULL readout (flag 3,7). Flag " << clusFlag
381 <<
" is not recognized."
383 <<
"Assuming FULL readout and continuing";
386 const GBRForestD &meanforest = *forestH_mean[coridx].product();
387 const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
394 evalEB[3] = ietamod20;
395 evalEB[4] = iphimod20;
396 evalEB[5] = reducedHits;
401 evalEE[3] = (ePS1 + ePS2) * invE;
402 evalEE[4] = reducedHits;
427 double ecor = iseb ? vdt::fast_exp(mean) * e : vdt::fast_exp(mean) * (e + ePS1 + ePS2);
428 double sigmacor = sigma * ecor;
430 LogDebug(
"PFClusterEMEnergyCorrector")
431 <<
"ieta : iphi : ietamod20 : iphimod20 : size : reducedHits = " << ietaix <<
" " << iphiiy <<
" " << ietamod20
432 <<
" " << iphimod20 <<
" " << size <<
" " << reducedHits <<
"\n"
433 <<
"isEB : eraw : ePS1 : ePS2 : (eps1+eps2)/raw : Flag = " << iseb <<
" " << evale <<
" " << ePS1 <<
" " << ePS2
434 <<
" " << (ePS1 + ePS2) / evale <<
" " << clusFlag <<
"\n"
435 <<
"response : correction = " <<
exp(mean) <<
" " << ecor;
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
double GetResponse(const float *vector) const
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_50ns_
bool applyMVACorrections_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
unique_ptr< ClusterSequence > cs
std::vector< T >::const_iterator const_iterator
double pt() const
transverse momentum, massless approximation
bool applyCrackCorrections_
Exp< T >::type exp(const T &t)
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_25ns_
edm::EDGetTokenT< EESrFlagCollection > eeSrFlagToken_
std::unique_ptr< PFEnergyCalibration > calibrator_
edm::EDGetTokenT< unsigned int > bunchSpacing_
edm::EDGetTokenT< EcalRecHitCollection > recHitsEE_
std::vector< std::string > condnames_mean_50ns_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
std::vector< std::string > condnames_mean_25ns_
void setCorrectedEnergy(double cenergy)
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_
double energy() const
cluster energy
DetId seed() const
return DetId of seed
edm::EDGetTokenT< EcalRecHitCollection > recHitsEB_
bool setEnergyUncertainty_
double maxPtForMVAEvaluation_
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_50ns_
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
bool autoDetectBunchSpacing_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Log< level::Warning, false > LogWarning
void setCorrectedEnergyUncertainty(float energyerr)
void getAssociatedPSEnergy(const size_t clusIdx, const reco::PFCluster::EEtoPSAssociation &assoc, float &e1, float &e2)
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_25ns_
tuple size
Write out results.