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;
195 bool isEB = ele.
isEB();
198 float energyRelError = energyError /
energy;
199 float momentumRelError = momentumError / momentum;
200 float errorRatio = energyRelError / momentumRelError;
203 float eOverP = energy / momentum;
204 float eOverPerror = eOverP*std::hypot(energyRelError,momentumRelError);
207 std::vector<float> regressionInputs ;
208 regressionInputs.resize(11,0.);
210 regressionInputs[0] =
energy;
211 regressionInputs[1] = energyRelError;
212 regressionInputs[2] = momentum;
213 regressionInputs[3] = momentumRelError;
214 regressionInputs[4] = errorRatio;
215 regressionInputs[5] = eOverP;
216 regressionInputs[6] = eOverPerror;
217 regressionInputs[7] =
static_cast<float>(isEcalDriven);
218 regressionInputs[8] =
static_cast<float>(isTrackerDriven);
219 regressionInputs[9] =
static_cast<float>(elClass);
220 regressionInputs[10] =
static_cast<float>(isEB);
225 &&fabs(momentum-energy)<15.*
sqrt(momentumError*momentumError + energyError*energyError)
229 if(weight>1.) weight = 1.;
230 else if(weight<0.) weight = 0.;
233 float combinedMomentum = weight*momentum + (1.-
weight)*energy;
234 float combinedMomentumError =
sqrt(weight*weight*momentumError*momentumError + (1.-weight)*(1.-weight)*energyError*energyError);
238 if(momentumError!=999. || weight==0.)
242 oldMomentum.y()*combinedMomentum/oldMomentum.t(),
243 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)
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
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
bool trackerDrivenSeed() const
const CaloClusterPtr & seed() const
seed BasicCluster
volatile std::atomic< bool > shutdown_flag false
RegressionHelper(const Configuration &)
bool combinationRegressionInitialized_
void checkSetup(const edm::EventSetup &)
float energyError(float E, float *par)
const CaloGeometry * caloGeometry_
const GBRForest * combinationReg_