Build a collection of chargedHadrons from objects in the input jet.
206 edm::LogPrint(
"TauChHFromTrack") <<
"<PFRecoTauChargedHadronFromGenericTrackPlugin::operator()>:";
218 float jEta =
jet.eta();
219 float jPhi =
jet.phi();
220 size_t numTracks =
tracks->size();
221 for (
size_t iTrack = 0; iTrack < numTracks; ++iTrack) {
233 edm::LogInfo(
"PFRecoTauChargedHadronFromGenericTrackPlugin::operator()")
234 <<
"Jet: Pt = " <<
jet.pt() <<
", eta = " <<
jet.eta() <<
", phi = " <<
jet.phi()
235 <<
" has area = " <<
jetArea <<
" !!" << std::endl;
248 if (
track.charge() > 0.)
249 trackCharge_int = +1;
250 else if (
track.charge() < 0.)
251 trackCharge_int = -1;
253 const double chargedPionMass = 0.13957;
254 double chargedPionP =
track.p();
255 double chargedPionEn = TMath::Sqrt(chargedPionP * chargedPionP + chargedPionMass * chargedPionMass);
262 auto chargedHadron = std::make_unique<PFRecoTauChargedHadron>(
279 p.setCharge(
track.charge());
282 if (trackPropagator.getSuccess() != 0) {
283 chargedHadron->positionAtECALEntrance_ = trackPropagator.particle().vertex();
285 if (chargedPionP4.pt() > 2. and
std::abs(chargedPionP4.eta()) < 3.) {
286 edm::LogWarning(
"PFRecoTauChargedHadronFromGenericTrackPlugin::operator()")
287 <<
"Failed to propagate track: Pt = " <<
track.pt() <<
", eta = " <<
track.eta()
288 <<
", phi = " <<
track.phi() <<
" to ECAL entrance !!" << std::endl;
293 std::vector<Candidate_withDistance> neutralJetConstituents_withDistance;
294 for (
const auto& jetConstituent :
jet.daughterPtrVector()) {
295 int pdgId = jetConstituent->pdgId();
300 double dRmerge = -1.;
303 else if (
pdgId == 22)
306 Candidate_withDistance jetConstituent_withDistance;
307 jetConstituent_withDistance.pfCandidate_ = jetConstituent;
308 jetConstituent_withDistance.distance_ =
dR;
309 neutralJetConstituents_withDistance.push_back(jetConstituent_withDistance);
314 neutralJetConstituents_withDistance.begin(), neutralJetConstituents_withDistance.end(), isSmallerDistance);
316 const double caloResolutionCoeff =
319 double neutralEnSum = 0.;
320 for (std::vector<Candidate_withDistance>::const_iterator nextNeutral =
321 neutralJetConstituents_withDistance.begin();
322 nextNeutral != neutralJetConstituents_withDistance.end();
324 double nextNeutralEn = nextNeutral->pfCandidate_->energy();
325 double resolutionCaloEn = caloResolutionCoeff *
sqrt(neutralEnSum + nextNeutralEn);
326 double resolution =
sqrt(resolutionTrackP * resolutionTrackP + resolutionCaloEn * resolutionCaloEn);
328 chargedHadron->neutralPFCandidates_.push_back(nextNeutral->pfCandidate_);
329 neutralEnSum += nextNeutralEn;
int Charge
electric charge type
static constexpr unsigned int maxWarnings_
std::vector< std::unique_ptr< PFRecoTauChargedHadron > > ChargedHadronVector
math::XYZPointF atECALEntrance(const reco::Candidate *part, double bField)
bool dRconeLimitedToJetArea_
bool filterTrack(const edm::Handle< std::vector< TrackClass > > &, size_t iTrack) const
XYZTLorentzVector getTrackPos(const TrackClass &track) const
void setChargedHadronTrack(PFRecoTauChargedHadron &chargedHadron, const edm::Ptr< TrackClass > &track) const
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< float > > XYZPointF
point in space with cartesian internal representation
double getTrackPtError(const TrackClass &track) const
reco::VertexRef associatedVertex(const Jet &jet) const
std::unique_ptr< RecoTauQualityCuts > qcuts_
static std::atomic< unsigned int > numWarnings_
Abs< T >::type abs(const T &t)
math::XYZPoint Point
point in the space
edm::EDGetTokenT< std::vector< TrackClass > > Tracks_token
const edm::Event * evt() const
Log< level::Warning, true > LogPrint
bool propagateToEcalEntrance(bool first=true)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Log< level::Info, false > LogInfo
math::XYZTLorentzVector LorentzVector
Lorentz vector.
RecoTauVertexAssociator vertexAssociator_
const std::string & name() const
math::XYZVector magneticFieldStrength_
Log< level::Warning, false > LogWarning
double dRmergeNeutralHadron_
void setChargedHadronP4(reco::PFRecoTauChargedHadron &chargedHadron, double scaleFactor_neutralPFCands=1.0)
math::XYZTLorentzVector XYZTLorentzVector