48 typedef std::pair<unsigned int, unsigned int>
IntPair;
67 minPt_ =
pset.getParameter<
double>(
"minTauPt");
69 typedef std::vector<edm::ParameterSet>
VPSet;
74 cuts.nTracksMin_ =
decayMode.getParameter<
unsigned>(
"nTracksMin");
75 cuts.nChargedPFCandsMin_ =
decayMode.getParameter<
unsigned>(
"nChargedPFCandsMin");
82 cuts.minPi0Mass_ =
decayMode.getParameter<
double>(
"minPi0Mass");
83 cuts.maxPi0Mass_ =
decayMode.getParameter<
double>(
"maxPi0Mass");
84 cuts.assumeStripMass_ =
decayMode.getParameter<
double>(
"assumeStripMass");
87 std::make_pair(
decayMode.getParameter<uint32_t>(
"nCharged"),
decayMode.getParameter<uint32_t>(
"nPiZeros")),
97 delete it->second.maxMass_;
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.";
149 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons =
tau->signalTauChargedHadronCandidates();
150 for (std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
163 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nTracks requirement for mass-window.";
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
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()) {
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);
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.";
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()) {
276 double dEta =
std::max(0., fabs(
cand.eta() - tauP4.eta()) - bendCorrection_eta);
281 edm::LogPrint(
"PFTauByHPSSelect") <<
"dR2(tau, signalPiZero) = " << dR2;
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.";
353 desc.add<
int>(
"verbosity", 0);
354 desc.add<
double>(
"minTauPt", 0.0);
363 vpset_decayModes.
add<
double>(
"minPi0Mass", -1.e3);
365 vpset_decayModes.
add<
double>(
"maxPi0Mass", 1.e9);
366 vpset_decayModes.
add<
unsigned int>(
"nPiZeros");
367 vpset_decayModes.
add<
double>(
"minMass");
368 vpset_decayModes.
add<
unsigned int>(
"nChargedPFCandsMin", 0);
369 vpset_decayModes.
add<
unsigned int>(
"nTracksMin", 0);
370 vpset_decayModes.
add<
unsigned int>(
"nCharged");
373 psd0.
add<
bool>(
"phi");
374 psd0.
add<
bool>(
"eta");
375 psd0.
add<
bool>(
"mass");
378 vpset_decayModes.
add<
double>(
"assumeStripMass", -1.0);
379 std::vector<edm::ParameterSet> vpset_default;
382 pset.addParameter<
double>(
"minPi0Mass", -1.e3);
383 pset.addParameter<
double>(
"maxPi0Mass", 1.e9);
384 pset.addParameter<
unsigned int>(
"nChargedPFCandsMin", 0);
385 pset.addParameter<
unsigned int>(
"nTracksMin", 0);
386 pset.addParameter<
double>(
"assumeStripMass", -1.0);
387 vpset_default.push_back(
pset);
389 desc.addVPSet(
"decayModes", vpset_decayModes, vpset_default);
392 desc.add<
double>(
"matchingCone", 0.5);
393 desc.add<
int>(
"minPixelHits", 1);
394 desc.add<
bool>(
"requireTauChargedHadronsToBeChargedPFCands",
false);
395 descriptions.
add(
"hpsSelectionDiscriminator",
desc);
constexpr double deltaPhi(double phi1, double phi2)
reco::GsfTrackRef gsfTrackRef() const
std::map< IntPair, DecayModeCuts > DecayModeCutMap
PFRecoTauDiscriminationByHPSSelection(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool isNonnull() const
Checks for non-null.
bool applyBendCorrection_eta_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
bool requireTauChargedHadronsToBeChargedPFCands_
unsigned nChargedPFCandsMin_
std::pair< unsigned int, unsigned int > IntPair
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
~PFRecoTauDiscriminationByHPSSelection() override
Log< level::Warning, true > LogPrint
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
std::pair< double, double > DoublePair
StringObjectFunction< reco::PFTau > TauFunc
bool applyBendCorrection_mass_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
DecayModeCutMap decayModeCuts_
T const * get() const
Returns C++ pointer to the item.
reco::TrackRef trackRef() const
double discriminate(const reco::PFTauRef &) const override
virtual const reco::Track & pseudoTrack() const
bool applyBendCorrection_phi_
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.