17 double factor =
sqrt(vec.energy() * vec.energy() - mass *
mass) / vec.P();
48 typedef std::pair<unsigned int, unsigned int>
IntPair;
69 typedef std::vector<edm::ParameterSet>
VPSet;
71 for (
auto const& decayMode : decayModes) {
74 cuts.
nTracksMin_ = decayMode.getParameter<
unsigned>(
"nTracksMin");
76 cuts.
minMass_ = decayMode.getParameter<
double>(
"minMass");
82 cuts.
minPi0Mass_ = decayMode.getParameter<
double>(
"minPi0Mass");
83 cuts.
maxPi0Mass_ = decayMode.getParameter<
double>(
"maxPi0Mass");
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();
151 chargedHadron != chargedHadrons.end();
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();
172 chargedHadron != chargedHadrons.end();
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()) {
266 if (
deltaR(cand.
p4(), tauP4) > cone_size) {
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);
279 double dR2 = dEta * dEta + dPhi * dPhi;
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) {
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;
372 pset.
addParameter<
unsigned int>(
"nChargedPFCandsMin", 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);
constexpr double deltaPhi(double phi1, double phi2)
std::map< IntPair, DecayModeCuts > DecayModeCutMap
PFRecoTauDiscriminationByHPSSelection(const edm::ParameterSet &)
bool isNonnull() const
Checks for non-null.
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
#define DEFINE_FWK_MODULE(type)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool applyBendCorrection_eta_
reco::TrackRef trackRef() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TkSoA const *__restrict__ CAHitNtupletGeneratorKernelsGPU::QualityCuts cuts
bool requireTauChargedHadronsToBeChargedPFCands_
unsigned nChargedPFCandsMin_
void addParameter(std::string const &name, T const &value)
std::pair< unsigned int, unsigned int > IntPair
Abs< T >::type abs(const T &t)
virtual const reco::Track & pseudoTrack() const
T const * get() const
Returns C++ pointer to the item.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
~PFRecoTauDiscriminationByHPSSelection() override
Log< level::Warning, true > LogPrint
bool hasTrackDetails() const
Return true if a bestTrack can be extracted from this Candidate.
static const TrackGhostTrackState * getTrack(const BasicGhostTrackState *basic)
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
T getParameter(std::string const &) const
std::pair< double, double > DoublePair
StringObjectFunction< reco::PFTau > TauFunc
bool applyBendCorrection_mass_
constexpr float correction(int sizeM1, int q_f, int q_l, uint16_t upper_edge_first_pix, uint16_t lower_edge_last_pix, float lorentz_shift, float theThickness, float cot_angle, float pitch, bool first_is_big, bool last_is_big)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Particle reconstructed by the particle flow algorithm.
DecayModeCutMap decayModeCuts_
reco::GsfTrackRef gsfTrackRef() const
int numberOfValidPixelHits() const
double discriminate(const reco::PFTauRef &) const override
bool applyBendCorrection_phi_
virtual double phi() const =0
momentum azimuthal angle
virtual double eta() const =0
momentum pseudorapidity
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector