112 validToken = iEvent.
getByToken(TrackCollection_, tracks_h);
113 if(!validToken)
return;
121 validToken = iEvent.
getByToken(GSFTrackCollection_, gsftracks_h);
122 if(!validToken)
return;
131 float evt_bField = magneticField->inTesla(
GlobalPoint(0.,0.,0.)).z();
140 validToken = iEvent.
getByToken(GSFElectron_, els_h);
141 if(!validToken)
return;
146 validToken = iEvent.
getByToken(GSFElectronCollection_, els_coll_h);
147 if(!validToken)
return;
154 validToken = iEvent.
getByToken(PFCandidateCollection_, pfCand_h);
155 if(!validToken)
return;
163 validToken = iEvent.
getByToken(thePVCollection_, vertexHandle);
164 if(!validToken)
return;
185 validToken = iEvent.
getByToken(BeamSpot_, beamspot_h);
186 if(!validToken)
return;
196 double mass = 0.000510998918;
204 const Track* el_track = (
const Track*)(el->gsfTrack().get());
206 const TrackRef ctfTkRef = el->closestTrack();
213 VertexCollection::const_iterator firstGoodVertex = vertexCollection->end();
214 int firstGoodVertexIdx = 0;
215 for (VertexCollection::const_iterator vtx = vertexCollection->begin(); vtx != vertexCollection->end(); ++vtx, ++firstGoodVertexIdx) {
216 if ( !vtx->isFake() && vtx->ndof()>=4. && vtx->position().Rho()<=2.0 && fabs(vtx->position().Z())<=24.0) {
217 firstGoodVertex = vtx;
226 int fiducialityMask = 0;
227 if ( el->isEB() ) fiducialityMask |= 1 <<
ISEB;
228 if ( el->isEBEEGap() ) fiducialityMask |= 1 <<
ISEBEEGAP;
229 if ( el->isEE() ) fiducialityMask |= 1 <<
ISEE;
230 if ( el->isEEGap() ) fiducialityMask |= 1 <<
ISEEGAP;
231 if ( el->isEBEtaGap() ) fiducialityMask |= 1 <<
ISEBETAGAP;
232 if ( el->isEBPhiGap() ) fiducialityMask |= 1 <<
ISEBPHIGAP;
233 if ( el->isEEDeeGap() ) fiducialityMask |= 1 <<
ISEEDEEGAP;
234 if ( el->isEERingGap() ) fiducialityMask |= 1 <<
ISEERINGGAP;
235 if ( el->isGap() ) fiducialityMask |= 1 <<
ISGAP;
242 int electronTypeMask = 0;
244 if ( el->trackerDrivenSeed() ) electronTypeMask |= 1 <<
ISTRACKERDRIVEN;
245 if ( el->ecalDrivenSeed() ) electronTypeMask |= 1 <<
ISECALDRIVEN;
246 if ( el->passingCutBasedPreselection() ) electronTypeMask |= 1 <<
ISCUTPRESELECTED;
247 if ( el->passingMvaPreselection() ) electronTypeMask |= 1 <<
ISMVAPRESELECTED;
259 p4In.SetXYZT ( p3In.x() , p3In.y() , p3In.z() ,
sqrt( mass*mass + p3In.R() *p3In.R() ) );
260 p4Out.SetXYZT( p3Out.x(), p3Out.y(), p3Out.z(),
sqrt( mass*mass + p3Out.R()*p3Out.R() ) );
268 hww.
els_type() .push_back( electronTypeMask );
279 hww.
els_ecalIso() .push_back( el->dr03EcalRecHitSumEt() );
280 hww.
els_hcalIso() .push_back( el->dr03HcalTowerSumEt() );
281 hww.
els_tkIso() .push_back( el->dr03TkSumPt() );
290 if ( firstGoodVertex!=vertexCollection->end() ) {
302 float pfiso_ch = 0.0;
303 float pfiso_em = 0.0;
304 float pfiso_nh = 0.0;
306 PFIsolation2012(*el, vertexCollection, firstGoodVertexIdx, 0.3, pfiso_ch, pfiso_em, pfiso_nh);
311 PFIsolation2012(*el, vertexCollection, firstGoodVertexIdx, 0.4, pfiso_ch, pfiso_em, pfiso_nh);
338 hww.
els_etaSC() .push_back( el->superCluster()->eta() );
339 hww.
els_eSC() .push_back( el->superCluster()->energy() );
340 hww.
els_eSCRaw() .push_back( el->superCluster()->rawEnergy() );
341 hww.
els_eSCPresh() .push_back( el->superCluster()->preshowerEnergy() );
342 hww.
els_nSeed() .push_back( el->basicClustersSize() - 1 );
343 hww.
els_e1x5() .push_back( el->e1x5() );
344 hww.
els_e5x5() .push_back( el->e5x5() );
346 hww.
els_etaSCwidth() .push_back( el->superCluster()->etaWidth() );
347 hww.
els_phiSCwidth() .push_back( el->superCluster()->phiWidth() );
354 if( el->superCluster()->seed().isAvailable() ) {
356 const BasicCluster& clRef = *(el->superCluster()->seed());
357 const vector<float>& lcovs = clusterTools.localCovariances(clRef);
358 const vector<float> localCovariancesSC = clusterTools.scLocalCovariances(*(el->superCluster()));
360 hww.
els_sigmaIPhiIPhi() .push_back( isfinite(lcovs[2]) ? lcovs[2] > 0 ?
sqrt(lcovs[2]) : -1 *
sqrt(-1 * lcovs[2]) : -9999. );
361 hww.
els_e3x3() .push_back( clusterTools.e3x3(clRef) );
375 hww.
els_hOverE() .push_back( el->hcalOverEcal() );
376 hww.
els_eOverPIn() .push_back( el->eSuperClusterOverP() );
380 hww.
els_fbrem() .push_back( el->fbrem() );
382 hww.
els_dEtaIn() .push_back( el->deltaEtaSuperClusterTrackAtVtx() );
383 hww.
els_dEtaOut() .push_back( el->deltaEtaSeedClusterTrackAtCalo() );
384 hww.
els_dPhiIn() .push_back( el->deltaPhiSuperClusterTrackAtVtx() );
385 hww.
els_dPhiOut() .push_back( el->deltaPhiSeedClusterTrackAtCalo() );
397 hww.
els_d0() .push_back( el_track->
d0() );
398 hww.
els_d0corr() .push_back( -1*(el_track->
dxy(beamSpotreco)) );
407 hww.
els_trkidx() . push_back( static_cast<int> ( ctfTkRef.
key() ) );
408 hww.
els_trkshFrac() . push_back( static_cast<float>( el->ctfGsfOverlap() ) );
421 if ( firstGoodVertex!=vertexCollection->end() ) {
428 hww.
els_ip3d() . push_back( -999. );
445 vector<ConversionInfo> v_convInfos = convFinder.getConversionInfos(*(el->core()), tracks_h, gsftracks_h, evt_bField);
448 vector<int> v_gsftkidx;
449 vector<int> v_delmisshits;
451 vector<float> v_dist;
452 vector<float> v_dcot;
454 vector<LorentzVector> v_pos_p4;
456 for(
unsigned int i_conv = 0; i_conv < v_convInfos.size(); i_conv++) {
458 math::XYZPoint convPoint = v_convInfos.at(i_conv).pointOfConversion();
459 float convPointX = isfinite(convPoint.x()) ? convPoint.x() : -9999.;
460 float convPointY = isfinite(convPoint.y()) ? convPoint.y() : -9999.;
461 float convPointZ = isfinite(convPoint.z()) ? convPoint.z() : -9999.;
463 v_dist .push_back( isfinite(v_convInfos.at(i_conv).dist()) ? v_convInfos.at(i_conv).dist() : -9999. );
464 v_dcot .push_back( v_convInfos.at(i_conv).dcot() );
465 v_rad .push_back( v_convInfos.at(i_conv).radiusOfConversion() );
466 v_delmisshits .push_back( v_convInfos.at(i_conv).deltaMissingHits() );
467 v_flag .push_back( v_convInfos.at(i_conv).flag() );
468 v_pos_p4 .push_back(
LorentzVector(convPointX, convPointY, convPointZ, 0) );
470 if( v_convInfos.at(i_conv).conversionPartnerCtfTk().isNonnull() ) {
471 v_tkidx.push_back(v_convInfos.at(i_conv).conversionPartnerCtfTk().key());
474 v_tkidx.push_back(-9999);
478 if( v_convInfos.at(i_conv).conversionPartnerGsfTk().isNonnull() ) {
479 v_gsftkidx.push_back(v_convInfos.at(i_conv).conversionPartnerGsfTk().key());
482 v_gsftkidx.push_back(-9999);
488 ConversionInfo convInfo = convFinder.getConversionInfo( *el, tracks_h, gsftracks_h, evt_bField );
499 iEvent.
getByToken(ConversionCollection_, convs_h);
506 hww.
els_conv_old_dist() . push_back( isfinite(el->convDist()) ? el->convDist() : -9999. );
507 hww.
els_conv_old_dcot() . push_back( isfinite(el->convDcot()) ? el->convDcot() : -9999. );
522 float footprintdr,
float gammastripveto,
float elestripveto,
int filterId){
526 float pffootprint = 0.;
527 float pfjurveto = 0.;
528 float pfjurvetoq = 0.;
533 if (gsfTrack.
isNull() && siTrack.
isNull())
return -9999.;
536 float eleta = el.
eta();
538 for (PFCandidateCollection::const_iterator pf=pfCand_h->begin(); pf<pfCand_h->end(); ++pf){
540 float pfeta = pf->eta();
541 float dR =
deltaR(pfeta, pf->phi(), eleta, el.
phi());
542 if (dR>coner)
continue;
544 float deta = fabs(pfeta - eleta);
545 int pfid =
abs(pf->pdgId());
546 float pfpt = pf->pt();
548 if (filterId!=0 && filterId!=pfid)
continue;
550 if (pf->charge()==0) {
554 if (dR<footprintdr && pfid==130) pffootprint+=pfpt;
555 if (deta<gammastripveto && pfid==22) pfjurveto+=pfpt;
564 if ( pf->gsfTrackRef().isNonnull()) {
565 if (gsfTrack.
isNonnull() && gsfTrack.
key()==pf->gsfTrackRef().key())
continue;
568 if (pfid==11 && pf->gsfTrackRef().isNonnull()) {
569 if(fabs(pf->gsfTrackRef()->dz(vtx.
position()) - eldz )<dzcut) {
571 if (deta<elestripveto && pfid==11) pfjurvetoq+=pfpt;
577 if(fabs( pfTrack->dz(vtx.
position()) - eldz )<dzcut) {
579 if (deta<elestripveto && pfid==11) pfjurvetoq+=pfpt;
584 return pfciso+pfniso-pffootprint-pfjurveto-pfjurvetoq;
589 const int vertexIndex,
const float &
R,
float &pfiso_ch,
float &pfiso_em,
float &pfiso_nh)
598 reco::PFCandidateCollection::const_iterator pf = pfCand_h->begin();
599 for (pf = pfCand_h->begin(); pf != pfCand_h->end(); ++pf) {
606 const float dR =
deltaR(pf->eta(), pf->phi(), el.
eta(), el.
phi());
607 if (dR > R)
continue;
613 if (pfVertexIndex != vertexIndex)
continue;
void Load_els_conv_old_dist()
std::vector< float > & els_ip3derr()
double p() const
momentum vector magnitude
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< float > & els_iso03_pf2012_ch()
std::vector< float > & els_iso04_pf_nhad05()
T getParameter(std::string const &) const
bool isNonnull() const
Checks for non-null.
std::vector< float > & els_conv_dcot()
std::vector< float > & els_tkIso()
std::vector< int > & els_exp_innerlayers()
double d0() const
dxy parameter in perigee convention (d0 = -dxy)
std::vector< float > & els_e3x3()
std::vector< float > & els_ndof()
void Load_els_conv_old_dcot()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< LorentzVector > & els_vertex_p4()
std::vector< float > & els_hOverE()
std::vector< float > & els_d0corr()
std::vector< float > & els_ecalEnergy()
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
std::vector< int > & els_nSeed()
std::vector< float > & els_d0()
std::vector< float > & els_iso04_pf2012_nh()
std::vector< float > & els_eOverPOut()
std::vector< int > & els_sccharge()
std::vector< float > & els_iso04_pf2012_em()
std::vector< float > & els_ip3d()
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< float > & els_fbrem()
void Load_els_iso03_pf_ch()
void Load_els_eOverPOut()
std::vector< float > & els_conv_dist()
double deltaR(const T1 &t1, const T2 &t2)
key_type key() const
Accessor for product key.
double px() const
x coordinate of momentum vector
void Load_els_iso04_pf2012_em()
float electronIsoValuePF(HWW &, const unsigned int iel, unsigned int ivtx, float coner=0.4, float minptn=1.0, float dzcut=0.1, float footprintdr=0.07, float gammastripveto=0.025, float elestripveto=-999., int filterId=0)
void Load_els_eSeedOverPOut()
const Point & position() const
position
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
virtual double eta() const
momentum pseudorapidity
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
std::vector< float > & els_iso04_pf2012_ch()
void Load_els_iso04_pf_nhad05()
std::vector< int > & els_gsftrkidx()
std::vector< float > & els_iso03_pf2012_nh()
std::vector< float > & els_eOverPIn()
std::vector< float > & els_iso03_pf_ch()
std::vector< float > & els_iso03_pf_gamma05()
void Load_els_trk_charge()
void Load_els_iso03_pf_nhad05()
std::vector< int > & els_trk_charge()
void Load_els_conv_dist()
double chi2() const
chi-squared of the fit
std::vector< float > & els_ecalIso()
double ndof() const
number of degrees of freedom of the fit
std::vector< float > & els_eSeedOverPOut()
std::vector< float > & els_chi2()
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
void Load_els_exp_innerlayers()
void Load_els_trkshFrac()
std::vector< float > & els_eSC()
void Load_els_sigmaIEtaIEta()
std::vector< float > & els_conv_old_dist()
Abs< T >::type abs(const T &t)
void Load_els_etaSCwidth()
std::vector< float > & els_dEtaOut()
void Load_els_hcalIso04()
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< float > > XYZVectorF
spatial vector with cartesian internal representation
std::vector< float > & els_dPhiOut()
std::vector< float > & els_hcalIso()
std::vector< LorentzVector > & els_p4()
std::vector< float > & els_etaSC()
void Load_els_sigmaIPhiIPhi()
bool isNull() const
Checks for null.
std::vector< float > & els_eSCPresh()
double pz() const
z coordinate of momentum vector
std::vector< float > & els_iso03_pf_nhad05()
void Load_els_iso03_pf2012_nh()
void Load_els_ecalIso04()
void SetVars(HWW &, const edm::Event &, const edm::EventSetup &)
double electronIsoValuePF(const reco::GsfElectron &el, const reco::Vertex &vtx, float coner, float minptn, float dzcut, float footprintdr, float gammastripveto, float elestripveto, int filterId)
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
void Load_els_iso04_pf2012_nh()
double vz() const
z coordinate of the reference point on track
std::vector< float > & els_iso04_pf_gamma05()
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< float > & els_e5x5()
std::vector< float > & els_etaSCwidth()
std::vector< float > & els_trkshFrac()
T const * product() const
void Load_els_iso04_pf_gamma05()
void Load_els_fiduciality()
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
std::vector< float > & els_eSCRaw()
std::vector< float > & els_ecalIso04()
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< float > & els_conv_old_dcot()
std::vector< int > & els_charge()
void Load_els_ecalEnergy()
std::vector< float > & els_hcalIso04()
int chargedHadronVertex(const reco::VertexCollection &vertices, const reco::PFCandidate &pfcand) const
void Load_els_eSeedOverPIn()
ElectronMaker(const edm::ParameterSet &, edm::ConsumesCollector)
std::vector< float > & els_dPhiIn()
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > LorentzVector
void Load_els_iso04_pf_ch()
std::vector< int > & els_type()
std::vector< float > & els_e1x5()
std::vector< float > & els_iso04_pf_ch()
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void Load_els_iso03_pf2012_em()
void Load_els_iso04_pf2012_ch()
std::vector< float > & els_dEtaIn()
int charge() const
track electric charge
const Point & position() const
position
std::vector< float > & els_phiSCwidth()
std::vector< float > & els_iso03_pf2012_em()
void Load_els_iso03_pf2012_ch()
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< float > & els_eSeedOverPIn()
void Load_els_vertex_p4()
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
void Load_els_conv_dcot()
virtual double phi() const
momentum azimuthal angle
std::vector< float > & els_sigmaIEtaIEta()
void PFIsolation2012(const reco::GsfElectron &el, const reco::VertexCollection *vertexCollection, const int vertexIndex, const float &R, float &pfiso_ch, float &pfiso_em, float &pfiso_nh)
void Load_els_gsftrkidx()
double py() const
y coordinate of momentum vector
std::vector< LorentzVector > & els_trk_p4()
math::PtEtaPhiELorentzVectorF LorentzVector
int numberOfHits(HitCategory category) const
std::vector< float > & els_sigmaIPhiIPhi()
virtual TrackRef closestTrack() const
std::vector< int > & els_trkidx()
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
std::vector< int > & els_fiduciality()
std::vector< float > & els_z0corr()
void Load_els_iso03_pf_gamma05()
void Load_els_phiSCwidth()