21#include "FairLogger.h"
29 for (
int d = mDDL; d--;) {
30 for (
int b = 4;
b--;) {
36 for (
int bc = 0;
bc < 4; ++
bc) {
42 mRunStartTime =
other.mRunStartTime;
47 LOG(info) <<
"Collected statistics per ddl: " << mNorm[1] <<
" " << mNorm[2] <<
" " << mNorm[3] <<
" " << mNorm[4] <<
" " << mNorm[5] <<
" " << mNorm[6] <<
" " << mNorm[7] <<
" " << mNorm[8] <<
" " << mNorm[9] <<
" " << mNorm[10] <<
" " << mNorm[11] <<
" " << mNorm[12] <<
" " << mNorm[13];
53 LOG(info) <<
"Retrieving BadMap from CCDB";
58 LOG(info) <<
"Retrieving Calibration from CCDB";
62 for (
auto& tr : trs) {
64 int firstCellInEvent = tr.getFirstEntry();
65 int lastCellInEvent = firstCellInEvent + tr.getNumberOfObjects();
67 for (
int i = firstCellInEvent;
i < lastCellInEvent;
i++) {
79 if (
c.getHighGain()) {
80 e =
c.getEnergy() * mCalibParams->
getGain(absId);
86 if (e > mEmin && t > mTimeMin && t < mTimeMax) {
89 int ddl = (relid[0] - 1) * 4 + (relid[1] - 1) / 16 - 2;
90 for (
int b = 0;
b < 4;
b++) {
91 int timeshift = tr.getBCData().bc % 4 -
b;
95 float tcorr = t - timeshift * 25e-9;
96 mMean[ddl][
b] += tcorr;
97 mRMS[ddl][
b] += tcorr * tcorr;
98 int it = (tcorr + 200.e-9) / 4.e-9;
99 if (it >= 0 && it < 100) {
100 mQcHisto[
b][ddl * 100 + it]++;
109 std::array<std::array<float, 4>, 14>& sumRMS,
110 std::array<float, 14>& sumNorm)
112 for (
int d = mDDL; d--;) {
113 for (
int b = 4;
b--;) {
114 sumMean[d][
b] += mMean[d][
b];
115 sumRMS[d][
b] += mRMS[d][
b];
117 sumNorm[d] += mNorm[d];
122 for (
int bc = 4;
bc--;) {
123 for (
int it = 1400; it--;) {
124 sum[
bc][it] += mQcHisto[
bc][it];
130 for (
int d = mDDL; d--;) {
131 for (
int b = 4;
b--;) {
132 mMean[d][
b] += prev->mMean[d][
b];
133 mRMS[d][
b] += prev->mRMS[d][
b];
135 mNorm[d] += prev->mNorm[d];
137 for (
int bc = 4;
bc--;) {
138 for (
int it = 1400; it--;) {
139 mQcHisto[
bc][it] += prev->mQcHisto[
bc][it];
145 for (
int d = mDDL; d--;) {
146 for (
int b = 4;
b--;) {
152 for (
int bc = 4;
bc--;) {
153 mQcHisto[
bc].fill(0);
161 for (
int d = mDDL; d--;) {
162 for (
int b = 4;
b--;) {
168 for (
int bc = 0;
bc < 4; ++
bc) {
169 mQcHisto[
bc].fill(0);
193 auto& slot = front ? cont.emplace_front(tstart, tend) : cont.emplace_back(tstart, tend);
194 slot.setContainer(std::make_unique<PHOSL1phaseSlot>());
203 slotTF.getContainer()->setRunStartTime(
tf);
204 slotTF.getContainer()->fill(
cells, tr);
212 for (
auto& slot : cont) {
219 for (
int d = 0; d < mDDL; d++) {
220 int iMinRMS = 0, iMinMean = 0;
224 float minMean = 0, minRMS = 0, subminRMS = 0;
225 for (
int b = 0;
b < 4;
b++) {
226 float av = mMean[d][
b] / mNorm[d];
227 float avRMS = mRMS[d][
b] / mNorm[d] - av * av;
234 if (minRMS > avRMS) {
239 if (subminRMS == 0) {
242 if (avRMS < subminRMS) {
256 const float eps = 1.e-2;
257 if (minRMS < subminRMS - eps * minRMS) {
263 for (
int it = 100; it--;) {
264 mQcHisto[4][d * 100 + it] = mQcHisto[bestB][d * 100 + it];
267 mL1phase |= (bestB << (2 * d));
static std::string getCCDBServer()
o2::calibration::TFType TFType
Slot & getSlotForTF(TFType tf)
const Container * getContainer() const
static BasicCCDBManager & instance()
CCDB container for bad (masked) channels in PHOS.
bool isChannelGood(short channelID) const
Get the status of a certain cell.
float getHGLGRatio(short cellID) const
Get High Gain to Low Gain ratio calibration coefficients.
float getGain(short cellID) const
Get High Gain energy calibration coefficients.
float getLGTimeCalib(short cellID) const
Get Low Gain time calibration coefficient.
float getHGTimeCalib(short cellID) const
Get High Gain time calibration coefficients.
static bool absToRelNumbering(short absId, char *relid)
Slot & emplaceNewSlot(bool front, TFType tstart, TFType tend) final
bool hasEnoughData(const Slot &slot) const final
void finalizeSlot(Slot &slot) final
bool process(TFType tf, const gsl::span< const Cell > &clu, const gsl::span< const TriggerRecord > &trs)
void fill(const gsl::span< const Cell > &cells, const gsl::span< const TriggerRecord > &trs)
void addQcHistos(std::array< unsigned int, 1400 >(&sum)[5])
void merge(const PHOSL1phaseSlot *prev)
void addMeanRms(std::array< std::array< float, 4 >, 14 > &sumMean, std::array< std::array< float, 4 >, 14 > &sumRMS, std::array< float, 14 > &sumNorm)
float sum(float s, o2::dcs::DataPointValue v)
GLboolean GLboolean GLboolean b
std::unique_ptr< GPUReconstructionTimeframe > tf
VectorOfTObjectPtrs other
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cell > cells