Skip to content

Commit 5eed443

Browse files
authored
[Common] QC flags added in event selection tables (AliceO2Group#9418)
1 parent 51de5e6 commit 5eed443

File tree

3 files changed

+57
-10
lines changed

3 files changed

+57
-10
lines changed

Common/CCDB/AnalysisCCDBLinkDef.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file AnalysisCCDBLinkDef.h
13+
/// \brief Dictionary definitions
14+
///
15+
/// \author Evgeny Kryshen <[email protected]>
16+
17+
#ifndef COMMON_CCDB_ANALYSISCCDBLINKDEF_H_
18+
#define COMMON_CCDB_ANALYSISCCDBLINKDEF_H_
19+
1220
#pragma link off all globals;
1321
#pragma link off all classes;
1422
#pragma link off all functions;
1523

1624
#pragma link C++ class EventSelectionParams + ;
1725
#pragma link C++ class TriggerAliases + ;
26+
#pragma link C++ class std::map < uint64_t, uint32_t> + ;
27+
28+
#endif // COMMON_CCDB_ANALYSISCCDBLINKDEF_H_

Common/DataModel/EventSelection.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11+
12+
/// \file EventSelection.h
13+
/// \brief Definitions of event selection tables
14+
///
15+
/// \author Evgeny Kryshen <[email protected]> and Igor Altsybeev <[email protected]>
16+
1117
#ifndef COMMON_DATAMODEL_EVENTSELECTION_H_
1218
#define COMMON_DATAMODEL_EVENTSELECTION_H_
1319

@@ -47,6 +53,7 @@ namespace evsel
4753
{
4854
DECLARE_SOA_BITMAP_COLUMN(Alias, alias, 32); //! Bitmask of fired trigger aliases (see TriggerAliases.h for definitions)
4955
DECLARE_SOA_BITMAP_COLUMN(Selection, selection, 64); //! Bitmask of selection flags (see EventSelectionParams.h for definitions)
56+
DECLARE_SOA_BITMAP_COLUMN(Rct, rct, 32); //! Bitmask of RCT flags
5057
DECLARE_SOA_COLUMN(Sel7, sel7, bool); //! Event selection decision based on V0A & V0C
5158
DECLARE_SOA_COLUMN(Sel8, sel8, bool); //! Event selection decision based on TVX
5259
DECLARE_SOA_INDEX_COLUMN_FULL(FoundBC, foundBC, int, BCs, "_foundBC"); //! BC entry index in BCs table (-1 if doesn't exist)
@@ -55,19 +62,20 @@ DECLARE_SOA_INDEX_COLUMN_FULL(FoundFV0, foundFV0, int, FV0As, "_foundFV0"); //!
5562
DECLARE_SOA_INDEX_COLUMN_FULL(FoundFDD, foundFDD, int, FDDs, "_foundFDD"); //! FDD entry index in FDDs table (-1 if doesn't exist)
5663
DECLARE_SOA_INDEX_COLUMN_FULL(FoundZDC, foundZDC, int, Zdcs, "_foundZDC"); //! ZDC entry index in ZDCs table (-1 if doesn't exist)
5764
DECLARE_SOA_COLUMN(BcInTF, bcInTF, int); //! Position of a (found) bunch crossing inside a given timeframe
58-
DECLARE_SOA_COLUMN(NumTracksInTimeRange, trackOccupancyInTimeRange, int); //! Occupancy in specified time interval by a number of tracks from nearby collisions
59-
DECLARE_SOA_COLUMN(SumAmpFT0CInTimeRange, ft0cOccupancyInTimeRange, float); //! Occupancy in specified time interval by a sum of FT0C amplitudes from nearby collisions
65+
DECLARE_SOA_COLUMN(NumTracksInTimeRange, trackOccupancyInTimeRange, int); //! Occupancy in specified time interval by a number of tracks from nearby collisions // o2-linter: disable=name/o2-column
66+
DECLARE_SOA_COLUMN(SumAmpFT0CInTimeRange, ft0cOccupancyInTimeRange, float); //! Occupancy in specified time interval by a sum of FT0C amplitudes from nearby collisions // o2-linter: disable=name/o2-column
6067
} // namespace evsel
6168

6269
// bc-joinable event selection decisions
6370
DECLARE_SOA_TABLE(BcSels, "AOD", "BCSEL", //!
64-
evsel::Alias, evsel::Selection, evsel::FoundFT0Id, evsel::FoundFV0Id, evsel::FoundFDDId, evsel::FoundZDCId);
71+
evsel::Alias, evsel::Selection, evsel::Rct, evsel::FoundFT0Id, evsel::FoundFV0Id, evsel::FoundFDDId, evsel::FoundZDCId);
6572
using BcSel = BcSels::iterator;
6673

6774
// collision-joinable event selection decisions
6875
DECLARE_SOA_TABLE(EvSels, "AOD", "EVSEL", //!
6976
evsel::Alias,
7077
evsel::Selection,
78+
evsel::Rct,
7179
evsel::Sel7,
7280
evsel::Sel8,
7381
evsel::FoundBCId,

Common/TableProducer/eventSelection.cxx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <vector>
1818
#include <map>
19+
#include <string>
1920

2021
#include "Framework/ConfigParamSpec.h"
2122
#include "Framework/runDataProcessing.h"
@@ -80,13 +81,13 @@ struct BcSelectionTask {
8081
bool isPP = 1; // default value
8182
TriggerAliases* aliases = nullptr;
8283
EventSelectionParams* par = nullptr;
84+
std::map<uint64_t, uint32_t>* mapRCT = nullptr;
8385
std::map<int64_t, std::vector<int16_t>> mapInactiveChips; // number of inactive chips vs orbit per layer
8486
int64_t prevOrbitForInactiveChips = 0; // cached next stored orbit in the inactive chip map
8587
int64_t nextOrbitForInactiveChips = 0; // cached previous stored orbit in the inactive chip map
8688
bool isGoodITSLayer3 = true; // default value
8789
bool isGoodITSLayer0123 = true; // default value
8890
bool isGoodITSLayersAll = true; // default value
89-
9091
void init(InitContext&)
9192
{
9293
if (metadataInfo.isFullyDefined() && !doprocessRun2 && !doprocessRun3) { // Check if the metadata is initialized (only if not forced from the workflow configuration)
@@ -242,8 +243,9 @@ struct BcSelectionTask {
242243
histos.get<TH1>(HIST("hCounterTVX"))->Fill(Form("%d", bc.runNumber()), 1);
243244
}
244245

246+
uint32_t rct = 0;
245247
// Fill bc selection columns
246-
bcsel(alias, selection, foundFT0, foundFV0, foundFDD, foundZDC);
248+
bcsel(alias, selection, rct, foundFT0, foundFV0, foundFDD, foundZDC);
247249
}
248250
}
249251
PROCESS_SWITCH(BcSelectionTask, processRun2, "Process Run2 event selection", true);
@@ -311,6 +313,18 @@ struct BcSelectionTask {
311313
}
312314
} // loop over vector of inactive chip ids
313315
} // loop over orbits
316+
317+
// QC info
318+
std::map<std::string, std::string> metadata;
319+
metadata["run"] = Form("%d", run);
320+
ccdb->setFatalWhenNull(0);
321+
mapRCT = ccdb->getSpecific<std::map<uint64_t, uint32_t>>("Users/j/jian/RCT", ts, metadata);
322+
ccdb->setFatalWhenNull(1);
323+
if (mapRCT == nullptr) {
324+
LOGP(info, "rct object missing... inserting dummy rct flags");
325+
mapRCT = new std::map<uint64_t, uint32_t>;
326+
mapRCT->insert(std::pair<uint64_t, uint32_t>(sorTimestamp, 0));
327+
}
314328
}
315329

316330
// map from GlobalBC to BcId needed to find triggerBc
@@ -326,6 +340,13 @@ struct BcSelectionTask {
326340

327341
// bc loop
328342
for (auto bc : bcs) { // o2-linter: disable=const-ref-in-for-loop
343+
// store rct flags
344+
auto itrct = mapRCT->upper_bound(bc.timestamp());
345+
if (itrct != mapRCT->begin())
346+
itrct--;
347+
uint32_t rct = itrct->second;
348+
LOGP(debug, "sor={} eor={} ts={} rct={}", sorTimestamp, eorTimestamp, bc.timestamp(), rct);
349+
329350
uint32_t alias{0};
330351
// workaround for pp2022 (trigger info is shifted by -294 bcs)
331352
int32_t triggerBcId = mapGlobalBCtoBcId[bc.globalBC() + triggerBcShift];
@@ -424,7 +445,7 @@ struct BcSelectionTask {
424445
LOGP(debug, "prev inactive chips: {} {} {} {} {} {} {}", vPrevInactiveChips[0], vPrevInactiveChips[1], vPrevInactiveChips[2], vPrevInactiveChips[3], vPrevInactiveChips[4], vPrevInactiveChips[5], vPrevInactiveChips[6]);
425446
isGoodITSLayer3 = vPrevInactiveChips[3] <= maxInactiveChipsPerLayer->at(3) && vNextInactiveChips[3] <= maxInactiveChipsPerLayer->at(3);
426447
isGoodITSLayer0123 = true;
427-
for (int i = 0; i < 3; i++) {
448+
for (int i = 0; i < 4; i++) {
428449
isGoodITSLayer0123 &= vPrevInactiveChips[i] <= maxInactiveChipsPerLayer->at(i) && vNextInactiveChips[i] <= maxInactiveChipsPerLayer->at(i);
429450
}
430451
isGoodITSLayersAll = true;
@@ -506,7 +527,7 @@ struct BcSelectionTask {
506527
}
507528

508529
// Fill bc selection columns
509-
bcsel(alias, selection, foundFT0, foundFV0, foundFDD, foundZDC);
530+
bcsel(alias, selection, rct, foundFT0, foundFV0, foundFDD, foundZDC);
510531
}
511532
}
512533
PROCESS_SWITCH(BcSelectionTask, processRun3, "Process Run3 event selection", false);
@@ -677,6 +698,9 @@ struct EventSelectionTask {
677698
selection |= (spdClusters < par->fSPDClsVsTklA + nTkl * par->fSPDClsVsTklB) ? BIT(kNoSPDClsVsTklBG) : 0;
678699
selection |= !(nTkl < 6 && multV0C012 > par->fV0C012vsTklA + nTkl * par->fV0C012vsTklB) ? BIT(kNoV0C012vsTklBG) : 0;
679700

701+
// copy rct flags from bcsel table
702+
uint32_t rct = bc.rct_raw();
703+
680704
// apply int7-like selections
681705
bool sel7 = 1;
682706
for (int i = 0; i < kNsel; i++) {
@@ -702,7 +726,7 @@ struct EventSelectionTask {
702726
}
703727
}
704728

705-
evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, 0, 0, 0);
729+
evsel(alias, selection, rct, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, 0, 0, 0);
706730
}
707731
PROCESS_SWITCH(EventSelectionTask, processRun2, "Process Run2 event selection", true);
708732

@@ -757,7 +781,8 @@ struct EventSelectionTask {
757781
int32_t foundFDD = bc.foundFDDId();
758782
int32_t foundZDC = bc.foundZDCId();
759783
int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF;
760-
evsel(bc.alias_raw(), bc.selection_raw(), kFALSE, kFALSE, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF, -1, -1);
784+
uint32_t rct = 0;
785+
evsel(bc.alias_raw(), bc.selection_raw(), rct, kFALSE, kFALSE, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF, -1, -1);
761786
}
762787
return;
763788
}
@@ -1171,6 +1196,9 @@ struct EventSelectionTask {
11711196
selection |= (vNoCollInSameRofStandard[colIndex] && vNoCollInSameRofWithCloseVz[colIndex]) ? BIT(kNoCollInRofStandard) : 0;
11721197
selection |= vNoHighMultCollInPrevRof[colIndex] ? BIT(kNoHighMultCollInPrevRof) : 0;
11731198

1199+
// copy rct flags from bcsel table
1200+
uint32_t rct = bc.rct_raw();
1201+
11741202
// apply int7-like selections
11751203
bool sel7 = 0;
11761204

@@ -1190,7 +1218,7 @@ struct EventSelectionTask {
11901218

11911219
int bcInTF = (bc.globalBC() - bcSOR) % nBCsPerTF;
11921220

1193-
evsel(alias, selection, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF,
1221+
evsel(alias, selection, rct, sel7, sel8, foundBC, foundFT0, foundFV0, foundFDD, foundZDC, bcInTF,
11941222
vNumTracksITS567inFullTimeWin[colIndex], vSumAmpFT0CinFullTimeWin[colIndex]);
11951223
}
11961224
}

0 commit comments

Comments
 (0)