23 #include "CLHEP/Units/GlobalPhysicalConstants.h"
28 using namespace reco ;
45 assert (matchingCondition_==
"Cone") ;
193 h1_chi2 =
bookH1(
"chi2",
"ele track #chi^{2}",100,0.,15.,
"#Chi^{2}");
201 h1_lostHits =
bookH1(
"lostHits",
"ele track # lost hits",5,0.,5.,
"N_{lost hits}");
250 h1_fbrem =
bookH1(
"fbrem",
"ele brem fraction",100,0.,1.,
"P_{in} - P_{out} / P_{in}") ;
257 h1_mva =
bookH1(
"mva",
"ele identification mva",100,-1.,1.,
"mva");
261 h1_tkSumPt_dr03 =
bookH1(
"tkSumPt_dr03",
"tk isolation sum, dR=0.3",100,0.0,20.,
"TkIsoSum (GeV/c)",
"Events",
"ELE_LOGY E1 P");
262 h1_ecalRecHitSumEt_dr03 =
bookH1(
"ecalRecHitSumEt_dr03",
"ecal isolation sum, dR=0.3",100,0.0,20.,
"EcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
263 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 ; }
344 const BeamSpot bs = *recoBeamSpotHandle ;
346 int ievt = iEvent.
id().
event();
347 int irun = iEvent.
id().
run();
351 <<
"Treating "<<gsfElectrons.
product()->size()<<
" electrons"
352 <<
" from event "<<ievt<<
" in run "<<irun<<
" and lumiblock "<<ils ;
356 reco::GsfElectronCollection::const_iterator gsfIter ;
358 ( gsfIter=gsfElectrons->begin() ;
359 gsfIter!=gsfElectrons->end();
364 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
365 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
366 vertexTIP =
sqrt(vertexTIP) ;
369 if (!
selected(gsfIter,vertexTIP)) continue ;
394 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
395 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
413 h1_chi2->
Fill( gsfIter->gsfTrack()->normalizedChi2() );
414 py_chi2VsEta->
Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
415 py_chi2VsPhi->
Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
477 int eleClass = gsfIter->classification() ;
478 if (gsfIter->isEE()) eleClass+=5;
486 if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(0.);
487 if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(-2.);
488 if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(2.);
505 int matchingObjectNum=0;
506 reco::SuperClusterCollection::const_iterator moIter ;
508 ( moIter=recoClusters->begin() ;
509 moIter!=recoClusters->end() ;
532 bool okGsfFound =
false ;
533 double gsfOkRatio = 999999999. ;
535 reco::GsfElectronCollection::const_iterator gsfIter ;
537 ( gsfIter=gsfElectrons->begin() ;
538 gsfIter!=gsfElectrons->end() ;
541 reco::GsfElectronCollection::const_iterator gsfIter2 ;
543 ( gsfIter2=gsfIter+1;
544 gsfIter2!=gsfElectrons->end() ;
548 if(matchingObjectNum == 1){
h1_mee->
Fill(invMass) ;}
549 if ((matchingObjectNum == 1) && (((gsfIter->charge())*(gsfIter2->charge()))<0.))
554 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
555 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
556 vertexTIP =
sqrt(vertexTIP) ;
559 if (!
selected(gsfIter,vertexTIP)) continue ;
564 double dphi = gsfIter->phi()-moIter->phi() ;
566 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
572 double tmpGsfRatio = gsfIter->p()/moIter->energy() ;
575 gsfOkRatio = tmpGsfRatio;
576 bestGsfElectron=*gsfIter;
613 float mee2 = p12.Dot(p12) ;
614 float invMass =
sqrt(mee2) ;
705 if (gsfIter->pt()<
minPt_)
return true ;
707 if (gsfIter->isEB() &&
isEE_)
return true ;
708 if (gsfIter->isEE() &&
isEB_)
return true ;
712 if (gsfIter->trackerDrivenSeed() &&
isEcalDriven_)
return true ;
719 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<
minEt_)
return true ;
726 if (gsfIter->isEB() && vertexTIP >
tipMaxBarrel_)
return true ;
729 if (gsfIter->dr03TkSumPt() >
tkIso03Max_)
return true ;
741 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() <
eOverPMinBarrel_)
return true ;
742 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() >
eOverPMaxBarrel_)
return true ;
743 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() <
eOverPMinEndcaps_)
return true ;
744 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
edm::InputTag vertexCollection_
MonitorElement * h1_vertexPt_barrel
MonitorElement * py_lostHitsVsEta
MonitorElement * h1_sclSigEtaEta_barrel
MonitorElement * py_chi2VsEta
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_
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_dPhiSc_propVtx_endcaps
double ecalIso03MaxEndcaps_
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_
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)