8 #include <svd/calibration/SVDHotStripsCalibrationsAlgorithm.h>
11 #include <svd/calibration/SVDHotStripsCalibrations.h>
14 #include <framework/logging/Logger.h>
21 SVDHotStripsCalibrationsAlgorithm::SVDHotStripsCalibrationsAlgorithm(
const std::string& str) :
35 double stripOccAfterAbsCut[768];
37 for (
int i = 0; i < 768; i++) { vecHS[i] = 0; stripOccAfterAbsCut[i] = 0;}
45 auto tree = getObjectPtr<TTree>(
"HTreeOccupancyCalib");
47 TH1F* hocc =
new TH1F(
"",
"", 768, 0, 768);
50 B2WARNING(
"No tree object.");
51 }
else if (!tree->GetEntries()) {
52 B2WARNING(
"No data in the tree.");
60 tree->SetBranchAddress(
"hist", &hocc);
61 tree->SetBranchAddress(
"layer", &layer);
62 tree->SetBranchAddress(
"ladder", &ladder);
63 tree->SetBranchAddress(
"sensor", &sensor);
64 tree->SetBranchAddress(
"view", &side);
67 for (
int i = 0; i < tree->GetEntries(); i++) {
70 if (!side && layer != 3) nstrips = 512;
72 for (
int iterStrip = 0; iterStrip < nstrips; iterStrip++) {
73 float occCal = hocc->GetBinContent(iterStrip + 1);
76 if (occCal > occThr) {
78 stripOccAfterAbsCut[iterStrip] = 0;
79 }
else stripOccAfterAbsCut[iterStrip] = occCal;
86 while (moreHS &&
theHSFinder(stripOccAfterAbsCut, vecHS, nstrips)) {
87 moreHS =
theHSFinder(stripOccAfterAbsCut, vecHS, nstrips);
90 for (
int l = 0; l < nstrips; l++) {
91 isHotStrip = (int) vecHS[l];
93 payload->set(layer, ladder, sensor,
bool(side), l, isHotStrip);
114 for (
int sector = 0; sector < N; sector++) {
117 double sensorOccAverage = 0;
120 sensorOccAverage = sensorOccAverage + stripOccAfterAbsCut[l];
121 if (stripOccAfterAbsCut[l] > 0) nafter++;
123 sensorOccAverage = sensorOccAverage / nafter;
125 B2DEBUG(1,
"Average occupancy: " << sensorOccAverage);
131 if (stripOccAfterAbsCut[l] > sensorOccAverage *
m_relOccPrec) {
134 stripOccAfterAbsCut[l] = 0;
Base class for calibration algorithms.
void saveCalibration(TClonesArray *data, const std::string &name)
Store DBArray payload with given name with default IOV.
void setDescription(const std::string &description)
Set algorithm description (in constructor)
EResult
The result of calibration.
@ c_OK
Finished successfuly =0 in Python.
std::string m_id
Parameter given to set the UniqueID of the payload.
float m_relOccPrec
parameter to tue the finder algorithm
bool theHSFinder(double *stripOccAfterAbsCut, int *hsflag, int nstrips)
returns true if the strip is hot
virtual EResult calibrate() override
Run algo on data.
int m_base
parameter to tune finder angorithm
SVDCalibrationsBase< SVDCalibrationsBitmap > t_payload
typedef of the SVDHotStripsCalibrations payload for all SVD strips
Abstract base class for different kinds of events.