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");
70 &&
dataset !=
"Summer12_LegacyPaper" ) )
72 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown MC dataset";
78 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown Data dataset";
82 if(combinationType!=3 && applyLinearityCorrection)
84 std::cout <<
"[CalibratedElectronProducer] "
85 <<
"Warning: you chose combinationType!=3 and applyLinearityCorrection=True. Linearity corrections are only applied on top of combination 3." << std::endl;
89 std::cout <<
"[CalibratedPATElectronProducer] Correcting scale for dataset " <<
dataset << std::endl;
93 switch ( correctionsType )
100 std::cout <<
"You choose regression 1 scale corrections" << std::endl;
106 std::cout <<
"You choose regression 2 scale corrections." << std::endl;
111 <<
"You choose standard non-regression ecal energy scale corrections. They are not implemented yet.";
115 <<
"Unknown correctionsType !!!";
124 applyLinearityCorrection,
134 std::cout <<
"[CalibratedPATElectronProducer] "
135 <<
"ElectronEnergyCalibrator object is created " << std::endl;
139 myEpCombinationTool->init
149 std::cout <<
"[CalibratedPATElectronProducer] "
150 <<
"Combination tools are created and initialized " << std::endl;
163 event.getByToken(inputPatElectronsToken,oldElectrons) ;
165 ElectronCollection::const_iterator
electron ;
166 ElectronCollection::iterator ele ;
171 ele!=oldElectrons->end();
177 electrons->push_back(clone);
180 if (correctionsType != 0 )
184 ele = electrons->begin();
185 ele != electrons->end() ;
190 int run =
event.run();
192 float r9 = ele->r9();
193 double correctedEcalEnergy = ele->correctedEcalEnergy();
194 double correctedEcalEnergyError = ele->correctedEcalEnergyError();
196 double trackMomentumError = ele->trackMomentumError();
197 double combinedMomentum = ele->p();
198 double combinedMomentumError = 0;
199 if ( ele->candidateP4Kind() != GsfElectron::P4_UNKNOWN )
201 combinedMomentumError = ele->p4Error(ele->candidateP4Kind());
206 if( !ele->ecalDrivenSeed() )
208 double error = 999. ;
209 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
212 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02} ;
213 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
215 else if ( ele->isEE() )
217 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
218 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
220 combinedMomentumError =
error;
235 correctedEcalEnergyError,
238 ele->ecalRegressionEnergy(),
239 ele->ecalRegressionError(),
241 combinedMomentumError,
242 ele->superCluster()->eta(),
246 ele->trackerDrivenSeed()
250 if ( ele->core()->ecalDrivenSeed() || correctionsType==2 || combinationType==3 )
252 theEnCorrector->calibrate(mySimpleElectron, event.
streamID());
256 switch ( combinationType )
261 std::cout <<
"[CalibratedPATElectronProducer] "
262 <<
"You choose not to combine." << std::endl;
268 std::cout <<
"[CalibratedPATElectronProducer] "
269 <<
"You choose corrected regression energy for standard combination" << std::endl;
271 myCombinator->setCombinationMode(1);
272 myCombinator->combine(mySimpleElectron);
277 std::cout <<
"[CalibratedPATElectronProducer] "
278 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
280 myCombinator->setCombinationMode(2);
281 myCombinator->combine(mySimpleElectron);
286 std::cout <<
"[CalibratedPATElectronProducer] "
287 <<
"You choose regression combination." << std::endl;
290 theEnCorrector->correctLinearity(mySimpleElectron);
294 <<
"Unknown combination Type !!!" ;
300 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
301 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
302 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
303 mySimpleElectron.getCombinedMomentum() ) ;
308 mySimpleElectron.getTrackerMomentumError(),
309 mySimpleElectron.getCombinedMomentumError()
314 std::cout <<
"[CalibratedPATElectronProducer] Combined momentum after saving "
315 << ele->p4().t() << std::endl;
323 std::cout <<
"[CalibratedPATElectronProducer] "
324 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
328 event.put(electrons) ;
T getParameter(std::string const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
tuple applyExtraHighEnergyProtection
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)