Public Member Functions | |
virtual void | endJob () |
virtual bool | filter (edm::Event &evt, const edm::EventSetup &es) |
RecoTauDifferenceAnalyzer (const edm::ParameterSet &pset) | |
virtual | ~RecoTauDifferenceAnalyzer () |
Private Attributes | |
size_t | allPassed1_ |
size_t | allPassed2_ |
size_t | differences_ |
edm::InputTag | disc1_ |
edm::InputTag | disc2_ |
size_t | eventsExamined_ |
bool | filter_ |
double | maxDeltaR_ |
size_t | passed1_ |
size_t | passed2_ |
edm::InputTag | src1_ |
edm::InputTag | src2_ |
size_t | tausExamined_ |
Definition at line 10 of file RecoTauDifferenceAnalyzer.cc.
RecoTauDifferenceAnalyzer::RecoTauDifferenceAnalyzer | ( | const edm::ParameterSet & | pset | ) | [explicit] |
Definition at line 32 of file RecoTauDifferenceAnalyzer.cc.
References allPassed1_, allPassed2_, differences_, disc1_, disc2_, eventsExamined_, edm::ParameterSet::exists(), filter_, edm::ParameterSet::getParameter(), passed1_, passed2_, src1_, src2_, and tausExamined_.
{ src1_ = pset.getParameter<edm::InputTag>("src1"); src2_ = pset.getParameter<edm::InputTag>("src2"); disc1_ = pset.getParameter<edm::InputTag>("disc1"); disc2_ = pset.getParameter<edm::InputTag>("disc2"); eventsExamined_ = 0; tausExamined_ = 0; differences_ = 0; passed1_ = 0; passed2_ = 0; allPassed2_ = 0; allPassed1_ = 0; filter_ = pset.exists("filter") ? pset.getParameter<bool>("filter") : false; }
virtual RecoTauDifferenceAnalyzer::~RecoTauDifferenceAnalyzer | ( | ) | [inline, virtual] |
Definition at line 13 of file RecoTauDifferenceAnalyzer.cc.
{}
void RecoTauDifferenceAnalyzer::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDFilter.
Definition at line 120 of file RecoTauDifferenceAnalyzer.cc.
References allPassed1_, allPassed2_, gather_cfg::cout, differences_, disc1_, disc2_, eventsExamined_, passed1_, passed2_, src1_, src2_, and tausExamined_.
{ std::cout << " RECO TAU DIFFERENCE SUMMARY: " << std::endl; std::cout << " Examined " << tausExamined_ << " taus in " << eventsExamined_ << " events." << std::endl; std::cout << " There were " << differences_ << " differences." << std::endl; std::cout << src1_ << "," << disc1_ << " had " << allPassed1_ << " total passes and " << passed1_ << " exclusive passes." << std::endl; std::cout << src2_ << "," << disc2_ << " had " << allPassed2_ << " total passes and " << passed2_ << " exclusive passes." << std::endl; }
bool RecoTauDifferenceAnalyzer::filter | ( | edm::Event & | evt, |
const edm::EventSetup & | es | ||
) | [virtual] |
Implements edm::EDFilter.
Definition at line 58 of file RecoTauDifferenceAnalyzer.cc.
References allPassed1_, allPassed2_, gather_cfg::cout, deltaR(), differences_, disc1_, disc2_, eventsExamined_, filter_, edm::Event::getByLabel(), edm::Ref< C, T, F >::isNull(), passed1_, passed2_, src1_, src2_, and tausExamined_.
{ eventsExamined_++; // Get taus edm::Handle<reco::PFTauCollection> taus1; evt.getByLabel(src1_, taus1); edm::Handle<reco::PFTauCollection> taus2; evt.getByLabel(src2_, taus2); // Get discriminators edm::Handle<reco::PFTauDiscriminator> disc1; evt.getByLabel(disc1_, disc1); edm::Handle<reco::PFTauDiscriminator> disc2; evt.getByLabel(disc2_, disc2); bool differenceFound = false; // Loop over first collection for (size_t iTau1 = 0; iTau1 < taus1->size(); ++iTau1) { tausExamined_++; reco::PFTauRef tau1(taus1, iTau1); // Find the best match in the other collection reco::PFTauRef bestMatch; double bestDeltaR = -1; for (size_t iTau2 = 0; iTau2 < taus2->size(); ++iTau2) { reco::PFTauRef tau2(taus2, iTau2); reco::PFJetRef jet1 = getJetRef(*tau1); reco::PFJetRef jet2 = getJetRef(*tau2); double deltaRVal = deltaR(jet2->p4(), jet1->p4()); if (bestMatch.isNull() || deltaRVal < bestDeltaR) { bestMatch = tau2; bestDeltaR = deltaRVal; } } // See what's up with the discriminators bool result1 = ((*disc1)[tau1] > 0.5); bool result2 = ((*disc2)[bestMatch] > 0.5); allPassed1_ += result1; allPassed2_ += result2; if (result1 ^ result2) { differenceFound = true; passed1_ += result1; passed2_ += result2; differences_++; std::cout << "********* RecoTau difference detected! *************" << std::endl; std::cout << " Tau1 InputTag: " << src1_ << " result: " << result1 << std::endl; std::cout << " Tau2 InputTag: " << src2_ << " result: " << result2 << std::endl; std::cout << "--------- Tau 1 -------------" << std::endl; std::cout << *tau1 << std::endl; tau1->dump(std::cout); std::cout << "--------- Tau 2 -------------" << std::endl; std::cout << *bestMatch << std::endl; bestMatch->dump(std::cout); } } return (filter_ ? differenceFound : true); }
size_t RecoTauDifferenceAnalyzer::allPassed1_ [private] |
Definition at line 27 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
size_t RecoTauDifferenceAnalyzer::allPassed2_ [private] |
Definition at line 28 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
size_t RecoTauDifferenceAnalyzer::differences_ [private] |
Definition at line 24 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
Definition at line 19 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
Definition at line 20 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
size_t RecoTauDifferenceAnalyzer::eventsExamined_ [private] |
Definition at line 22 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
bool RecoTauDifferenceAnalyzer::filter_ [private] |
Definition at line 29 of file RecoTauDifferenceAnalyzer.cc.
Referenced by filter(), and RecoTauDifferenceAnalyzer().
double RecoTauDifferenceAnalyzer::maxDeltaR_ [private] |
Definition at line 21 of file RecoTauDifferenceAnalyzer.cc.
size_t RecoTauDifferenceAnalyzer::passed1_ [private] |
Definition at line 25 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
size_t RecoTauDifferenceAnalyzer::passed2_ [private] |
Definition at line 26 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
Definition at line 17 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
Definition at line 18 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().
size_t RecoTauDifferenceAnalyzer::tausExamined_ [private] |
Definition at line 23 of file RecoTauDifferenceAnalyzer.cc.
Referenced by endJob(), filter(), and RecoTauDifferenceAnalyzer().