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 = 0;
198 if ( ele->candidateP4Kind() != GsfElectron::P4_UNKNOWN )
200 combinedMomentumError = ele->p4Error(ele->candidateP4Kind());
205 if( !ele->ecalDrivenSeed() )
207 double error = 999. ;
208 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
211 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02} ;
212 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
214 else if ( ele->isEE() )
216 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
217 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
219 combinedMomentumError =
error;
234 correctedEcalEnergyError,
237 ele->ecalRegressionEnergy(),
238 ele->ecalRegressionError(),
240 combinedMomentumError,
241 ele->superCluster()->eta(),
245 ele->trackerDrivenSeed()
249 if ( ele->core()->ecalDrivenSeed() || correctionsType==2 || combinationType==3 )
251 theEnCorrector->calibrate(mySimpleElectron, event.
streamID());
255 switch ( combinationType )
260 std::cout <<
"[CalibratedPATElectronProducer] "
261 <<
"You choose not to combine." << std::endl;
267 std::cout <<
"[CalibratedPATElectronProducer] "
268 <<
"You choose corrected regression energy for standard combination" << std::endl;
270 myCombinator->setCombinationMode(1);
271 myCombinator->combine(mySimpleElectron);
276 std::cout <<
"[CalibratedPATElectronProducer] "
277 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
279 myCombinator->setCombinationMode(2);
280 myCombinator->combine(mySimpleElectron);
285 std::cout <<
"[CalibratedPATElectronProducer] "
286 <<
"You choose regression combination." << std::endl;
288 myEpCombinationTool->combine(mySimpleElectron);
289 theEnCorrector->correctLinearity(mySimpleElectron);
293 <<
"Unknown combination Type !!!" ;
299 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
300 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
301 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
302 mySimpleElectron.getCombinedMomentum() ) ;
307 mySimpleElectron.getTrackerMomentumError(),
308 mySimpleElectron.getCombinedMomentumError()
313 std::cout <<
"[CalibratedPATElectronProducer] Combined momentum after saving "
314 << ele->p4().t() << std::endl;
322 std::cout <<
"[CalibratedPATElectronProducer] "
323 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
327 event.put(electrons) ;
T getParameter(std::string const &) const
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)
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
StreamID streamID() const
const_iterator begin() const
first daughter const_iterator
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)