13 ecalRegressionInitialized_(
false),
14 combinationRegressionInitialized_(
false),
15 caloTopologyCacheId_(0),
16 caloGeometryCacheId_(0),
17 regressionCacheId_(0) {
56 unsigned long long newRegressionCacheId = es.
get<
GBRWrapperRcd>().cacheIdentifier();
86 unsigned long long newRegressionCacheId = es.
get<
GBRWrapperRcd>().cacheIdentifier();
131 double& energyFactor,
132 double& errorFactor)
const {
133 energyFactor = -999.;
136 std::vector<float> rInputs;
140 if (sc.
seed()->hitsAndFractions()[0].first.subdetId() ==
EcalBarrel) {
143 }
else if (sc.
seed()->hitsAndFractions()[0].first.subdetId() ==
EcalEndcap) {
147 throw cms::Exception(
"RegressionHelper::calculateRegressedEnergy")
148 <<
"Supercluster seed is either EB nor EE!" << std::endl;
181 bool isEB = ele.
isEB();
184 float energyRelError = energyError /
energy;
185 float momentumRelError = momentumError / momentum;
186 float errorRatio = energyRelError / momentumRelError;
189 float eOverP = energy / momentum;
190 float eOverPerror = eOverP * std::hypot(energyRelError, momentumRelError);
193 std::vector<float> regressionInputs;
194 regressionInputs.resize(11, 0.);
196 regressionInputs[0] =
energy;
197 regressionInputs[1] = energyRelError;
198 regressionInputs[2] = momentum;
199 regressionInputs[3] = momentumRelError;
200 regressionInputs[4] = errorRatio;
201 regressionInputs[5] =
eOverP;
202 regressionInputs[6] = eOverPerror;
203 regressionInputs[7] =
static_cast<float>(isEcalDriven);
204 regressionInputs[8] =
static_cast<float>(isTrackerDriven);
205 regressionInputs[9] =
static_cast<float>(elClass);
206 regressionInputs[10] =
static_cast<float>(isEB);
210 if (eOverP > 0.025 &&
211 fabs(momentum - energy) < 15. *
sqrt(momentumError * momentumError +
212 energyError * energyError))
217 else if (weight < 0.)
221 float combinedMomentum = weight * momentum + (1. -
weight) * energy;
222 float combinedMomentumError =
223 sqrt(weight * weight * momentumError * momentumError + (1. - weight) * (1. - weight) * energyError * energyError);
227 if (momentumError != 999. || weight == 0.) {
230 oldMomentum.y() * combinedMomentum / oldMomentum.t(),
231 oldMomentum.z() * combinedMomentum / oldMomentum.t(),
double GetResponse(const float *vector) const
std::vector< std::string > ecalRegressionWeightFiles
unsigned long long caloGeometryCacheId_
void applyCombinationRegression(reco::GsfElectron &ele) const
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
std::vector< std::string > combinationRegressionWeightLabels
unsigned long long regressionCacheId_
float trackMomentumError() const
const GBRForest * ecalRegEndcap_
const LorentzVector & p4(P4Kind kind) const
std::vector< std::string > ecalRegressionWeightLabels
unsigned long long caloTopologyCacheId_
void fill(const reco::SuperCluster &superClus, const EcalRecHitCollection *ebRecHits, const EcalRecHitCollection *eeRecHits, const CaloGeometry *geom, const CaloTopology *topology, const reco::VertexCollection *vertices)
math::XYZVectorF trackMomentumAtVtx() const
bool combinationWeightsFromDB
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
const CaloTopology * caloTopology_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const GBRForest * ecalRegBarrel_
const GBRForest * ecalRegErrorBarrel_
void setCorrectedEcalEnergyError(float newEnergyError)
void fillVec(std::vector< float > &inputVec) const
std::vector< std::string > combinationRegressionWeightFiles
float correctedEcalEnergy() const
T const * product() const
void getEcalRegression(const reco::SuperCluster &sc, const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< EcalRecHitCollection > &rechitsEB, const edm::Handle< EcalRecHitCollection > &rechitsEE, double &energyFactor, double &errorFactor) const
Classification classification() const
void readEvent(const edm::Event &)
bool ecalRegressionInitialized_
const GBRForest * ecalRegErrorEndcap_
float correctedEcalEnergyError() const
void setCorrectedEcalEnergy(float newEnergy)
void applyEcalRegression(reco::GsfElectron &electron, const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< EcalRecHitCollection > &rechitsEB, const edm::Handle< EcalRecHitCollection > &rechitsEE) const
SuperClusterRef superCluster() const override
reference to a SuperCluster
bool trackerDrivenSeed() const
const CaloClusterPtr & seed() const
seed BasicCluster
RegressionHelper(const Configuration &)
bool combinationRegressionInitialized_
void checkSetup(const edm::EventSetup &)
const CaloGeometry * caloGeometry_
const GBRForest * combinationReg_