Skip to content

Commit 10c70ff

Browse files
kegangxiongkegangxiong
authored andcommitted
Fix the magic number
1 parent df77187 commit 10c70ff

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

PWGCF/Flow/Tasks/flowZdcEnergy.cxx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,26 @@ struct flowZdcEnergy {
148148

149149
// Helper: event selection
150150
template <typename TCollision>
151-
bool acceptEvent(TCollision const& collision, const int runmode)
151+
bool acceptEventRun2(TCollision const& collision)
152152
{
153153
registry.fill(HIST("QA/hEventCount"), kAllEvents);
154-
if (runmode == 2 && !collision.sel7()) {
154+
if (!collision.sel7()) {
155155
return false;
156156
}
157-
if (runmode == 3 && !collision.sel8()) {
157+
registry.fill(HIST("QA/hEventCount"), kSeln);
158+
if (std::abs(collision.posZ()) > evsel.cfgVtxZ) {
159+
return false;
160+
}
161+
registry.fill(HIST("QA/hEventCount"), kZvtx);
162+
163+
return true;
164+
}
165+
166+
template <typename TCollision>
167+
bool acceptEventRun3(TCollision const& collision)
168+
{
169+
registry.fill(HIST("QA/hEventCount"), kAllEvents);
170+
if (!collision.sel8()) {
158171
return false;
159172
}
160173
registry.fill(HIST("QA/hEventCount"), kSeln);
@@ -225,11 +238,12 @@ struct flowZdcEnergy {
225238
registry.fill(HIST("hEnergyWithMult_ZNA_SumSectors"), sumEnergyZNA, multiTPC);
226239
registry.fill(HIST("hEnergyWithMult_ZNC_SumSectors"), sumEnergyZNC, multiTPC);
227240

228-
if (commonDen > 1.e-6f) {
241+
const float nonZero = 1.e-6f;
242+
if (commonDen > nonZero) {
229243
registry.fill(HIST("hEnergyWithCent_RescaledDiff"), (energyCommonZNA - energyCommonZNC) / commonDen, centrality);
230244
registry.fill(HIST("hEnergyWithMult_RescaledDiff"), (energyCommonZNA - energyCommonZNC) / commonDen, multiTPC);
231245
}
232-
if (sumDen > 1.e-6f) {
246+
if (sumDen > nonZero) {
233247
registry.fill(HIST("hEnergyWithCent_RescaledSumDiff"), (sumEnergyZNA - sumEnergyZNC) / sumDen, centrality);
234248
registry.fill(HIST("hEnergyWithMult_RescaledSumDiff"), (sumEnergyZNA - sumEnergyZNC) / sumDen, multiTPC);
235249
}
@@ -249,7 +263,7 @@ struct flowZdcEnergy {
249263
registry.fill(HIST("QA/hMultiplicity_beforeCut"), multi);
250264
registry.fill(HIST("QA/hMultiplicity_TPC_beforeCut"), multiTPC);
251265

252-
if (!acceptEvent(collision, 3)) {
266+
if (!acceptEventRun3(collision)) {
253267
return;
254268
}
255269
registry.fill(HIST("QA/hCentrality_afterCut"), centrality);
@@ -277,7 +291,7 @@ struct flowZdcEnergy {
277291
registry.fill(HIST("QA/hMultiplicity_beforeCut"), multi);
278292
registry.fill(HIST("QA/hMultiplicity_TPC_beforeCut"), multiTPC);
279293

280-
if (!acceptEvent(collision, 2)) {
294+
if (!acceptEventRun2(collision)) {
281295
return;
282296
}
283297
registry.fill(HIST("QA/hCentrality_afterCut"), centrality);

0 commit comments

Comments
 (0)