20 if (chargedPFPCand !=
nullptr) {
25 if (lostTrackCand !=
nullptr) {
32 double chargedHadronP = 0.;
33 double chargedHadronPx = 0.;
34 double chargedHadronPy = 0.;
35 double chargedHadronPz = 0.;
36 double SumNeutrals = 0.;
41 chargedHadronP += chargedPFCand->p();
42 chargedHadronPx = chargedPFCand->px();
43 chargedHadronPy = chargedPFCand->py();
44 chargedHadronPz = chargedPFCand->pz();
47 if (track !=
nullptr) {
48 chargedHadronP += track->
p();
49 chargedHadronPx = track->
px();
50 chargedHadronPy = track->
py();
51 chargedHadronPz = track->
pz();
55 chargedHadronP += lostTrack->p();
56 chargedHadronPx = lostTrack->px();
57 chargedHadronPy = lostTrack->py();
58 chargedHadronPz = lostTrack->pz();
63 for (std::vector<reco::CandidatePtr>::const_iterator neutralPFCand = neutralPFCands.begin();
64 neutralPFCand != neutralPFCands.end();
66 SumNeutrals += (*neutralPFCand)->p();
68 double noNeutrals = chargedHadronP;
69 chargedHadronP += scaleFactor_neutralPFCands * SumNeutrals;
70 double ptRatio = chargedHadronP / noNeutrals;
77 chargedHadron.
setP4(chargedHadronP4);
81 double chargedHadronPy,
82 double chargedHadronPz) {
83 const double chargedPionMass = 0.13957;
84 double chargedHadronEn =
sqrt(chargedHadronPx * chargedHadronPx + chargedHadronPy * chargedHadronPy +
85 chargedHadronPz * chargedHadronPz + chargedPionMass * chargedPionMass);
87 chargedHadronPx, chargedHadronPy, chargedHadronPz, chargedHadronEn);
88 return chargedHadronP4;
92 double chargedHadronTheta,
93 double chargedHadronPhi) {
94 double chargedHadronPx = chargedHadronP * TMath::Cos(chargedHadronPhi) * TMath::Sin(chargedHadronTheta);
95 double chargedHadronPy = chargedHadronP * TMath::Sin(chargedHadronPhi) * TMath::Sin(chargedHadronTheta);
96 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)