1 #include <boost/foreach.hpp> 16 double factor =
sqrt(vec.energy()*vec.energy() - mass*
mass)/vec.P();
49 typedef std::pair<unsigned int, unsigned int>
IntPair;
71 typedef std::vector<edm::ParameterSet>
VPSet;
76 if ( decayMode.
exists(
"nTracksMin") ) {
81 if ( decayMode.
exists(
"nChargedPFCandsMin") ) {
92 if ( decayMode.
exists(
"minPi0Mass") ) {
99 if ( decayMode.
exists(
"assumeStripMass") ) {
124 delete it->second.maxMass_;
132 edm::LogPrint(
"PFTauByHPSSelect") <<
"<PFRecoTauDiscriminationByHPSSelection::discriminate>:" ;
133 edm::LogPrint(
"PFTauByHPSSelect") <<
" nCharged = " << tau->signalTauChargedHadronCandidates().size() ;
134 edm::LogPrint(
"PFTauByHPSSelect") <<
" nPiZeros = " << tau->signalPiZeroCandidates().size() ;
138 if ( tau->pt() <
minPt_ ) {
146 DecayModeCutMap::const_iterator massWindowIter =
147 decayModeCuts_.find(std::make_pair(tau->signalTauChargedHadronCandidates().size(),
148 tau->signalPiZeroCandidates().size()));
152 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails mass-window definition requirement." ;
160 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
161 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
172 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nTracks requirement for mass-window." ;
178 unsigned int nChargedPFCands = 0;
179 const std::vector<reco::PFRecoTauChargedHadron>& chargedHadrons = tau->signalTauChargedHadronCandidates();
180 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator
chargedHadron = chargedHadrons.begin();
191 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails nChargedPFCands requirement for mass-window." ;
199 edm::LogPrint(
"PFTauByHPSSelect") <<
"tau: Pt = " << tauP4.pt() <<
", eta = " << tauP4.eta() <<
", phi = " << tauP4.phi() <<
", mass = " << tauP4.mass() ;
204 tau->signalPiZeroCandidates()){
212 tau->signalPiZeroCandidates()){
218 stripsP4 += correction;
222 edm::LogPrint(
"PFTauByHPSSelect") <<
"strips: Pt = " << stripsP4.pt() <<
", eta = " << stripsP4.eta() <<
", phi = " << stripsP4.phi() <<
", mass = " << stripsP4.mass() ;
226 double maxMass_value = (*massWindow.
maxMass_)(*tau);
228 if ( !((tauP4.M() - bendCorrection_mass) < maxMass_value && (tauP4.M() + bendCorrection_mass) > massWindow.
minMass_) ) {
230 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut." ;
237 const std::vector<reco::PFRecoTauChargedHadron>& signalChargedHadrons = tau->signalTauChargedHadronCandidates();
238 for ( std::vector<reco::PFRecoTauChargedHadron>::const_iterator signalChargedHadron = signalChargedHadrons.begin();
239 signalChargedHadron != signalChargedHadrons.end(); ++signalChargedHadron ) {
240 tauP4_charged += signalChargedHadron->p4();
242 if ( !(tauP4_charged.mass() < maxMass_value) ) {
244 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails tau mass-window cut." ;
253 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails strip mass-window cut." ;
262 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails matching-cone cut." ;
268 double cone_size = tau->signalConeSize();
270 for (
auto const& cand : tau->signalTauChargedHadronCandidates()) {
274 if (
deltaR(cand.
p4(), tauP4) > cone_size ) {
276 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for charged hadron(s)." ;
282 for (
auto const& cand : tau->signalPiZeroCandidates()) {
284 double dEta =
std::max(0., fabs(cand.
eta() - tauP4.eta()) - bendCorrection_eta);
287 double dR2 = dEta*dEta + dPhi*dPhi;
289 edm::LogPrint(
"PFTauByHPSSelect") <<
"dR2(tau, signalPiZero) = " << dR2 ;
291 if ( dR2 > cone_size*cone_size ) {
293 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails signal-cone cut for strip(s)." ;
306 else algo_string =
"Undefined";
307 edm::LogPrint(
"PFTauByHPSSelect") <<
"algo(signalPFChargedHadr) = " << algo_string ;
311 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on PFRecoTauChargedHadron algo." ;
319 int numPixelHits = 0;
320 const std::vector<reco::PFCandidatePtr>& chargedHadrCands = tau->signalPFChargedHadrCands();
321 for ( std::vector<reco::PFCandidatePtr>::const_iterator chargedHadrCand = chargedHadrCands.begin();
322 chargedHadrCand != chargedHadrCands.end(); ++chargedHadrCand ) {
324 if ( (*chargedHadrCand)->trackRef().isNonnull() ) track = (*chargedHadrCand)->trackRef().get();
325 else if ( (*chargedHadrCand)->gsfTrackRef().isNonnull() ) track = (*chargedHadrCand)->gsfTrackRef().get();
332 edm::LogPrint(
"PFTauByHPSSelect") <<
" fails cut on sum of pixel hits." ;
T getParameter(std::string const &) const
const unsigned int nTracks(const reco::Vertex &sv)
std::map< IntPair, DecayModeCuts > DecayModeCutMap
PFRecoTauChargedHadronAlgorithm algo() const
Algorithm that built this charged hadron.
PFRecoTauDiscriminationByHPSSelection(const edm::ParameterSet &)
double eta() const final
momentum pseudorapidity
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)
const LorentzVector & p4() const final
four-momentum Lorentz vector
~PFRecoTauDiscriminationByHPSSelection() override
double deltaR(double eta1, double eta2, double phi1, double phi2)
double deltaPhi(double phi1, double phi2)
float bendCorrEta() const
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.
float bendCorrPhi() const
DecayModeCutMap decayModeCuts_
int numberOfValidPixelHits() const
double phi() const final
momentum azimuthal angle
bool applyBendCorrection_phi_