Skip to content

Commit 2057fe9

Browse files
author
Sahil Upadhyaya
committed
FIT: Include FT0/FV0 total charge histograms for Pb-Pb Galuber fit studies
1 parent a0c4cac commit 2057fe9

4 files changed

Lines changed: 241 additions & 3 deletions

File tree

Modules/FIT/FT0/include/FT0/DigitQcTask.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@
2525
#include <vector>
2626
#include <array>
2727
#include <boost/algorithm/string.hpp>
28+
#include <bitset>
2829

2930
#include "TH1.h"
3031
#include "TH2.h"
3132
#include "TList.h"
3233
#include "Rtypes.h"
3334

3435
#include "CommonConstants/LHCConstants.h"
35-
36+
#include "CommonDataFormat/BunchFilling.h"
3637
#include "QualityControl/TaskInterface.h"
3738
#include "QualityControl/QcInfoLogger.h"
3839

40+
#include "DataFormatsFIT/DeadChannelMap.h"
3941
#include "FT0Base/Constants.h"
4042
#include "FT0Base/Geometry.h"
4143
#include "DataFormatsFT0/Digit.h"
@@ -88,6 +90,15 @@ class DigitQcTask final : public TaskInterface
8890
void rebinFromConfig();
8991
bool chIsVertexEvent(const o2::ft0::ChannelData);
9092

93+
o2::BunchFilling mBcPattern;
94+
std::bitset<sBCperOrbit> mCollBC;
95+
bool mBcPatternLoaded = false;
96+
void loadBcPatternIfNeeded();
97+
98+
o2::fit::DeadChannelMap* mDeadChannelMap = nullptr;
99+
bool mDeadChannelMapLoaded = false;
100+
void loadDeadChannelMapIfNeeded();
101+
91102
TList* mListHistGarbage;
92103
std::set<unsigned int> mSetAllowedChIDs;
93104
std::set<unsigned int> mSetAllowedChIDsAmpVsTime;
@@ -116,10 +127,17 @@ class DigitQcTask final : public TaskInterface
116127
std::unique_ptr<TH2F> mHistChDataBits;
117128
std::unique_ptr<TH2F> mHistOrbit2BC;
118129
std::unique_ptr<TH1F> mHistBC;
130+
std::unique_ptr<TH1F> mHistBCBeamBeam;
119131
std::unique_ptr<TH1F> mHistNchA;
120132
std::unique_ptr<TH1F> mHistNchC;
121133
std::unique_ptr<TH1F> mHistSumAmpA;
122134
std::unique_ptr<TH1F> mHistSumAmpC;
135+
std::unique_ptr<TH1F> mHistSumAmpAVTXBeamBeam;
136+
std::unique_ptr<TH1F> mHistSumAmpCVTXBeamBeam;
137+
std::unique_ptr<TH1F> mHistSumAmpACVTXBeamBeam;
138+
std::unique_ptr<TH1F> mHistSumAmpAVTXBeamBeam_by8;
139+
std::unique_ptr<TH1F> mHistSumAmpCVTXBeamBeam_by8;
140+
std::unique_ptr<TH1F> mHistSumAmpACVTXBeamBeam_by8;
123141
std::unique_ptr<TH1F> mHistAverageTimeA;
124142
std::unique_ptr<TH1F> mHistAverageTimeC;
125143
std::unique_ptr<TH1F> mHistChannelID;

Modules/FIT/FT0/src/DigitQcTask.cxx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
#include "DataFormatsFT0/LookUpTable.h"
2626
#include "Common/Utils.h"
2727

28+
#include "DataFormatsParameters/GRPLHCIFData.h"
29+
#include "CCDB/BasicCCDBManager.h"
30+
2831
#include "FITCommon/HelperHist.h"
2932
#include "FITCommon/HelperCommon.h"
3033

@@ -106,6 +109,7 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
106109
mHistTime2Ch = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "TimePerChannel", "Time vs Channel;Channel;Time", sNCHANNELS_PM, 0, sNCHANNELS_PM, 4100, -2050, 2050);
107110
mHistAmp2Ch = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "AmpPerChannel", "Amplitude vs Channel;Channel;Amp", sNCHANNELS_PM, 0, sNCHANNELS_PM, 4200, -100, 4100);
108111
mHistBC = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BC", "BC;BC;counts;", sBCperOrbit, 0, sBCperOrbit);
112+
mHistBCBeamBeam = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "BC_BeamBeam", "Colliding BCs;BC;counts;", sBCperOrbit, 0, sBCperOrbit);
109113
mHistChDataBits = helper::registerHist<TH2F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "ChannelDataBits", "ChannelData bits per ChannelID;Channel;Bit", sNCHANNELS_PM, 0, sNCHANNELS_PM, mMapPMbits);
110114

111115
// Trg plots
@@ -170,6 +174,13 @@ void DigitQcTask::initialize(o2::framework::InitContext& /*ctx*/)
170174
mHistNchC = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "NumChannelsC", "Number of channels(TCM), side C;Nch", sNCHANNELS_PM, 0, sNCHANNELS_PM);
171175
mHistSumAmpA = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpA", "Sum of amplitudes(TCM), side A;", 1e4, 0, 1e4);
172176
mHistSumAmpC = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpC", "Sum of amplitudes(TCM), side C;", 1e4, 0, 1e4);
177+
mHistSumAmpAVTXBeamBeam = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpAVTXBeamBeam", "Sum of amplitudes(VTX+BeamBeam), FT0 A;ADC units;", 4e5, 0, 4e5);
178+
mHistSumAmpCVTXBeamBeam = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpCVTXBeamBeam", "Sum of amplitudes(VTX+BeamBeam), FT0 C;ADC units;", 4e5, 0, 4e5);
179+
mHistSumAmpACVTXBeamBeam = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpACVTXBeamBeam", "Sum of amplitudes(VTX+BeamBeam), FT0 A+C;ADC units;", 9e5, 0, 9e5);
180+
mHistSumAmpAVTXBeamBeam_by8 = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpAVTXBeamBeam_by8", "Sum of amplitudes(VTX+BeamBeam), FT0 A;ADC/8 units;", 42000, 0, 42000);
181+
mHistSumAmpCVTXBeamBeam_by8 = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpCVTXBeamBeam_by8", "Sum of amplitudes(VTX+BeamBeam), FT0 C;ADC/8 units;", 42000, 0, 42000);
182+
mHistSumAmpACVTXBeamBeam_by8 = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "SumAmpACVTXBeamBeam_by8", "Sum of amplitudes(VTX+BeamBeam), FT0 A+C;ADC/8 units;", 1e5, 0, 1e5);
183+
173184
mHistAverageTimeA = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "AverageTimeA", "Average time(TCM), side A", 4100, -2050, 2050);
174185
mHistAverageTimeC = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "AverageTimeC", "Average time(TCM), side C", 4100, -2050, 2050);
175186
mHistChannelID = helper::registerHist<TH1F>(getObjectsManager(), PublicationPolicy::Forever, "COLZ", "StatChannelID", "ChannelID statistics;ChannelID", sNCHANNELS_PM, 0, sNCHANNELS_PM);
@@ -249,6 +260,7 @@ void DigitQcTask::startOfActivity(const Activity& activity)
249260
mHistTime2Ch->Reset();
250261
mHistAmp2Ch->Reset();
251262
mHistBC->Reset();
263+
mHistBCBeamBeam->Reset();
252264
mHistChDataBits->Reset();
253265
mHistTimeSum2Diff->Reset();
254266
mHistBCvsFEEmodules->Reset();
@@ -264,6 +276,12 @@ void DigitQcTask::startOfActivity(const Activity& activity)
264276
mHistNchC->Reset();
265277
mHistSumAmpA->Reset();
266278
mHistSumAmpC->Reset();
279+
mHistSumAmpAVTXBeamBeam->Reset();
280+
mHistSumAmpCVTXBeamBeam->Reset();
281+
mHistSumAmpACVTXBeamBeam->Reset();
282+
mHistSumAmpAVTXBeamBeam_by8->Reset();
283+
mHistSumAmpCVTXBeamBeam_by8->Reset();
284+
mHistSumAmpACVTXBeamBeam_by8->Reset();
267285
mHistAverageTimeA->Reset();
268286
mHistAverageTimeC->Reset();
269287
mHistChannelID->Reset();
@@ -299,10 +317,54 @@ void DigitQcTask::startOfCycle()
299317
mTimeSum = 0.;
300318
}
301319

320+
void DigitQcTask::loadBcPatternIfNeeded()
321+
{
322+
if (mBcPatternLoaded) {
323+
return;
324+
}
325+
auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance();
326+
ccdbManager.setTimestamp(mTFcreationTime);
327+
ccdbManager.setCaching(true);
328+
auto lhcIf = ccdbManager.get<o2::parameters::GRPLHCIFData>("GLO/Config/GRPLHCIF");
329+
if (!lhcIf) {
330+
ILOG(Error) << "GRPLHCIF missing → no colliding BC mask will be applied" << ENDM;
331+
mCollBC.reset();
332+
mBcPatternLoaded = true;
333+
return;
334+
}
335+
const auto& pattern = lhcIf->getBunchFilling().getBCPattern();
336+
mCollBC.reset();
337+
for (size_t bc = 0; bc < pattern.size(); ++bc) {
338+
if (pattern.test(bc)) {
339+
mCollBC.set(bc);
340+
}
341+
}
342+
mBcPatternLoaded = true;
343+
}
344+
345+
void DigitQcTask::loadDeadChannelMapIfNeeded()
346+
{
347+
if (mDeadChannelMapLoaded) {
348+
return;
349+
}
350+
auto& ccdbManager = o2::ccdb::BasicCCDBManager::instance();
351+
ccdbManager.setTimestamp(mTFcreationTime);
352+
mDeadChannelMap = ccdbManager.get<o2::fit::DeadChannelMap>("FT0/Calib/DeadChannelMap");
353+
if (!mDeadChannelMap) {
354+
ILOG(Error) << "Failed to load FT0 dead channel map" << ENDM;
355+
mDeadChannelMapLoaded = true;
356+
return;
357+
}
358+
ILOG(Info) << "Loaded FT0 dead channel map with " << mDeadChannelMap->map.size() << " entries" << ENDM;
359+
mDeadChannelMapLoaded = true;
360+
}
361+
302362
void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
303363
{
304364
mTFcreationTime = ctx.services().get<o2::framework::TimingInfo>().creation;
305365
mTfCounter++;
366+
loadBcPatternIfNeeded();
367+
loadDeadChannelMapIfNeeded();
306368
auto channels = ctx.inputs().get<gsl::span<o2::ft0::ChannelData>>("channels");
307369
auto digits = ctx.inputs().get<gsl::span<o2::ft0::Digit>>("digits");
308370
if (digits.size() > 0) {
@@ -325,6 +387,12 @@ void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
325387
mHistOrbit2BC->Fill(digit.getIntRecord().orbit % sOrbitsPerTF, digit.getIntRecord().bc);
326388
mHistBC->Fill(digit.getBC());
327389

390+
const bool isCollidingBC = mCollBC.test(digit.getBC());
391+
392+
if (isCollidingBC) {
393+
mHistBCBeamBeam->Fill(digit.getBC());
394+
}
395+
328396
std::set<uint8_t> setFEEmodules{};
329397

330398
int32_t pmSumAmplA = 0;
@@ -337,9 +405,17 @@ void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
337405
int pmAverTimeC{ 0 };
338406

339407
std::map<uint8_t, int> mapPMhash2sumAmpl;
408+
std::map<uint8_t, int> mapPMhash2sumAmplAliveChannels;
340409
for (const auto& entry : mMapPMhash2isAside) {
341410
mapPMhash2sumAmpl.insert({ entry.first, 0 });
411+
mapPMhash2sumAmplAliveChannels.insert({ entry.first, 0 });
342412
}
413+
414+
int32_t sumampAVTXBeamBeam = 0;
415+
int32_t sumampCVTXBeamBeam = 0;
416+
int32_t sumampAVTXBeamBeam_by8 = 0;
417+
int32_t sumampCVTXBeamBeam_by8 = 0;
418+
343419
for (const auto& chData : vecChData) {
344420
mHistTime2Ch->Fill(static_cast<Double_t>(chData.ChId), static_cast<Double_t>(chData.CFDTime));
345421
mHistAmp2Ch->Fill(static_cast<Double_t>(chData.ChId), static_cast<Double_t>(chData.QTCAmpl));
@@ -376,7 +452,36 @@ void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
376452
if (chData.getFlag(o2::ft0::ChannelData::kIsCFDinADCgate)) {
377453
mapPMhash2sumAmpl[mChID2PMhash[static_cast<uint8_t>(chData.ChId)]] += static_cast<Int_t>(chData.QTCAmpl);
378454
}
455+
456+
const auto chId = static_cast<uint8_t>(chData.ChId);
457+
if (mDeadChannelMap && !mDeadChannelMap->isChannelAlive(chId)) {
458+
continue;
459+
}
460+
if (chData.getFlag(o2::ft0::ChannelData::kIsCFDinADCgate) && digit.mTriggers.getVertex() && isCollidingBC) {
461+
mapPMhash2sumAmplAliveChannels[mChID2PMhash[chId]] += static_cast<Int_t>(chData.QTCAmpl);
462+
}
463+
464+
if (digit.mTriggers.getVertex() && chData.getFlag(o2::ft0::ChannelData::kIsCFDinADCgate) && isCollidingBC) {
465+
if (!mMapPMhash2isAside[mChID2PMhash[static_cast<uint8_t>(chData.ChId)]]) {
466+
sumampCVTXBeamBeam += chData.QTCAmpl;
467+
} else if (mMapPMhash2isAside[mChID2PMhash[static_cast<uint8_t>(chData.ChId)]]) {
468+
sumampAVTXBeamBeam += chData.QTCAmpl;
469+
}
470+
}
471+
}
472+
mHistSumAmpAVTXBeamBeam->Fill(sumampAVTXBeamBeam);
473+
mHistSumAmpCVTXBeamBeam->Fill(sumampCVTXBeamBeam);
474+
mHistSumAmpACVTXBeamBeam->Fill(sumampAVTXBeamBeam + sumampCVTXBeamBeam);
475+
476+
for (const auto& entry : mapPMhash2sumAmplAliveChannels) {
477+
if (mMapPMhash2isAside[entry.first]) {
478+
sumampAVTXBeamBeam_by8 += (entry.second >> 3);
479+
} else
480+
sumampCVTXBeamBeam_by8 += (entry.second >> 3);
379481
}
482+
mHistSumAmpAVTXBeamBeam_by8->Fill(sumampAVTXBeamBeam_by8);
483+
mHistSumAmpCVTXBeamBeam_by8->Fill(sumampCVTXBeamBeam_by8);
484+
mHistSumAmpACVTXBeamBeam_by8->Fill(sumampAVTXBeamBeam_by8 + sumampCVTXBeamBeam_by8);
380485

381486
for (const auto& entry : mapPMhash2sumAmpl) {
382487
if (mMapPMhash2isAside[entry.first])
@@ -433,6 +538,7 @@ void DigitQcTask::monitorData(o2::framework::ProcessingContext& ctx)
433538

434539
mHistTimeSum2Diff->Fill((digit.mTriggers.getTimeC() - digit.mTriggers.getTimeA()) * sCFDChannel2NS / 2, (digit.mTriggers.getTimeC() + digit.mTriggers.getTimeA()) * sCFDChannel2NS / 2);
435540
}
541+
436542
if (isTCM) {
437543
std::vector<unsigned int> vecTrgWords{};
438544
const uint64_t trgWordExt = digit.mTriggers.getExtendedTrgWordFT0();
@@ -490,13 +596,20 @@ void DigitQcTask::reset()
490596
mHistTime2Ch->Reset();
491597
mHistAmp2Ch->Reset();
492598
mHistBC->Reset();
599+
mHistBCBeamBeam->Reset();
493600
mHistChDataBits->Reset();
494601
mHistTimeSum2Diff->Reset();
495602
mHistOrbit2BC->Reset();
496603
mHistNchA->Reset();
497604
mHistNchC->Reset();
498605
mHistSumAmpA->Reset();
499606
mHistSumAmpC->Reset();
607+
mHistSumAmpAVTXBeamBeam->Reset();
608+
mHistSumAmpCVTXBeamBeam->Reset();
609+
mHistSumAmpACVTXBeamBeam->Reset();
610+
mHistSumAmpAVTXBeamBeam_by8->Reset();
611+
mHistSumAmpCVTXBeamBeam_by8->Reset();
612+
mHistSumAmpACVTXBeamBeam_by8->Reset();
500613
mHistAverageTimeA->Reset();
501614
mHistAverageTimeC->Reset();
502615
mHistChannelID->Reset();

Modules/FIT/FV0/include/FV0/DigitQcTask.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@
2525
#include <vector>
2626
#include <array>
2727
#include <boost/algorithm/string.hpp>
28+
#include <bitset>
2829

2930
#include "TH1.h"
3031
#include "TH2.h"
3132
#include "TList.h"
3233
#include "Rtypes.h"
3334

3435
#include "CommonConstants/LHCConstants.h"
35-
36+
#include "CommonDataFormat/BunchFilling.h"
3637
#include "QualityControl/TaskInterface.h"
3738
#include "QualityControl/QcInfoLogger.h"
3839

40+
#include "DataFormatsFIT/DeadChannelMap.h"
3941
#include "FV0Base/Constants.h"
4042
#include "DataFormatsFV0/Digit.h"
4143
#include "DataFormatsFV0/ChannelData.h"
@@ -83,10 +85,20 @@ class DigitQcTask final : public TaskInterface
8385
double mTimeSum = 0.;
8486

8587
long mTFcreationTime = 0;
88+
long mRunStartTime = 0;
8689

8790
int mMinTimeGate = -192;
8891
int mMaxTimeGate = 192;
8992

93+
o2::BunchFilling mBcPattern;
94+
std::bitset<sBCperOrbit> mCollBC;
95+
bool mBcPatternLoaded = false;
96+
void loadBcPatternIfNeeded();
97+
98+
o2::fit::DeadChannelMap* mDeadChannelMap = nullptr;
99+
bool mDeadChannelMapLoaded = false;
100+
void loadDeadChannelMapIfNeeded();
101+
90102
template <typename Param_t,
91103
typename = typename std::enable_if<std::is_floating_point<Param_t>::value ||
92104
std::is_same<std::string, Param_t>::value || (std::is_integral<Param_t>::value && !std::is_same<bool, Param_t>::value)>::type>
@@ -162,10 +174,13 @@ class DigitQcTask final : public TaskInterface
162174
std::unique_ptr<TH2F> mHistChDataBits;
163175
std::unique_ptr<TH2F> mHistOrbit2BC;
164176
std::unique_ptr<TH1F> mHistBC;
177+
std::unique_ptr<TH1F> mHistBCBeamBeam;
165178
std::unique_ptr<TH1F> mHistNchA;
166179
std::unique_ptr<TH1F> mHistNchC;
167180
std::unique_ptr<TH1F> mHistSumAmpA;
168181
std::unique_ptr<TH1F> mHistSumAmpC;
182+
std::unique_ptr<TH1F> mHistSumAmpAOrABeamBeam;
183+
std::unique_ptr<TH1F> mHistSumAmpAOrABeamBeam_by8;
169184
std::unique_ptr<TH1F> mHistAverageTimeA;
170185
std::unique_ptr<TH1F> mHistAverageTimeC;
171186
std::unique_ptr<TH1F> mHistChannelID;

0 commit comments

Comments
 (0)