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

Constructor & Destructor Documentation

◆ SiPixelPhase1RawDataErrorComparator()

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

Definition at line 143 of file SiPixelPhase1RawDataErrorComparator.cc.

144  : pixelErrorSrcGPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcGPU")),
145  pixelErrorSrcCPU_(iConfig.getParameter<edm::InputTag>("pixelErrorSrcCPU")),
148  topFolderName_(iConfig.getParameter<std::string>("topFolderName")) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
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 153 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(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, dqmiolumiharvest::j, kName, LogDebug, SiStripPI::min, FEDNumbering::MINSiPixeluTCAFEDID, nErrors, nFEDs, pixelErrorSrcCPU_, pixelErrorSrcGPU_, tokenErrorsCPU_, tokenErrorsGPU_, and parallelization::uint.

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

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

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

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

Member Data Documentation

◆ h_FEDerrorVsFEDIdUnbalance_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_FEDerrorVsFEDIdUnbalance_
private

Definition at line 129 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_nFEDErrors_

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

Definition at line 130 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_totFEDErrors_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_totFEDErrors_
private

Definition at line 128 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ kName

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

Definition at line 133 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ nErrors

constexpr int SiPixelPhase1RawDataErrorComparator::nErrors = k_FED38 - k_FED25
staticprivate

Definition at line 137 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ nFEDs

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

Definition at line 136 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ pixelErrorSrcCPU_

const edm::InputTag SiPixelPhase1RawDataErrorComparator::pixelErrorSrcCPU_
private

Definition at line 123 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ pixelErrorSrcGPU_

const edm::InputTag SiPixelPhase1RawDataErrorComparator::pixelErrorSrcGPU_
private

Definition at line 122 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsCPU_

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

Definition at line 125 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsGPU_

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

Definition at line 124 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelPhase1RawDataErrorComparator::topFolderName_
private

Definition at line 126 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by bookHistograms().