23 const bool srcMuons_label_empty,
27 std::atomic<unsigned int>& numWarnings,
28 const unsigned int& maxWarnings,
38 : pfLeadChargedHadron_{pfCand} {
40 edm::LogPrint(
"PFTauAgainstMuon2") <<
"<PFRecoTauDiscriminationAgainstMuon2Container::discriminate>:";
42 edm::LogPrint(
"PFTauAgainstMuon2") <<
"tau #" << pfTau.key() <<
": Pt = " << pfTau->pt()
43 <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi();
46 std::vector<int> numMatchesDT(4);
47 std::vector<int> numMatchesCSC(4);
48 std::vector<int> numMatchesRPC(4);
49 std::vector<int> numHitsDT(4);
50 std::vector<int> numHitsCSC(4);
51 std::vector<int> numHitsRPC(4);
52 for (
int iStation = 0; iStation < 4; ++iStation) {
53 numMatchesDT[iStation] = 0;
54 numMatchesCSC[iStation] = 0;
55 numMatchesRPC[iStation] = 0;
56 numHitsDT[iStation] = 0;
57 numHitsCSC[iStation] = 0;
58 numHitsRPC[iStation] = 0;
62 if (pfLeadChargedHadron_.isNonnull()) {
72 if (!srcMuons_label_empty) {
74 for (
size_t idxMuon = 0; idxMuon <
numMuons; ++idxMuon) {
78 <<
", eta = " <<
muon->eta() <<
", phi = " <<
muon->phi();
81 edm::LogPrint(
"PFTauAgainstMuon2") <<
" fails Pt cut --> skipping it.";
85 if (pfLeadChargedHadron_.isNonnull()) {
87 if (muonRef.
isNonnull() &&
muon == pfLeadChargedHadron_->muonRef()) {
89 edm::LogPrint(
"PFTauAgainstMuon2") <<
" matches muonRef of tau --> skipping it.";
98 if (pfTau->jetRef().isNonnull())
99 jetArea = pfTau->jetRef()->jetArea();
103 if (numWarnings < maxWarnings) {
104 edm::LogInfo(
"PFRecoTauDiscriminationAgainstMuon2Container::discriminate")
105 <<
"Jet associated to Tau: Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta()
106 <<
", phi = " << pfTau->phi() <<
" has area = " << jetArea <<
" !!";
114 edm::LogPrint(
"PFTauAgainstMuon2") <<
" overlaps with tau, dR = " <<
dR;
121 for (
int iStation = 0; iStation < 4; ++iStation) {
123 ++numStationsWithMatches_;
125 ++numStationsWithMatches_;
127 ++numStationsWithMatches_;
130 for (
int iStation = 2; iStation < 4; ++iStation) {
131 if (numHitsDT[iStation] > 0 && !
maskHitsDT[iStation])
132 ++numLast2StationsWithHits_;
133 if (numHitsCSC[iStation] > 0 && !
maskHitsCSC[iStation])
134 ++numLast2StationsWithHits_;
135 if (numHitsRPC[iStation] > 0 && !
maskHitsRPC[iStation])
136 ++numLast2StationsWithHits_;
143 edm::LogPrint(
"PFTauAgainstMuon2") <<
" --> numStationsWithMatches_ = " << numStationsWithMatches_;
147 edm::LogPrint(
"PFTauAgainstMuon2") <<
" --> numLast2StationsWithHits_ = " << numLast2StationsWithHits_;
150 if (pfLeadChargedHadron_.isNonnull()) {
151 energyECALplusHCAL_ = pfLeadChargedHadron_->ecalEnergy() + pfLeadChargedHadron_->hcalEnergy();
153 if (pfLeadChargedHadron_->trackRef().isNonnull()) {
155 <<
"decayMode = " << pfTau->decayMode() <<
", energy(ECAL+HCAL) = " << energyECALplusHCAL_
156 <<
", leadPFChargedHadronP = " << pfLeadChargedHadron_->trackRef()->p();
157 }
else if (pfLeadChargedHadron_->gsfTrackRef().isNonnull()) {
159 <<
"decayMode = " << pfTau->decayMode() <<
", energy(ECAL+HCAL) = " << energyECALplusHCAL_
160 <<
", leadPFChargedHadronP = " << pfLeadChargedHadron_->gsfTrackRef()->p();
163 if (pfLeadChargedHadron_->trackRef().isNonnull())
164 leadTrack_ = pfLeadChargedHadron_->trackRef().get();
165 else if (pfLeadChargedHadron_->gsfTrackRef().isNonnull())
166 leadTrack_ = pfLeadChargedHadron_->gsfTrackRef().get();
172 bool passesCaloMuonVeto =
true;
175 passesCaloMuonVeto =
false;
178 bool discriminatorValue =
false;
181 discriminatorValue =
true;
185 discriminatorValue =
true;
189 discriminatorValue =
true;
191 discriminatorValue =
true;
193 discriminatorValue =
false;
195 discriminatorValue =
false;
196 if (
config.doCaloMuonVeto && !passesCaloMuonVeto)
197 discriminatorValue =
false;
199 return discriminatorValue;