21 #include "CLHEP/Units/GlobalPhysicalConstants.h"
26 using namespace reco ;
43 assert (matchingCondition_==
"Cone") ;
191 h1_chi2 =
bookH1(
"chi2",
"ele track #chi^{2}",100,0.,15.,
"#Chi^{2}");
199 h1_lostHits =
bookH1(
"lostHits",
"ele track # lost hits",5,0.,5.,
"N_{lost hits}");
248 h1_fbrem =
bookH1(
"fbrem",
"ele brem fraction",100,0.,1.,
"P_{in} - P_{out} / P_{in}") ;
255 h1_mva =
bookH1(
"mva",
"ele identification mva",100,-1.,1.,
"mva");
259 h1_tkSumPt_dr03 =
bookH1(
"tkSumPt_dr03",
"tk isolation sum, dR=0.3",100,0.0,20.,
"TkIsoSum (GeV/c)",
"Events",
"ELE_LOGY E1 P");
260 h1_ecalRecHitSumEt_dr03 =
bookH1(
"ecalRecHitSumEt_dr03",
"ecal isolation sum, dR=0.3",100,0.0,20.,
"EcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
261 h1_hcalTowerSumEt_dr03 =
bookH1(
"hcalTowerSumEt_dr03",
"hcal isolation sum, dR=0.3",100,0.0,20.,
"HcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
286 { matchingObjectType =
"SC" ; }
287 if (matchingObjectType==
"")
288 {
edm::LogError(
"ElectronMcFakeValidator::beginJob")<<
"Unknown matching object type !" ; }
290 {
edm::LogInfo(
"ElectronMcFakeValidator::beginJob")<<
"Matching object type: "<<matchingObjectType ; }
333 const BeamSpot bs = *recoBeamSpotHandle ;
335 int ievt = iEvent.
id().
event();
336 int irun = iEvent.
id().
run();
340 <<
"Treating "<<gsfElectrons.
product()->size()<<
" electrons"
341 <<
" from event "<<ievt<<
" in run "<<irun<<
" and lumiblock "<<ils ;
345 reco::GsfElectronCollection::const_iterator gsfIter ;
347 ( gsfIter=gsfElectrons->begin() ;
348 gsfIter!=gsfElectrons->end();
353 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
354 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
355 vertexTIP =
sqrt(vertexTIP) ;
358 if (!
selected(gsfIter,vertexTIP)) continue ;
383 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
384 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
402 h1_chi2->
Fill( gsfIter->gsfTrack()->normalizedChi2() );
403 py_chi2VsEta->
Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
404 py_chi2VsPhi->
Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
466 int eleClass = gsfIter->classification() ;
467 if (gsfIter->isEE()) eleClass+=5;
475 if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(0.);
476 if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(-2.);
477 if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(2.);
494 int matchingObjectNum=0;
495 reco::SuperClusterCollection::const_iterator moIter ;
497 ( moIter=recoClusters->begin() ;
498 moIter!=recoClusters->end() ;
521 bool okGsfFound =
false ;
522 double gsfOkRatio = 999999999. ;
524 reco::GsfElectronCollection::const_iterator gsfIter ;
526 ( gsfIter=gsfElectrons->begin() ;
527 gsfIter!=gsfElectrons->end() ;
530 reco::GsfElectronCollection::const_iterator gsfIter2 ;
532 ( gsfIter2=gsfIter+1;
533 gsfIter2!=gsfElectrons->end() ;
537 if(matchingObjectNum == 1){
h1_mee->
Fill(invMass) ;}
538 if ((matchingObjectNum == 1) && (((gsfIter->charge())*(gsfIter2->charge()))<0.))
543 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
544 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
545 vertexTIP =
sqrt(vertexTIP) ;
548 if (!
selected(gsfIter,vertexTIP)) continue ;
553 double dphi = gsfIter->phi()-moIter->phi() ;
555 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
561 double tmpGsfRatio = gsfIter->p()/moIter->energy() ;
564 gsfOkRatio = tmpGsfRatio;
565 bestGsfElectron=*gsfIter;
602 float mee2 = p12.Dot(p12) ;
603 float invMass =
sqrt(mee2) ;
694 if (gsfIter->pt()<
minPt_)
return true ;
696 if (gsfIter->isEB() &&
isEE_)
return true ;
697 if (gsfIter->isEE() &&
isEB_)
return true ;
701 if (gsfIter->trackerDrivenSeed() &&
isEcalDriven_)
return true ;
708 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<
minEt_)
return true ;
715 if (gsfIter->isEB() && vertexTIP >
tipMaxBarrel_)
return true ;
718 if (gsfIter->dr03TkSumPt() >
tkIso03Max_)
return true ;
730 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() <
eOverPMinBarrel_)
return true ;
731 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() >
eOverPMaxBarrel_)
return true ;
732 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() <
eOverPMinEndcaps_)
return true ;
733 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() >
eOverPMaxEndcaps_)
return true ;
MonitorElement * h1_foundHits
T getParameter(std::string const &) const
EventNumber_t event() const
MonitorElement * bookP1(const std::string &name, const std::string &title, int nchX, double lowX, double highX, double lowY, double highY, const std::string &titleX="", const std::string &titleY="", Option_t *option="E1 P")
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")
double hadronicOverEmMaxEndcaps_
MonitorElement * h1_mee_os
const LorentzVector & p4(P4Kind kind) const
bool selected(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP)
MonitorElement * h1_dPhiSc_propVtx_barrel
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * h1_vertexPt_barrel
MonitorElement * py_lostHitsVsEta
MonitorElement * h1_sclSigEtaEta_barrel
MonitorElement * py_chi2VsEta
edm::EDGetTokenT< reco::SuperClusterCollection > matchingObjectCollection_
MonitorElement * h1_vertexEta
MonitorElement * py_chi2VsPhi
MonitorElement * h1_Eop_endcaps
MonitorElement * h1_ecalRecHitSumEt_dr03
edm::LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * h1_hcalTowerSumEt_dr03
MonitorElement * h1_matchingObject_Eta
MonitorElement * h1_Hoe_barrel
edm::InputTag triggerResults_
MonitorElement * py_HoeVsPhi
MonitorElement * h1_matchedObject_Pt
double sigIetaIetaMinBarrel_
double maxPtMatchingObject_
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 ecalIso03MaxBarrel_
MonitorElement * h1_matchedObject_Phi
MonitorElement * h1_tkSumPt_dr03
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double sigIetaIetaMaxBarrel_
MonitorElement * h2_vertexXvsY
MonitorElement * py_fbremVsEta
MonitorElement * h1_provenance
MonitorElement * h1_dEtaEleCl_propOut_barrel
MonitorElement * py_EopVsPhi
MonitorElement * h1_Eop_barrel
double sigIetaIetaMinEndcaps_
MonitorElement * py_dEtaSc_propVtxVsPhi
double sigIetaIetaMaxEndcaps_
Abs< T >::type abs(const T &t)
std::string matchingCondition_
double hcalIso03Depth1MaxBarrel_
MonitorElement * h1_dEtaEleCl_propOut_endcaps
MonitorElement * h1_Hoe_endcaps
ElectronAnalyzer(const edm::ParameterSet &conf)
edm::EDGetTokenT< reco::GsfTrackCollection > gsftrackCollection_
MonitorElement * h1_vertexPt_endcaps
MonitorElement * py_lostHitsVsPhi
double deltaR(double eta1, double eta2, double phi1, double phi2)
MonitorElement * h1_vertexZ
MonitorElement * py_dPhiSc_propVtxVsPhi
double hcalIso03Depth1MaxEndcaps_
MonitorElement * h1_dPhiEleCl_propOut_endcaps
virtual void analyze(const edm::Event &e, const edm::EventSetup &c)
MonitorElement * py_fbremVsPhi
MonitorElement * py_foundHitsVsPhi
bool etCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
MonitorElement * h1_fbrem
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
double maxAbsEtaMatchingObject_
MonitorElement * h1_lostHits
MonitorElement * h2_vertexEtaVsPhi
MonitorElement * h1_EeleOPout_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")
edm::EDGetTokenT< reco::GsfElectronCollection > electronCollection_
MonitorElement * h1_classes
MonitorElement * h1_sclEt
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
MonitorElement * h1_EeleOPout_barrel
bool generalCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
MonitorElement * h1_dEtaSc_propVtx_barrel
float computeInvMass(const reco::GsfElectron &e1, const reco::GsfElectron &e2)
MonitorElement * h1_matchingObject_Phi
MonitorElement * h1_dPhiSc_propVtx_endcaps
double ecalIso03MaxEndcaps_
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
virtual ~ElectronAnalyzer()
MonitorElement * h1_sclSigEtaEta_endcaps
const Point & position() const
position
volatile std::atomic< bool > shutdown_flag false
MonitorElement * py_foundHitsVsEta
edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
bool idCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
double hcalIso03Depth2MaxEndcaps_
double hadronicOverEmMaxBarrel_
MonitorElement * h1_matchedObject_Eta
MonitorElement * h1_matchingObject_Pt
Power< A, B >::type pow(const A &a, const B &b)
MonitorElement * h1_dPhiEleCl_propOut_barrel
MonitorElement * h1_dEtaSc_propVtx_endcaps
bool isolationCut(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP)