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;
197 unsigned nElectrons = oldElectronsH->size();
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
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_
virtual void produce(edm::Event &, const edm::EventSetup &)
std::string newElectronName_
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
virtual ~CalibratedElectronProducer()
std::string scaleCorrectionsInputPath
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void correctLinearity(SimpleElectron &electron)
edm::EDGetTokenT< edm::ValueMap< double > > energyErrorRegToken_
float correctedEcalEnergy() const
void setCombinationMode(int mode)
std::string combinationRegressionInputPath
T const * product() const
std::string nameNewEnergyErrorReg_
Classification classification() const
const CaloGeometry * caloGeometry_
virtual GsfElectronCoreRef core() const
virtual double p() const final
magnitude of momentum vector
float correctedEcalEnergyError() const
edm::EDGetTokenT< reco::GsfElectronCollection > inputElectronsToken_
ElectronEnergyCalibrator * theEnCorrector
StreamID streamID() const
void combine(SimpleElectron &electron)
bool trackerDrivenSeed() const
CalibratedElectronProducer(const edm::ParameterSet &)
Power< A, B >::type pow(const A &a, const B &b)
EpCombinationTool * myEpCombinationTool
bool ecalDrivenSeed() const