44 using namespace reco ;
50 produces<ElectronCollection>();
55 updateEnergyError = cfg.
getParameter<
bool>(
"updateEnergyError");
57 correctionsType = cfg.
getParameter<
int>(
"correctionsType");
58 applyLinearityCorrection = cfg.
getParameter<
bool>(
"applyLinearityCorrection");
59 combinationType = cfg.
getParameter<
int>(
"combinationType");
61 synchronization = cfg.
getParameter<
bool>(
"synchronization");
69 &&
dataset !=
"Summer12_LegacyPaper" ) )
71 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown MC dataset";
77 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown Data dataset";
81 if(combinationType!=3 && applyLinearityCorrection)
83 std::cout <<
"[CalibratedElectronProducer] "
84 <<
"Warning: you chose combinationType!=3 and applyLinearityCorrection=True. Linearity corrections are only applied on top of combination 3." << std::endl;
88 std::cout <<
"[CalibratedPATElectronProducer] Correcting scale for dataset " <<
dataset << std::endl;
92 switch ( correctionsType )
99 std::cout <<
"You choose regression 1 scale corrections" << std::endl;
105 std::cout <<
"You choose regression 2 scale corrections." << std::endl;
110 <<
"You choose standard non-regression ecal energy scale corrections. They are not implemented yet.";
114 <<
"Unknown correctionsType !!!";
123 applyLinearityCorrection,
133 std::cout <<
"[CalibratedPATElectronProducer] "
134 <<
"ElectronEnergyCalibrator object is created " << std::endl;
138 myEpCombinationTool->init
148 std::cout <<
"[CalibratedPATElectronProducer] "
149 <<
"Combination tools are created and initialized " << std::endl;
162 event.getByToken(inputPatElectronsToken,oldElectrons) ;
164 ElectronCollection::const_iterator
electron ;
165 ElectronCollection::iterator ele ;
170 ele!=oldElectrons->end();
176 electrons->push_back(clone);
179 if (correctionsType != 0 )
183 ele = electrons->begin();
184 ele != electrons->end() ;
189 int run =
event.run();
191 float r9 = ele->r9();
192 double correctedEcalEnergy = ele->correctedEcalEnergy();
193 double correctedEcalEnergyError = ele->correctedEcalEnergyError();
195 double trackMomentumError = ele->trackMomentumError();
196 double combinedMomentum = ele->p();
197 double combinedMomentumError = ele->p4Error(ele->candidateP4Kind());
201 if( !ele->ecalDrivenSeed() )
203 double error = 999. ;
204 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
207 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02} ;
208 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
210 else if ( ele->isEE() )
212 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
213 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
215 combinedMomentumError =
error;
230 correctedEcalEnergyError,
233 ele->ecalRegressionEnergy(),
234 ele->ecalRegressionError(),
236 combinedMomentumError,
237 ele->superCluster()->eta(),
241 ele->trackerDrivenSeed()
245 if ( ele->core()->ecalDrivenSeed() || correctionsType==2 || combinationType==3 )
247 theEnCorrector->calibrate(mySimpleElectron, event.
streamID());
251 switch ( combinationType )
256 std::cout <<
"[CalibratedPATElectronProducer] "
257 <<
"You choose not to combine." << std::endl;
263 std::cout <<
"[CalibratedPATElectronProducer] "
264 <<
"You choose corrected regression energy for standard combination" << std::endl;
266 myCombinator->setCombinationMode(1);
267 myCombinator->combine(mySimpleElectron);
272 std::cout <<
"[CalibratedPATElectronProducer] "
273 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
275 myCombinator->setCombinationMode(2);
276 myCombinator->combine(mySimpleElectron);
281 std::cout <<
"[CalibratedPATElectronProducer] "
282 <<
"You choose regression combination." << std::endl;
284 myEpCombinationTool->combine(mySimpleElectron);
285 theEnCorrector->correctLinearity(mySimpleElectron);
289 <<
"Unknown combination Type !!!" ;
295 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
296 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
297 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
298 mySimpleElectron.getCombinedMomentum() ) ;
303 mySimpleElectron.getTrackerMomentumError(),
304 mySimpleElectron.getCombinedMomentumError()
309 std::cout <<
"[CalibratedPATElectronProducer] Combined momentum after saving "
310 << ele->p4().t() << std::endl;
318 std::cout <<
"[CalibratedPATElectronProducer] "
319 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
323 event.put(electrons) ;
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
virtual void produce(edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
CalibratedPatElectronProducer(const edm::ParameterSet &)
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
std::vector< Electron > ElectronCollection
collectin of Electron objects
virtual ~CalibratedPatElectronProducer()
Analysis-level electron class.
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
virtual const_iterator begin() const =0
first daughter const_iterator
StreamID streamID() const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)