Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions Common/CCDB/RCTSelectionFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ enum RCTSelectionFlags {
kTPCLimAccMCRepr,
kTRDBad,
kZDCBad,
kNRCTSelectionFlags
kNRCTSelectionFlags,
kDummy24,
kDummy25,
kDummy26,
kDummy27,
kDummy28,
kDummy29,
kDummy30,
kCcdbObjectLoaded
};

template <typename T>
Expand Down Expand Up @@ -104,9 +112,14 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
// The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data)
// The treatLimitedAcceptanceAsBad boolean flag controls whether "LimitedAcceptanceMCReproducible" flags should be
// treated as Bad and the corresponding events excluded
explicit RCTFlagsChecker(const std::string& label, bool checkZDC = false, bool treatLimitedAcceptanceAsBad = false)
// The checkTableValidity boolean flag controls whether events without a corresponding valid RCT CCDB object should be
// treated as Bad and excluded
explicit RCTFlagsChecker(const std::string& label,
bool checkZDC = false,
bool treatLimitedAcceptanceAsBad = false,
bool checkTableValidity = false)
{
init(label, checkZDC, treatLimitedAcceptanceAsBad);
init(label, checkZDC, treatLimitedAcceptanceAsBad, checkTableValidity);
}

// Initialize the object from an initializer list of RCTSelectionFlags values
Expand All @@ -121,13 +134,18 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
// - "CBT"
// - "CBT_hadronPID"
// - "CBT_electronPID"
// - "CBT_calo"
// - "CCBT_calo"
// - "CBT_muon"
// - "CBT_muon_glo"
// The checkZDC boolean flag controls whether to iclude the ZDC quality in all the pre-defined selections (for Pb-Pb data)
// The treatLimitedAcceptanceAsBad boolean flag controls whether "LimitedAcceptanceMCReproducible" flags should be
// treated as Bad and the corresponding events excluded
void init(const std::string& label, bool checkZDC = false, bool treatLimitedAcceptanceAsBad = false)
// The checkTableValidity boolean flag controls whether events without a corresponding valid RCT CCDB object should be
// treated as Bad and excluded
void init(const std::string& label,
bool checkZDC = false,
bool treatLimitedAcceptanceAsBad = false,
bool checkTableValidity = false)
{
auto setFlags = [this](std::initializer_list<RCTSelectionFlags> flags) {
std::for_each(flags.begin(),
Expand Down Expand Up @@ -182,14 +200,19 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
if (checkZDC) {
set(kZDCBad);
}

if (checkTableValidity) {
set(kCcdbObjectLoaded);
}
}

// Check the RCT column of a given event selection table.
// The function returns true if none of the checked flags is set in the RCT column.
bool checkTable(const HasRCTFlags auto& table)
{
// throw an exception if none of the bits in the checker mask is set
if (!any()) {
throw std::out_of_range("RCTFlagsCheckerAlt with empty RCTSelectionFlags bits mask");
throw std::out_of_range("RCTFlagsChecker has empty RCTSelectionFlags bits mask");
}

// bitmask of the current table
Expand All @@ -201,6 +224,13 @@ class RCTFlagsChecker : public o2::utils::EnumFlags<RCTSelectionFlags>
return ((tableBits & flagsBits) == 0);
}

// Check the validity of the RCT column of a given event selection table.
// The function returns true if the RCT CCDB object was correctly fetched (bit31 == 0).
bool isTableValid(const HasRCTFlags auto& table)
{
return (table.rct_bit(kCcdbObjectLoaded) == 0);
}

bool operator()(const HasRCTFlags auto& table)
{
return checkTable(table);
Expand Down
81 changes: 42 additions & 39 deletions DPG/Tasks/AOTEvent/timeDependentQa.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

int64_t tsSOR = 0; // dummy start-of-run timestamp
int64_t tsEOR = 1; // dummy end-of-run timestamp
if (runNumber >= 500000) {

Check failure on line 177 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), runNumber);
// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
Expand Down Expand Up @@ -291,39 +291,40 @@

// ### QA RCT flags
int nRctFlagsTotal = enNumRctFlagsTotal;
histos.add("hSecondsRCTflags", "", kTH2F, {axisSecondsWideBins, {nRctFlagsTotal + 1, -0.5, nRctFlagsTotal + 1 - 0.5, "Monitoring of RCT flags"}});
histos.add("hSecondsRCTflags", "", kTH2F, {axisSecondsWideBins, {nRctFlagsTotal + 2, -0.5, nRctFlagsTotal + 2 - 0.5, "Monitoring of RCT flags"}});
axRctFlags = reinterpret_cast<TAxis*>(histos.get<TH2>(HIST("hSecondsRCTflags"))->GetYaxis());
axRctFlags->SetBinLabel(1, "NcollisionsSel8");
axRctFlags->SetBinLabel(2 + kCPVBad, "CPVBad");
axRctFlags->SetBinLabel(2 + kEMCBad, "EMCBad");
axRctFlags->SetBinLabel(2 + kEMCLimAccMCRepr, "EMCLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kFDDBad, "FDDBad");
axRctFlags->SetBinLabel(2 + kFT0Bad, "FT0Bad");
axRctFlags->SetBinLabel(2 + kFV0Bad, "FV0Bad");
axRctFlags->SetBinLabel(2 + kHMPBad, "HMPBad");
axRctFlags->SetBinLabel(2 + kITSBad, "ITSBad");
axRctFlags->SetBinLabel(2 + kITSLimAccMCRepr, "ITSLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kMCHBad, "MCHBad");
axRctFlags->SetBinLabel(2 + kMCHLimAccMCRepr, "MCHLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kMFTBad, "MFTBad");
axRctFlags->SetBinLabel(2 + kMFTLimAccMCRepr, "MFTLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kMIDBad, "MIDBad");
axRctFlags->SetBinLabel(2 + kMIDLimAccMCRepr, "MIDLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kPHSBad, "PHSBad");
axRctFlags->SetBinLabel(2 + kTOFBad, "TOFBad");
axRctFlags->SetBinLabel(2 + kTOFLimAccMCRepr, "TOFLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kTPCBadTracking, "TPCBadTracking");
axRctFlags->SetBinLabel(2 + kTPCBadPID, "TPCBadPID");
axRctFlags->SetBinLabel(2 + kTPCLimAccMCRepr, "TPCLimAccMCRepr");
axRctFlags->SetBinLabel(2 + kTRDBad, "TRDBad");
axRctFlags->SetBinLabel(2 + kZDCBad, "ZDCBad");
axRctFlags->SetBinLabel(2, "CcdbNotFound");
axRctFlags->SetBinLabel(3 + kCPVBad, "CPVBad");
axRctFlags->SetBinLabel(3 + kEMCBad, "EMCBad");
axRctFlags->SetBinLabel(3 + kEMCLimAccMCRepr, "EMCLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kFDDBad, "FDDBad");
axRctFlags->SetBinLabel(3 + kFT0Bad, "FT0Bad");
axRctFlags->SetBinLabel(3 + kFV0Bad, "FV0Bad");
axRctFlags->SetBinLabel(3 + kHMPBad, "HMPBad");
axRctFlags->SetBinLabel(3 + kITSBad, "ITSBad");
axRctFlags->SetBinLabel(3 + kITSLimAccMCRepr, "ITSLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kMCHBad, "MCHBad");
axRctFlags->SetBinLabel(3 + kMCHLimAccMCRepr, "MCHLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kMFTBad, "MFTBad");
axRctFlags->SetBinLabel(3 + kMFTLimAccMCRepr, "MFTLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kMIDBad, "MIDBad");
axRctFlags->SetBinLabel(3 + kMIDLimAccMCRepr, "MIDLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kPHSBad, "PHSBad");
axRctFlags->SetBinLabel(3 + kTOFBad, "TOFBad");
axRctFlags->SetBinLabel(3 + kTOFLimAccMCRepr, "TOFLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kTPCBadTracking, "TPCBadTracking");
axRctFlags->SetBinLabel(3 + kTPCBadPID, "TPCBadPID");
axRctFlags->SetBinLabel(3 + kTPCLimAccMCRepr, "TPCLimAccMCRepr");
axRctFlags->SetBinLabel(3 + kTRDBad, "TRDBad");
axRctFlags->SetBinLabel(3 + kZDCBad, "ZDCBad");
// combined flags
axRctFlags->SetBinLabel(2 + enCBT, "CBT");
axRctFlags->SetBinLabel(2 + enCBT_hadronPID, "CBT_hadronPID");
axRctFlags->SetBinLabel(2 + enCBT_electronPID, "CBT_electronPID");
axRctFlags->SetBinLabel(2 + enCBT_calo, "CBT_calo");
axRctFlags->SetBinLabel(2 + enCBT_muon, "CBT_muon");
axRctFlags->SetBinLabel(2 + enCBT_muon_glo, "CBT_muon_glo");
axRctFlags->SetBinLabel(3 + enCBT, "CBT");
axRctFlags->SetBinLabel(3 + enCBT_hadronPID, "CBT_hadronPID");
axRctFlags->SetBinLabel(3 + enCBT_electronPID, "CBT_electronPID");
axRctFlags->SetBinLabel(3 + enCBT_calo, "CBT_calo");
axRctFlags->SetBinLabel(3 + enCBT_muon, "CBT_muon");
axRctFlags->SetBinLabel(3 + enCBT_muon_glo, "CBT_muon_glo");

// QA for all tracks
// const AxisSpec axisChi2ITS{40, 0., 20., "chi2/ndof"};
Expand Down Expand Up @@ -428,7 +429,7 @@
// phi holes vs time
const AxisSpec axisPhi{64, 0, TMath::TwoPi(), "#varphi"}; // o2-linter: disable=external-pi (temporary fix)
const AxisSpec axisEta{10, -0.8, 0.8, "#eta"};
if (confFlagFillPhiVsTimeHist == 2) {

Check failure on line 432 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.add("hSecondsITSlayer0vsPhi", "", kTH2F, {axisSeconds, axisPhi});
histos.add("hSecondsITSlayer1vsPhi", "", kTH2F, {axisSeconds, axisPhi});
histos.add("hSecondsITSlayer2vsPhi", "", kTH2F, {axisSeconds, axisPhi});
Expand Down Expand Up @@ -469,7 +470,7 @@
if (confTakeVerticesWithUPCsettings > 0) { // otherwise analyse all collisions
if (confTakeVerticesWithUPCsettings == 1 && isVertexUPC) // reject vertices with UPC settings
continue;
if (confTakeVerticesWithUPCsettings == 2 && !isVertexUPC) // we want to select vertices with UPC settings --> reject vertices reconstructed with "normal" settings

Check failure on line 473 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
// LOGP(info, "flags={} nTracks = {}", flags, tracks.size());
}
Expand All @@ -488,7 +489,7 @@

histos.fill(HIST("hSecondsUPCverticesBeforeAllCuts"), secFromSOR, isVertexUPC ? 1 : 0);

if (std::fabs(col.posZ()) > 10)

Check failure on line 492 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;

histos.fill(HIST("hSecondsUPCverticesBeforeSel8"), secFromSOR, isVertexUPC ? 1 : 0);
Expand Down Expand Up @@ -540,13 +541,13 @@
bool isLowOccupStdAlsoInPrevRof = isLowOccupStd && col.selection_bit(kNoHighMultCollInPrevRof);
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdAlsoInPrevRof, isLowOccupStdAlsoInPrevRof);

bool isLowOccupStdCut500 = isLowOccupStd && occupByTracks >= 0 && occupByTracks < 500;

Check failure on line 544 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdCut500, isLowOccupStdCut500);

bool isLowOccupStdCut2000 = isLowOccupStd && occupByTracks >= 0 && occupByTracks < 2000;

Check failure on line 547 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdCut2000, isLowOccupStdCut2000);

bool isLowOccupStdCut4000 = isLowOccupStd && occupByTracks >= 0 && occupByTracks < 4000;

Check failure on line 550 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("hSecondsEventSelBits"), secFromSOR, enIsLowOccupStdCut4000, isLowOccupStdCut4000);

bool isLowOccupStdAlsoInPrevRofCut2000noDeadStaves = isLowOccupStdCut2000 && col.selection_bit(kNoHighMultCollInPrevRof) && col.selection_bit(kIsGoodITSLayersAll);
Expand All @@ -554,18 +555,20 @@

// check RCT flags
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 0); // n collisions sel8
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1, col.rct_bit(kCcdbObjectLoaded)); // CCDB object not loaded
LOGP(debug, "i = 1, bitValue = {}, binLabel={}, binCenter={}", col.rct_bit(kCcdbObjectLoaded), axRctFlags->GetBinLabel(2), axRctFlags->GetBinCenter(2));
for (int iFlag = 0; iFlag < kNRCTSelectionFlags; iFlag++) {
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + iFlag, col.rct_bit(iFlag));
LOGP(debug, "i = {}, bitValue = {}, binLabel={}, binCenter={}", iFlag, col.rct_bit(iFlag), axRctFlags->GetBinLabel(2 + iFlag), axRctFlags->GetBinCenter(2 + iFlag));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + iFlag, col.rct_bit(iFlag));
LOGP(debug, "i = {}, bitValue = {}, binLabel={}, binCenter={}", iFlag, col.rct_bit(iFlag), axRctFlags->GetBinLabel(3 + iFlag), axRctFlags->GetBinCenter(3 + iFlag));
}
LOGP(debug, "CBT_hadronPID = {}, kFT0Bad = {}, kITSBad = {}, kTPCBadTracking = {}, kTPCBadPID = {}, kTOFBad = {}, 1 + enCBT_hadronPID = {}, binLabel={}, binCenter={}", rctCheckerCBT_hadronPID(col),
col.rct_bit(kFT0Bad), col.rct_bit(kITSBad), col.rct_bit(kTPCBadTracking), col.rct_bit(kTPCBadPID), col.rct_bit(kTOFBad), 1 + enCBT_hadronPID, axRctFlags->GetBinLabel(2 + enCBT_hadronPID), axRctFlags->GetBinCenter(2 + enCBT_hadronPID));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT, rctCheckerCBT(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_hadronPID, rctCheckerCBT_hadronPID(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_electronPID, rctCheckerCBT_electronPID(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_calo, rctCheckerCBT_calo(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_muon, rctCheckerCBT_muon(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 1 + enCBT_muon_glo, rctCheckerCBT_muon_glo(col));
col.rct_bit(kFT0Bad), col.rct_bit(kITSBad), col.rct_bit(kTPCBadTracking), col.rct_bit(kTPCBadPID), col.rct_bit(kTOFBad), 2 + enCBT_hadronPID, axRctFlags->GetBinLabel(3 + enCBT_hadronPID), axRctFlags->GetBinCenter(3 + enCBT_hadronPID));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT, rctCheckerCBT(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_hadronPID, rctCheckerCBT_hadronPID(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_electronPID, rctCheckerCBT_electronPID(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_calo, rctCheckerCBT_calo(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_muon, rctCheckerCBT_muon(col));
histos.fill(HIST("hSecondsRCTflags"), secFromSOR, 2 + enCBT_muon_glo, rctCheckerCBT_muon_glo(col));

// check hadronic rate
double hadronicRate = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; // kHz
Expand All @@ -585,7 +588,7 @@
for (const auto& track : tracksGrouped) {
// if (!track.hasTPC() || !track.hasITS())
// continue;
if (std::fabs(track.eta()) > 0.8 || std::fabs(track.pt()) < 0.2)

Check failure on line 591 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;

double dcaR = track.dcaXY();
Expand Down Expand Up @@ -669,7 +672,7 @@
if (track.tpcNClsFound() >= confCutOnNtpcClsForSharedFractAndDeDxCalc) {
histos.fill(HIST("A/global/hSecondsTpcFractionSharedCls"), secFromSOR, track.tpcFractionSharedCls());
histos.fill(HIST("A/global/hSeconds2DTpcFractionSharedCls"), secFromSOR, track.tpcFractionSharedCls());
if (dedx < 1.e4) // protection from weird values

Check failure on line 675 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("A/global/hSecondsDeDx"), secFromSOR, dedx);
}

Expand All @@ -690,7 +693,7 @@
if (track.tpcNClsFound() >= confCutOnNtpcClsForSharedFractAndDeDxCalc) {
histos.fill(HIST("A/globalPV/hSecondsTpcFractionSharedCls"), secFromSOR, track.tpcFractionSharedCls());
histos.fill(HIST("A/globalPV/hSeconds2DTpcFractionSharedCls"), secFromSOR, track.tpcFractionSharedCls());
if (dedx < 1.e4) // protection from weird values

Check failure on line 696 in DPG/Tasks/AOTEvent/timeDependentQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
histos.fill(HIST("A/globalPV/hSecondsDeDx"), secFromSOR, dedx);
}
}
Expand Down
Loading