8#include <svd/calibration/SVDHotStripsCalibrationsAlgorithm.h>
11#include <svd/calibration/SVDHotStripsCalibrations.h>
14#include <framework/logging/Logger.h>
34 double stripOccAfterAbsCut[768];
36 for (
int i = 0; i < 768; i++) { vecHS[i] = 0; stripOccAfterAbsCut[i] = 0;}
44 auto tree = getObjectPtr<TTree>(
"HTreeOccupancyCalib");
46 TH1F* hocc =
new TH1F(
"",
"", 768, 0, 768);
49 B2WARNING(
"No tree object.");
50 }
else if (!tree->GetEntries()) {
51 B2WARNING(
"No data in the tree.");
59 tree->SetBranchAddress(
"hist", &hocc);
60 tree->SetBranchAddress(
"layer", &layer);
61 tree->SetBranchAddress(
"ladder", &ladder);
62 tree->SetBranchAddress(
"sensor", &sensor);
63 tree->SetBranchAddress(
"view", &side);
66 for (
int i = 0; i < tree->GetEntries(); i++) {
69 if (!side && layer != 3) nstrips = 512;
71 for (
int iterStrip = 0; iterStrip < nstrips; iterStrip++) {
72 float occCal = hocc->GetBinContent(iterStrip + 1);
75 if (occCal > occThr) {
77 stripOccAfterAbsCut[iterStrip] = 0;
78 }
else stripOccAfterAbsCut[iterStrip] = occCal;
85 while (moreHS &&
theHSFinder(stripOccAfterAbsCut, vecHS, nstrips)) {
86 moreHS =
theHSFinder(stripOccAfterAbsCut, vecHS, nstrips);
89 for (
int l = 0; l < nstrips; l++) {
90 isHotStrip = (int) vecHS[l];
92 payload->set(layer, ladder, sensor,
bool(side), l, isHotStrip);
113 for (
int sector = 0; sector < N; sector++) {
116 double sensorOccAverage = 0;
119 sensorOccAverage = sensorOccAverage + stripOccAfterAbsCut[l];
120 if (stripOccAfterAbsCut[l] > 0) nafter++;
122 sensorOccAverage = sensorOccAverage / nafter;
124 B2DEBUG(1,
"Average occupancy: " << sensorOccAverage);
130 if (stripOccAfterAbsCut[l] > sensorOccAverage *
m_relOccPrec) {
133 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 successfully =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
SVDHotStripsCalibrationsAlgorithm(const std::string &str)
Constructor set the prefix to SVDHotStripsCalibrationsCollector.
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.