Skip to content

Commit 117c557

Browse files
authored
[Common,DPG] automatic extraction of orbitsPerTF from ccdb by LPMProductionTag in bc- and event-selection (#12202)
1 parent c65f4f0 commit 117c557

File tree

4 files changed

+57
-22
lines changed

4 files changed

+57
-22
lines changed

Common/TableProducer/eventSelection.cxx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ struct BcSelectionTask {
8484
int mITSROFrameEndBorderMargin = 20; // default value
8585
int mTimeFrameStartBorderMargin = 300; // default value
8686
int mTimeFrameEndBorderMargin = 4000; // default value
87+
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata
88+
8789
TriggerAliases* aliases = nullptr;
8890
EventSelectionParams* par = nullptr;
8991
std::map<uint64_t, uint32_t>* mapRCT = nullptr;
@@ -99,6 +101,8 @@ struct BcSelectionTask {
99101
ccdb->setURL("http://alice-ccdb.cern.ch");
100102
ccdb->setCaching(true);
101103
ccdb->setLocalObjectValidityChecking();
104+
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag
105+
102106
histos.add("hCounterInvalidBCTimestamp", "", kTH1D, {{1, 0., 1.}});
103107
}
104108

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

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

519524
int32_t findClosest(int64_t globalBC, std::map<int64_t, int32_t>& bcs)
520525
{
@@ -580,6 +585,7 @@ struct EventSelectionTask {
580585
}
581586
}
582587
}
588+
strLPMProductionTag = metadataInfo.get("LPMProductionTag"); // to extract info from ccdb by the tag
583589

584590
ccdb->setURL("http://alice-ccdb.cern.ch");
585591
ccdb->setCaching(true);
@@ -678,7 +684,7 @@ struct EventSelectionTask {
678684
int run3min = 500000;
679685
if (run != lastRun && run >= run3min) {
680686
lastRun = run;
681-
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
687+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
682688
// first bc of the first orbit
683689
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
684690
// duration of TF in bcs

Common/TableProducer/eventSelectionService.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct eventselectionRun2 {
9191

9292
// task-specific
9393
timestampMod.init(timestampConfigurables, metadataInfo);
94-
bcselmodule.init(context, bcselOpts, histos);
94+
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
9595
evselmodule.init(context, evselOpts, histos, metadataInfo);
9696
}
9797

@@ -154,7 +154,7 @@ struct eventselectionRun3 {
154154

155155
// task-specific
156156
timestampMod.init(timestampConfigurables, metadataInfo);
157-
bcselmodule.init(context, bcselOpts, histos);
157+
bcselmodule.init(context, bcselOpts, histos, metadataInfo);
158158
evselmodule.init(context, evselOpts, histos, metadataInfo);
159159
lumimodule.init(context, lumiOpts, histos);
160160
}

Common/Tools/EventSelectionTools.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ class BcSelectionModule
138138
int mITSROFrameEndBorderMargin = 20; // default value
139139
int mTimeFrameStartBorderMargin = 300; // default value
140140
int mTimeFrameEndBorderMargin = 4000; // default value
141+
std::string strLPMProductionTag = ""; // MC production tag to be retrieved from AO2D metadata
142+
141143
TriggerAliases* aliases = nullptr;
142144
EventSelectionParams* par = nullptr;
143145
std::map<uint64_t, uint32_t>* mapRCT = nullptr;
@@ -148,8 +150,8 @@ class BcSelectionModule
148150
bool isGoodITSLayer0123 = true; // default value
149151
bool isGoodITSLayersAll = true; // default value
150152

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

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

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

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

691696
histos.add("eventselection/hColCounterAll", "", framework::kTH1D, {{1, 0., 1.}});
692697
histos.add("eventselection/hColCounterTVX", "", framework::kTH1D, {{1, 0., 1.}});
@@ -701,7 +706,7 @@ class EventSelectionModule
701706
// extract bc pattern from CCDB for data or anchored MC only
702707
if (run != lastRun && run >= run3min) {
703708
lastRun = run;
704-
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run);
709+
auto runInfo = o2::parameters::AggregatedRunInfo::buildAggregatedRunInfo(o2::ccdb::BasicCCDBManager::instance(), run, strLPMProductionTag);
705710
// first bc of the first orbit
706711
bcSOR = runInfo.orbitSOR * nBCsPerOrbit;
707712
// duration of TF in bcs

DPG/Tasks/AOTEvent/eventSelectionQa.cxx

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// \file eventSelectionQa.cxx
1313
/// \brief Event selection QA task
1414
///
15-
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch>
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch> and Igor Altsybeev <Igor.Altsybeev@cern.ch>
1616

1717
#include <map>
1818
#include <vector>
@@ -361,7 +361,17 @@ struct EventSelectionQaTask {
361361
// requested by TPC experts: nTPConly tracks vs occupancy
362362
histos.add("occupancyQA/hNumTracksTPConly_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNtracksTPConly, axisOccupancyTracks});
363363
histos.add("occupancyQA/hNumTracksTPConlyNoITS_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNtracksTPConly, axisOccupancyTracks});
364-
364+
// request from experts to add track properties vs occupancy, to compare data vs MC
365+
const AxisSpec axisOccupancyForTrackQA{60, 0., 15000, "occupancy (n ITS tracks weighted)"};
366+
const AxisSpec axisNTPCcls{150, 0, 150, "n TPC clusters"};
367+
histos.add("occupancyQA/tpcNClsFound_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
368+
histos.add("occupancyQA/tpcNClsFindable_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
369+
histos.add("occupancyQA/tpcNClsShared_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
370+
histos.add("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisNTPCcls, axisOccupancyForTrackQA});
371+
const AxisSpec axisChi2TPC{150, 0, 15, "chi2Ncl TPC"};
372+
histos.add("occupancyQA/tpcChi2_vs_V0A_vs_occupancy", "", kTH3F, {axisMultV0AForOccup, axisChi2TPC, axisOccupancyForTrackQA});
373+
374+
// ITS in-ROF occupancy
365375
histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF", ";nITStracks event #1;nITStracks event #2", kTH2D, {{200, 0., 6000}, {200, 0., 6000}});
366376
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}});
367377
histos.add("occupancyQA/hITSTracks_ev1_vs_ev2_2coll_in_ROF_nonUPC", ";nITStracks event #1;nITStracks event #2", kTH2D, {{200, 0., 6000}, {200, 0., 6000}});
@@ -1128,6 +1138,10 @@ struct EventSelectionQaTask {
11281138
int nTracksITSTPC = 0;
11291139

11301140
bool isTVX = col.selection_bit(kIsTriggerTVX);
1141+
1142+
int occupancyByTracks = col.trackOccupancyInTimeRange();
1143+
float occupancyByFT0C = col.ft0cOccupancyInTimeRange();
1144+
11311145
for (const auto& track : tracksGrouped) {
11321146
int trackBcDiff = bcDiff + track.trackTime() / o2::constants::lhc::LHCBunchSpacingNS;
11331147

@@ -1158,7 +1172,19 @@ struct EventSelectionQaTask {
11581172
nPV++;
11591173
if (track.hasTPC()) {
11601174
nContributorsAfterEtaTPCLooseCuts++;
1161-
}
1175+
1176+
if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10 && occupancyByTracks >= 0) {
1177+
histos.fill(HIST("occupancyQA/tpcNClsFound_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFound(), occupancyByTracks);
1178+
histos.fill(HIST("occupancyQA/tpcNClsFindable_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable(), occupancyByTracks);
1179+
histos.fill(HIST("occupancyQA/tpcNClsShared_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsShared(), occupancyByTracks);
1180+
histos.fill(HIST("occupancyQA/tpcChi2_vs_V0A_vs_occupancy"), multV0A, track.tpcChi2NCl(), occupancyByTracks);
1181+
int tpcNClsFindableMinusCrossedRowsCorrected = track.tpcNClsFindableMinusCrossedRows();
1182+
// correct for a buggy behaviour due to int8 and uint8 difference:
1183+
if (tpcNClsFindableMinusCrossedRowsCorrected < -70)
1184+
tpcNClsFindableMinusCrossedRowsCorrected += 256;
1185+
histos.fill(HIST("occupancyQA/tpcNCrossedRows_vs_V0A_vs_occupancy"), multV0A, track.tpcNClsFindable() - tpcNClsFindableMinusCrossedRowsCorrected, occupancyByTracks);
1186+
}
1187+
} // end of hasTPC
11621188
if (track.tpcNClsFound() > 70 && track.tpcNClsCrossedRows() > 80 && track.itsChi2NCl() < 36 && track.tpcChi2NCl() < 4) {
11631189
nContributorsAfterEtaTPCCuts++;
11641190
// ROF border QA
@@ -1183,10 +1209,8 @@ struct EventSelectionQaTask {
11831209

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

1186-
if (!isLowFlux && col.sel8() && fabs(col.posZ()) < 10) {
1187-
int occupancyByTracks = col.trackOccupancyInTimeRange();
1212+
if (!isLowFlux && col.sel8() && col.selection_bit(kNoSameBunchPileup) && fabs(col.posZ()) < 10) {
11881213
histos.fill(HIST("occupancyQA/hOccupancyByTracks"), occupancyByTracks);
1189-
float occupancyByFT0C = col.ft0cOccupancyInTimeRange();
11901214
histos.fill(HIST("occupancyQA/hOccupancyByFT0C"), occupancyByFT0C);
11911215
if (occupancyByTracks >= 0) {
11921216
histos.fill(HIST("occupancyQA/hOccupancyByFT0CvsByTracks"), occupancyByTracks, occupancyByFT0C);

0 commit comments

Comments
 (0)