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
18 changes: 12 additions & 6 deletions Common/TableProducer/eventSelection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
int mITSROFrameEndBorderMargin = 20; // default value
int mTimeFrameStartBorderMargin = 300; // default value
int mTimeFrameEndBorderMargin = 4000; // default value
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata

TriggerAliases* aliases = nullptr;
EventSelectionParams* par = nullptr;
std::map<uint64_t, uint32_t>* mapRCT = nullptr;
Expand All @@ -99,6 +101,8 @@
ccdb->setURL("http://alice-ccdb.cern.ch");
ccdb->setCaching(true);
ccdb->setLocalObjectValidityChecking();
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag

histos.add("hCounterInvalidBCTimestamp", "", kTH1D, {{1, 0., 1.}});
}

Expand Down Expand Up @@ -256,7 +260,7 @@
// duration of TF in bcs
nBCsPerTF = 32; // hard-coded for Run3 MC (no info from ccdb at the moment)
} else {
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
// SOR and EOR timestamps
sorTimestamp = runInfo.sor;
eorTimestamp = runInfo.eor;
Expand Down Expand Up @@ -511,10 +515,11 @@
int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun)
std::bitset<nBCsPerOrbit> bcPatternB; // bc pattern of colliding bunches

int64_t bcSOR = -1; // global bc of the start of the first orbit
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
int rofOffset = -1; // ITS ROF offset, in bc
int rofLength = -1; // ITS ROF length, in bc
int64_t bcSOR = -1; // global bc of the start of the first orbit
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
int rofOffset = -1; // ITS ROF offset, in bc
int rofLength = -1; // ITS ROF length, in bc
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata

int32_t findClosest(int64_t globalBC, std::map<int64_t, int32_t>& bcs)
{
Expand Down Expand Up @@ -580,6 +585,7 @@
}
}
}
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag

ccdb->setURL("http://alice-ccdb.cern.ch");
ccdb->setCaching(true);
Expand Down Expand Up @@ -678,7 +684,7 @@
int run3min = 500000;
if (run != lastRun && run >= run3min) {
lastRun = run;
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
// duration of TF in bcs
Expand Down Expand Up @@ -1343,15 +1349,15 @@
double perBcRateTCE = static_cast<double>(mCounterTCE[i + 1] - mCounterTCE[i]) / nOrbits / nCollidingBCs;
double perBcRateZNC = static_cast<double>(mCounterZNC[i + 1] - mCounterZNC[i]) / nOrbits / nCollidingBCs;
double perBcRateZEM = static_cast<double>(mCounterZEM[i + 1] - mCounterZEM[i]) / nOrbits / nCollidingBCs;
double muTVX = (perBcRateTVX < 1 && perBcRateTVX > 1e-10) ? -std::log(1 - perBcRateTVX) : 0;

Check failure on line 1352 in Common/TableProducer/eventSelection.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.
double muTCE = (perBcRateTCE < 1 && perBcRateTCE > 1e-10) ? -std::log(1 - perBcRateTCE) : 0;

Check failure on line 1353 in Common/TableProducer/eventSelection.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.
double muZNC = (perBcRateZNC < 1 && perBcRateZNC > 1e-10) ? -std::log(1 - perBcRateZNC) : 0;

Check failure on line 1354 in Common/TableProducer/eventSelection.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.
double muZEM = (perBcRateZEM < 1 && perBcRateZEM > 1e-10) ? -std::log(1 - perBcRateZEM) : 0;

Check failure on line 1355 in Common/TableProducer/eventSelection.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.
LOGP(debug, "orbit={} muTVX={} muTCE={} muZNC={} muZEM={}", mOrbits[i], muTVX, muTCE, muZNC, muZEM);
mPileupCorrectionTVX.push_back(muTVX > 1e-10 ? muTVX / (1 - std::exp(-muTVX)) : 1);

Check failure on line 1357 in Common/TableProducer/eventSelection.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.
mPileupCorrectionTCE.push_back(muTCE > 1e-10 ? muTCE / (1 - std::exp(-muTCE)) : 1);

Check failure on line 1358 in Common/TableProducer/eventSelection.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.
mPileupCorrectionZNC.push_back(muZNC > 1e-10 ? muZNC / (1 - std::exp(-muZNC)) : 1);

Check failure on line 1359 in Common/TableProducer/eventSelection.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.
mPileupCorrectionZEM.push_back(muZEM > 1e-10 ? muZEM / (1 - std::exp(-muZEM)) : 1);

Check failure on line 1360 in Common/TableProducer/eventSelection.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.
}
// filling last orbit range using previous orbit range
mPileupCorrectionTVX.push_back(mPileupCorrectionTVX.back());
Expand Down
4 changes: 2 additions & 2 deletions Common/TableProducer/eventSelectionService.cxx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.

Check failure on line 1 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[o2-workflow-options]

Do not use workflow options to customise workflow topology composition in defineDataProcessing. Use process function switches or metadata instead.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
Expand All @@ -11,7 +11,7 @@

/// \file eventSelectionTester.cxx
/// \brief unified, self-configuring event selection task
/// \author ALICE

Check failure on line 14 in Common/TableProducer/eventSelectionService.cxx

View workflow job for this annotation

GitHub Actions / O2 linter

[doc/file]

Documentation for \file is missing, incorrect or misplaced.

//===============================================================
//
Expand Down Expand Up @@ -91,7 +91,7 @@

// task-specific
timestampMod.init(timestampConfigurables, metadataInfo);
bcselmodule.init(context, bcselOpts, histos);
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
evselmodule.init(context, evselOpts, histos, metadataInfo);
}

Expand Down Expand Up @@ -154,7 +154,7 @@

// task-specific
timestampMod.init(timestampConfigurables, metadataInfo);
bcselmodule.init(context, bcselOpts, histos);
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
evselmodule.init(context, evselOpts, histos, metadataInfo);
lumimodule.init(context, lumiOpts, histos);
}
Expand Down
21 changes: 13 additions & 8 deletions Common/Tools/EventSelectionTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ class BcSelectionModule
int mITSROFrameEndBorderMargin = 20; // default value
int mTimeFrameStartBorderMargin = 300; // default value
int mTimeFrameEndBorderMargin = 4000; // default value
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata

TriggerAliases* aliases = nullptr;
EventSelectionParams* par = nullptr;
std::map<uint64_t, uint32_t>* mapRCT = nullptr;
Expand All @@ -148,8 +150,8 @@ class BcSelectionModule
bool isGoodITSLayer0123 = true; // default value
bool isGoodITSLayersAll = true; // default value

template <typename TContext, typename TBcSelOpts, typename THistoRegistry>
void init(TContext& context, TBcSelOpts const& external_bcselopts, THistoRegistry& histos)
template <typename TContext, typename TBcSelOpts, typename THistoRegistry, typename TMetadataInfo>
void init(TContext& context, TBcSelOpts const& external_bcselopts, THistoRegistry& histos, TMetadataInfo const& metadataInfo)
{
// read in configurations from the task where it's used
bcselOpts = external_bcselopts;
Expand All @@ -172,6 +174,7 @@ class BcSelectionModule
return;
}
}
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag

// add counter
histos.add("bcselection/hCounterInvalidBCTimestamp", "", o2::framework::kTH1D, {{1, 0., 1.}});
Expand Down Expand Up @@ -199,7 +202,7 @@ class BcSelectionModule
// duration of TF in bcs
nBCsPerTF = 32; // hard-coded for Run3 MC (no info from ccdb at the moment)
} else {
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
// SOR and EOR timestamps
sorTimestamp = runInfo.sor;
eorTimestamp = runInfo.eor;
Expand Down Expand Up @@ -600,10 +603,11 @@ class EventSelectionModule
int lastRun = -1; // last run number (needed to access ccdb only if run!=lastRun)
std::bitset<nBCsPerOrbit> bcPatternB; // bc pattern of colliding bunches

int64_t bcSOR = -1; // global bc of the start of the first orbit
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
int rofOffset = -1; // ITS ROF offset, in bc
int rofLength = -1; // ITS ROF length, in bc
int64_t bcSOR = -1; // global bc of the start of the first orbit
int64_t nBCsPerTF = -1; // duration of TF in bcs, should be 128*3564 or 32*3564
int rofOffset = -1; // ITS ROF offset, in bc
int rofLength = -1; // ITS ROF length, in bc
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata

int32_t findClosest(int64_t globalBC, std::map<int64_t, int32_t>& bcs)
{
Expand Down Expand Up @@ -687,6 +691,7 @@ class EventSelectionModule
}
}
}
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag

histos.add("eventselection/hColCounterAll", "", framework::kTH1D, {{1, 0., 1.}});
histos.add("eventselection/hColCounterTVX", "", framework::kTH1D, {{1, 0., 1.}});
Expand All @@ -701,7 +706,7 @@ class EventSelectionModule
// extract bc pattern from CCDB for data or anchored MC only
if (run != lastRun && run >= run3min) {
lastRun = run;
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
// first bc of the first orbit
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
// duration of TF in bcs
Expand Down
36 changes: 30 additions & 6 deletions DPG/Tasks/AOTEvent/eventSelectionQa.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/// \file eventSelectionQa.cxx
/// \brief Event selection QA task
///
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch> and Igor Altsybeev <Igor.Altsybeev@cern.ch>

#include <map>
#include <vector>
Expand Down Expand Up @@ -361,7 +361,17 @@ struct EventSelectionQaTask {
// requested by TPC experts: nTPConly tracks vs occupancy
histos.add("occupancyQA/hNumTracksTPConly_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNtracksTPConly, axisOccupancyTracks});
histos.add("occupancyQA/hNumTracksTPConlyNoITS_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNtracksTPConly, axisOccupancyTracks});

// request from experts to add track properties vs occupancy, to compare data vs MC
const AxisSpec axisOccupancyForTrackQA{60, 0., 15000, "occupancy (n ITS tracks weighted)"};
const AxisSpec axisNTPCcls{150, 0, 150, "n TPC clusters"};
histos.add("occupancyQA/tpcNClsFound_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
histos.add("occupancyQA/tpcNClsFindable_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
histos.add("occupancyQA/tpcNClsShared_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
histos.add("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
const AxisSpec axisChi2TPC{150, 0, 15, "chi2Ncl TPC"};
histos.add("occupancyQA/tpcChi2_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisChi2TPC, axisOccupancyForTrackQA});

// ITS in-ROF occupancy
histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF", ";nITStracks event #1;nITStracks event #2", kTH2D, {{200, 0., 6000}, {200, 0., 6000}});
histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF_UPC", ";nITStracks event #1;nITStracks event #2", kTH2D, {{41, -0.5, 40.5}, {41, -0.5, 40.5}});
histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF_nonUPC", ";nITStracks event #1;nITStracks event #2", kTH2D, {{200, 0., 6000}, {200, 0., 6000}});
Expand Down Expand Up @@ -1128,6 +1138,10 @@ struct EventSelectionQaTask {
int nTracksITSTPC = 0;

bool isTVX = col.selection_bit(kIsTriggerTVX);

int occupancyByTracks = col.trackOccupancyInTimeRange();
float occupancyByFT0C = col.ft0cOccupancyInTimeRange();

for (const auto& track : tracksGrouped) {
int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS;

Expand Down Expand Up @@ -1158,7 +1172,19 @@ struct EventSelectionQaTask {
nPV++;
if (track.hasTPC()) {
nContributorsAfterEtaTPCLooseCuts++;
}

if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10 && occupancyByTracks >= 0) {
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);
histos.fill(HIST("occupancyQA/tpcChi2_vs_V0A_vs_occupancy"), multV0A, track.tpcChi2NCl(), occupancyByTracks);
int tpcNClsFindableMinusCrossedRowsCorrected = track.tpcNClsFindableMinusCrossedRows();
// correct for a buggy behaviour due to int8 and uint8 difference:
if (tpcNClsFindableMinusCrossedRowsCorrected < -70)
tpcNClsFindableMinusCrossedRowsCorrected += 256;
histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks);
}
} // end of hasTPC
if (track.tpcNClsFound() > 70 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) {
nContributorsAfterEtaTPCCuts++;
// ROF border QA
Expand All @@ -1183,10 +1209,8 @@ struct EventSelectionQaTask {

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

if (!isLowFlux && col.sel8() && fabs(col.posZ()) < 10) {
int occupancyByTracks = col.trackOccupancyInTimeRange();
if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10) {
histos.fill(HIST("occupancyQA/hOccupancyByTracks"), occupancyByTracks);
float occupancyByFT0C = col.ft0cOccupancyInTimeRange();
histos.fill(HIST("occupancyQA/hOccupancyByFT0C"), occupancyByFT0C);
if (occupancyByTracks >= 0) {
histos.fill(HIST("occupancyQA/hOccupancyByFT0CvsByTracks"), occupancyByTracks, occupancyByFT0C);
Expand Down
Loading