64 if ( isMC && ( dataset !=
"Summer11" && dataset !=
"Fall11" 65 && dataset!=
"Summer12" && dataset !=
"Summer12_DR53X_HCP2012" 66 && dataset !=
"Summer12_LegacyPaper" ) )
68 throw cms::Exception(
"CalibratedgsfElectronProducer|ConfigError") <<
"Unknown MC dataset";
70 if ( !isMC && ( dataset !=
"Prompt" && dataset !=
"ReReco" 71 && dataset !=
"Jan16ReReco" && dataset !=
"ICHEP2012" 72 && dataset !=
"Moriond2013" && dataset !=
"22Jan2013ReReco" ) )
74 throw cms::Exception(
"CalibratedgsfElectronProducer|ConfigError") <<
"Unknown Data dataset";
78 if(combinationType!=3 && applyLinearityCorrection)
80 std::cout <<
"[CalibratedElectronProducer] " 81 <<
"Warning: you chose combinationType!=3 and applyLinearityCorrection=True. Linearity corrections are only applied on top of combination 3." << std::endl;
84 std::cout <<
"[CalibratedGsfElectronProducer] Correcting scale for dataset " << dataset << std::endl;
88 switch (correctionsType)
95 std::cout <<
"You choose regression 1 scale corrections" << std::endl;
101 std::cout <<
"You choose regression 2 scale corrections." << std::endl;
106 <<
"You choose standard non-regression ecal energy scale corrections. They are not implemented yet.";
110 <<
"Unknown correctionsType !!!" ;
129 std::cout<<
"[CalibratedGsfElectronProducer] " 130 <<
"ElectronEnergyCalibrator object is created" << std::endl;
144 std::cout <<
"[CalibratedGsfElectronProducer] " 145 <<
"Combination tools are created and initialized" << std::endl;
198 for(
unsigned iele = 0; iele <
nElectrons; ++iele )
200 electrons->push_back((*oldElectronsH)[iele]);
203 std::vector<double> regressionValues;
204 std::vector<double> regressionErrorValues;
205 regressionValues.reserve(nElectrons);
206 regressionErrorValues.reserve(nElectrons);
210 for (
unsigned iele = 0; iele <
nElectrons ; ++iele)
214 double regressionEnergy = (*valMapEnergyH)[elecRef];
215 double regressionEnergyError = (*valMapEnergyErrorH)[elecRef];
217 regressionValues.push_back(regressionEnergy);
218 regressionErrorValues.push_back(regressionEnergyError);
224 recHits = pEBRecHits.
product();
225 }
else recHits = pEERecHits.
product();
230 int run =
event.run();
232 float r9 = mySCHelper.
r9();
237 double combinedMomentum = ele.
p();
244 double error = 999. ;
245 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
248 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02};
249 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
251 else if ( ele.
isEE() )
253 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
254 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
256 combinedMomentumError =
error;
271 correctedEcalEnergyError,
275 regressionEnergyError,
277 combinedMomentumError,
297 std::cout <<
"[CalibratedGsfElectronProducer] " 298 <<
"You choose not to combine." << std::endl;
304 std::cout <<
"[CalibratedGsfElectronProducer] " 305 <<
"You choose corrected regression energy for standard combination" << std::endl;
313 std::cout <<
"[CalibratedGsfElectronProducer] " 314 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
322 std::cout <<
"[CalibratedGsfElectronProducer] " 323 <<
"You choose regression combination." << std::endl;
330 <<
"Unknown combination Type !!!" ;
336 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
337 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
338 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
339 mySimpleElectron.getCombinedMomentum() ) ;
344 mySimpleElectron.getTrackerMomentumError(),
345 mySimpleElectron.getCombinedMomentumError()
350 std::cout <<
"[CalibratedGsfElectronProducer] Combined momentum after saving " 351 << ele.
p4().t() << std::endl;
359 std::cout <<
"[CalibratedGsfElectronProducer] " 360 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
366 energyFiller.
insert(gsfNewElectronHandle,regressionValues.begin(),regressionValues.end());
368 energyErrorFiller.
insert(gsfNewElectronHandle,regressionErrorValues.begin(),regressionErrorValues.end());
369 energyErrorFiller.
fill();
std::string nameNewEnergyReg_
T getParameter(std::string const &) const
float trackMomentumError() const
const LorentzVector & p4(P4Kind kind) const
P4Kind candidateP4Kind() const
#define DEFINE_FWK_MODULE(type)
void correctMomentum(const LorentzVector &p4, float trackMomentumError, float p4Error)
math::XYZVectorF trackMomentumAtVtx() const
void insert(const H &h, I begin, I end)
float p4Error(P4Kind kind) const
std::string linCorrectionsInputPath
def setup(process, global_tag, zero_tesla=False)
void calibrate(SimpleElectron &electron, edm::StreamID const &)
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.
bool applyLinearityCorrection
const CaloTopology * ecalTopology_
std::string newElectronName_
~CalibratedElectronProducer() override
std::string scaleCorrectionsInputPath
void correctLinearity(SimpleElectron &electron)
edm::EDGetTokenT< edm::ValueMap< double > > energyErrorRegToken_
float correctedEcalEnergy() const
double p() const final
magnitude of momentum vector
void setCombinationMode(int mode)
std::string combinationRegressionInputPath
T const * product() const
std::string nameNewEnergyErrorReg_
Classification classification() const
const CaloGeometry * caloGeometry_
virtual GsfElectronCoreRef core() const
float correctedEcalEnergyError() const
edm::EDGetTokenT< reco::GsfElectronCollection > inputElectronsToken_
ElectronEnergyCalibrator * theEnCorrector
StreamID streamID() const
SuperClusterRef superCluster() const override
reference to a SuperCluster
void combine(SimpleElectron &electron)
bool trackerDrivenSeed() const
CalibratedElectronProducer(const edm::ParameterSet &)
Power< A, B >::type pow(const A &a, const B &b)
void produce(edm::Event &, const edm::EventSetup &) override
EpCombinationTool * myEpCombinationTool
bool ecalDrivenSeed() const