CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes
SiPixelPhase1RawDataErrorComparator Class Reference

#include <SiPixelPhase1RawDataErrorComparator.cc>

Inheritance diagram for SiPixelPhase1RawDataErrorComparator:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void bookHistograms (DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
 SiPixelPhase1RawDataErrorComparator (const edm::ParameterSet &)
 
 ~SiPixelPhase1RawDataErrorComparator () 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- 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 &)
 

Private Attributes

MonitorElementh_FEDerrorVsFEDIdUnbalance_
 
std::unordered_map< SiPixelFEDErrorCodes, MonitorElement * > h_nFEDErrors_
 
MonitorElementh_totFEDErrors_
 
const edm::InputTag pixelErrorSrcCPU_
 
const edm::InputTag pixelErrorSrcGPU_
 
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsCPU_
 
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsGPU_
 
const std::string topFolderName_
 

Static Private Attributes

static constexpr const char * kName = "SiPixelPhase1RawDataErrorComparator"
 
static constexpr int nErrors = k_FED38 - k_FED25
 
static constexpr int nFEDs = FEDNumbering::MAXSiPixeluTCAFEDID - FEDNumbering::MINSiPixeluTCAFEDID
 

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
 
- 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 114 of file SiPixelPhase1RawDataErrorComparator.cc.

Constructor & Destructor Documentation

◆ SiPixelPhase1RawDataErrorComparator()

SiPixelPhase1RawDataErrorComparator::SiPixelPhase1RawDataErrorComparator ( const edm::ParameterSet iConfig)
explicit

Definition at line 144 of file SiPixelPhase1RawDataErrorComparator.cc.

145  : pixelErrorSrcGPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcGPU")),
146  pixelErrorSrcCPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcCPU")),
149  topFolderName_(iConfig.getParameter<std::string>("topFolderName")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsGPU_
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsCPU_

◆ ~SiPixelPhase1RawDataErrorComparator()

SiPixelPhase1RawDataErrorComparator::~SiPixelPhase1RawDataErrorComparator ( )
overridedefault

Member Function Documentation

◆ analyze()

void SiPixelPhase1RawDataErrorComparator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 154 of file SiPixelPhase1RawDataErrorComparator.cc.

References edm::InputTag::encode(), dqm::impl::MonitorElement::Fill(), h_FEDerrorVsFEDIdUnbalance_, h_nFEDErrors_, h_totFEDErrors_, mps_fire::i, iEvent, edm::HandleBase::isValid(), dqmiolumiharvest::j, kName, LogDebug, SiStripPI::min, FEDNumbering::MINSiPixeluTCAFEDID, nErrors, nFEDs, pixelErrorSrcCPU_, pixelErrorSrcGPU_, tokenErrorsCPU_, tokenErrorsGPU_, and parallelization::uint.

154  {
155  std::map<int, int> countsOnCPU;
156  std::map<int, int> countsOnGPU;
157 
158  std::array<std::array<int, nErrors>, nFEDs> countsMatrixOnCPU;
159  std::array<std::array<int, nErrors>, nFEDs> countsMatrixOnGPU;
160 
161  // initialize the counts for FED/error matrix
162  for (int i = 0; i < nFEDs; i++) {
163  for (int j = 0; j < nErrors; j++) {
164  countsMatrixOnCPU[i][j] = 0;
165  countsMatrixOnGPU[i][j] = 0;
166  }
167  }
168 
169  // initialize the counts for errors per type scatter plots
170  for (unsigned int j = k_FED25; j <= k_FED31; j++) {
171  countsOnCPU[j] = 0.;
172  countsOnGPU[j] = 0.;
173  }
174 
175  // check upfront if the error collection is present
177  iEvent.getByToken(tokenErrorsCPU_, inputFromCPU);
178  if (!inputFromCPU.isValid()) {
179  edm::LogError(kName) << "reference (cpu) SiPixelRawDataErrors collection (" << pixelErrorSrcCPU_.encode()
180  << ") not found; \n"
181  << "the comparison will not run.";
182  return;
183  }
184 
186  iEvent.getByToken(tokenErrorsGPU_, inputFromGPU);
187  if (!inputFromGPU.isValid()) {
188  edm::LogError(kName) << "target (gpu) SiPixelRawDataErrors collection (" << pixelErrorSrcGPU_.encode()
189  << ") not found; \n"
190  << "the comparison will not run.";
191  return;
192  }
193 
194  // fill the counters on host
195  uint errorsOnCPU{0};
196  for (auto it = inputFromCPU->begin(); it != inputFromCPU->end(); ++it) {
197  for (auto& siPixelRawDataError : *it) {
198  int fed = siPixelRawDataError.getFedId();
199  int type = siPixelRawDataError.getType();
200  DetId id = it->detId();
201 
202  // fill the error matrices for CPU
203  countsOnCPU[type] += 1;
204  countsMatrixOnCPU[fed - FEDNumbering::MINSiPixeluTCAFEDID][type - k_FED25] += 1;
205 
206  LogDebug(kName) << " (on cpu) FED: " << fed << " detid: " << id.rawId() << " type:" << type;
207  errorsOnCPU++;
208  }
209  }
210 
211  // fill the counters on device
212  uint errorsOnGPU{0};
213  for (auto it = inputFromGPU->begin(); it != inputFromGPU->end(); ++it) {
214  for (auto& siPixelRawDataError : *it) {
215  int fed = siPixelRawDataError.getFedId();
216  int type = siPixelRawDataError.getType();
217  DetId id = it->detId();
218 
219  // fill the error matrices for GPU
220  countsOnGPU[type] += 1;
221  countsMatrixOnGPU[fed - FEDNumbering::MINSiPixeluTCAFEDID][type - k_FED25] += 1;
222 
223  LogDebug(kName) << " (on gpu) FED: " << fed << " detid: " << id.rawId() << " type:" << type;
224  errorsOnGPU++;
225  }
226  }
227 
228  edm::LogPrint(kName) << " on gpu found: " << errorsOnGPU << " on cpu found: " << errorsOnCPU;
229 
230  h_totFEDErrors_->Fill(errorsOnCPU, errorsOnGPU);
231 
232  // fill the correlations per error type
233  for (unsigned int j = k_FED25; j <= k_FED31; j++) {
234  const SiPixelFEDErrorCodes code = static_cast<SiPixelFEDErrorCodes>(j);
235  h_nFEDErrors_[code]->Fill(std::min(1000, countsOnCPU[j]), std::min(1000, countsOnGPU[j]));
236  }
237 
238  // fill the error unbalance per FEDid per error type
239  for (int i = 0; i < nFEDs; i++) {
240  for (int j = 0; j < nErrors; j++) {
241  if (countsMatrixOnGPU[i][j] != 0 || countsMatrixOnCPU[i][j] != 0) {
242  edm::LogVerbatim(kName) << "FED: " << i + FEDNumbering::MINSiPixeluTCAFEDID << " error: " << j + k_FED25
243  << " | GPU counts: " << countsMatrixOnGPU[i][j]
244  << " CPU counts:" << countsMatrixOnCPU[i][j];
246  j, i + FEDNumbering::MINSiPixeluTCAFEDID, countsMatrixOnGPU[i][j] - countsMatrixOnCPU[i][j]);
247  }
248  }
249  }
250 }
Log< level::Info, true > LogVerbatim
std::unordered_map< SiPixelFEDErrorCodes, MonitorElement * > h_nFEDErrors_
std::string encode() const
Definition: InputTag.cc:159
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsGPU_
Log< level::Error, false > LogError
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
Log< level::Warning, true > LogPrint
Definition: DetId.h:17
bool isValid() const
Definition: HandleBase.h:70
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsCPU_
#define LogDebug(id)

◆ bookHistograms()

void SiPixelPhase1RawDataErrorComparator::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 255 of file SiPixelPhase1RawDataErrorComparator.cc.

References dqm::implementation::IBooker::book2I(), dqm::implementation::NavigatorBase::cd(), h_FEDerrorVsFEDIdUnbalance_, h_nFEDErrors_, h_totFEDErrors_, dqmiolumiharvest::j, FEDNumbering::MAXSiPixeluTCAFEDID, FEDNumbering::MINSiPixeluTCAFEDID, nErrors, nFEDs, dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::setCurrentFolder(), and topFolderName_.

257  {
258  iBook.cd();
259  iBook.setCurrentFolder(topFolderName_);
260 
262  iBook.book2I("FEErrorVsFEDIdUnbalance",
263  "difference (GPU-CPU) of FED errors per FEDid per error type;;FED Id number;GPU counts - CPU counts",
264  nErrors,
265  -0.5,
266  nErrors - 0.5,
267  nFEDs,
270  for (int j = 0; j < nErrors; j++) {
271  const auto& errorCode = static_cast<SiPixelFEDErrorCodes>(j + k_FED25);
272  h_FEDerrorVsFEDIdUnbalance_->setBinLabel(j + 1, errorCodeToTypeMap.at(errorCode));
273  }
274 
275  h_totFEDErrors_ = make2DIfLog(iBook,
276  true,
277  true,
278  "nTotalFEDError",
279  "n. of total Pixel FEDError per event; CPU; GPU",
280  500,
281  log10(0.5),
282  log10(5000.5),
283  500,
284  log10(0.5),
285  log10(5000.5));
286 
287  for (const auto& element : errorCodeToStringMap) {
288  h_nFEDErrors_[element.first] = iBook.book2I(fmt::sprintf("nFED%i_Errors", element.first),
289  fmt::sprintf("n. of %ss per event; CPU; GPU", element.second),
290  1000,
291  -0.5,
292  1000.5,
293  1000,
294  -0.5,
295  1000.5);
296  }
297 }
std::unordered_map< SiPixelFEDErrorCodes, MonitorElement * > h_nFEDErrors_
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)

◆ fillDescriptions()

void SiPixelPhase1RawDataErrorComparator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 299 of file SiPixelPhase1RawDataErrorComparator.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

299  {
301  desc.add<edm::InputTag>("pixelErrorSrcGPU", edm::InputTag("siPixelDigis@cuda"))
302  ->setComment("input GPU SiPixel FED errors");
303  desc.add<edm::InputTag>("pixelErrorSrcCPU", edm::InputTag("siPixelDigis@cpu"))
304  ->setComment("input CPU SiPixel FED errors");
305  desc.add<std::string>("topFolderName", "SiPixelHeterogeneous/PixelErrorCompareGPUvsCPU");
306  descriptions.addWithDefaultLabel(desc);
307 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ h_FEDerrorVsFEDIdUnbalance_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_FEDerrorVsFEDIdUnbalance_
private

Definition at line 130 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_nFEDErrors_

std::unordered_map<SiPixelFEDErrorCodes, MonitorElement*> SiPixelPhase1RawDataErrorComparator::h_nFEDErrors_
private

Definition at line 131 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_totFEDErrors_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_totFEDErrors_
private

Definition at line 129 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ kName

constexpr const char* SiPixelPhase1RawDataErrorComparator::kName = "SiPixelPhase1RawDataErrorComparator"
staticprivate

Definition at line 134 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ nErrors

constexpr int SiPixelPhase1RawDataErrorComparator::nErrors = k_FED38 - k_FED25
staticprivate

Definition at line 138 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ nFEDs

constexpr int SiPixelPhase1RawDataErrorComparator::nFEDs = FEDNumbering::MAXSiPixeluTCAFEDID - FEDNumbering::MINSiPixeluTCAFEDID
staticprivate

Definition at line 137 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ pixelErrorSrcCPU_

const edm::InputTag SiPixelPhase1RawDataErrorComparator::pixelErrorSrcCPU_
private

Definition at line 124 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ pixelErrorSrcGPU_

const edm::InputTag SiPixelPhase1RawDataErrorComparator::pixelErrorSrcGPU_
private

Definition at line 123 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsCPU_

const edm::EDGetTokenT<edm::DetSetVector<SiPixelRawDataError> > SiPixelPhase1RawDataErrorComparator::tokenErrorsCPU_
private

Definition at line 126 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsGPU_

const edm::EDGetTokenT<edm::DetSetVector<SiPixelRawDataError> > SiPixelPhase1RawDataErrorComparator::tokenErrorsGPU_
private

Definition at line 125 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelPhase1RawDataErrorComparator::topFolderName_
private

Definition at line 127 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by bookHistograms().