Build a collection of chargedHadrons from objects in the input jet.
208 edm::LogPrint(
"TauChHFromTrack") <<
"<PFRecoTauChargedHadronFromGenericTrackPlugin::operator()>:";
220 float jEta =
jet.eta();
221 float jPhi =
jet.phi();
222 size_t numTracks =
tracks->size();
223 for (
size_t iTrack = 0; iTrack < numTracks; ++iTrack) {
230 double jetArea =
jet.jetArea();
235 edm::LogInfo(
"PFRecoTauChargedHadronFromGenericTrackPlugin::operator()")
236 <<
"Jet: Pt = " <<
jet.pt() <<
", eta = " <<
jet.eta() <<
", phi = " <<
jet.phi()
237 <<
" has area = " << jetArea <<
" !!" << std::endl;
250 if (
track.charge() > 0.)
251 trackCharge_int = +1;
252 else if (
track.charge() < 0.)
253 trackCharge_int = -1;
255 const double chargedPionMass = 0.13957;
256 double chargedPionP =
track.p();
257 double chargedPionEn = TMath::Sqrt(chargedPionP * chargedPionP + chargedPionMass * chargedPionMass);
281 p.setCharge(
track.charge());
284 if (trackPropagator.getSuccess() != 0) {
285 chargedHadron->positionAtECALEntrance_ = trackPropagator.particle().vertex();
287 if (chargedPionP4.pt() > 2. and
std::abs(chargedPionP4.eta()) < 3.) {
288 edm::LogWarning(
"PFRecoTauChargedHadronFromGenericTrackPlugin::operator()")
289 <<
"Failed to propagate track: Pt = " <<
track.pt() <<
", eta = " <<
track.eta()
290 <<
", phi = " <<
track.phi() <<
" to ECAL entrance !!" << std::endl;
295 std::vector<Candidate_withDistance> neutralJetConstituents_withDistance;
296 for (
const auto& jetConstituent :
jet.daughterPtrVector()) {
297 int pdgId = jetConstituent->pdgId();
302 double dRmerge = -1.;
305 else if (
pdgId == 22)
308 Candidate_withDistance jetConstituent_withDistance;
309 jetConstituent_withDistance.pfCandidate_ = jetConstituent;
310 jetConstituent_withDistance.distance_ =
dR;
311 neutralJetConstituents_withDistance.push_back(jetConstituent_withDistance);
316 neutralJetConstituents_withDistance.begin(), neutralJetConstituents_withDistance.end(), isSmallerDistance);
318 const double caloResolutionCoeff =
321 double neutralEnSum = 0.;
322 for (std::vector<Candidate_withDistance>::const_iterator nextNeutral =
323 neutralJetConstituents_withDistance.begin();
324 nextNeutral != neutralJetConstituents_withDistance.end();
326 double nextNeutralEn = nextNeutral->pfCandidate_->energy();
327 double resolutionCaloEn = caloResolutionCoeff *
sqrt(neutralEnSum + nextNeutralEn);
328 double resolution =
sqrt(resolutionTrackP * resolutionTrackP + resolutionCaloEn * resolutionCaloEn);
330 chargedHadron->neutralPFCandidates_.push_back(nextNeutral->pfCandidate_);
331 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)
RecoTauQualityCuts * qcuts_
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
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
auto const & tracks
cannot be loose
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)
void setPV(const reco::VertexRef &vtx)
Update the primary vertex.
math::XYZTLorentzVector XYZTLorentzVector