44 produces<pat::ElectronCollection>();
63 &&
dataset !=
"Summer12_LegacyPaper" ) )
65 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown MC dataset";
71 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown Data dataset";
75 if(combinationType!=3 && applyLinearityCorrection)
77 std::cout <<
"[CalibratedElectronProducer] " 78 <<
"Warning: you chose combinationType!=3 and applyLinearityCorrection=True. Linearity corrections are only applied on top of combination 3." << std::endl;
82 std::cout <<
"[CalibratedPATElectronProducer] Correcting scale for dataset " <<
dataset << std::endl;
86 switch ( correctionsType )
93 std::cout <<
"You choose regression 1 scale corrections" << std::endl;
99 std::cout <<
"You choose regression 2 scale corrections." << std::endl;
104 <<
"You choose standard non-regression ecal energy scale corrections. They are not implemented yet.";
108 <<
"Unknown correctionsType !!!";
127 std::cout <<
"[CalibratedPATElectronProducer] " 128 <<
"ElectronEnergyCalibrator object is created " << std::endl;
134 edm::FileInPath(combinationRegressionInputPath.c_str()).fullPath().c_str(),
142 std::cout <<
"[CalibratedPATElectronProducer] " 143 <<
"Combination tools are created and initialized " << std::endl;
158 pat::ElectronCollection::const_iterator
electron ;
159 pat::ElectronCollection::iterator ele ;
164 ele!=oldElectrons->end();
170 electrons->push_back(clone);
177 ele = electrons->begin();
178 ele != electrons->end() ;
183 int run =
event.run();
185 float r9 = ele->r9();
186 double correctedEcalEnergy = ele->correctedEcalEnergy();
187 double correctedEcalEnergyError = ele->correctedEcalEnergyError();
189 double trackMomentumError = ele->trackMomentumError();
190 double combinedMomentum = ele->p();
191 double combinedMomentumError = 0;
194 combinedMomentumError = ele->p4Error(ele->candidateP4Kind());
199 if( !ele->ecalDrivenSeed() )
201 double error = 999. ;
202 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
205 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02} ;
206 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
208 else if ( ele->isEE() )
210 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
211 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
213 combinedMomentumError =
error;
228 correctedEcalEnergyError,
231 ele->ecalRegressionEnergy(),
232 ele->ecalRegressionError(),
234 combinedMomentumError,
235 ele->superCluster()->eta(),
239 ele->trackerDrivenSeed()
254 std::cout <<
"[CalibratedPATElectronProducer] " 255 <<
"You choose not to combine." << std::endl;
261 std::cout <<
"[CalibratedPATElectronProducer] " 262 <<
"You choose corrected regression energy for standard combination" << std::endl;
270 std::cout <<
"[CalibratedPATElectronProducer] " 271 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
279 std::cout <<
"[CalibratedPATElectronProducer] " 280 <<
"You choose regression combination." << std::endl;
287 <<
"Unknown combination Type !!!" ;
293 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
294 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
295 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
296 mySimpleElectron.getCombinedMomentum() ) ;
301 mySimpleElectron.getTrackerMomentumError(),
302 mySimpleElectron.getCombinedMomentumError()
307 std::cout <<
"[CalibratedPATElectronProducer] Combined momentum after saving " 308 << ele->p4().t() << std::endl;
316 std::cout <<
"[CalibratedPATElectronProducer] " 317 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
edm::EDGetTokenT< edm::View< reco::Candidate > > inputPatElectronsToken
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
def setup(process, global_tag, zero_tesla=False)
void calibrate(SimpleElectron &electron, edm::StreamID const &)
std::string combinationRegressionInputPath
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::string scaleCorrectionsInputPath
CalibratedPatElectronProducer(const edm::ParameterSet &)
std::vector< Electron > ElectronCollection
void correctLinearity(SimpleElectron &electron)
virtual ~CalibratedPatElectronProducer()
EpCombinationTool * myEpCombinationTool
ElectronEPcombinator * myCombinator
void setCombinationMode(int mode)
Analysis-level electron class.
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
StreamID streamID() const
void combine(SimpleElectron &electron)
const_iterator begin() const
first daughter const_iterator
ElectronEnergyCalibrator * theEnCorrector
std::string linCorrectionsInputPath
Power< A, B >::type pow(const A &a, const B &b)
bool applyLinearityCorrection