46 using namespace reco ;
52 produces<ElectronCollection>();
57 updateEnergyError = cfg.
getParameter<
bool>(
"updateEnergyError");
59 correctionsType = cfg.
getParameter<
int>(
"correctionsType");
60 applyLinearityCorrection = cfg.
getParameter<
bool>(
"applyLinearityCorrection");
61 combinationType = cfg.
getParameter<
int>(
"combinationType");
63 synchronization = cfg.
getParameter<
bool>(
"synchronization");
64 combinationRegressionInputPath = cfg.
getParameter<std::string>(
"combinationRegressionInputPath");
65 scaleCorrectionsInputPath = cfg.
getParameter<std::string>(
"scaleCorrectionsInputPath");
66 linCorrectionsInputPath = cfg.
getParameter<std::string>(
"linearityCorrectionsInputPath");
69 if ( isMC && ( dataset !=
"Summer11" && dataset !=
"Fall11"
70 && dataset !=
"Summer12" && dataset !=
"Summer12_DR53X_HCP2012"
71 && dataset !=
"Summer12_LegacyPaper" ) )
73 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown MC dataset";
75 if ( !isMC && ( dataset !=
"Prompt" && dataset !=
"ReReco"
76 && dataset !=
"Jan16ReReco" && dataset !=
"ICHEP2012"
77 && dataset !=
"Moriond2013" && dataset !=
"22Jan2013ReReco" ) )
79 throw cms::Exception(
"CalibratedPATElectronProducer|ConfigError") <<
"Unknown Data dataset";
83 if(combinationType!=3 && applyLinearityCorrection)
85 std::cout <<
"[CalibratedElectronProducer] "
86 <<
"Warning: you chose combinationType!=3 and applyLinearityCorrection=True. Linearity corrections are only applied on top of combination 3." << std::endl;
90 std::cout <<
"[CalibratedPATElectronProducer] Correcting scale for dataset " << dataset << std::endl;
93 std::string pathToDataCorr;
94 switch ( correctionsType )
101 std::cout <<
"You choose regression 1 scale corrections" << std::endl;
107 std::cout <<
"You choose regression 2 scale corrections." << std::endl;
112 <<
"You choose standard non-regression ecal energy scale corrections. They are not implemented yet.";
116 <<
"Unknown correctionsType !!!";
125 applyLinearityCorrection,
135 std::cout <<
"[CalibratedPATElectronProducer] "
136 <<
"ElectronEnergyCalibrator object is created " << std::endl;
140 myEpCombinationTool->init
142 edm::FileInPath(combinationRegressionInputPath.c_str()).fullPath().c_str(),
150 std::cout <<
"[CalibratedPATElectronProducer] "
151 <<
"Combination tools are created and initialized " << std::endl;
164 event.getByLabel(inputPatElectrons,oldElectrons) ;
166 ElectronCollection::const_iterator
electron ;
167 ElectronCollection::iterator ele ;
172 ele!=oldElectrons->end();
178 electrons->push_back(clone);
181 if (correctionsType != 0 )
185 ele = electrons->begin();
186 ele != electrons->end() ;
191 int run =
event.run();
193 float r9 = ele->r9();
194 double correctedEcalEnergy = ele->correctedEcalEnergy();
195 double correctedEcalEnergyError = ele->correctedEcalEnergyError();
197 double trackMomentumError = ele->trackMomentumError();
198 double combinedMomentum = ele->p();
199 double combinedMomentumError = ele->p4Error(ele->candidateP4Kind());
203 if( !ele->ecalDrivenSeed() )
205 double error = 999. ;
206 double momentum = (combinedMomentum<15. ? 15. : combinedMomentum);
209 float parEB[3] = { 5.24e-02, 2.01e-01, 1.00e-02} ;
210 error = momentum *
sqrt(
pow(parEB[0]/
sqrt(momentum),2) +
pow(parEB[1]/momentum,2) +
pow(parEB[2],2) );
212 else if ( ele->isEE() )
214 float parEE[3] = { 1.46e-01, 9.21e-01, 1.94e-03} ;
215 error = momentum *
sqrt(
pow(parEE[0]/
sqrt(momentum),2) +
pow(parEE[1]/momentum,2) +
pow(parEE[2],2) );
217 combinedMomentumError =
error;
232 correctedEcalEnergyError,
235 ele->ecalRegressionEnergy(),
236 ele->ecalRegressionError(),
238 combinedMomentumError,
239 ele->superCluster()->eta(),
243 ele->trackerDrivenSeed()
247 if ( ele->core()->ecalDrivenSeed() || correctionsType==2 || combinationType==3 )
249 theEnCorrector->calibrate(mySimpleElectron);
253 switch ( combinationType )
258 std::cout <<
"[CalibratedPATElectronProducer] "
259 <<
"You choose not to combine." << std::endl;
265 std::cout <<
"[CalibratedPATElectronProducer] "
266 <<
"You choose corrected regression energy for standard combination" << std::endl;
268 myCombinator->setCombinationMode(1);
269 myCombinator->combine(mySimpleElectron);
274 std::cout <<
"[CalibratedPATElectronProducer] "
275 <<
"You choose uncorrected regression energy for standard combination" << std::endl;
277 myCombinator->setCombinationMode(2);
278 myCombinator->combine(mySimpleElectron);
283 std::cout <<
"[CalibratedPATElectronProducer] "
284 <<
"You choose regression combination." << std::endl;
286 myEpCombinationTool->combine(mySimpleElectron);
287 theEnCorrector->correctLinearity(mySimpleElectron);
291 <<
"Unknown combination Type !!!" ;
297 ( oldMomentum.x()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
298 oldMomentum.y()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
299 oldMomentum.z()*mySimpleElectron.getCombinedMomentum()/oldMomentum.t(),
300 mySimpleElectron.getCombinedMomentum() ) ;
305 mySimpleElectron.getTrackerMomentumError(),
306 mySimpleElectron.getCombinedMomentumError()
311 std::cout <<
"[CalibratedPATElectronProducer] Combined momentum after saving "
312 << ele->p4().t() << std::endl;
320 std::cout <<
"[CalibratedPATElectronProducer] "
321 <<
"You choose not to correct. Uncorrected Regression Energy is taken." << std::endl;
325 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_FWK_MODULE(HiMixingModule)
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
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)