122 edm::LogPrint(
"PFTauByHPSSelect") <<
"<PFRecoTauDiscriminationByHPSSelection::discriminate>:";
123 edm::LogPrint(
"PFTauByHPSSelect") <<
" nCharged = " <<
tau->signalTauChargedHadronCandidates().size();
124 edm::LogPrint(
"PFTauByHPSSelect") <<
" nPiZeros = " <<
tau->signalPiZeroCandidates().size();
136 DecayModeCutMap::const_iterator massWindowIter =
decayModeCuts_.find(
137 std::make_pair(
tau->signalTauChargedHadronCandidates().size(),
tau->signalPiZeroCandidates().size()));
141 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails mass-window definition requirement.";
145 const DecayModeCuts& massWindow = massWindowIter->second;
147 if (massWindow.nTracksMin_ > 0) {
149 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons =
tau->signalTauChargedHadronCandidates();
150 for (std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
159 edm::LogPrint(
"PFTauByHPSSelect") <<
"nTracks = " <<
nTracks <<
" (min = " << massWindow.nTracksMin_ <<
")";
161 if (
nTracks < massWindow.nTracksMin_) {
163 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nTracks requirement for mass-window.";
168 if (massWindow.nChargedPFCandsMin_ > 0) {
169 unsigned int nChargedPFCands = 0;
170 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons =
tau->signalTauChargedHadronCandidates();
171 for (std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
179 edm::LogPrint(
"PFTauByHPSSelect") <<
"nChargedPFCands = " << nChargedPFCands
180 <<
" (min = " << massWindow.nChargedPFCandsMin_ <<
")";
182 if (nChargedPFCands < massWindow.nChargedPFCandsMin_) {
184 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nChargedPFCands requirement for mass-window.";
192 edm::LogPrint(
"PFTauByHPSSelect") <<
"tau: Pt = " << tauP4.pt() <<
", eta = " << tauP4.eta()
193 <<
", phi = " << tauP4.phi() <<
", mass = " << tauP4.mass();
197 for (
auto const&
cand :
tau->signalPiZeroCandidates()) {
203 if (massWindow.assumeStripMass_ >= 0) {
204 for (
auto const&
cand :
tau->signalPiZeroCandidates()) {
213 edm::LogPrint(
"PFTauByHPSSelect") <<
"strips: Pt = " << stripsP4.pt() <<
", eta = " << stripsP4.eta()
214 <<
", phi = " << stripsP4.phi() <<
", mass = " << stripsP4.mass();
218 double maxMass_value = (*massWindow.maxMass_)(*
tau);
219 double bendCorrection_mass = (massWindow.applyBendCorrection_mass_) ?
tau->bendCorrMass() : 0.;
220 if (!((tauP4.M() - bendCorrection_mass) < maxMass_value && (tauP4.M() + bendCorrection_mass) > massWindow.minMass_)) {
222 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut.";
229 const std::vector<reco::PFRecoTauChargedHadron>& signalChargedHadrons =
tau->signalTauChargedHadronCandidates();
230 for (std::vector<reco::PFRecoTauChargedHadron>::const_iterator signalChargedHadron = signalChargedHadrons.begin();
231 signalChargedHadron != signalChargedHadrons.end();
232 ++signalChargedHadron) {
233 tauP4_charged += signalChargedHadron->p4();
235 if (!(tauP4_charged.mass() < maxMass_value)) {
237 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut.";
243 if (stripsP4.M() > massWindow.maxPi0Mass_ || stripsP4.M() < massWindow.minPi0Mass_) {
245 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails strip mass-window cut.";
254 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails matching-cone cut.";
260 double cone_size =
tau->signalConeSize();
262 for (
auto const&
cand :
tau->signalTauChargedHadronCandidates()) {
268 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for charged hadron(s).";
274 for (
auto const&
cand :
tau->signalPiZeroCandidates()) {
275 double bendCorrection_eta = (massWindow.applyBendCorrection_eta_) ?
cand.bendCorrEta() : 0.;
276 double dEta =
std::max(0., fabs(
cand.eta() - tauP4.eta()) - bendCorrection_eta);
277 double bendCorrection_phi = (massWindow.applyBendCorrection_phi_) ?
cand.bendCorrPhi() : 0.;
283 if (
dR2 > cone_size * cone_size) {
285 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for strip(s).";
292 for (
auto const&
cand :
tau->signalTauChargedHadronCandidates()) {
296 algo_string =
"ChargedPFCandidate";
298 algo_string =
"Track";
300 algo_string =
"PFNeutralHadron";
302 algo_string =
"Undefined";
303 edm::LogPrint(
"PFTauByHPSSelect") <<
"algo(signalPFChargedHadr) = " << algo_string;
307 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on PFRecoTauChargedHadron algo.";
315 int numPixelHits = 0;
316 const int nProngs =
tau->decayMode() / 5 + 1;
318 for (
const auto& chargedHadrCand :
tau->signalChargedHadrCands()) {
320 if (
track !=
nullptr) {
321 numPixelHits +=
track->hitPattern().numberOfValidPixelHits();
327 for (
const auto&
track :
tau->signalTracks()) {
328 if (
track.isNonnull()) {
329 numPixelHits +=
track->hitPattern().numberOfValidPixelHits();
336 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on sum of pixel hits.";
constexpr double deltaPhi(double phi1, double phi2)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
ALPAKA_FN_ACC static ALPAKA_FN_INLINE float dR2(Position4 pos1, Position4 pos2)
bool requireTauChargedHadronsToBeChargedPFCands_
Abs< T >::type abs(const T &t)
Log< level::Warning, true > LogPrint
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
DecayModeCutMap decayModeCuts_