203 unsigned nElectrons = oldElectronsH->size();
204 for(
unsigned iele = 0; iele < nElectrons; ++iele )
206 electrons->push_back((*oldElectronsH)[iele]);
209 std::vector<double> regressionValues;
210 std::vector<double> regressionErrorValues;
211 regressionValues.reserve(nElectrons);
212 regressionErrorValues.reserve(nElectrons);
216 for (
unsigned iele = 0; iele < nElectrons ; ++iele)
220 double regressionEnergy = (*valMapEnergyH)[elecRef];
221 double regressionEnergyError = (*valMapEnergyErrorH)[elecRef];
223 regressionValues.push_back(regressionEnergy);
224 regressionErrorValues.push_back(regressionEnergyError);
230 recHits = pEBRecHits.
product();
231 }
else recHits = pEERecHits.
product();
236 int run =
event.run();
238 float r9 = mySCHelper.r9();
239 double correctedEcalEnergy = ele.correctedEcalEnergy();
240 double correctedEcalEnergyError = ele.correctedEcalEnergyError();
242 double trackMomentumError = ele.trackMomentumError();
243 double combinedMomentum = ele.p();
244 double combinedMomentumError = ele.p4Error(ele.candidateP4Kind());
248 if( !ele.ecalDrivenSeed() )
250 double error = 999. ;
251 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
254 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02};
255 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
257 else if ( ele.isEE() )
259 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
260 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
262 combinedMomentumError =
error;
277 correctedEcalEnergyError,
281 regressionEnergyError,
283 combinedMomentumError,
284 ele.superCluster()->eta(),
288 ele.trackerDrivenSeed()
303 std::cout <<
"[CalibratedGsfElectronProducer] "
304 <<
"You choose not to combine." << std::endl;
310 std::cout <<
"[CalibratedGsfElectronProducer] "
311 <<
"You choose corrected regression energy for standard combination" << std::endl;
319 std::cout <<
"[CalibratedGsfElectronProducer] "
320 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
328 std::cout <<
"[CalibratedGsfElectronProducer] "
329 <<
"You choose regression combination." << std::endl;
336 <<
"Unknown combination Type !!!" ;
342 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
343 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
344 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
345 mySimpleElectron.getCombinedMomentum() ) ;
350 mySimpleElectron.getTrackerMomentumError(),
351 mySimpleElectron.getCombinedMomentumError()
356 std::cout <<
"[CalibratedGsfElectronProducer] Combined momentum after saving "
357 << ele.p4().t() << std::endl;
365 std::cout <<
"[CalibratedGsfElectronProducer] "
366 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
372 energyFiller.insert(gsfNewElectronHandle,regressionValues.begin(),regressionValues.end());
374 energyErrorFiller.insert(gsfNewElectronHandle,regressionErrorValues.begin(),regressionErrorValues.end());
375 energyErrorFiller.fill();
std::string nameNewEnergyReg_
void calibrate(SimpleElectron &electron)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::InputTag recHitCollectionEE_
ElectronEPcombinator * myCombinator
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const CaloTopology * ecalTopology_
std::string newElectronName_
edm::InputTag inputElectrons_
void correctLinearity(SimpleElectron &electron)
edm::InputTag recHitCollectionEB_
void setCombinationMode(int mode)
std::string nameNewEnergyErrorReg_
const CaloGeometry * caloGeometry_
T const * product() const
ElectronEnergyCalibrator * theEnCorrector
void combine(SimpleElectron &electron)
edm::InputTag nameEnergyErrorReg_
edm::InputTag nameEnergyReg_
Power< A, B >::type pow(const A &a, const B &b)
EpCombinationTool * myEpCombinationTool