18 double factor =
sqrt(vec.energy()*vec.energy() - mass*
mass)/vec.P();
53 typedef std::pair<unsigned int, unsigned int>
IntPair;
75 typedef std::vector<edm::ParameterSet>
VPSet;
77 for(
auto const&
decayMode : decayModes ) {
94 decayMode.getParameter<uint32_t>(
"nCharged"),
95 decayMode.getParameter<uint32_t>(
"nPiZeros")),
110 delete it->second.maxMass_;
135 edm::LogPrint(
"PFTauByHPSSelect") <<
"<PFRecoTauDiscriminationByHPSSelection::discriminate>:" ;
136 edm::LogPrint(
"PFTauByHPSSelect") <<
" nCharged = " << tau->signalTauChargedHadronCandidates().size() ;
137 edm::LogPrint(
"PFTauByHPSSelect") <<
" nPiZeros = " << tau->signalPiZeroCandidates().size() ;
141 if ( tau->pt() <
minPt_ ) {
149 DecayModeCutMap::const_iterator massWindowIter =
150 decayModeCuts_.find(std::make_pair(tau->signalTauChargedHadronCandidates().size(),
151 tau->signalPiZeroCandidates().size()));
155 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails mass-window definition requirement." ;
163 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
164 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
175 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nTracks requirement for mass-window." ;
181 unsigned int nChargedPFCands = 0;
182 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
183 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
194 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nChargedPFCands requirement for mass-window." ;
202 edm::LogPrint(
"PFTauByHPSSelect") <<
"tau: Pt = " << tauP4.pt() <<
", eta = " << tauP4.eta() <<
", phi = " << tauP4.phi() <<
", mass = " << tauP4.mass() ;
206 for(
auto const&
cand : tau->signalPiZeroCandidates()){
213 for(
auto const&
cand : tau->signalPiZeroCandidates()){
219 stripsP4 += correction;
223 edm::LogPrint(
"PFTauByHPSSelect") <<
"strips: Pt = " << stripsP4.pt() <<
", eta = " << stripsP4.eta() <<
", phi = " << stripsP4.phi() <<
", mass = " << stripsP4.mass() ;
227 double maxMass_value = (*massWindow.
maxMass_)(*tau);
229 if ( !((tauP4.M() - bendCorrection_mass) < maxMass_value && (tauP4.M() + bendCorrection_mass) > massWindow.
minMass_) ) {
231 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut." ;
238 const std::vector<reco::PFRecoTauChargedHadron>& signalChargedHadrons = tau->signalTauChargedHadronCandidates();
239 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator signalChargedHadron = signalChargedHadrons.begin();
240 signalChargedHadron != signalChargedHadrons.end(); ++signalChargedHadron ) {
241 tauP4_charged += signalChargedHadron->p4();
243 if ( !(tauP4_charged.mass() < maxMass_value) ) {
245 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut." ;
254 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails strip mass-window cut." ;
263 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails matching-cone cut." ;
269 double cone_size = tau->signalConeSize();
271 for (
auto const&
cand : tau->signalTauChargedHadronCandidates()) {
277 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for charged hadron(s)." ;
283 for (
auto const&
cand : tau->signalPiZeroCandidates()) {
285 double dEta =
std::max(0., fabs(
cand.eta() - tauP4.eta()) - bendCorrection_eta);
288 double dR2 = dEta*dEta + dPhi*
dPhi;
290 edm::LogPrint(
"PFTauByHPSSelect") <<
"dR2(tau, signalPiZero) = " << dR2 ;
292 if ( dR2 > cone_size*cone_size ) {
294 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for strip(s)." ;
301 for(
auto const&
cand : tau->signalTauChargedHadronCandidates()) {
307 else algo_string =
"Undefined";
308 edm::LogPrint(
"PFTauByHPSSelect") <<
"algo(signalPFChargedHadr) = " << algo_string ;
312 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on PFRecoTauChargedHadron algo." ;
320 int numPixelHits = 0;
321 for (
const auto& chargedHadrCand : tau->signalChargedHadrCands()) {
323 if (track !=
nullptr) {
329 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on sum of pixel hits." ;
347 desc.
add<
int>(
"verbosity", 0);
348 desc.
add<
double>(
"minTauPt", 0.0);
357 vpset_decayModes.
add<
double>(
"minPi0Mass", -1.e3);
359 vpset_decayModes.
add<
double>(
"maxPi0Mass", 1.e9);
360 vpset_decayModes.
add<
unsigned int>(
"nPiZeros");
361 vpset_decayModes.
add<
double>(
"minMass");
362 vpset_decayModes.
add<
unsigned int>(
"nChargedPFCandsMin", 0);
363 vpset_decayModes.
add<
unsigned int>(
"nTracksMin", 0);
364 vpset_decayModes.
add<
unsigned int>(
"nCharged");
367 psd0.
add<
bool>(
"phi");
368 psd0.
add<
bool>(
"eta");
369 psd0.
add<
bool>(
"mass");
372 vpset_decayModes.
add<
double>(
"assumeStripMass", -1.0);
373 std::vector<edm::ParameterSet> vpset_default;
378 pset.
addParameter<
unsigned int>(
"nChargedPFCandsMin", 0);
381 vpset_default.push_back(pset);
383 desc.
addVPSet(
"decayModes", vpset_decayModes, vpset_default);
386 desc.
add<
double>(
"matchingCone", 0.5);
387 desc.
add<
int>(
"minPixelHits", 1);
388 desc.
add<
bool>(
"requireTauChargedHadronsToBeChargedPFCands",
false);
389 descriptions.
add(
"hpsSelectionDiscriminator", desc);
constexpr double deltaPhi(double phi1, double phi2)
T getParameter(std::string const &) const
const unsigned int nTracks(const reco::Vertex &sv)
std::map< IntPair, DecayModeCuts > DecayModeCutMap
PFRecoTauDiscriminationByHPSSelection(const edm::ParameterSet &)
bool isNonnull() const
Checks for non-null.
double discriminate(const reco::PFTauRef &) const override
ParameterDescriptionBase * addVPSet(U const &iLabel, ParameterSetDescription const &validator, std::vector< ParameterSet > const &defaults)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool applyBendCorrection_eta_
reco::TrackRef trackRef() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
#define DEFINE_FWK_MODULE(type)
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
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.
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_
reco::GsfTrackRef gsfTrackRef() const
int numberOfValidPixelHits() const
bool applyBendCorrection_phi_