Skip to content
Merged
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
137 changes: 70 additions & 67 deletions DPG/Tasks/AOTEvent/eventSelectionQa.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
Configurable<bool> isMC{"isMC", 0, "0 - data, 1 - MC"};
Configurable<int32_t> nGlobalBCs{"nGlobalBCs", 100000, "number of global bcs for detailed monitoring"};
Configurable<bool> isLowFlux{"isLowFlux", 1, "1 - low flux (pp, pPb), 0 - high flux (PbPb)"};
Configurable<bool> fillITSdeadStaveHists{"fillITSdeadStaveHists", 0, "0 - no, 1 - yes"};

Service<o2::ccdb::BasicCCDBManager> ccdb;
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
Expand Down Expand Up @@ -400,7 +401,7 @@
for (int i = 0; i < kNsel; i++) {
histos.get<TH1>(HIST("hSelMask"))->SetBinContent(i + 1, applySelection[i]);
}
isINT1period = run <= 136377 || (run >= 144871 && run <= 159582);

Check failure on line 404 in DPG/Tasks/AOTEvent/eventSelectionQa.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.
}

// bc-based event selection qa
Expand Down Expand Up @@ -598,7 +599,7 @@
lastRun = run;
int64_t tsSOR = 0; // dummy start-of-run timestamp for unanchored MC
int64_t tsEOR = 1; // dummy end-of-run timestamp for unanchored MC
if (run >= 500000) {

Check failure on line 602 in DPG/Tasks/AOTEvent/eventSelectionQa.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(), run);
// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
Expand Down Expand Up @@ -639,78 +640,80 @@
}

// fill ITS dead maps
o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp<o2::itsmft::TimeDeadMap>("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2);
auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits
if (itsDeadMapOrbits.size() > 0) {
std::vector<double> itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end());
const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble};

for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) {
int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l);
double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l);
// int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
// double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits});
}
if (fillITSdeadStaveHists) {
o2::itsmft::TimeDeadMap* itsDeadMap = ccdb->getForTimeStamp<o2::itsmft::TimeDeadMap>("ITS/Calib/TimeDeadMap", (tsSOR + tsEOR) / 2);
auto itsDeadMapOrbits = itsDeadMap->getEvolvingMapKeys(); // roughly every second, ~350 TFs = 350x32 orbits
if (itsDeadMapOrbits.size() > 0) {
std::vector<double> itsDeadMapOrbitsDouble(itsDeadMapOrbits.begin(), itsDeadMapOrbits.end());
const AxisSpec axisItsDeadMapOrbits{itsDeadMapOrbitsDouble};

for (int l = 0; l < o2::itsmft::ChipMappingITS::NLayers; l++) {
int nChips = o2::itsmft::ChipMappingITS::getNChipsOnLayer(l);
double idFirstChip = o2::itsmft::ChipMappingITS::getFirstChipsOnLayer(l);
// int nStaves = o2::itsmft::ChipMappingITS::getNStavesOnLr(l);
// double idFirstStave = o2::itsmft::ChipMappingITS::getFirstStavesOnLr(l);
histos.add(Form("hDeadChipsVsOrbitL%d", l), Form(";orbit; chip; Layer %d", l), kTH2C, {axisItsDeadMapOrbits, {nChips, idFirstChip, idFirstChip + nChips}});
histos.add(Form("hNumberOfInactiveChipsVsOrbitL%d", l), Form(";orbit; Layer %d", l), kTH1I, {axisItsDeadMapOrbits});
}

std::vector<uint16_t> vClosest;
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> alwaysDeadChips;
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> deadChips;
alwaysDeadChips.set();
for (const auto& orbit : itsDeadMapOrbits) {
itsDeadMap->getMapAtOrbit(orbit, vClosest);
deadChips.reset();
for (size_t iel = 0; iel < vClosest.size(); iel++) {
uint16_t w1 = vClosest[iel];
bool isLastInSequence = (w1 & 0x8000) == 0;
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
uint16_t chipId1 = w1 & 0x7FFF;
uint16_t chipId2 = w2 & 0x7FFF;
// dead chips are stored as ranges
// vClosest contains first and last chip ids in the range
// last chip id in the range is marked with 0x8000 bit set to 1
for (int chipId = chipId1; chipId < chipId2; chipId++) {
histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1);
deadChips.set(chipId);
std::vector<uint16_t> vClosest;
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> alwaysDeadChips;
std::bitset<o2::itsmft::ChipMappingITS::getNChips()> deadChips;
alwaysDeadChips.set();
for (const auto& orbit : itsDeadMapOrbits) {
itsDeadMap->getMapAtOrbit(orbit, vClosest);
deadChips.reset();
for (size_t iel = 0; iel < vClosest.size(); iel++) {
uint16_t w1 = vClosest[iel];
bool isLastInSequence = (w1 & 0x8000) == 0;
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
uint16_t chipId1 = w1 & 0x7FFF;
uint16_t chipId2 = w2 & 0x7FFF;
// dead chips are stored as ranges
// vClosest contains first and last chip ids in the range
// last chip id in the range is marked with 0x8000 bit set to 1
for (int chipId = chipId1; chipId < chipId2; chipId++) {
histos.fill(HIST("hDeadChipsVsOrbitL0"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL1"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL2"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL3"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL4"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL5"), orbit, chipId, 1);
histos.fill(HIST("hDeadChipsVsOrbitL6"), orbit, chipId, 1);
deadChips.set(chipId);
}
}
alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0
}
alwaysDeadChips &= deadChips; // chips active in the current orbit are set to 0
}
// std::cout << alwaysDeadChips << std::endl;

// filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive)
for (const auto& orbit : itsDeadMapOrbits) {
itsDeadMap->getMapAtOrbit(orbit, vClosest);
std::vector<int16_t> nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0);
for (size_t iel = 0; iel < vClosest.size(); iel++) {
uint16_t w1 = vClosest[iel];
bool isLastInSequence = (w1 & 0x8000) == 0;
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
uint16_t chipId1 = w1 & 0x7FFF;
uint16_t chipId2 = w2 & 0x7FFF;
for (int chipId = chipId1; chipId < chipId2; chipId++) {
if (alwaysDeadChips[chipId]) // skip always inactive chips
continue;
int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId);
nInactiveChips[layer]++;
// std::cout << alwaysDeadChips << std::endl;

// filling histograms with number of inactive chips per layer vs orbit (ignoring always inactive)
for (const auto& orbit : itsDeadMapOrbits) {
itsDeadMap->getMapAtOrbit(orbit, vClosest);
std::vector<int16_t> nInactiveChips(o2::itsmft::ChipMappingITS::NLayers, 0);
for (size_t iel = 0; iel < vClosest.size(); iel++) {
uint16_t w1 = vClosest[iel];
bool isLastInSequence = (w1 & 0x8000) == 0;
uint16_t w2 = isLastInSequence ? w1 + 1 : vClosest[iel + 1];
uint16_t chipId1 = w1 & 0x7FFF;
uint16_t chipId2 = w2 & 0x7FFF;
for (int chipId = chipId1; chipId < chipId2; chipId++) {
if (alwaysDeadChips[chipId]) // skip always inactive chips
continue;
int32_t layer = o2::itsmft::ChipMappingITS::getLayer(chipId);
nInactiveChips[layer]++;
}
}
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]);
}
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL0"), orbit, nInactiveChips[0]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL1"), orbit, nInactiveChips[1]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL2"), orbit, nInactiveChips[2]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL3"), orbit, nInactiveChips[3]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL4"), orbit, nInactiveChips[4]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL5"), orbit, nInactiveChips[5]);
histos.fill(HIST("hNumberOfInactiveChipsVsOrbitL6"), orbit, nInactiveChips[6]);
}
}
} // end of fill ITS dead maps
} // run >= 500000

// create orbit-axis histograms on the fly with binning based on info from GRP if GRP is available
Expand All @@ -736,7 +739,7 @@

double minSec = floor(tsSOR / 1000.);
double maxSec = ceil(tsEOR / 1000.);
const AxisSpec axisSeconds{maxSec - minSec < 5000 ? static_cast<int>(maxSec - minSec) : 5000, minSec, maxSec, "seconds"};
const AxisSpec axisSeconds{maxSec - minSec < 1000 ? static_cast<int>(maxSec - minSec) : 1000, minSec, maxSec, "seconds"};

Check failure on line 742 in DPG/Tasks/AOTEvent/eventSelectionQa.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.
const AxisSpec axisBcDif{600, -300., 300., "bc difference"};
histos.add("hSecondsTVXvsBcDif", "", kTH2F, {axisSeconds, axisBcDif});
histos.add("hSecondsTVXvsBcDifAll", "", kTH2F, {axisSeconds, axisBcDif});
Expand Down Expand Up @@ -965,7 +968,7 @@
for (const auto& bc : bcs) {
int64_t globalBC = bc.globalBC();
// skip non-colliding bcs for data and anchored runs
if (run >= 500000 && bcPatternB[globalBC % nBCsPerOrbit] == 0) {

Check failure on line 971 in DPG/Tasks/AOTEvent/eventSelectionQa.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;
}
if (bc.selection_bit(kIsBBT0A) || bc.selection_bit(kIsBBT0C)) {
Expand All @@ -989,7 +992,7 @@
if (track.hasTOF() || track.hasTRD() || !track.hasITS() || !track.hasTPC() || track.pt() < 1)
continue;
histos.fill(HIST("hTrackBcDiffVsEtaAll"), track.eta(), bcDiff);
if (track.eta() < -0.2 || track.eta() > 0.2)

Check failure on line 995 in DPG/Tasks/AOTEvent/eventSelectionQa.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("hSecondsTVXvsBcDifAll"), bc.timestamp() / 1000., bcDiff);
}
Expand Down Expand Up @@ -1145,7 +1148,7 @@
for (const auto& track : tracksGrouped) {
int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS;

if (track.hasTPC() && std::fabs(track.eta()) < 0.8 && track.pt() > 0.2 && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 50 && track.tpcChi2NCl() < 4) {

Check failure on line 1151 in DPG/Tasks/AOTEvent/eventSelectionQa.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.
nTPConly++;
// if (track.tpcSignal() > 20)
// nTPConlyWithDeDxCut++;
Expand All @@ -1153,7 +1156,7 @@
nTPConlyNoITS++;
}

if (std::fabs(track.eta()) < 0.8 && track.pt() > 0.2) {

Check failure on line 1159 in DPG/Tasks/AOTEvent/eventSelectionQa.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.
if (track.hasITS()) {
nTracksITS++;
if (track.hasTPC())
Expand All @@ -1173,7 +1176,7 @@
if (track.hasTPC()) {
nContributorsAfterEtaTPCLooseCuts++;

if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10 && occupancyByTracks >= 0) {

Check failure on line 1179 in DPG/Tasks/AOTEvent/eventSelectionQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
histos.fill(HIST("occupancyQA/tpcNClsFound_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFound(), occupancyByTracks);
histos.fill(HIST("occupancyQA/tpcNClsFindable_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable(), occupancyByTracks);
histos.fill(HIST("occupancyQA/tpcNClsShared_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsShared(), occupancyByTracks);
Expand All @@ -1185,7 +1188,7 @@
histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks);
}
} // end of hasTPC
if (col.sel8() && fabs(col.posZ()) < 10 && track.tpcNClsFound() > 50 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) {

Check failure on line 1191 in DPG/Tasks/AOTEvent/eventSelectionQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
nContributorsAfterEtaTPCCuts++;
// ROF border QA
histos.fill(HIST("ITSROFborderQA/hFoundBC_kTVX_nITSlayers_for_ITSTPCtracks"), localBC, track.itsNCls());
Expand All @@ -1209,7 +1212,7 @@

histos.fill(HIST("hNcontribAfterCutsVsBcInTF"), bcInTF, nContributorsAfterEtaTPCCuts);

if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10) {

Check failure on line 1215 in DPG/Tasks/AOTEvent/eventSelectionQa.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[std-prefix]

Use std:: prefix for names from the std namespace.
histos.fill(HIST("occupancyQA/hOccupancyByTracks"), occupancyByTracks);
histos.fill(HIST("occupancyQA/hOccupancyByFT0C"), occupancyByFT0C);
if (occupancyByTracks >= 0) {
Expand Down
Loading