18 if (chargedPFPCand !=
nullptr) {
22 if (lostTrackCand !=
nullptr) {
30 double chargedHadronP = 0.;
31 double chargedHadronPx = 0.;
32 double chargedHadronPy = 0.;
33 double chargedHadronPz = 0.;
34 double SumNeutrals = 0.;
39 chargedHadronP += chargedPFCand->p();
40 chargedHadronPx = chargedPFCand->px();
41 chargedHadronPy = chargedPFCand->py();
42 chargedHadronPz = chargedPFCand->pz();
45 if (track !=
nullptr) {
46 chargedHadronP += track->
p();
47 chargedHadronPx = track->
px();
48 chargedHadronPy = track->
py();
49 chargedHadronPz = track->
pz();
53 chargedHadronP += lostTrack->p();
54 chargedHadronPx = lostTrack->px();
55 chargedHadronPy = lostTrack->py();
56 chargedHadronPz = lostTrack->pz();
60 for ( std::vector<reco::CandidatePtr>::const_iterator neutralPFCand = neutralPFCands.begin();
61 neutralPFCand != neutralPFCands.end(); ++neutralPFCand ) {
62 SumNeutrals += (*neutralPFCand)->p();
64 double noNeutrals=chargedHadronP;
65 chargedHadronP+=scaleFactor_neutralPFCands*SumNeutrals;
66 double ptRatio=chargedHadronP/noNeutrals;
73 chargedHadron.
setP4(chargedHadronP4);
78 const double chargedPionMass = 0.13957;
79 double chargedHadronEn =
sqrt(chargedHadronPx*chargedHadronPx + chargedHadronPy*chargedHadronPy + chargedHadronPz*chargedHadronPz + chargedPionMass*chargedPionMass);
81 return chargedHadronP4;
86 double chargedHadronPx = chargedHadronP*TMath::Cos(chargedHadronPhi)*TMath::Sin(chargedHadronTheta);
87 double chargedHadronPy = chargedHadronP*TMath::Sin(chargedHadronPhi)*TMath::Sin(chargedHadronTheta);
88 double chargedHadronPz = chargedHadronP*TMath::Cos(chargedHadronTheta);
double p() const
momentum vector magnitude
T const * get() const
Returns C++ pointer to the item.
double px() const
x coordinate of momentum vector
const reco::Track * bestTrack() const override
return a pointer to the track if present. otherwise, return a null pointer
const TrackPtr & getTrack() const
reference to reco::Track
bool isNonnull() const
Checks for non-null.
double pz() const
z coordinate of momentum vector
reco::Candidate::LorentzVector compChargedHadronP4fromPThetaPhi(double, double, double)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
const reco::Track * getTrackFromChargedHadron(const reco::PFRecoTauChargedHadron &chargedHadron)
bool algoIs(PFRecoTauChargedHadronAlgorithm algo) const
Check whether a given algo produced this charged hadron.
void setChargedHadronP4(reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
const CandidatePtr & getChargedPFCandidate() const
reference to "charged" PFCandidate (either charged PFCandidate or PFNeutralHadron) ...
void setP4(const LorentzVector &p4) final
set 4-momentum
double py() const
y coordinate of momentum vector
const std::vector< CandidatePtr > & getNeutralPFCandidates() const
references to additional neutral PFCandidates
const CandidatePtr & getLostTrackCandidate() const
reference to "lostTrack Candidate" when chadron built with tracks stored as pat::PackedCandidates ...
reco::Candidate::LorentzVector compChargedHadronP4fromPxPyPz(double, double, double)