Belle II Software prerelease-11-00-00a
CDCDeadBoardDetectorModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <cdc/modules/cdcCalibrationCollector/CDCDeadBoardDetectorModule.h>
10#include <TH1F.h>
11#include <iostream>
12
13using namespace std;
14using namespace Belle2;
15using namespace CDC;
16
17REG_MODULE(CDCDeadBoardDetector);
18
20{
21 //Set module properties
22 setDescription("CDCDeadBoardDetector detects dead boards.");
24}
25
29
31{
32 m_rawCDCs.isRequired();
33 auto m_BoardIDs = new TH1F("CDCboardIDs", "CDC board IDs", 299, 0.5, 299.5);
34 registerObject<TH1F>("CDCboardIDs", m_BoardIDs);
35}
36
38{
39
40 //
41 // Proccess RawCDC data block.
42 //
43
44 const int nEntries = m_rawCDCs.getEntries();
45
46 for (int i = 0; i < nEntries; ++i) {
47 const int nEntriesRawCDC = m_rawCDCs[i]->GetNumEntries();
48 for (int j = 0; j < nEntriesRawCDC; ++j) {
49 int MaxNumOfCh = m_rawCDCs[i]->GetMaxNumOfCh(j);
50
51 for (int iFiness = 0; iFiness < MaxNumOfCh; ++iFiness) {
52 int* ibuf = (int*)m_rawCDCs[i]->GetDetectorBuffer(j, iFiness);
53 const int nWord = m_rawCDCs[i]->GetDetectorNwords(j, iFiness);
54 const int c_headearWords = 3;
55 if (nWord < c_headearWords) {
56 continue;
57 }
58 unsigned int boardID = (ibuf[0] & 0x01ff);
59 if ((boardID > 0) && (boardID < 300)) {
60 getObjectPtr<TH1F>("CDCboardIDs")->Fill(boardID);
61 }
62 }
63 }
64 }
65}
66
StoreArray< RawCDC > m_rawCDCs
Input array for CDC Raw.
void collect() override
Event action (main routine).
void prepare() override
Initializes the Module.
virtual ~CDCDeadBoardDetectorModule()
Destructor of the module.
void registerObject(const std::string &name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
T * getObjectPtr(const std::string &name)
Calls the CalibObjManager to get the requested stored collector data.
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
void setDescription(const std::string &description)
Sets the description of the module.
Definition Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition Module.cc:208
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition Module.h:80
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.
STL namespace.