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;
282 edm::LogInfo(
"PFClusterEMEnergyCorrector") <<
"SrFlagCollection information is not available. The ECAL PFCluster " 283 "corrections will assume \"full readout\" for all hits.";
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.;
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;
337 auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EBDetId>(cluster.
seed()));
339 if (srf != ebSrFlags->
end())
340 clusFlag = srf->value();
344 auto ecalUnit = readoutTool.readOutUnitOf(static_cast<EEDetId>(cluster.
seed()));
346 if (srf != eeSrFlags->
end())
347 clusFlag = srf->value();
366 int ZS_bit = clusFlag >> 0 & 1;
367 int FR_bit = clusFlag >> 1 & 1;
369 if (ZS_bit != 0 && FR_bit == 0)
374 else if (
pt >= 2.5 &&
pt < 6.)
379 if (ZS_bit == 0 || clusFlag > 7) {
381 <<
"We can only correct regions readout in ZS (flag 1,5) or FULL readout (flag 3,7). Flag " << clusFlag
382 <<
" is not recognized." 384 <<
"Assuming FULL readout and continuing";
387 const GBRForestD &meanforest = *forestH_mean[coridx].product();
388 const GBRForestD &sigmaforest = *forestH_sigma[coridx].product();
395 evalEB[3] = ietamod20;
396 evalEB[4] = iphimod20;
397 evalEB[5] = reducedHits;
402 evalEE[3] = (ePS1 + ePS2) * invE;
403 evalEE[4] = reducedHits;
428 double ecor = iseb ? vdt::fast_exp(
mean) *
e : vdt::fast_exp(
mean) * (
e + ePS1 + ePS2);
429 double sigmacor = sigma * ecor;
431 LogDebug(
"PFClusterEMEnergyCorrector")
432 <<
"ieta : iphi : ietamod20 : iphimod20 : size : reducedHits = " << ietaix <<
" " << iphiiy <<
" " << ietamod20
433 <<
" " << iphimod20 <<
" " <<
size <<
" " << reducedHits <<
"\n" 434 <<
"isEB : eraw : ePS1 : ePS2 : (eps1+eps2)/raw : Flag = " << iseb <<
" " << evale <<
" " << ePS1 <<
" " << ePS2
435 <<
" " << (ePS1 + ePS2) / evale <<
" " << clusFlag <<
"\n" 436 <<
"response : correction = " <<
exp(
mean) <<
" " << ecor;
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestMeanTokens_50ns_
bool applyMVACorrections_
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
DetId seed() const
return DetId of seed
std::vector< T >::const_iterator const_iterator
bool applyCrackCorrections_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
PFLayer::Layer layer() const
cluster layer, see PFLayer.h in this directory
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_
int ieta() const
get the crystal ieta
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
std::vector< std::string > condnames_mean_25ns_
void setCorrectedEnergy(double cenergy)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
double energy() const
cluster energy
Abs< T >::type abs(const T &t)
const EcalReadoutTools::ESGetTokens ecalReadoutToolsESGetTokens_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
double pt() const
transverse momentum, massless approximation
double GetResponse(const float *vector) const
const_iterator end() const
edm::EDGetTokenT< EcalRecHitCollection > recHitsEB_
bool setEnergyUncertainty_
iterator find(key_type k)
double maxPtForMVAEvaluation_
std::vector< edm::ESGetToken< GBRForestD, GBRDWrapperRcd > > forestSigmaTokens_50ns_
edm::EDGetTokenT< EBSrFlagCollection > ebSrFlagToken_
bool autoDetectBunchSpacing_
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_