14 double factor =
sqrt(vec.energy()*vec.energy() - mass*
mass)/vec.P();
47 typedef std::pair<unsigned int, unsigned int>
IntPair;
69 typedef std::vector<edm::ParameterSet>
VPSet;
71 for(
auto const&
decayMode : decayModes ) {
79 if (
decayMode.exists(
"nChargedPFCandsMin") ) {
97 if (
decayMode.exists(
"assumeStripMass") ) {
105 decayMode.getParameter<uint32_t>(
"nCharged"),
106 decayMode.getParameter<uint32_t>(
"nPiZeros")),
122 delete it->second.maxMass_;
130 edm::LogPrint(
"PFTauByHPSSelect") <<
"<PFRecoTauDiscriminationByHPSSelection::discriminate>:" ;
131 edm::LogPrint(
"PFTauByHPSSelect") <<
" nCharged = " << tau->signalTauChargedHadronCandidates().size() ;
132 edm::LogPrint(
"PFTauByHPSSelect") <<
" nPiZeros = " << tau->signalPiZeroCandidates().size() ;
136 if ( tau->pt() <
minPt_ ) {
144 DecayModeCutMap::const_iterator massWindowIter =
145 decayModeCuts_.find(std::make_pair(tau->signalTauChargedHadronCandidates().size(),
146 tau->signalPiZeroCandidates().size()));
150 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails mass-window definition requirement." ;
158 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
159 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
170 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nTracks requirement for mass-window." ;
176 unsigned int nChargedPFCands = 0;
177 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
178 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
189 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nChargedPFCands requirement for mass-window." ;
197 edm::LogPrint(
"PFTauByHPSSelect") <<
"tau: Pt = " << tauP4.pt() <<
", eta = " << tauP4.eta() <<
", phi = " << tauP4.phi() <<
", mass = " << tauP4.mass() ;
201 for(
auto const&
cand : tau->signalPiZeroCandidates()){
208 for(
auto const&
cand : tau->signalPiZeroCandidates()){
214 stripsP4 += correction;
218 edm::LogPrint(
"PFTauByHPSSelect") <<
"strips: Pt = " << stripsP4.pt() <<
", eta = " << stripsP4.eta() <<
", phi = " << stripsP4.phi() <<
", mass = " << stripsP4.mass() ;
222 double maxMass_value = (*massWindow.
maxMass_)(*tau);
224 if ( !((tauP4.M() - bendCorrection_mass) < maxMass_value && (tauP4.M() + bendCorrection_mass) > massWindow.
minMass_) ) {
226 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut." ;
233 const std::vector<reco::PFRecoTauChargedHadron>& signalChargedHadrons = tau->signalTauChargedHadronCandidates();
234 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator signalChargedHadron = signalChargedHadrons.begin();
235 signalChargedHadron != signalChargedHadrons.end(); ++signalChargedHadron ) {
236 tauP4_charged += signalChargedHadron->p4();
238 if ( !(tauP4_charged.mass() < maxMass_value) ) {
240 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut." ;
249 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails strip mass-window cut." ;
258 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails matching-cone cut." ;
264 double cone_size = tau->signalConeSize();
266 for (
auto const&
cand : tau->signalTauChargedHadronCandidates()) {
272 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for charged hadron(s)." ;
278 for (
auto const&
cand : tau->signalPiZeroCandidates()) {
280 double dEta =
std::max(0., fabs(
cand.eta() - tauP4.eta()) - bendCorrection_eta);
283 double dR2 = dEta*dEta + dPhi*
dPhi;
285 edm::LogPrint(
"PFTauByHPSSelect") <<
"dR2(tau, signalPiZero) = " << dR2 ;
287 if ( dR2 > cone_size*cone_size ) {
289 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for strip(s)." ;
296 for(
auto const&
cand : tau->signalTauChargedHadronCandidates()) {
302 else 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 std::vector<reco::PFCandidatePtr>& chargedHadrCands = tau->signalPFChargedHadrCands();
317 for ( std::vector<reco::PFCandidatePtr>::const_iterator chargedHadrCand = chargedHadrCands.begin();
318 chargedHadrCand != chargedHadrCands.end(); ++chargedHadrCand ) {
320 if ( (*chargedHadrCand)->trackRef().isNonnull() ) track = (*chargedHadrCand)->trackRef().get();
321 else if ( (*chargedHadrCand)->gsfTrackRef().isNonnull() ) track = (*chargedHadrCand)->gsfTrackRef().get();
328 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on sum of pixel hits." ;
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 &)
double discriminate(const reco::PFTauRef &) const override
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
bool applyBendCorrection_eta_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
bool requireTauChargedHadronsToBeChargedPFCands_
unsigned nChargedPFCandsMin_
std::pair< unsigned int, unsigned int > IntPair
Abs< T >::type abs(const T &t)
~PFRecoTauDiscriminationByHPSSelection() override
double deltaR(double eta1, double eta2, double phi1, double phi2)
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_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
DecayModeCutMap decayModeCuts_
int numberOfValidPixelHits() const
bool applyBendCorrection_phi_