File indexing completed on 2024-04-06 12:09:44
0001 #ifndef RecoParticleFlow_Benchmark_BenchmarkManager_h
0002 #define RecoParticleFlow_Benchmark_BenchmarkManager_h
0003
0004 #include "DQMOffline/PFTau/interface/Benchmark.h"
0005 #include "DQMOffline/PFTau/interface/CandidateBenchmark.h"
0006 #include "DQMOffline/PFTau/interface/MatchCandidateBenchmark.h"
0007 #include "DQMOffline/PFTau/interface/PFCandidateBenchmark.h"
0008
0009 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0010 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0011
0012 #include <vector>
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 class PFCandidateManager : public Benchmark {
0027 public:
0028 PFCandidateManager(float dRMax = 0.3, bool matchCharge = true, Benchmark::Mode mode = Benchmark::DEFAULT)
0029 : Benchmark(mode),
0030 candBench_(mode),
0031 pfCandBench_(mode),
0032 matchCandBench_(mode),
0033 dRMax_(dRMax),
0034 matchCharge_(matchCharge) {}
0035
0036 ~PFCandidateManager() override;
0037
0038
0039 void setParameters(float dRMax = 0.3, bool matchCharge = true, Benchmark::Mode mode = Benchmark::DEFAULT);
0040
0041
0042 void setDirectory(TDirectory *dir) override;
0043
0044
0045 void setup(DQMStore::IBooker &b);
0046
0047
0048 template <class C>
0049 void fill(const reco::PFCandidateCollection &candCollection, const C &matchedCandCollection);
0050
0051 protected:
0052 CandidateBenchmark candBench_;
0053 PFCandidateBenchmark pfCandBench_;
0054 MatchCandidateBenchmark matchCandBench_;
0055
0056 float dRMax_;
0057 bool matchCharge_;
0058 };
0059
0060 #include "DQMOffline/PFTau/interface/Matchers.h"
0061
0062 template <class C>
0063 void PFCandidateManager::fill(const reco::PFCandidateCollection &candCollection, const C &matchCandCollection) {
0064 std::vector<int> matchIndices;
0065 PFB::match(candCollection, matchCandCollection, matchIndices, matchCharge_, dRMax_);
0066
0067 for (unsigned int i = 0; i < candCollection.size(); i++) {
0068 const reco::PFCandidate &cand = candCollection[i];
0069
0070 if (!isInRange(cand.pt(), cand.eta(), cand.phi()))
0071 continue;
0072
0073 int iMatch = matchIndices[i];
0074
0075 assert(iMatch < static_cast<int>(matchCandCollection.size()));
0076
0077
0078
0079
0080
0081 if (iMatch != -1) {
0082 candBench_.fillOne(cand);
0083 pfCandBench_.fillOne(cand);
0084 matchCandBench_.fillOne(cand, matchCandCollection[iMatch]);
0085 }
0086 }
0087 }
0088
0089 #endif