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. );
447 vector<ConversionInfo> v_convInfos = convFinder.getConversionInfos(*(el->core()), tracks_h, gsftracks_h, evt_bField);
450 vector<int> v_gsftkidx;
451 vector<int> v_delmisshits;
453 vector<float> v_dist;
454 vector<float> v_dcot;
456 vector<LorentzVector> v_pos_p4;
458 for(
unsigned int i_conv = 0; i_conv < v_convInfos.size(); i_conv++) {
460 math::XYZPoint convPoint = v_convInfos.at(i_conv).pointOfConversion();
461 float convPointX = isfinite(convPoint.x()) ? convPoint.x() : -9999.;
462 float convPointY = isfinite(convPoint.y()) ? convPoint.y() : -9999.;
463 float convPointZ = isfinite(convPoint.z()) ? convPoint.z() : -9999.;
465 v_dist .push_back( isfinite(v_convInfos.at(i_conv).dist()) ? v_convInfos.at(i_conv).dist() : -9999. );
466 v_dcot .push_back( v_convInfos.at(i_conv).dcot() );
467 v_rad .push_back( v_convInfos.at(i_conv).radiusOfConversion() );
468 v_delmisshits .push_back( v_convInfos.at(i_conv).deltaMissingHits() );
469 v_flag .push_back( v_convInfos.at(i_conv).flag() );
470 v_pos_p4 .push_back(
LorentzVector(convPointX, convPointY, convPointZ, 0) );
472 if( v_convInfos.at(i_conv).conversionPartnerCtfTk().isNonnull() ) {
473 v_tkidx.push_back(v_convInfos.at(i_conv).conversionPartnerCtfTk().key());
476 v_tkidx.push_back(-9999);
480 if( v_convInfos.at(i_conv).conversionPartnerGsfTk().isNonnull() ) {
481 v_gsftkidx.push_back(v_convInfos.at(i_conv).conversionPartnerGsfTk().key());
484 v_gsftkidx.push_back(-9999);
490 ConversionInfo convInfo = convFinder.getConversionInfo( *el, tracks_h, gsftracks_h, evt_bField );
501 iEvent.
getByToken(ConversionCollection_, convs_h);
508 hww.
els_conv_old_dist() . push_back( isfinite(el->convDist()) ? el->convDist() : -9999. );
509 hww.
els_conv_old_dcot() . push_back( isfinite(el->convDcot()) ? el->convDcot() : -9999. );
524 float footprintdr,
float gammastripveto,
float elestripveto,
int filterId){
528 float pffootprint = 0.;
529 float pfjurveto = 0.;
530 float pfjurvetoq = 0.;
535 if (gsfTrack.
isNull() && siTrack.
isNull())
return -9999.;
538 float eleta = el.
eta();
540 for (PFCandidateCollection::const_iterator pf=pfCand_h->begin(); pf<pfCand_h->end(); ++pf){
542 float pfeta = pf->eta();
543 float dR =
deltaR(pfeta, pf->phi(), eleta, el.
phi());
544 if (dR>coner)
continue;
546 float deta = fabs(pfeta - eleta);
547 int pfid =
abs(pf->pdgId());
548 float pfpt = pf->pt();
550 if (filterId!=0 && filterId!=pfid)
continue;
552 if (pf->charge()==0) {
556 if (dR<footprintdr && pfid==130) pffootprint+=pfpt;
557 if (deta<gammastripveto && pfid==22) pfjurveto+=pfpt;
566 if ( pf->gsfTrackRef().isNonnull()) {
567 if (gsfTrack.
isNonnull() && gsfTrack.
key()==pf->gsfTrackRef().key())
continue;
570 if (pfid==11 && pf->gsfTrackRef().isNonnull()) {
571 if(fabs(pf->gsfTrackRef()->dz(vtx.
position()) - eldz )<dzcut) {
573 if (deta<elestripveto && pfid==11) pfjurvetoq+=pfpt;
579 if(fabs( pfTrack->dz(vtx.
position()) - eldz )<dzcut) {
581 if (deta<elestripveto && pfid==11) pfjurvetoq+=pfpt;
586 return pfciso+pfniso-pffootprint-pfjurveto-pfjurvetoq;
591 const int vertexIndex,
const float &
R,
float &pfiso_ch,
float &pfiso_em,
float &pfiso_nh)
600 reco::PFCandidateCollection::const_iterator pf = pfCand_h->begin();
601 for (pf = pfCand_h->begin(); pf != pfCand_h->end(); ++pf) {
608 const float dR =
deltaR(pf->eta(), pf->phi(), el.
eta(), el.
phi());
609 if (dR > R)
continue;
615 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
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
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 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
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()
bool isNonnull() const
Checks for non-null.
virtual float phi() const GCC11_FINAL
momentum azimuthal angle
void Load_els_trk_charge()
bool isNull() const
Checks for null.
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()
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
const HitPattern & trackerExpectedHitsInner() const
Access the hit pattern counting (in the Tracker) the number of expected crossed layers before the fir...
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()
std::vector< float > & els_eSCPresh()
double pz() const
z coordinate of momentum vector
std::vector< float > & els_iso03_pf_nhad05()
virtual float eta() const GCC11_FINAL
momentum pseudorapidity
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()
void Load_els_iso04_pf_gamma05()
void Load_els_fiduciality()
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()
key_type key() const
Accessor for product key.
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)
T const * product() const
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()
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()
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
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()