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::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsCPU_
 
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsGPU_
 
const std::string topFolderName_
 

Static Private Attributes

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

Constructor & Destructor Documentation

◆ SiPixelPhase1RawDataErrorComparator()

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

Definition at line 144 of file SiPixelPhase1RawDataErrorComparator.cc.

145  : tokenErrorsGPU_(
146  consumes<edm::DetSetVector<SiPixelRawDataError>>(iConfig.getParameter<edm::InputTag>("pixelErrorSrcGPU"))),
148  consumes<edm::DetSetVector<SiPixelRawDataError>>(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 dqm::impl::MonitorElement::Fill(), h_FEDerrorVsFEDIdUnbalance_, h_nFEDErrors_, h_totFEDErrors_, mps_fire::i, iEvent, edm::HandleBase::isValid(), dqmiolumiharvest::j, FEDNumbering::MINSiPixeluTCAFEDID, nErrors, nFEDs, 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 
176  iEvent.getByToken(tokenErrorsCPU_, inputFromCPU);
177  if (!inputFromCPU.isValid()) {
178  edm::LogWarning("SiPixelCompareTrackSoA") << "reference (cpu) SiPixelRawDataErrors not found; \n"
179  << "the comparison will not run.";
180  return;
181  }
182 
183  uint errorsOnCPU{0};
184  for (auto it = inputFromCPU->begin(); it != inputFromCPU->end(); ++it) {
185  for (auto& siPixelRawDataError : *it) {
186  int fed = siPixelRawDataError.getFedId();
187  int type = siPixelRawDataError.getType();
188  DetId id = it->detId();
189 
190  // fill the error matrices for CPU
191  countsOnCPU[type] += 1;
192  countsMatrixOnCPU[fed - FEDNumbering::MINSiPixeluTCAFEDID][type - k_FED25] += 1;
193 
194  edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
195  << __PRETTY_FUNCTION__ << " on cpu: FED: " << fed << " detid: " << id.rawId() << " type:" << type;
196  errorsOnCPU++;
197  }
198  }
199 
201  iEvent.getByToken(tokenErrorsGPU_, inputFromGPU);
202  if (!inputFromGPU.isValid()) {
203  edm::LogWarning("SiPixelCompareTrackSoA") << "target (gpu) SiPixelRawDataErrors not found; \n"
204  << "the comparison will not run.";
205  return;
206  }
207 
208  uint errorsOnGPU{0};
209  for (auto it = inputFromGPU->begin(); it != inputFromGPU->end(); ++it) {
210  for (auto& siPixelRawDataError : *it) {
211  int fed = siPixelRawDataError.getFedId();
212  int type = siPixelRawDataError.getType();
213  DetId id = it->detId();
214 
215  // fill the error matrices for GPU
216  countsOnGPU[type] += 1;
217  countsMatrixOnGPU[fed - FEDNumbering::MINSiPixeluTCAFEDID][type - k_FED25] += 1;
218 
219  edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
220  << __PRETTY_FUNCTION__ << " on gpu: FED: " << fed << " detid: " << id.rawId() << " type:" << type;
221  errorsOnGPU++;
222  }
223  }
224 
225  edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
226  << __PRETTY_FUNCTION__ << " on gpu found: " << errorsOnGPU << " on cpu found: " << errorsOnCPU << std::endl;
227 
228  h_totFEDErrors_->Fill(errorsOnCPU, errorsOnGPU);
229 
230  // fill the correlations per error type
231  for (unsigned int j = k_FED25; j <= k_FED31; j++) {
232  SiPixelFEDErrorCodes code = static_cast<SiPixelFEDErrorCodes>(j);
233  h_nFEDErrors_[code]->Fill(countsOnCPU[j], countsOnGPU[j]);
234  }
235 
236  // fill the error unbalance per FEDid per error type
237  for (int i = 0; i < nFEDs; i++) {
238  for (int j = 0; j < nErrors; j++) {
239  if (countsMatrixOnGPU[i][j] != 0 || countsMatrixOnCPU[i][j] != 0) {
240  edm::LogInfo("SiPixelPhase1RawDataErrorComparator")
241  << "FED: " << i + FEDNumbering::MINSiPixeluTCAFEDID << " error: " << j + k_FED25
242  << " | GPU counts: " << countsMatrixOnGPU[i][j] << " CPU counts:" << countsMatrixOnCPU[i][j] << std::endl;
244  j, i + FEDNumbering::MINSiPixeluTCAFEDID, countsMatrixOnGPU[i][j] - countsMatrixOnCPU[i][j]);
245  }
246  }
247  }
248 }
std::unordered_map< SiPixelFEDErrorCodes, MonitorElement * > h_nFEDErrors_
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsGPU_
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
Definition: DetId.h:17
bool isValid() const
Definition: HandleBase.h:70
Log< level::Warning, false > LogWarning
const edm::EDGetTokenT< edm::DetSetVector< SiPixelRawDataError > > tokenErrorsCPU_

◆ bookHistograms()

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

Implements DQMEDAnalyzer.

Definition at line 253 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_.

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

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

297  {
299  //desc.add<edm::InputTag>("pixelErrorSrcGPU", edm::InputTag("siPixelDigiErrors"));
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 133 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_nFEDErrors_

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

Definition at line 134 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ h_totFEDErrors_

MonitorElement* SiPixelPhase1RawDataErrorComparator::h_totFEDErrors_
private

Definition at line 132 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze(), and bookHistograms().

◆ 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().

◆ tokenErrorsCPU_

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

Definition at line 129 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ tokenErrorsGPU_

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

Definition at line 128 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by analyze().

◆ topFolderName_

const std::string SiPixelPhase1RawDataErrorComparator::topFolderName_
private

Definition at line 130 of file SiPixelPhase1RawDataErrorComparator.cc.

Referenced by bookHistograms().