23 #include "CLHEP/Units/GlobalPhysicalConstants.h"
29 using namespace reco ;
180 h1_chi2 =
bookH1(
"chi2",
"ele track #chi^{2}",100,0.,15.,
"#Chi^{2}");
182 h1_lostHits =
bookH1(
"lostHits",
"ele track # lost hits",5,0.,5.,
"N_{lost hits}");
203 h1_fbrem =
bookH1(
"fbrem",
"ele brem fraction",100,0.,1.,
"P_{in} - P_{out} / P_{in}") ;
207 h1_mva =
bookH1(
"mva",
"ele identification mva",100,-1.,1.);
211 h1_tkSumPt_dr03 =
bookH1(
"tkSumPt_dr03",
"tk isolation sum, dR=0.3",100,0.0,20.,
"TkIsoSum, cone 0.3 (GeV/c)",
"Events",
"ELE_LOGY E1 P");
212 h1_ecalRecHitSumEt_dr03 =
bookH1(
"ecalRecHitSumEt_dr03",
"ecal isolation sum, dR=0.3",100,0.0,20.,
"EcalIsoSum, cone 0.3 (GeV)",
"Events",
"ELE_LOGY E1 P");
213 h1_hcalTowerSumEt_dr03 =
bookH1(
"hcalTowerSumEt_dr03",
"hcal isolation sum, dR=0.3",100,0.0,20.,
"HcalIsoSum, cone 0.3 (GeV)",
"Events",
"ELE_LOGY E1 P");
227 std::string matchingObjectType ;
229 { matchingObjectType =
"SC" ; }
230 if (matchingObjectType==
"")
231 {
edm::LogError(
"ElectronMcFakeValidator::beginJob")<<
"Unknown matching object type !" ; }
233 {
edm::LogInfo(
"ElectronMcFakeValidator::beginJob")<<
"Matching object type: "<<matchingObjectType ; }
264 const BeamSpot bs = *recoBeamSpotHandle ;
266 int ievt = iEvent.
id().
event();
267 int irun = iEvent.
id().
run();
271 <<
"Treating "<<gsfElectrons.
product()->size()<<
" electrons"
272 <<
" from event "<<ievt<<
" in run "<<irun<<
" and lumiblock "<<ils ;
275 std::vector<std::pair<double,double> > TTCheck;
276 std::vector<std::pair<double,double> > TTscCheck;
279 reco::GsfElectronCollection::const_iterator gsfIter ;
281 ( gsfIter=gsfElectrons->begin() ;
282 gsfIter!=gsfElectrons->end();
287 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
288 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
289 vertexTIP =
sqrt(vertexTIP) ;
292 if (!
selected(gsfIter,vertexTIP)) continue ;
295 reco::SuperClusterCollection::const_iterator moIter ;
297 ( moIter=recoClusters->begin() ;
298 moIter!=recoClusters->end() ;
301 if (moIter->eta()==sclTagRef->eta())
continue ;
315 float SCenergy = moIter->energy();
317 float theta = caloposition.Theta();
319 float SCmomentumX = SCenergy*
sin(theta)*
cos(moIter->phi());
320 float SCmomentumY = SCenergy*
sin(theta)*
sin(moIter->phi());
321 float SCmomentumZ = SCenergy*
cos(theta);
325 float mee2 = p12.Dot(p12);
326 float invMass =
sqrt(mee2);
328 if( invMass < massLow_ || invMass >
massHigh_ ) continue ;
338 bool okGsfFound =
false;
340 reco::GsfElectronCollection::const_iterator gsfIter2 ;
343 ( gsfIter2=gsfElectrons->begin();
344 gsfIter2!=gsfElectrons->end() ;
348 sclProbeRef = gsfIter2->superCluster();
350 if (sclProbeRef->eta() == moIter->eta())
353 bestGsfElectron=*gsfIter2;
356 bool opsign = (((gsfIter->charge())*(bestGsfElectron.
charge()))<0.) ;
358 { okGsfFound =
false ;
362 { okGsfFound =
true ; }
398 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
399 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
410 if (bestGsfElectron.
isEB())
421 if (bestGsfElectron.
isEE())
436 if (bestGsfElectron.
isEE()) eleClass+=5;
453 bool invMassTTAlreadyFilled =
false;
454 if(TTCheck.size() != 0){
455 int TTCheckDim = TTCheck.size();
456 for(
int i=0 ;
i<TTCheckDim;
i++){
457 if((bestGsfElectron.
eta() == TTCheck.at(
i).first) && (gsfIter->eta() == TTCheck.at(
i).second)){
458 invMassTTAlreadyFilled=
true;
464 if (!invMassTTAlreadyFilled && (((gsfIter->charge())*(bestGsfElectron.
charge()))<0.))
468 float mee2bis = p12.Dot(p12bis);
469 float invMassEE =
sqrt(mee2bis);
471 std::pair<double,double>
p(gsfIter->eta(),bestGsfElectron.
eta());
472 TTCheck.push_back(
p);
491 float mee2 = p12.Dot(p12) ;
492 float invMass =
sqrt(mee2) ;
497 (
const reco::SuperClusterCollection::const_iterator & moIter,
501 h1_matchedObject_Eta->Fill( moIter->eta() );
503 h1_matchedObject_Pt->Fill( moIter->energy()/cosh(moIter->eta()) );
504 h1_matchedObject_Phi->Fill( moIter->phi() );
604 if (gsfIter->pt()<
minPt_)
return true ;
606 if (gsfIter->isEB() &&
isEE_)
return true ;
607 if (gsfIter->isEE() &&
isEB_)
return true ;
611 if (gsfIter->trackerDrivenSeed() &&
isEcalDriven_)
return true ;
618 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<
minEt_)
return true ;
625 if (gsfIter->isEB() && vertexTIP >
tipMaxBarrel_)
return true ;
628 if (gsfIter->dr03TkSumPt() >
tkIso03Max_)
return true ;
640 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() <
eOverPMinBarrel_)
return true ;
641 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() >
eOverPMaxBarrel_)
return true ;
642 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() <
eOverPMinEndcaps_)
return true ;
643 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() >
eOverPMaxEndcaps_)
return true ;
void fillMatchedHistos(const reco::SuperClusterCollection::const_iterator &moIter, const reco::GsfElectron &electron)
T getParameter(std::string const &) const
EventNumber_t event() const
MonitorElement * h1_dEtaEleCl_propOut_endcaps
edm::InputTag gsftrackCollection_
MonitorElement * h1_sclSigEtaEta_barrel
MonitorElement * h1_EeleOPout_barrel
edm::InputTag beamSpotTag_
MonitorElement * bookH1(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
MonitorElement * h1_EeleOPout_endcaps
MonitorElement * h1_dEtaSc_propVtx_endcaps
double hadronicOverEmMaxBarrel_
float scSigmaEtaEta() const
double hcalIso03Depth2MaxEndcaps_
double sigIetaIetaMinBarrel_
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
const LorentzVector & p4(P4Kind kind) const
edm::InputTag vertexCollection_
edm::InputTag matchingObjectCollection_
float eSuperClusterOverP() const
double sigIetaIetaMinEndcaps_
MonitorElement * h1_Hoe_endcaps
MonitorElement * h1_ecalRecHitSumEt_dr03
virtual const Point & vertex() const
vertex position
edm::InputTag triggerResults_
Sin< T >::type sin(const T &t)
double sigIetaIetaMaxEndcaps_
float computeInvMass(const reco::GsfElectron &e1, const reco::GsfElectron &e2)
Geom::Theta< T > theta() const
edm::LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * h1_hcalTowerSumEt_dr03
MonitorElement * h1_dPhiEleCl_propOut_barrel
double hadronicOverEmMaxEndcaps_
MonitorElement * h1_Hoe_barrel
MonitorElement * h1_matchedObject_Pt
double ecalIso03MaxEndcaps_
MonitorElement * h1_mee_os
MonitorElement * bookH1withSumw2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, const std::string &titleX="", const std::string &titleY="Events", Option_t *option="E1 P")
double sigIetaIetaMaxBarrel_
virtual double eta() const
momentum pseudorapidity
ElectronTagProbeAnalyzer(const edm::ParameterSet &conf)
MonitorElement * h1_vertexEta
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
MonitorElement * h1_vertexPt_endcaps
MonitorElement * h1_provenance
float deltaEtaSuperClusterTrackAtVtx() const
float hadronicOverEm() const
MonitorElement * h1_dPhiSc_propVtx_endcaps
MonitorElement * h1_matchingObject_Eta
MonitorElement * h1_tkSumPt_dr03
MonitorElement * h1_Eop_barrel
double hcalIso03Depth1MaxEndcaps_
MonitorElement * h1_classes
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
MonitorElement * h2_vertexXvsY
float deltaPhiSuperClusterTrackAtVtx() const
Cos< T >::type cos(const T &t)
virtual int charge() const
electric charge
float dr03TkSumPt() const
MonitorElement * h2_vertexEtaVsPhi
MonitorElement * h1_lostHits
bool isolationCut(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP)
MonitorElement * h1_matchingObject_Pt
float eEleClusterOverPout() const
MonitorElement * h1_fbrem
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
float deltaPhiEleClusterTrackAtCalo() const
double ecalIso03MaxBarrel_
MonitorElement * h1_matchedObject_Eta
MonitorElement * h1_Eop_endcaps
MonitorElement * h1_vertexZ
MonitorElement * h1_matchedObject_Phi
float deltaEtaEleClusterTrackAtCalo() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
virtual double pt() const
transverse momentum
XYZPointD XYZPoint
point in space with cartesian internal representation
Classification classification() const
MonitorElement * h1_dEtaEleCl_propOut_barrel
MonitorElement * h1_sclSigEtaEta_endcaps
T const * product() const
MonitorElement * bookH2(const std::string &name, const std::string &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="COLZ")
float dr03EcalRecHitSumEt() const
MonitorElement * h1_dPhiEleCl_propOut_endcaps
virtual ~ElectronTagProbeAnalyzer()
MonitorElement * h1_matchingObject_Phi
MonitorElement * h1_vertexPt_barrel
bool generalCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
bool trackerDrivenSeed() const
float dr03HcalTowerSumEt() const
const Point & position() const
position
bool etCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
MonitorElement * h1_foundHits
MonitorElement * h1_dPhiSc_propVtx_barrel
edm::InputTag electronCollection_
virtual double phi() const
momentum azimuthal angle
math::XYZTLorentzVector LorentzVector
Lorentz vector.
MonitorElement * h1_dEtaSc_propVtx_barrel
double hcalIso03Depth1MaxBarrel_
bool selected(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP)
edm::InputTag trackCollection_
MonitorElement * h1_sclEt
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
bool ecalDrivenSeed() const
bool idCut(const reco::GsfElectronCollection::const_iterator &gsfIter)