Skip to content

Commit 7b04421

Browse files
authored
Rename event selection bits
Rename event selection enum to be consistent with new zdcExtraTableReader.cxx task (and naming conventions)
1 parent cf66dcc commit 7b04421

1 file changed

Lines changed: 54 additions & 46 deletions

File tree

Common/TableProducer/zdcExtraTableProducer.cxx

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,33 @@ struct ZdcExtraTableProducer {
7373
Configurable<bool> cfgSaveQaHistos{"cfgSaveQaHistos", false, "Flag to save QA histograms"};
7474

7575
enum SelectionCriteria {
76-
evSel_zvtx,
77-
evSel_sel8,
78-
evSel_occupancy,
79-
evSel_kNoSameBunchPileup,
80-
evSel_kIsGoodZvtxFT0vsPV,
81-
evSel_kNoCollInTimeRangeStandard,
82-
evSel_kIsVertexITSTPC,
83-
evSel_kIsGoodITSLayersAll,
84-
evSel_allEvents,
85-
nEventSelections
76+
kZvtx,
77+
kSel8,
78+
kOccupancy,
79+
kNoSameBunchPileup,
80+
kIsGoodZvtxFT0vsPV,
81+
kNoCollInTimeRangeStandard,
82+
kIsVertexITSTPC,
83+
kIsGoodITSLayersAll,
84+
kAllEvents,
85+
kNEventSelections
8686
};
8787

8888
HistogramRegistry registry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
8989

9090
void init(InitContext const&)
9191
{
9292

93-
registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}});
94-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events");
95-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ");
96-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_sel8 + 1, "Sel8");
97-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_occupancy + 1, "kOccupancy");
98-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoSameBunchPileup + 1, "kNoSameBunchPileup");
99-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
100-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
101-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC");
102-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll");
93+
registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{kNEventSelections, 0, kNEventSelections}}});
94+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kAllEvents + 1, "kAllEvents");
95+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kZvtx + 1, "kZvtx");
96+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kSel8 + 1, "kSel8");
97+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kOccupancy + 1, "kOccupancy");
98+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kNoSameBunchPileup + 1, "kNoSameBunchPileup");
99+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
100+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
101+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kIsVertexITSTPC + 1, "kIsVertexITSTPC");
102+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll");
103103

104104
// Skip histogram registration if QA flag is false
105105
if (!cfgSaveQaHistos) {
@@ -129,62 +129,63 @@ struct ZdcExtraTableProducer {
129129
uint8_t selectionBits = 0;
130130
bool selected;
131131

132-
registry.fill(HIST("hEventCount"), evSel_allEvents);
132+
registry.fill(HIST("hEventCount"), kAllEvents);
133133

134134
selected = std::fabs(collision.posZ()) < cfgEvSelVtxZ;
135135
if (selected) {
136-
selectionBits |= (uint8_t)(0x1u << evSel_zvtx);
137-
registry.fill(HIST("hEventCount"), evSel_zvtx);
136+
SETBIT(selectionBits, kZvtx);
137+
registry.fill(HIST("hEventCount"), kZvtx);
138138
}
139139

140140
selected = collision.sel8();
141141
if (selected) {
142-
selectionBits |= (uint8_t)(0x1u << evSel_sel8);
143-
registry.fill(HIST("hEventCount"), evSel_sel8);
142+
SETBIT(selectionBits, kSel8);
143+
registry.fill(HIST("hEventCount"), kSel8);
144144
}
145145

146146
auto occupancy = collision.trackOccupancyInTimeRange();
147147
selected = occupancy <= cfgEvSelsMaxOccupancy;
148148
if (selected) {
149-
selectionBits |= (uint8_t)(0x1u << evSel_occupancy);
150-
registry.fill(HIST("hEventCount"), evSel_occupancy);
149+
SETBIT(selectionBits, kOccupancy);
150+
registry.fill(HIST("hEventCount"), kOccupancy);
151151
}
152152

153153
selected = collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup);
154154
if (selected) {
155-
selectionBits |= (uint8_t)(0x1u << evSel_kNoSameBunchPileup);
156-
registry.fill(HIST("hEventCount"), evSel_kNoSameBunchPileup);
155+
SETBIT(selectionBits, kNoSameBunchPileup);
156+
registry.fill(HIST("hEventCount"), kNoSameBunchPileup);
157157
}
158158

159159
selected = collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV);
160160
if (selected) {
161-
selectionBits |= (uint8_t)(0x1u << evSel_kIsGoodZvtxFT0vsPV);
162-
registry.fill(HIST("hEventCount"), evSel_kIsGoodZvtxFT0vsPV);
161+
SETBIT(selectionBits, kIsGoodZvtxFT0vsPV);
162+
registry.fill(HIST("hEventCount"), kIsGoodZvtxFT0vsPV);
163163
}
164164

165165
selected = collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard);
166166
if (selected) {
167-
selectionBits |= (uint8_t)(0x1u << evSel_kNoCollInTimeRangeStandard);
168-
registry.fill(HIST("hEventCount"), evSel_kNoCollInTimeRangeStandard);
167+
SETBIT(selectionBits, kNoCollInTimeRangeStandard);
168+
registry.fill(HIST("hEventCount"), kNoCollInTimeRangeStandard);
169169
}
170170

171171
selected = collision.selection_bit(o2::aod::evsel::kIsVertexITSTPC);
172172
if (selected) {
173-
selectionBits |= (uint8_t)(0x1u << evSel_kIsVertexITSTPC);
174-
registry.fill(HIST("hEventCount"), evSel_kIsVertexITSTPC);
173+
SETBIT(selectionBits, kIsVertexITSTPC);
174+
registry.fill(HIST("hEventCount"), kIsVertexITSTPC);
175175
}
176176

177177
selected = collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll);
178178
if (selected) {
179-
selectionBits |= (uint8_t)(0x1u << evSel_kIsGoodITSLayersAll);
180-
registry.fill(HIST("hEventCount"), evSel_kIsGoodITSLayersAll);
179+
SETBIT(selectionBits, kIsGoodITSLayersAll);
180+
registry.fill(HIST("hEventCount"), kIsGoodITSLayersAll);
181181
}
182182

183183
return selectionBits;
184184
}
185185

186186
void process(ColEvSels const& cols, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/)
187187
{
188+
188189
// collision-based event selection
189190
constexpr int NTowers = 4; // number of ZDC towers
190191

@@ -195,23 +196,30 @@ struct ZdcExtraTableProducer {
195196

196197
uint8_t evSelection = eventSelected(collision);
197198

198-
// add event selection
199-
if (cfgEvSelSel8 && !(evSelection & (1 << evSel_sel8)))
199+
if (cfgEvSelSel8 && !TESTBIT(evSelection, kSel8)) {
200200
continue;
201-
if (!(evSelection & (1 << evSel_zvtx)))
201+
}
202+
if (!TESTBIT(evSelection, kZvtx)) {
202203
continue;
203-
if (cfgEvSelsDoOccupancySel && !(evSelection & (1 << evSel_occupancy)))
204+
}
205+
if (cfgEvSelsDoOccupancySel && !TESTBIT(evSelection, kOccupancy)) {
204206
continue;
205-
if (cfgEvSelsNoSameBunchPileupCut && !(evSelection & (1 << evSel_kNoSameBunchPileup)))
207+
}
208+
if (cfgEvSelsNoSameBunchPileupCut && !TESTBIT(evSelection, kNoSameBunchPileup)) {
206209
continue;
207-
if (cfgEvSelsIsGoodZvtxFT0vsPV && !(evSelection & (1 << evSel_kIsGoodZvtxFT0vsPV)))
210+
}
211+
if (cfgEvSelsIsGoodZvtxFT0vsPV && !TESTBIT(evSelection, kIsGoodZvtxFT0vsPV)) {
208212
continue;
209-
if (cfgEvSelsNoCollInTimeRangeStandard && !(evSelection & (1 << evSel_kNoCollInTimeRangeStandard)))
213+
}
214+
if (cfgEvSelsNoCollInTimeRangeStandard && !TESTBIT(evSelection, kNoCollInTimeRangeStandard)) {
210215
continue;
211-
if (cfgEvSelsIsVertexITSTPC && !(evSelection & (1 << evSel_kIsVertexITSTPC)))
216+
}
217+
if (cfgEvSelsIsVertexITSTPC && !TESTBIT(evSelection, kIsVertexITSTPC)) {
212218
continue;
213-
if (cfgEvSelsIsGoodITSLayersAll && !(evSelection & (1 << evSel_kIsGoodITSLayersAll)))
219+
}
220+
if (cfgEvSelsIsGoodITSLayersAll && !TESTBIT(evSelection, kIsGoodITSLayersAll)) {
214221
continue;
222+
}
215223

216224
float centrality = collision.centFT0C();
217225

0 commit comments

Comments
 (0)