CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
PFCaloGPUComparisonTask Class Reference
Inheritance diagram for PFCaloGPUComparisonTask:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (edm::Event const &e, edm::EventSetup const &c) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 PFCaloGPUComparisonTask (edm::ParameterSet const &conf)
 
 ~PFCaloGPUComparisonTask () override=default
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

std::string pfCaloGPUCompDir_
 
MonitorElementpfCluster_Depth_GPUvsCPU_
 
MonitorElementpfCluster_DuplicateMatches_GPUvsCPU_
 
MonitorElementpfCluster_Energy_GPUvsCPU_
 
MonitorElementpfCluster_Eta_GPUvsCPU_
 
MonitorElementpfCluster_Layer_GPUvsCPU_
 
MonitorElementpfCluster_Multiplicity_GPUvsCPU_
 
MonitorElementpfCluster_Phi_GPUvsCPU_
 
MonitorElementpfCluster_RecHitMultiplicity_GPUvsCPU_
 
edm::EDGetTokenT< reco::PFClusterCollectionpfClusterTok_ref_
 
edm::EDGetTokenT< reco::PFClusterCollectionpfClusterTok_target_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 45 of file PFCaloGPUComparisonTask.cc.

Constructor & Destructor Documentation

◆ PFCaloGPUComparisonTask()

PFCaloGPUComparisonTask::PFCaloGPUComparisonTask ( edm::ParameterSet const &  conf)

Definition at line 68 of file PFCaloGPUComparisonTask.cc.

References edm::ParameterSet::getUntrackedParameter().

69  : pfClusterTok_ref_{consumes<reco::PFClusterCollection>(
70  conf.getUntrackedParameter<edm::InputTag>("pfClusterToken_ref"))},
72  consumes<reco::PFClusterCollection>(conf.getUntrackedParameter<edm::InputTag>("pfClusterToken_target"))},
73  pfCaloGPUCompDir_{conf.getUntrackedParameter<std::string>("pfCaloGPUCompDir")} {}
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterTok_ref_
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterTok_target_

◆ ~PFCaloGPUComparisonTask()

PFCaloGPUComparisonTask::~PFCaloGPUComparisonTask ( )
overridedefault

Member Function Documentation

◆ analyze()

void PFCaloGPUComparisonTask::analyze ( edm::Event const &  e,
edm::EventSetup const &  c 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 106 of file PFCaloGPUComparisonTask.cc.

References dqm::impl::MonitorElement::Fill(), nano_mu_digi_cff::float, dqm::impl::MonitorElement::getTH2F(), mps_fire::i, dqmiolumiharvest::j, LOGVERB, muonTagProbeFilters_cff::matched, pfCluster_Depth_GPUvsCPU_, pfCluster_DuplicateMatches_GPUvsCPU_, pfCluster_Energy_GPUvsCPU_, pfCluster_Eta_GPUvsCPU_, pfCluster_Layer_GPUvsCPU_, pfCluster_Multiplicity_GPUvsCPU_, pfCluster_Phi_GPUvsCPU_, pfCluster_RecHitMultiplicity_GPUvsCPU_, pfClusterTok_ref_, and pfClusterTok_target_.

106  {
108  event.getByToken(pfClusterTok_ref_, pfClusters_ref);
109 
110  edm::Handle<reco::PFClusterCollection> pfClusters_target;
111  event.getByToken(pfClusterTok_target_, pfClusters_target);
112 
113  //
114  // Compare per-event PF cluster multiplicity
115 
116  if (pfClusters_ref->size() != pfClusters_target->size())
117  LOGVERB("PFCaloGPUComparisonTask") << " PFCluster multiplicity " << pfClusters_ref->size() << " "
118  << pfClusters_target->size();
119  pfCluster_Multiplicity_GPUvsCPU_->Fill((float)pfClusters_ref->size(), (float)pfClusters_target->size());
120 
121  //
122  // Find matching PF cluster pairs
123  std::vector<int> matched_idx;
124  matched_idx.reserve(pfClusters_ref->size());
125  for (unsigned i = 0; i < pfClusters_ref->size(); ++i) {
126  bool matched = false;
127  for (unsigned j = 0; j < pfClusters_target->size(); ++j) {
128  if (pfClusters_ref->at(i).seed() == pfClusters_target->at(j).seed()) {
129  if (!matched) {
130  matched = true;
131  matched_idx.push_back((int)j);
132  } else {
133  edm::LogWarning("PFCaloGPUComparisonTask") << "Found duplicate match";
135  }
136  }
137  }
138  if (!matched)
139  matched_idx.push_back(-1); // if you don't find a match, put a dummy number
140  }
141 
142  //
143  // Plot matching PF cluster variables
144  for (unsigned i = 0; i < pfClusters_ref->size(); ++i) {
145  if (matched_idx[i] >= 0) {
146  unsigned int j = matched_idx[i];
147  int ref_energy_bin = pfCluster_Energy_GPUvsCPU_->getTH2F()->GetXaxis()->FindBin(pfClusters_ref->at(i).energy());
148  int target_energy_bin =
149  pfCluster_Energy_GPUvsCPU_->getTH2F()->GetXaxis()->FindBin(pfClusters_target->at(j).energy());
150  if (ref_energy_bin != target_energy_bin)
151  edm::LogPrint("PFCaloGPUComparisonTask")
152  << "Off-diagonal energy bin entries: " << pfClusters_ref->at(i).energy() << " "
153  << pfClusters_ref->at(i).eta() << " " << pfClusters_ref->at(i).phi() << " "
154  << pfClusters_target->at(j).energy() << " " << pfClusters_target->at(j).eta() << " "
155  << pfClusters_target->at(j).phi() << std::endl;
156  pfCluster_Energy_GPUvsCPU_->Fill(pfClusters_ref->at(i).energy(), pfClusters_target->at(j).energy());
157  pfCluster_Layer_GPUvsCPU_->Fill(pfClusters_ref->at(i).layer(), pfClusters_target->at(j).layer());
158  pfCluster_Eta_GPUvsCPU_->Fill(pfClusters_ref->at(i).eta(), pfClusters_target->at(j).eta());
159  pfCluster_Phi_GPUvsCPU_->Fill(pfClusters_ref->at(i).phi(), pfClusters_target->at(j).phi());
160  pfCluster_Depth_GPUvsCPU_->Fill(pfClusters_ref->at(i).depth(), pfClusters_target->at(j).depth());
161  pfCluster_RecHitMultiplicity_GPUvsCPU_->Fill((float)pfClusters_ref->at(i).recHitFractions().size(),
162  (float)pfClusters_target->at(j).recHitFractions().size());
163  }
164  }
165 }
MonitorElement * pfCluster_Phi_GPUvsCPU_
MonitorElement * pfCluster_Multiplicity_GPUvsCPU_
MonitorElement * pfCluster_Depth_GPUvsCPU_
void Fill(long long x)
Log< level::Warning, true > LogPrint
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterTok_ref_
MonitorElement * pfCluster_RecHitMultiplicity_GPUvsCPU_
MonitorElement * pfCluster_Eta_GPUvsCPU_
MonitorElement * pfCluster_DuplicateMatches_GPUvsCPU_
Log< level::Warning, false > LogWarning
MonitorElement * pfCluster_Layer_GPUvsCPU_
#define LOGVERB(x)
MonitorElement * pfCluster_Energy_GPUvsCPU_
edm::EDGetTokenT< reco::PFClusterCollection > pfClusterTok_target_

◆ bookHistograms()

void PFCaloGPUComparisonTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  irun,
edm::EventSetup const &  isetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 75 of file PFCaloGPUComparisonTask.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), timingPdfMaker::histo, pfCaloGPUCompDir_, pfCluster_Depth_GPUvsCPU_, pfCluster_DuplicateMatches_GPUvsCPU_, pfCluster_Energy_GPUvsCPU_, pfCluster_Eta_GPUvsCPU_, pfCluster_Layer_GPUvsCPU_, pfCluster_Multiplicity_GPUvsCPU_, pfCluster_Phi_GPUvsCPU_, pfCluster_RecHitMultiplicity_GPUvsCPU_, and dqm::implementation::NavigatorBase::setCurrentFolder().

77  {
78  const char* histo;
79 
80  ibooker.setCurrentFolder("ParticleFlow/" + pfCaloGPUCompDir_);
81 
82  histo = "pfCluster_Multiplicity_GPUvsCPU";
83  pfCluster_Multiplicity_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 2000, 100, 0, 2000);
84 
85  histo = "pfCluster_Energy_GPUvsCPU";
86  pfCluster_Energy_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 500, 100, 0, 500);
87 
88  histo = "pfCluster_RecHitMultiplicity_GPUvsCPU";
89  pfCluster_RecHitMultiplicity_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 100, 100, 0, 100);
90 
91  histo = "pfCluster_Layer_GPUvsCPU";
92  pfCluster_Layer_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 100, 100, 0, 100);
93 
94  histo = "pfCluster_Depth_GPUvsCPU";
95  pfCluster_Depth_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 100, 100, 0, 100);
96 
97  histo = "pfCluster_Eta_GPUvsCPU";
98  pfCluster_Eta_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 100, 100, 0, 100);
99 
100  histo = "pfCluster_Phi_GPUvsCPU";
101  pfCluster_Phi_GPUvsCPU_ = ibooker.book2D(histo, histo, 100, 0, 100, 100, 0, 100);
102 
103  histo = "pfCluster_DuplicateMatches_GPUvsCPU";
104  pfCluster_DuplicateMatches_GPUvsCPU_ = ibooker.book1D(histo, histo, 100, 0., 1000);
105 }
MonitorElement * pfCluster_Phi_GPUvsCPU_
MonitorElement * pfCluster_Multiplicity_GPUvsCPU_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * pfCluster_Depth_GPUvsCPU_
MonitorElement * pfCluster_RecHitMultiplicity_GPUvsCPU_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:212
MonitorElement * pfCluster_Eta_GPUvsCPU_
MonitorElement * pfCluster_DuplicateMatches_GPUvsCPU_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * pfCluster_Layer_GPUvsCPU_
MonitorElement * pfCluster_Energy_GPUvsCPU_

Member Data Documentation

◆ pfCaloGPUCompDir_

std::string PFCaloGPUComparisonTask::pfCaloGPUCompDir_
private

Definition at line 65 of file PFCaloGPUComparisonTask.cc.

Referenced by bookHistograms().

◆ pfCluster_Depth_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_Depth_GPUvsCPU_
private

Definition at line 60 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_DuplicateMatches_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_DuplicateMatches_GPUvsCPU_
private

Definition at line 63 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_Energy_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_Energy_GPUvsCPU_
private

Definition at line 57 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_Eta_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_Eta_GPUvsCPU_
private

Definition at line 61 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_Layer_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_Layer_GPUvsCPU_
private

Definition at line 59 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_Multiplicity_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_Multiplicity_GPUvsCPU_
private

Definition at line 56 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_Phi_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_Phi_GPUvsCPU_
private

Definition at line 62 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfCluster_RecHitMultiplicity_GPUvsCPU_

MonitorElement* PFCaloGPUComparisonTask::pfCluster_RecHitMultiplicity_GPUvsCPU_
private

Definition at line 58 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze(), and bookHistograms().

◆ pfClusterTok_ref_

edm::EDGetTokenT<reco::PFClusterCollection> PFCaloGPUComparisonTask::pfClusterTok_ref_
private

Definition at line 53 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze().

◆ pfClusterTok_target_

edm::EDGetTokenT<reco::PFClusterCollection> PFCaloGPUComparisonTask::pfClusterTok_target_
private

Definition at line 54 of file PFCaloGPUComparisonTask.cc.

Referenced by analyze().