12 cfg_(config),ecalRegressionInitialized_(
false),combinationRegressionInitialized_(
false),
13 caloTopologyCacheId_(0), caloGeometryCacheId_(0),regressionCacheId_(0)
32 unsigned long long newCaloTopologyCacheId
43 unsigned long long newCaloGeometryCacheId
58 unsigned long long newRegressionCacheId
93 unsigned long long newRegressionCacheId
143 double & energyFactor,
double & errorFactor)
const {
145 energyFactor = -999.;
148 std::vector<float> rInputs;
152 if(sc.
seed()->hitsAndFractions()[0].first.subdetId()==
EcalBarrel){
155 }
else if(sc.
seed()->hitsAndFractions()[0].first.subdetId()==
EcalEndcap){
159 throw cms::Exception(
"RegressionHelper::calculateRegressedEnergy")
160 <<
"Supercluster seed is either EB nor EE!" << std::endl;
196 bool isEB = ele.
isEB();
199 float energyRelError = energyError / energy;
200 float momentumRelError = momentumError / momentum;
201 float errorRatio = energyRelError / momentumRelError;
204 float eOverP = energy / momentum;
205 float eOverPerror = eOverP*std::hypot(energyRelError,momentumRelError);
208 std::vector<float> regressionInputs ;
209 regressionInputs.resize(11,0.);
211 regressionInputs[0] = energy;
212 regressionInputs[1] = energyRelError;
213 regressionInputs[2] = momentum;
214 regressionInputs[3] = momentumRelError;
215 regressionInputs[4] = errorRatio;
216 regressionInputs[5] = eOverP;
217 regressionInputs[6] = eOverPerror;
218 regressionInputs[7] =
static_cast<float>(isEcalDriven);
219 regressionInputs[8] =
static_cast<float>(isTrackerDriven);
220 regressionInputs[9] =
static_cast<float>(elClass);
221 regressionInputs[10] =
static_cast<float>(isEB);
226 &&fabs(momentum-energy)<15.*
sqrt(momentumError*momentumError + energyError*energyError)
230 if(weight>1.) weight = 1.;
231 else if(weight<0.) weight = 0.;
234 float combinedMomentum = weight*momentum + (1.-
weight)*energy;
235 float combinedMomentumError =
sqrt(weight*weight*momentumError*momentumError + (1.-weight)*(1.-weight)*energyError*energyError);
239 if(momentumError!=999. || weight==0.)
243 oldMomentum.y()*combinedMomentum/oldMomentum.t(),
244 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
const CaloTopology * caloTopology_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const GBRForest * ecalRegBarrel_
const GBRForest * ecalRegErrorBarrel_
void setCorrectedEcalEnergyError(float newEnergyError)
void get(HolderT &iHolder) const
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 &)
float energyError(float E, float *par)
const CaloGeometry * caloGeometry_
const GBRForest * combinationReg_