Belle II Software prerelease-11-00-00a
DeadBoardAlgorithm.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/calibration/DeadBoardAlgorithm.h>
10#include <framework/logging/Logger.h>
11#include <TH1F.h>
12
13using namespace Belle2;
14using namespace CDC;
15
17 CalibrationAlgorithm("CDCDeadBoardDetector")
18{
20 " -------------------------- Dead Board Detection Algorithm -------------------------\n"
21 );
22}
23
25{
26 auto hBoardIDs = getObjectPtr<TH1F>(m_histName);
27
28 if (!hBoardIDs) {
29 B2ERROR("Histogram " << m_histName << " not found");
30 return;
31 }
32
33 B2INFO("Found histogram " << m_histName
34 << ", nbins = " << hBoardIDs->GetNbinsX()
35 << ", entries = " << hBoardIDs->GetEntries());
36
37 for (int ibin = 1; ibin <= hBoardIDs->GetNbinsX(); ++ibin) {
38 const double content = hBoardIDs->GetBinContent(ibin);
39
40 // Use bin center as board ID
41 const int boardID = static_cast<int>(std::lround(hBoardIDs->GetXaxis()->GetBinCenter(ibin)));
42
43 // Temporary/simple logic:
44 // a board with zero (or below-threshold) entries is marked as dead.
45 if (content <= m_threshold) {
46 B2INFO("Dead board candidate found: boardID = " << boardID
47 << ", bin = " << ibin
48 << ", content = " << content);
49
50 // eff = 0 means dead board
51 m_badBoardList->setBoard(boardID, 0.0);
52 }
53 }
54
55 B2INFO("Total dead boards found: " << m_badBoardList->getEntries());
56 m_badBoardList->dump();
57}
58
60{
62
63 const auto exprun = getRunList()[0];
64 B2INFO("ExpRun used for DB Geometry : " << exprun.first << " " << exprun.second);
65 updateDBObjPtrs(1, exprun.second, exprun.first);
66
68
69 saveCalibration(m_badBoardList, "CDCBadBoards");
70 return c_OK;
71}
Database object for bad boards.
float m_threshold
dead-board threshold
std::string m_histName
input histogram name
void detectDeadBoards()
Detect dead boards from histogram.
CDCBadBoards * m_badBoardList
bad-board list to be saved
EResult calibrate() override
Run algorithm on data.
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default IOV.
static void updateDBObjPtrs(const unsigned int event, const int run, const int experiment)
Updates any DBObjPtrs by calling update(event) for DBStore.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
const std::vector< Calibration::ExpRun > & getRunList() const
Get the list of runs for which calibration is called.
EResult
The result of calibration.
@ c_OK
Finished successfully =0 in Python.
CalibrationAlgorithm(const std::string &collectorModuleName)
Constructor - sets the prefix for collected objects (won't be accesses until execute(....
std::shared_ptr< T > getObjectPtr(const std::string &name, const std::vector< Calibration::ExpRun > &requestedRuns)
Get calibration data object by name and list of runs, the Merge function will be called to generate t...
Abstract base class for different kinds of events.