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 for (
const auto& chargedHadrCand :
tau->signalChargedHadrCands()) {
318 if (
track !=
nullptr) {
319 numPixelHits +=
track->hitPattern().numberOfValidPixelHits();
324 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on sum of pixel hits.";
341 desc.
add<
int>(
"verbosity", 0);
342 desc.
add<
double>(
"minTauPt", 0.0);
351 vpset_decayModes.
add<
double>(
"minPi0Mass", -1.e3);
353 vpset_decayModes.
add<
double>(
"maxPi0Mass", 1.e9);
354 vpset_decayModes.
add<
unsigned int>(
"nPiZeros");
355 vpset_decayModes.
add<
double>(
"minMass");
356 vpset_decayModes.
add<
unsigned int>(
"nChargedPFCandsMin", 0);
357 vpset_decayModes.
add<
unsigned int>(
"nTracksMin", 0);
358 vpset_decayModes.
add<
unsigned int>(
"nCharged");
361 psd0.
add<
bool>(
"phi");
362 psd0.
add<
bool>(
"eta");
363 psd0.
add<
bool>(
"mass");
366 vpset_decayModes.
add<
double>(
"assumeStripMass", -1.0);
367 std::vector<edm::ParameterSet> vpset_default;
370 pset.addParameter<
double>(
"minPi0Mass", -1.e3);
371 pset.addParameter<
double>(
"maxPi0Mass", 1.e9);
372 pset.addParameter<
unsigned int>(
"nChargedPFCandsMin", 0);
373 pset.addParameter<
unsigned int>(
"nTracksMin", 0);
374 pset.addParameter<
double>(
"assumeStripMass", -1.0);
375 vpset_default.push_back(
pset);
377 desc.
addVPSet(
"decayModes", vpset_decayModes, vpset_default);
380 desc.
add<
double>(
"matchingCone", 0.5);
381 desc.
add<
int>(
"minPixelHits", 1);
382 desc.
add<
bool>(
"requireTauChargedHadronsToBeChargedPFCands",
false);
383 descriptions.
add(
"hpsSelectionDiscriminator", desc);