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

Constructor & Destructor Documentation

◆ SiPixelPhase1RawDataErrorComparator()

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

Definition at line 141 of file SiPixelPhase1RawDataErrorComparator.cc.

142  : pixelErrorSrcGPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcGPU")),
143  pixelErrorSrcCPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcCPU")),
146  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 151 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.

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

254  {
255  iBook.cd();
256  iBook.setCurrentFolder(topFolderName_);
257 
259  iBook.book2I("FEErrorVsFEDIdUnbalance",
260  "difference (GPU-CPU) of FED errors per FEDid per error type;;FED Id number;GPU counts - CPU counts",
261  nErrors,
262  -0.5,
263  nErrors - 0.5,
264  nFEDs,
267  for (int j = 0; j < nErrors; j++) {
268  const auto& errorCode = static_cast<SiPixelFEDErrorCodes>(j + k_FED25);
269  h_FEDerrorVsFEDIdUnbalance_->setBinLabel(j + 1, errorCodeToTypeMap[errorCode]);
270  }
271 
272  h_totFEDErrors_ = make2DIfLog(iBook,
273  true,
274  true,
275  "nTotalFEDError",
276  "n. of total Pixel FEDError per event; CPU; GPU",
277  500,
278  log10(0.5),
279  log10(5000.5),
280  500,
281  log10(0.5),
282  log10(5000.5));
283 
284  for (const auto& element : errorCodeToStringMap) {
285  h_nFEDErrors_[element.first] = iBook.book2I(fmt::sprintf("nFED%i_Errors", element.first),
286  fmt::sprintf("n. of %ss per event; CPU; GPU", element.second),
287  1000,
288  -0.5,
289  1000.5,
290  1000,
291  -0.5,
292  1000.5);
293  }
294 }
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 296 of file SiPixelPhase1RawDataErrorComparator.cc.

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

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

Member Data Documentation

◆ h_FEDerrorVsFEDIdUnbalance_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_FEDerrorVsFEDIdUnbalance_
private

Definition at line 127 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_nFEDErrors_

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

Definition at line 128 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_totFEDErrors_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_totFEDErrors_
private

Definition at line 126 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ kName

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

Definition at line 131 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ nErrors

constexpr int SiPixelPhase1RawDataErrorComparator::nErrors = k_FED38 - k_FED25
staticprivate

Definition at line 135 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ nFEDs

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

Definition at line 134 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ pixelErrorSrcCPU_

const edm::InputTag SiPixelPhase1RawDataErrorComparator::pixelErrorSrcCPU_
private

Definition at line 121 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ pixelErrorSrcGPU_

const edm::InputTag SiPixelPhase1RawDataErrorComparator::pixelErrorSrcGPU_
private

Definition at line 120 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsCPU_

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

Definition at line 123 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsGPU_

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

Definition at line 122 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelPhase1RawDataErrorComparator::topFolderName_
private

Definition at line 124 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by bookHistograms().