25 #include "CLHEP/Units/GlobalPhysicalConstants.h"
30 using namespace reco ;
47 assert (matchingCondition_==
"Cone") ;
195 h1_chi2 =
bookH1(
"chi2",
"ele track #chi^{2}",100,0.,15.,
"#Chi^{2}");
203 h1_lostHits =
bookH1(
"lostHits",
"ele track # lost hits",5,0.,5.,
"N_{lost hits}");
252 h1_fbrem =
bookH1(
"fbrem",
"ele brem fraction",100,0.,1.,
"P_{in} - P_{out} / P_{in}") ;
259 h1_mva =
bookH1(
"mva",
"ele identification mva",100,-1.,1.,
"mva");
263 h1_tkSumPt_dr03 =
bookH1(
"tkSumPt_dr03",
"tk isolation sum, dR=0.3",100,0.0,20.,
"TkIsoSum (GeV/c)",
"Events",
"ELE_LOGY E1 P");
264 h1_ecalRecHitSumEt_dr03 =
bookH1(
"ecalRecHitSumEt_dr03",
"ecal isolation sum, dR=0.3",100,0.0,20.,
"EcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
265 h1_hcalTowerSumEt_dr03 =
bookH1(
"hcalTowerSumEt_dr03",
"hcal isolation sum, dR=0.3",100,0.0,20.,
"HcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
286 std::string matchingObjectType ;
288 { matchingObjectType =
"SC" ; }
289 if (matchingObjectType==
"")
290 {
edm::LogError(
"ElectronMcFakeValidator::beginJob")<<
"Unknown matching object type !" ; }
292 {
edm::LogInfo(
"ElectronMcFakeValidator::beginJob")<<
"Matching object type: "<<matchingObjectType ; }
346 const BeamSpot bs = *recoBeamSpotHandle ;
348 int ievt = iEvent.
id().
event();
349 int irun = iEvent.
id().
run();
353 <<
"Treating "<<gsfElectrons.
product()->size()<<
" electrons"
354 <<
" from event "<<ievt<<
" in run "<<irun<<
" and lumiblock "<<ils ;
358 reco::GsfElectronCollection::const_iterator gsfIter ;
360 ( gsfIter=gsfElectrons->begin() ;
361 gsfIter!=gsfElectrons->end();
366 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
367 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
368 vertexTIP =
sqrt(vertexTIP) ;
371 if (!
selected(gsfIter,vertexTIP)) continue ;
396 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
397 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
415 h1_chi2->
Fill( gsfIter->gsfTrack()->normalizedChi2() );
416 py_chi2VsEta->
Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
417 py_chi2VsPhi->
Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
479 int eleClass = gsfIter->classification() ;
480 if (gsfIter->isEE()) eleClass+=5;
488 if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(0.);
489 if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(-2.);
490 if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(2.);
508 reco::SuperClusterCollection::const_iterator moIter ;
510 ( moIter=recoClusters->begin() ;
511 moIter!=recoClusters->end() ;
534 bool okGsfFound =
false ;
535 double gsfOkRatio = 999999999. ;
537 reco::GsfElectronCollection::const_iterator gsfIter ;
539 ( gsfIter=gsfElectrons->begin() ;
540 gsfIter!=gsfElectrons->end() ;
543 reco::GsfElectronCollection::const_iterator gsfIter2 ;
545 ( gsfIter2=gsfIter+1;
546 gsfIter2!=gsfElectrons->end() ;
551 if (((gsfIter->charge())*(gsfIter2->charge()))<0.)
556 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
557 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
558 vertexTIP =
sqrt(vertexTIP) ;
561 if (!
selected(gsfIter,vertexTIP)) continue ;
566 double dphi = gsfIter->phi()-moIter->phi() ;
568 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
574 double tmpGsfRatio = gsfIter->p()/moIter->energy() ;
577 gsfOkRatio = tmpGsfRatio;
578 bestGsfElectron=*gsfIter;
615 float mee2 = p12.Dot(p12) ;
616 float invMass =
sqrt(mee2) ;
707 if (gsfIter->pt()<
minPt_)
return true ;
709 if (gsfIter->isEB() &&
isEE_)
return true ;
710 if (gsfIter->isEE() &&
isEB_)
return true ;
714 if (gsfIter->trackerDrivenSeed() &&
isEcalDriven_)
return true ;
721 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<
minEt_)
return true ;
728 if (gsfIter->isEB() && vertexTIP >
tipMaxBarrel_)
return true ;
731 if (gsfIter->dr03TkSumPt() >
tkIso03Max_)
return true ;
743 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() <
eOverPMinBarrel_)
return true ;
744 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() >
eOverPMaxBarrel_)
return true ;
745 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() <
eOverPMinEndcaps_)
return true ;
746 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
bool selected(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP)
MonitorElement * h1_dPhiSc_propVtx_barrel
edm::InputTag vertexCollection_
MonitorElement * h1_vertexPt_barrel
MonitorElement * py_lostHitsVsEta
MonitorElement * h1_sclSigEtaEta_barrel
MonitorElement * py_chi2VsEta
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_
edm::InputTag gsftrackCollection_
MonitorElement * h2_vertexXvsY
MonitorElement * py_fbremVsEta
MonitorElement * h1_provenance
MonitorElement * h1_dEtaEleCl_propOut_barrel
MonitorElement * py_EopVsPhi
edm::InputTag matchingObjectCollection_
MonitorElement * h1_Eop_barrel
edm::InputTag electronCollection_
double sigIetaIetaMinEndcaps_
MonitorElement * py_dEtaSc_propVtxVsPhi
double sigIetaIetaMaxEndcaps_
std::string matchingCondition_
double hcalIso03Depth1MaxBarrel_
MonitorElement * h1_dEtaEleCl_propOut_endcaps
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
MonitorElement * h1_Hoe_endcaps
ElectronAnalyzer(const edm::ParameterSet &conf)
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
double maxAbsEtaMatchingObject_
MonitorElement * h1_lostHits
MonitorElement * h2_vertexEtaVsPhi
MonitorElement * h1_EeleOPout_endcaps
edm::InputTag beamSpotTag_
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")
MonitorElement * h1_classes
MonitorElement * h1_sclEt
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_matchedObject_Z
MonitorElement * h1_dPhiSc_propVtx_endcaps
double ecalIso03MaxEndcaps_
MonitorElement * h1_matchingObject_Z
edm::InputTag trackCollection_
virtual ~ElectronAnalyzer()
MonitorElement * h1_sclSigEtaEta_endcaps
const Point & position() const
position
MonitorElement * py_foundHitsVsEta
bool idCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
double hcalIso03Depth2MaxEndcaps_
double hadronicOverEmMaxBarrel_
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
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)