20 #include "CLHEP/Units/GlobalPhysicalConstants.h" 25 using namespace reco ;
42 assert (matchingCondition_==
"Cone") ;
170 h2_vertexEtaVsPhi =
bookH2(iBooker,
"vertexEtaVsPhi",
"ele momentum #eta vs #phi",
nbineta2D,
etamin,
etamax,
nbinphi2D,
phimin,
phimax,
"#eta",
"#phi (rad)");
171 h2_vertexXvsY =
bookH2(iBooker,
"vertexXvsY",
"ele vertex x vs y",
nbinxyz2D,-0.1,0.1,
nbinxyz2D,-0.1,0.1,
"x (cm)",
"y (cm)");
178 h1_chi2 =
bookH1(iBooker,
"chi2",
"ele track #chi^{2}",100,0.,15.,
"#Chi^{2}");
184 h1_lostHits =
bookH1(iBooker,
"lostHits",
"ele track # lost hits",5,0.,5.,
"N_{lost hits}");
197 py_dEtaSc_propVtxVsPhi =
bookP1(iBooker,
"dEtaSc_propVtxVsPhi",
"ele #eta_{sc} - #eta_{tr}, prop from vertex vs #phi",
nbinphi2D,
phimin,
phimax,
detamatchmin,
detamatchmax,
"#phi (rad)",
"<#eta_{sc} - #eta_{tr}>");
204 py_dPhiSc_propVtxVsPhi =
bookP1(iBooker,
"dPhiSc_propVtxVsPhi",
"ele #phi_{sc} - #phi_{tr}, prop from vertex vs #phi",
nbinphi2D,
phimin,
phimax,
dphimatchmin,
dphimatchmax,
"#phi (rad)",
"<#phi_{sc} - #phi_{tr}> (rad)");
210 py_HoeVsPhi =
bookP1(iBooker,
"HoeVsPhi",
"ele hadronic energy / em energy vs #phi",
nbinphi2D,
phimin,
phimax,
hoemin,
hoemax,
"#phi (rad)",
"<H/E>",
"E1 P") ;
217 h1_fbrem =
bookH1(iBooker,
"fbrem",
"ele brem fraction",100,0.,1.,
"P_{in} - P_{out} / P_{in}") ;
223 h1_mva =
bookH1(iBooker,
"mva",
"ele identification mva",100,-1.,1.,
"mva");
227 h1_tkSumPt_dr03 =
bookH1(iBooker,
"tkSumPt_dr03",
"tk isolation sum, dR=0.3",100,0.0,20.,
"TkIsoSum (GeV/c)",
"Events",
"ELE_LOGY E1 P");
228 h1_ecalRecHitSumEt_dr03 =
bookH1(iBooker,
"ecalRecHitSumEt_dr03",
"ecal isolation sum, dR=0.3",100,0.0,20.,
"EcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
229 h1_hcalTowerSumEt_dr03 =
bookH1(iBooker,
"hcalTowerSumEt_dr03",
"hcal isolation sum, dR=0.3",100,0.0,20.,
"HcalIsoSum (GeV)",
"Events",
"ELE_LOGY E1 P");
232 h1_PFch_dr03 =
bookH1(iBooker,
"PFch_dr03",
"Charged PF candidate sum, dR=0.3",100,0.0,20.,
"PF charged (GeV/c)",
"Events",
"ELE_LOGY E1 P");
233 h1_PFem_dr03 =
bookH1(iBooker,
"PFem_dr03",
"Neutral EM PF candidate sum, dR=0.3",100,0.0,20.,
"PF neutral EM (GeV)",
"Events",
"ELE_LOGY E1 P");
234 h1_PFnh_dr03 =
bookH1(iBooker,
"PFnh_dr03",
"Neutral Had PF candidate sum, dR=0.3",100,0.0,20.,
"PF neutral Had (GeV)",
"Events",
"ELE_LOGY E1 P");
252 if (std::string::npos !=
std::string(l.module).find(
"SuperCluster",0))
253 { matchingObjectType =
"SC" ; }
254 if (matchingObjectType==
"")
255 {
edm::LogError(
"ElectronMcFakeValidator::beginJob")<<
"Unknown matching object type !" ; }
257 {
edm::LogInfo(
"ElectronMcFakeValidator::beginJob")<<
"Matching object type: "<<matchingObjectType ; }
289 const BeamSpot bs = *recoBeamSpotHandle ;
296 <<
"Treating "<<gsfElectrons.
product()->size()<<
" electrons" 297 <<
" from event "<<ievt<<
" in run "<<irun<<
" and lumiblock "<<ils ;
301 reco::GsfElectronCollection::const_iterator gsfIter ;
303 ( gsfIter=gsfElectrons->begin() ;
304 gsfIter!=gsfElectrons->end();
309 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
310 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
311 vertexTIP =
sqrt(vertexTIP) ;
314 if (!
selected(gsfIter,vertexTIP)) continue ;
317 reco::GsfElectronCollection::const_iterator gsfIter2 ;
319 ( gsfIter2=gsfIter+1;
320 gsfIter2!=gsfElectrons->end() ;
323 if (!
selected(gsfIter2,vertexTIP))
continue ;
326 if ( ( (gsfIter->charge())*(gsfIter2->charge()) )<0. )
329 if (gsfIter->isEB() && gsfIter2->isEB())
331 else if (gsfIter->isEE() && gsfIter2->isEE())
349 double R=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y() +sclRef->z()*sclRef->z());
350 double Rt=TMath::Sqrt(sclRef->x()*sclRef->x() + sclRef->y()*sclRef->y());
362 h1_chi2->
Fill( gsfIter->gsfTrack()->normalizedChi2() );
363 py_chi2VsEta->
Fill( gsfIter->eta(), gsfIter->gsfTrack()->normalizedChi2() );
364 py_chi2VsPhi->
Fill( gsfIter->phi(), gsfIter->gsfTrack()->normalizedChi2() );
384 if (gsfIter->eta() > 0) {
409 int eleClass = gsfIter->classification() ;
410 if (gsfIter->isEE()) eleClass+=5;
418 if (gsfIter->trackerDrivenSeed()||gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(0.);
419 if (gsfIter->trackerDrivenSeed()&&!gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(-2.);
420 if (!gsfIter->trackerDrivenSeed()&&gsfIter->ecalDrivenSeed())
h1_provenance->
Fill(2.);
437 int matchingObjectNum=0;
438 reco::SuperClusterCollection::const_iterator moIter ;
440 ( moIter=recoClusters->begin() ;
441 moIter!=recoClusters->end() ;
457 bool okGsfFound =
false ;
458 double gsfOkRatio = 999999999. ;
460 reco::GsfElectronCollection::const_iterator gsfIter ;
462 ( gsfIter=gsfElectrons->begin() ;
463 gsfIter!=gsfElectrons->end() ;
468 (gsfIter->vertex().x()-bs.
position().x()) * (gsfIter->vertex().x()-bs.
position().x()) +
469 (gsfIter->vertex().y()-bs.
position().y()) * (gsfIter->vertex().y()-bs.
position().y()) ;
470 vertexTIP =
sqrt(vertexTIP) ;
473 if (!
selected(gsfIter,vertexTIP)) continue ;
478 double dphi = gsfIter->phi()-moIter->phi() ;
480 { dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi ; }
484 double tmpGsfRatio = gsfIter->p()/moIter->energy() ;
487 gsfOkRatio = tmpGsfRatio;
488 bestGsfElectron=*gsfIter;
514 float mee2 = p12.Dot(p12) ;
515 float invMass = mee2 > 0. ?
sqrt(mee2) : 0;
531 if (gsfIter->pt()<
minPt_)
return true ;
533 if (gsfIter->isEB() &&
isEE_)
return true ;
534 if (gsfIter->isEE() &&
isEB_)
return true ;
538 if (gsfIter->trackerDrivenSeed() &&
isEcalDriven_)
return true ;
545 if (gsfIter->superCluster()->energy()/cosh(gsfIter->superCluster()->eta())<
minEt_)
return true ;
552 if (gsfIter->isEB() && vertexTIP >
tipMaxBarrel_)
return true ;
555 if (gsfIter->dr03TkSumPt() >
tkIso03Max_)
return true ;
567 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() <
eOverPMinBarrel_)
return true ;
568 if (gsfIter->isEB() && gsfIter->eSuperClusterOverP() >
eOverPMaxBarrel_)
return true ;
569 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() <
eOverPMinEndcaps_)
return true ;
570 if (gsfIter->isEE() && gsfIter->eSuperClusterOverP() >
eOverPMaxEndcaps_)
return true ;
MonitorElement * h1_foundHits
T getParameter(std::string const &) const
EventNumber_t event() const
MonitorElement * h1_dEtaSc_propVtx_endcapsPos
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 * h1_PFch_dr03
MonitorElement * py_lostHitsVsEta
MonitorElement * h1_mee_os_bb
MonitorElement * h1_sclSigEtaEta_barrel
MonitorElement * py_chi2VsEta
edm::EDGetTokenT< reco::SuperClusterCollection > matchingObjectCollection_
MonitorElement * h1_vertexEta
MonitorElement * py_chi2VsPhi
MonitorElement * h1_Eop_endcaps
MonitorElement * bookH1withSumw2(DQMStore::IBooker &, 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")
unsigned long long EventNumber_t
MonitorElement * h1_ecalRecHitSumEt_dr03
edm::LuminosityBlockNumber_t luminosityBlock() const
MonitorElement * h1_hcalTowerSumEt_dr03
MonitorElement * h1_dPhiEleCl_propOut_endcapsNeg
MonitorElement * h1_matchingObject_Eta
MonitorElement * h1_Hoe_barrel
MonitorElement * bookH2(DQMStore::IBooker &, 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::InputTag triggerResults_
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * py_HoeVsPhi
MonitorElement * h1_matchedObject_Pt
double sigIetaIetaMinBarrel_
double maxPtMatchingObject_
unsigned int LuminosityBlockNumber_t
double ecalIso03MaxBarrel_
MonitorElement * h1_matchedObject_Phi
MonitorElement * h1_PFem_dr03
MonitorElement * h1_mee_os_ee
MonitorElement * h1_tkSumPt_dr03
MonitorElement * h1_dEtaEleCl_propOut_endcapsPos
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
double sigIetaIetaMaxBarrel_
MonitorElement * h2_vertexXvsY
void setCurrentFolder(std::string const &fullpath)
MonitorElement * h1_dPhiSc_propVtx_endcapsPos
MonitorElement * py_fbremVsEta
MonitorElement * h1_provenance
MonitorElement * h1_dEtaEleCl_propOut_barrel
MonitorElement * py_EopVsPhi
MonitorElement * h1_PFnh_dr03
MonitorElement * h1_Eop_barrel
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
double sigIetaIetaMinEndcaps_
MonitorElement * py_dEtaSc_propVtxVsPhi
double sigIetaIetaMaxEndcaps_
Abs< T >::type abs(const T &t)
std::string matchingCondition_
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
MonitorElement * h1_dPhiEleCl_propOut_endcapsPos
double hcalIso03Depth1MaxBarrel_
MonitorElement * h1_Hoe_endcaps
MonitorElement * bookP1(DQMStore::IBooker &, 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 * h1_dEtaEleCl_propOut_endcapsNeg
MonitorElement * h1_dPhiSc_propVtx_endcapsNeg
ElectronAnalyzer(const edm::ParameterSet &conf)
~ElectronAnalyzer() override
edm::EDGetTokenT< reco::GsfTrackCollection > gsftrackCollection_
MonitorElement * h1_vertexPt_endcaps
MonitorElement * py_lostHitsVsPhi
MonitorElement * h1_vertexZ
MonitorElement * py_dPhiSc_propVtxVsPhi
double hcalIso03Depth1MaxEndcaps_
MonitorElement * py_fbremVsPhi
T const * product() const
MonitorElement * h1_dEtaSc_propVtx_endcapsNeg
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
edm::EDGetTokenT< reco::GsfElectronCollection > electronCollection_
MonitorElement * h1_classes
MonitorElement * h1_sclEt
MonitorElement * h1_sigIEtaIEta5x5_barrel
MonitorElement * h1_EeleOPout_barrel
std::string outputInternalPath_
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
double ecalIso03MaxEndcaps_
MonitorElement * h1_mee_os_eb
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
MonitorElement * h1_sigIEtaIEta5x5_endcaps
MonitorElement * h1_sclSigEtaEta_endcaps
const Point & position() const
position
MonitorElement * bookH1(DQMStore::IBooker &, 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 * py_foundHitsVsEta
edm::EDGetTokenT< reco::VertexCollection > vertexCollection_
bool idCut(const reco::GsfElectronCollection::const_iterator &gsfIter)
double hcalIso03Depth2MaxEndcaps_
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
void analyze(const edm::Event &e, const edm::EventSetup &c) override
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
bool isolationCut(const reco::GsfElectronCollection::const_iterator &gsfIter, double vertexTIP)