201 unsigned nElectrons = oldElectronsH->size();
202 for(
unsigned iele = 0; iele < nElectrons; ++iele )
204 electrons->push_back((*oldElectronsH)[iele]);
207 std::vector<double> regressionValues;
208 std::vector<double> regressionErrorValues;
209 regressionValues.reserve(nElectrons);
210 regressionErrorValues.reserve(nElectrons);
214 for (
unsigned iele = 0; iele < nElectrons ; ++iele)
218 double regressionEnergy = (*valMapEnergyH)[elecRef];
219 double regressionEnergyError = (*valMapEnergyErrorH)[elecRef];
221 regressionValues.push_back(regressionEnergy);
222 regressionErrorValues.push_back(regressionEnergyError);
228 recHits = pEBRecHits.
product();
229 }
else recHits = pEERecHits.
product();
234 int run =
event.run();
236 float r9 = mySCHelper.r9();
237 double correctedEcalEnergy = ele.correctedEcalEnergy();
238 double correctedEcalEnergyError = ele.correctedEcalEnergyError();
240 double trackMomentumError = ele.trackMomentumError();
241 double combinedMomentum = ele.p();
242 double combinedMomentumError = ele.p4Error(ele.candidateP4Kind());
246 if( !ele.ecalDrivenSeed() )
248 double error = 999. ;
249 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
252 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02};
253 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
255 else if ( ele.isEE() )
257 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
258 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
260 combinedMomentumError =
error;
275 correctedEcalEnergyError,
279 regressionEnergyError,
281 combinedMomentumError,
282 ele.superCluster()->eta(),
286 ele.trackerDrivenSeed()
301 std::cout <<
"[CalibratedGsfElectronProducer] "
302 <<
"You choose not to combine." << std::endl;
308 std::cout <<
"[CalibratedGsfElectronProducer] "
309 <<
"You choose corrected regression energy for standard combination" << std::endl;
317 std::cout <<
"[CalibratedGsfElectronProducer] "
318 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
326 std::cout <<
"[CalibratedGsfElectronProducer] "
327 <<
"You choose regression combination." << std::endl;
334 <<
"Unknown combination Type !!!" ;
340 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
341 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
342 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
343 mySimpleElectron.getCombinedMomentum() ) ;
348 mySimpleElectron.getTrackerMomentumError(),
349 mySimpleElectron.getCombinedMomentumError()
354 std::cout <<
"[CalibratedGsfElectronProducer] Combined momentum after saving "
355 << ele.p4().t() << std::endl;
363 std::cout <<
"[CalibratedGsfElectronProducer] "
364 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
370 energyFiller.insert(gsfNewElectronHandle,regressionValues.begin(),regressionValues.end());
372 energyErrorFiller.insert(gsfNewElectronHandle,regressionErrorValues.begin(),regressionErrorValues.end());
373 energyErrorFiller.fill();
std::string nameNewEnergyReg_
void calibrate(SimpleElectron &electron)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEEToken_
edm::EDGetTokenT< edm::ValueMap< double > > energyRegToken_
ElectronEPcombinator * myCombinator
edm::EDGetTokenT< EcalRecHitCollection > recHitCollectionEBToken_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const CaloTopology * ecalTopology_
std::string newElectronName_
void correctLinearity(SimpleElectron &electron)
edm::EDGetTokenT< edm::ValueMap< double > > energyErrorRegToken_
void setCombinationMode(int mode)
std::string nameNewEnergyErrorReg_
const CaloGeometry * caloGeometry_
T const * product() const
edm::EDGetTokenT< reco::GsfElectronCollection > inputElectronsToken_
ElectronEnergyCalibrator * theEnCorrector
void combine(SimpleElectron &electron)
Power< A, B >::type pow(const A &a, const B &b)
EpCombinationTool * myEpCombinationTool