24 const bool srcMuons_label_empty,
28 std::atomic<unsigned int>& numWarnings,
29 const unsigned int& maxWarnings,
39 : pfLeadChargedHadron_{pfCand} {
41 edm::LogPrint(
"PFTauAgainstMuon2") <<
"<PFRecoTauDiscriminationAgainstMuon2Container::discriminate>:";
42 edm::LogPrint(
"PFTauAgainstMuon2") <<
" moduleLabel = " << moduleLabel;
43 edm::LogPrint(
"PFTauAgainstMuon2") <<
"tau #" << pfTau.key() <<
": Pt = " << pfTau->pt()
44 <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
47 std::vector<int> numMatchesDT(4);
48 std::vector<int> numMatchesCSC(4);
49 std::vector<int> numMatchesRPC(4);
50 std::vector<int> numHitsDT(4);
51 std::vector<int> numHitsCSC(4);
52 std::vector<int> numHitsRPC(4);
53 for (
int iStation = 0; iStation < 4; ++iStation) {
54 numMatchesDT[iStation] = 0;
55 numMatchesCSC[iStation] = 0;
56 numMatchesRPC[iStation] = 0;
57 numHitsDT[iStation] = 0;
58 numHitsCSC[iStation] = 0;
59 numHitsRPC[iStation] = 0;
63 if (pfLeadChargedHadron_.isNonnull()) {
73 if (!srcMuons_label_empty) {
75 for (
size_t idxMuon = 0; idxMuon <
numMuons; ++idxMuon) {
79 <<
", eta = " <<
muon->eta() <<
", phi = " <<
muon->phi();
82 edm::LogPrint(
"PFTauAgainstMuon2") <<
" fails Pt cut --> skipping it.";
86 if (pfLeadChargedHadron_.isNonnull()) {
88 if (muonRef.
isNonnull() &&
muon == pfLeadChargedHadron_->muonRef()) {
90 edm::LogPrint(
"PFTauAgainstMuon2") <<
" matches muonRef of tau --> skipping it.";
99 if (pfTau->jetRef().isNonnull())
100 jetArea = pfTau->jetRef()->jetArea();
104 if (numWarnings < maxWarnings) {
105 edm::LogInfo(
"PFRecoTauDiscriminationAgainstMuon2Container::discriminate")
106 <<
"Jet associated to Tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta()
107 <<
", phi = " << pfTau->phi() <<
" has area = " << jetArea <<
" !!";
115 edm::LogPrint(
"PFTauAgainstMuon2") <<
" overlaps with tau, dR = " << dR;
122 for (
int iStation = 0; iStation < 4; ++iStation) {
124 ++numStationsWithMatches_;
126 ++numStationsWithMatches_;
128 ++numStationsWithMatches_;
131 for (
int iStation = 2; iStation < 4; ++iStation) {
132 if (numHitsDT[iStation] > 0 && !
maskHitsDT[iStation])
133 ++numLast2StationsWithHits_;
134 if (numHitsCSC[iStation] > 0 && !
maskHitsCSC[iStation])
135 ++numLast2StationsWithHits_;
136 if (numHitsRPC[iStation] > 0 && !
maskHitsRPC[iStation])
137 ++numLast2StationsWithHits_;
144 edm::LogPrint(
"PFTauAgainstMuon2") <<
" --> numStationsWithMatches_ = " << numStationsWithMatches_;
148 edm::LogPrint(
"PFTauAgainstMuon2") <<
" --> numLast2StationsWithHits_ = " << numLast2StationsWithHits_;
151 if (pfLeadChargedHadron_.isNonnull()) {
152 energyECALplusHCAL_ = pfLeadChargedHadron_->ecalEnergy() + pfLeadChargedHadron_->hcalEnergy();
154 if (pfLeadChargedHadron_->trackRef().isNonnull()) {
156 <<
"decayMode = " << pfTau->decayMode() <<
", energy(ECAL+HCAL) = " << energyECALplusHCAL_
157 <<
", leadPFChargedHadronP = " << pfLeadChargedHadron_->trackRef()->p();
158 }
else if (pfLeadChargedHadron_->gsfTrackRef().isNonnull()) {
160 <<
"decayMode = " << pfTau->decayMode() <<
", energy(ECAL+HCAL) = " << energyECALplusHCAL_
161 <<
", leadPFChargedHadronP = " << pfLeadChargedHadron_->gsfTrackRef()->p();
164 if (pfLeadChargedHadron_->trackRef().isNonnull())
165 leadTrack_ = pfLeadChargedHadron_->trackRef().get();
166 else if (pfLeadChargedHadron_->gsfTrackRef().isNonnull())
167 leadTrack_ = pfLeadChargedHadron_->gsfTrackRef().get();
173 bool passesCaloMuonVeto =
true;
176 passesCaloMuonVeto =
false;
179 bool discriminatorValue =
false;
182 discriminatorValue =
true;
186 discriminatorValue =
true;
190 discriminatorValue =
true;
192 discriminatorValue =
true;
194 discriminatorValue =
false;
196 discriminatorValue =
false;
198 discriminatorValue =
false;
200 return discriminatorValue;
double p() const
momentum vector magnitude
bool isNonnull() const
Checks for non-null.
void countMatches(const reco::Muon &muon, std::vector< int > &numMatchesDT, std::vector< int > &numMatchesCSC, std::vector< int > &numMatchesRPC)
double energyECALplusHCAL_
const reco::Track * leadTrack_
tuple dRmuonMatchLimitedToJetArea
bool eval(const PFRecoTauDiscriminationAgainstMuonConfigSet &, const reco::PFTauRef &) const
const reco::PFCandidatePtr & pfLeadChargedHadron_
Log< level::Warning, true > LogPrint
int maxNumberOfHitsLast2Stations
int numLast2StationsWithHits_
bool isNonnull() const
Checks for non-null.
Log< level::Info, false > LogInfo
int numStationsWithMatches_
tuple config
parse the configuration file
std::string format_vint(const std::vector< int > &vi)
PFRecoTauDiscriminationAgainstMuon2Helper(const bool &, const std::string &, const bool, const double &, const double &, const bool &, std::atomic< unsigned int > &, const unsigned int &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const std::vector< int > &, const edm::Handle< reco::MuonCollection > &, const reco::PFTauRef &, const reco::PFCandidatePtr &)
void countHits(const reco::Muon &muon, std::vector< int > &numHitsDT, std::vector< int > &numHitsCSC, std::vector< int > &numHitsRPC)