36 validToken = iEvent.
getByToken(PFCandidateCollection_, pfCandidatesHandle);
37 if(!validToken)
return;
38 pfCandidates = pfCandidatesHandle.
product();
43 validToken = iEvent.
getByToken(PFElectrons_, pfElectronsHandle);
44 if(!validToken)
return;
49 validToken = iEvent.
getByToken(TrackCollection_, track_h);
50 if(!validToken)
return;
54 validToken = iEvent.
getByToken(thePVCollection_, vertex_h);
55 if(!validToken)
return;
60 for( PFCandidateCollection::const_iterator pf_it = pfCandidates->begin(); pf_it != pfCandidates->end(); pf_it++ ) {
63 for(
unsigned int i = 0;
i < 17;
i++ ) {
71 hww.
pfcands_particleId() .push_back( pf_it->translateTypeToPdgId(pf_it->particleId()) );
75 if( pf_it->charge() != 0 ){
84 bool foundTrack =
false;
86 reco::TrackCollection::const_iterator tracks_end = track_h->end();
88 for (reco::TrackCollection::const_iterator itrk = track_h->begin(); itrk != tracks_end; ++itrk) {
92 if( pftrack.
key() == trkref.key() ){
95 float dpt = pftrack->pt() - trkref->pt();
96 if( fabs( dpt ) > 0.1 ){
97 edm::LogWarning(
"SanityCheck") <<
"Warning: pfcandidate track pt - matched track pt = " << dpt <<
", possible mismatch";
127 if (pf_it->gsfTrackRef().isNonnull()) {
129 int pfGsfTkId = pf_it->gsfTrackRef().key();
130 unsigned int elsIndex = 0;
132 unsigned int nE = el_pit.
size();
133 for(
unsigned int iE = 0; iE < nE; ++iE){
135 if (el_it.
isNull())
continue;
137 if (el_it->gsfTrackRef().
isNonnull()) elGsfTkId = el_it->gsfTrackRef().
key();
138 if (elGsfTkId==pfGsfTkId) {
PFCandidateMaker(const edm::ParameterSet &, edm::ConsumesCollector)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void Load_pfcands_pfelsidx()
void Load_pfcands_particleId()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< int > & pfcands_charge()
std::vector< Track > TrackCollection
collection of Tracks
std::vector< Vertex > VertexCollection
collection of Vertex objects
std::vector< LorentzVector > & pfcands_p4()
void Load_pfcands_trkidx()
key_type key() const
Accessor for product key.
std::vector< int > & pfcands_vtxidx()
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
std::vector< int > & pfcands_trkidx()
std::vector< int > & pfcands_pfelsidx()
std::vector< int > & pfcands_particleId()
bool isNull() const
Checks for null.
void Load_pfcands_charge()
bool isNonnull() const
Checks for non-null.
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
const_iterator begin() const
int chargedHadronVertex(const reco::VertexCollection &vertices, const reco::PFCandidate &pfcand) const
void Load_pfcands_vtxidx()
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< float > > XYZTLorentzVectorF
Lorentz vector with cylindrical internal representation using pseudorapidity.
void SetVars(HWW &, const edm::Event &, const edm::EventSetup &)
edm::ValueMap< reco::PFCandidatePtr > PFCandMap
math::PtEtaPhiELorentzVectorF LorentzVector