Go to the documentation of this file.00001 #ifndef RecoParticleFlow_Benchmark_BenchmarkManager_h
00002 #define RecoParticleFlow_Benchmark_BenchmarkManager_h
00003
00004 #include "DQMOffline/PFTau/interface/Benchmark.h"
00005 #include "DQMOffline/PFTau/interface/CandidateBenchmark.h"
00006 #include "DQMOffline/PFTau/interface/PFCandidateBenchmark.h"
00007 #include "DQMOffline/PFTau/interface/MatchCandidateBenchmark.h"
00008
00009 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
00010 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00011
00012 #include <vector>
00013
00024 class PFCandidateManager : public Benchmark {
00025
00026 public:
00027
00028 PFCandidateManager( float dRMax = 0.3,
00029 bool matchCharge = true,
00030 Benchmark::Mode mode=Benchmark::DEFAULT)
00031 :
00032 Benchmark(mode),
00033 candBench_(mode), pfCandBench_(mode), matchCandBench_(mode),
00034 dRMax_(dRMax), matchCharge_(matchCharge) {}
00035
00036 virtual ~PFCandidateManager();
00037
00039 void setParameters( float dRMax = 0.3,
00040 bool matchCharge = true,
00041 Benchmark::Mode mode=Benchmark::DEFAULT );
00042
00044 void setDirectory(TDirectory* dir);
00045
00047 void setup();
00048
00050 template< class C>
00051 void fill(const reco::PFCandidateCollection& candCollection,
00052 const C& matchedCandCollection );
00053
00054 protected:
00055 CandidateBenchmark candBench_;
00056 PFCandidateBenchmark pfCandBench_;
00057 MatchCandidateBenchmark matchCandBench_;
00058
00059 float dRMax_;
00060 bool matchCharge_;
00061
00062 };
00063
00064
00065 #include "DQMOffline/PFTau/interface/Matchers.h"
00066
00067 template< class C>
00068 void PFCandidateManager::fill(const reco::PFCandidateCollection& candCollection,
00069 const C& matchCandCollection) {
00070
00071
00072 std::vector<int> matchIndices;
00073 PFB::match( candCollection, matchCandCollection, matchIndices,
00074 matchCharge_, dRMax_ );
00075
00076 for (unsigned int i = 0; i < candCollection.size(); i++) {
00077 const reco::PFCandidate& cand = candCollection[i];
00078
00079 if( !isInRange(cand.pt(), cand.eta(), cand.phi() ) ) continue;
00080
00081 int iMatch = matchIndices[i];
00082
00083 assert(iMatch< static_cast<int>(matchCandCollection.size()));
00084
00085
00086
00087
00088
00089 if( iMatch!=-1 ) {
00090 candBench_.fillOne(cand);
00091 pfCandBench_.fillOne(cand);
00092 matchCandBench_.fillOne(cand, matchCandCollection[ iMatch ]);
00093 }
00094 }
00095 }
00096
00097
00098
00099 #endif