45 <<
" Invalid Configuration parameter 'discriminatorOption' = " << discriminatorOption_string <<
" !!\n";
50 if ( cfg.
exists(
"srcMuons") ) {
84 void countHits(
const reco::Muon&
muon, std::vector<int>& numHitsDT, std::vector<int>& numHitsCSC, std::vector<int>& numHitsRPC)
88 for (
int iHit = 0; iHit < muonHitPattern.
numberOfHits(); ++iHit ) {
90 if ( hit == 0 )
break;
93 if ( muonStation >= 0 && muonStation < 4 ) {
103 std::string format_vint(
const std::vector<int>& vi)
105 std::ostringstream os;
108 for (
unsigned iEntry = 0; iEntry <
numEntries; ++iEntry ) {
110 if ( iEntry < (numEntries - 1) ) os <<
", ";
120 std::cout <<
"<PFRecoTauDiscriminationAgainstMuon2::discriminate>:" << std::endl;
122 std::cout <<
"tau #" << pfTau.
key() <<
": Pt = " << pfTau->pt() <<
", eta = " << pfTau->eta() <<
", phi = " << pfTau->phi() << std::endl;
127 std::vector<int> numHitsDT(4);
128 std::vector<int> numHitsCSC(4);
129 std::vector<int> numHitsRPC(4);
130 for (
int iStation = 0; iStation < 4; ++iStation ) {
131 numHitsDT[iStation] = 0;
132 numHitsCSC[iStation] = 0;
133 numHitsRPC[iStation] = 0;
142 countHits(*muonRef, numHitsDT, numHitsCSC, numHitsRPC);
148 for (
size_t idxMuon = 0; idxMuon <
numMuons; ++idxMuon ) {
150 if (
verbosity_ )
std::cout <<
"muon #" << muon.
key() <<
": Pt = " << muon->pt() <<
", eta = " << muon->eta() <<
", phi = " << muon->phi() << std::endl;
151 if ( pfLeadChargedHadron.
isNonnull() && pfLeadChargedHadron->muonRef().
isNonnull() && muon == pfLeadChargedHadron->muonRef() ) {
155 double dR =
deltaR(muon->p4(), pfTau->p4());
159 countHits(*muon, numHitsDT, numHitsCSC, numHitsRPC);
165 std::cout <<
"numMatches = " << numMatches << std::endl;
166 std::cout <<
"numHitsDT = " << format_vint(numHitsDT) << std::endl;
167 std::cout <<
"numHitsCSC = " << format_vint(numHitsCSC) << std::endl;
168 std::cout <<
"numHitsRPC = " << format_vint(numHitsRPC) << std::endl;
171 int numLast2StationsWithHits = 0;
172 for (
int iStation = 2; iStation < 4; ++iStation ) {
173 if ( numHitsDT[iStation] > 0 ) ++numLast2StationsWithHits;
174 if ( numHitsCSC[iStation] > 0 ) ++numLast2StationsWithHits;
175 if ( numHitsRPC[iStation] > 0 ) ++numLast2StationsWithHits;
179 bool passesCaloMuonVeto =
true;
181 double energyECALplusHCAL = pfLeadChargedHadron->ecalEnergy() + pfLeadChargedHadron->hcalEnergy();
183 if ( pfLeadChargedHadron->trackRef().
isNonnull() )
std::cout <<
"decayMode = " << pfTau->decayMode() <<
", energy(ECAL+HCAL) = " << energyECALplusHCAL <<
", leadPFChargedHadronP = " << pfLeadChargedHadron->trackRef()->p() << std::endl;
184 else if ( pfLeadChargedHadron->gsfTrackRef().
isNonnull() )
185 std::cout <<
"decayMode = " << pfTau->decayMode() <<
", energy(ECAL+HCAL) = " << energyECALplusHCAL <<
", leadPFChargedHadronP = " << pfLeadChargedHadron->gsfTrackRef()->p() << std::endl;
189 if ( pfLeadChargedHadron->trackRef().
isNonnull() ) leadTrack = pfLeadChargedHadron->trackRef().
get();
190 else if ( pfLeadChargedHadron->gsfTrackRef().
isNonnull() ) leadTrack = pfLeadChargedHadron->gsfTrackRef().
get();
191 if ( pfTau->decayMode() == 0 && leadTrack && energyECALplusHCAL < (
hop_*leadTrack->
p()) ) passesCaloMuonVeto =
false;
194 double discriminatorValue = 0.;
203 discriminatorValue = pass ? 1.: 0.;
205 if (
verbosity_ )
std::cout <<
"--> returning discriminatorValue = " << discriminatorValue << std::endl;
207 return discriminatorValue;
double p() const
momentum vector magnitude
T getParameter(std::string const &) const
static bool muonDTHitFilter(uint32_t pattern)
#define DEFINE_FWK_MODULE(type)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
static uint32_t getHitType(uint32_t pattern)
static uint32_t getMuonStation(uint32_t pattern)
Muon station (1-4). Only valid for muon patterns, of course.
double discriminate(const reco::PFTauRef &)
int maxNumberOfHitsLast2Stations_
static bool muonHitFilter(uint32_t pattern)
bool isNonnull() const
Checks for non-null.
Long64_t numEntries(TFile *hdl, std::string const &trname)
~PFRecoTauDiscriminationAgainstMuon2()
static bool muonRPCHitFilter(uint32_t pattern)
edm::Handle< reco::MuonCollection > muons_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
double deltaR(double eta1, double eta2, double phi1, double phi2)
key_type key() const
Accessor for product key.
static bool muonCSCHitFilter(uint32_t pattern)
T const * get() const
Returns C++ pointer to the item.
uint32_t getHitPattern(int position) const
void beginEvent(const edm::Event &, const edm::EventSetup &)
PFRecoTauDiscriminationAgainstMuon2(const edm::ParameterSet &cfg)