20 #include <vdt/vdtMath.h>
72 EGRegressionModifierV3::EGRegressionModifierV3(const edm::
ParameterSet& conf, edm::ConsumesCollector& cc)
75 rhoToken_(cc.consumes(conf.getParameter<edm::
InputTag>("
rhoTag"))),
76 useClosestToCentreSeedCrysDef_(conf.getParameter<
bool>("useClosestToCentreSeedCrysDef")),
77 maxRawEnergyForLowPtEBSigma_(conf.getParameter<
double>("maxRawEnergyForLowPtEBSigma")),
78 maxRawEnergyForLowPtEESigma_(conf.getParameter<
double>("maxRawEnergyForLowPtEESigma")) {
79 if (conf.exists(
"eleRegs")) {
80 eleRegs_ = std::make_unique<EleRegs>(conf.getParameterSet(
"eleRegs"), cc);
82 if (conf.exists(
"phoRegs")) {
83 phoRegs_ = std::make_unique<PhoRegs>(conf.getParameterSet(
"phoRegs"), cc);
85 if (useClosestToCentreSeedCrysDef_) {
86 caloGeomToken_ = cc.esConsumes();
117 bool rescaleDependentValues = superClus->clusters().
isAvailable();
125 const float rawEnergy = superClus->rawEnergy();
126 const float rawESEnergy = superClus->preshowerEnergy();
128 const float rawEt = rawEnergy * superClus->position().rho() / superClus->position().r();
132 const float ecalMeanCorr = ecalMean > 0. ? ecalMean : 1.0;
145 const float corrEnergy = (rawEnergy + rawESEnergy) * ecalMeanCorr;
146 const float corrEnergyErr = corrEnergy * ecalSigma;
151 std::pair<float, float> combEnergyAndErr =
eleRegs_->epComb.combine(ele);
178 const float rawEnergy = superClus->rawEnergy();
179 const float rawESEnergy = superClus->preshowerEnergy();
181 const float rawEt = rawEnergy * superClus->position().rho() / superClus->position().r();
184 const float ecalMeanCorr = ecalMean > 0. ? ecalMean : 1.0;
195 const double corrEnergy = (rawEnergy + rawESEnergy) * ecalMeanCorr;
196 const double corrEnergyErr = corrEnergy * ecalSigma;
198 pho.
setCorrectedEnergy(reco::Photon::P4type::regression2, corrEnergy, corrEnergyErr,
true);
204 std::array<float, 32>
data;
209 const bool isEB = ele.
isEB();
210 const double rawEnergy = superClus->rawEnergy();
211 const double rawESEnergy = superClus->preshowerEnergy();
212 const int numberOfClusters = superClus->clusters().size();
215 float e5x5Inverse = ssFull5x5.
e5x5 != 0. ? vdt::fast_inv(ssFull5x5.e5x5) : 0.;
218 data[1] = superClus->etaWidth();
219 data[2] = superClus->phiWidth();
220 data[3] = superClus->seed()->energy() / rawEnergy;
221 data[4] = ssFull5x5.e5x5 / rawEnergy;
224 data[7] = seedClus->eta() - superClus->position().Eta();
225 data[8] =
reco::deltaPhi(seedClus->phi(), superClus->position().Phi());
226 data[9] = ssFull5x5.r9;
227 data[10] = ssFull5x5.sigmaIetaIeta;
228 data[11] = ssFull5x5.sigmaIetaIphi;
229 data[12] = ssFull5x5.sigmaIphiIphi;
230 data[13] = ssFull5x5.eMax * e5x5Inverse;
231 data[14] = ssFull5x5.e2nd * e5x5Inverse;
232 data[15] = ssFull5x5.eTop * e5x5Inverse;
233 data[16] = ssFull5x5.eBottom * e5x5Inverse;
234 data[17] = ssFull5x5.eLeft * e5x5Inverse;
235 data[18] = ssFull5x5.eRight * e5x5Inverse;
236 data[19] = ssFull5x5.e2x5Max * e5x5Inverse;
237 data[20] = ssFull5x5.e2x5Left * e5x5Inverse;
238 data[21] = ssFull5x5.e2x5Right * e5x5Inverse;
239 data[22] = ssFull5x5.e2x5Top * e5x5Inverse;
240 data[23] = ssFull5x5.e2x5Bottom * e5x5Inverse;
242 data[25] =
std::max(0, numberOfClusters);
247 int signIEta = iEta > 0 ? +1 : -1;
250 data[28] = (iEta - signIEta) % 5;
251 data[29] = (iPhi - 1) % 2;
252 const int iEtaCorr = iEta - (iEta > 0 ? +1 : -1);
253 const int iEtaCorr26 = iEta - (iEta > 0 ? +26 : -26);
254 data[30] =
std::abs(iEta) <= 25 ? iEtaCorr % 20 : iEtaCorr26 % 20;
255 data[31] = (iPhi - 1) % 20;
261 data[28] = rawESEnergy / rawEnergy;
268 std::array<float, 32>
data;
273 const bool isEB = pho.
isEB();
274 const double rawEnergy = superClus->rawEnergy();
275 const double rawESEnergy = superClus->preshowerEnergy();
276 const int numberOfClusters = superClus->clusters().size();
279 float e5x5Inverse = ssFull5x5.
e5x5 != 0. ? vdt::fast_inv(ssFull5x5.e5x5) : 0.;
282 data[1] = superClus->etaWidth();
283 data[2] = superClus->phiWidth();
284 data[3] = superClus->seed()->energy() / rawEnergy;
285 data[4] = ssFull5x5.e5x5 / rawEnergy;
290 data[7] = seedClus->eta() - superClus->position().Eta();
291 data[8] =
reco::deltaPhi(seedClus->phi(), superClus->position().Phi());
293 data[10] = ssFull5x5.sigmaIetaIeta;
296 data[11] = ssFull5x5.sigmaIetaIphi;
297 data[12] = ssFull5x5.sigmaIphiIphi;
298 data[13] = ssFull5x5.maxEnergyXtal * e5x5Inverse;
299 data[14] = ssFull5x5.e2nd * e5x5Inverse;
300 data[15] = ssFull5x5.eTop * e5x5Inverse;
301 data[16] = ssFull5x5.eBottom * e5x5Inverse;
302 data[17] = ssFull5x5.eLeft * e5x5Inverse;
303 data[18] = ssFull5x5.eRight * e5x5Inverse;
304 data[19] = ssFull5x5.e2x5Max * e5x5Inverse;
305 data[20] = ssFull5x5.e2x5Left * e5x5Inverse;
306 data[21] = ssFull5x5.e2x5Right * e5x5Inverse;
307 data[22] = ssFull5x5.e2x5Top * e5x5Inverse;
308 data[23] = ssFull5x5.e2x5Bottom * e5x5Inverse;
310 data[25] =
std::max(0, numberOfClusters);
317 int signIEta = iEta > 0 ? +1 : -1;
318 data[28] = (iEta - signIEta) % 5;
319 data[29] = (iPhi - 1) % 2;
320 const int iEtaCorr = iEta - (iEta > 0 ? +1 : -1);
321 const int iEtaCorr26 = iEta - (iEta > 0 ? +26 : -26);
322 data[30] =
std::abs(iEta) <= 25 ? iEtaCorr % 20 : iEtaCorr26 % 20;
323 data[31] = (iPhi - 1) % 20;
329 data[28] = rawESEnergy / rawEnergy;
351 iEtaOrX = ebId.
ieta();
352 iPhiOrY = ebId.iphi();
367 ecalOnlyMean.setEventContent(iSetup);
368 ecalOnlySigma.setEventContent(iSetup);
369 epComb.setEventContent(iSetup);
377 ecalOnlyMean.setEventContent(iSetup);
378 ecalOnlySigma.setEventContent(iSetup);
constexpr double deltaPhi(double phi1, double phi2)
Analysis-level Photon class.
float nSaturatedXtals() const
float maxRawEnergyForLowPtEBSigma_
float trackMomentumError() const
const LorentzVector & p4(P4Kind kind) const
void setCorrectedEnergy(P4type type, float E, float dE, bool toCand=true)
void setEventContent(const edm::EventSetup &iSetup)
EgammaRegressionContainer ecalOnlySigma
edm::EDGetTokenT< double > rhoToken_
EgammaRegressionContainer ecalOnlyMean
ParameterSet const & getParameterSet(ParameterSetID const &id)
PhoRegs(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
std::unique_ptr< PhoRegs > phoRegs_
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
EgammaRegressionContainer ecalOnlySigma
EgammaRegressionContainer ecalOnlyMean
void modifyObject(reco::GsfElectron &) const final
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
float hcalOverEcalBc(const ShowerShape &ss, int depth) const
void setCorrectedEcalEnergyError(float newEnergyError)
void getSeedCrysCoord(const reco::CaloCluster &clus, int &iEtaOrX, int &iPhiOrY) const
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
void setEventContent(const edm::EventSetup &iSetup)
EGRegressionModifierV3(const edm::ParameterSet &conf, edm::ConsumesCollector &cc)
static constexpr float kDefaultValue
edm::ESHandle< CaloGeometry > caloGeomHandle_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
Abs< T >::type abs(const T &t)
bool get(ProductID const &oid, Handle< PROD > &result) const
int ieta() const
get the crystal ieta
EleRegs(const edm::ParameterSet &iConfig, edm::ConsumesCollector &cc)
float hadronicOverEm(int depth=0) const
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
std::unique_ptr< EleRegs > eleRegs_
DetId seed() const
return DetId of seed
void setEventContent(const edm::EventSetup &) final
Analysis-level electron class.
~EGRegressionModifierV3() override
float maxRawEnergyForLowPtEESigma_
void setCorrectedEcalEnergy(float newEnergy)
bool isSaturated(const Digi &digi, const int &maxADCvalue, int ifirst, int n)
const ShowerShape & full5x5_showerShape() const
char data[epos_bytes_allocation]
const ShowerShape & full5x5_showerShapeVariables() const
void setEvent(const edm::Event &) final
std::array< float, 32 > getRegData(const reco::GsfElectron &ele) const
#define DEFINE_EDM_PLUGIN(factory, type, name)
bool useClosestToCentreSeedCrysDef_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
constexpr char Electron[]
SuperClusterRef superCluster() const override
reference to a SuperCluster
float nSaturatedXtals() const