Skip to content

Commit e93a34c

Browse files
committed
modified following o2 linter and code-check
1 parent 5cf3a20 commit e93a34c

2 files changed

Lines changed: 15 additions & 25 deletions

File tree

PWGUD/Tasks/flowCorrelationsUpc.cxx

100644100755
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ struct FlowCorrelationsUpc {
314314
if (mEfficiency == nullptr) {
315315
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str());
316316
}
317-
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency);
317+
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), static_cast<void*>(mEfficiency));
318318
}
319319
correctionsLoaded = true;
320320
}
@@ -385,10 +385,10 @@ struct FlowCorrelationsUpc {
385385
if (!trackSelected(track1))
386386
continue;
387387

388-
auto momentum = std::array<double, 3>{track1.px(), track1.py(), track1.pz()};
389-
double pt1 = RecoDecay::pt(momentum);
390-
double phi1 = RecoDecay::phi(momentum);
391-
double eta1 = RecoDecay::eta(momentum);
388+
auto momentum1 = std::array<double, 3>{track1.px(), track1.py(), track1.pz()};
389+
double pt1 = RecoDecay::pt(momentum1);
390+
double phi1 = RecoDecay::phi(momentum1);
391+
double eta1 = RecoDecay::eta(momentum1);
392392

393393
// 计算track1的权重
394394
float weff1 = 1., wacc1 = 1.;
@@ -407,10 +407,10 @@ struct FlowCorrelationsUpc {
407407
if (system == MixedEvent && cfgUsePtOrderInMixEvent && pt1 <= track2.pt())
408408
continue;
409409

410-
auto momentum = std::array<double, 3>{track2.px(), track2.py(), track2.pz()};
411-
double pt2 = RecoDecay::pt(momentum);
412-
double phi2 = RecoDecay::phi(momentum);
413-
double eta2 = RecoDecay::eta(momentum);
410+
auto momentum2 = std::array<double, 3>{track2.px(), track2.py(), track2.pz()};
411+
double pt2 = RecoDecay::pt(momentum2);
412+
double phi2 = RecoDecay::phi(momentum2);
413+
double eta2 = RecoDecay::eta(momentum2);
414414

415415
float weff2 = 1., wacc2 = 1.;
416416
if (mEfficiency) {

PWGUD/Tasks/flowCumulantsUpc.cxx

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ struct FlowCumulantsUpc {
147147
GFW* fGFWMC = new GFW();
148148
std::vector<GFW::CorrConfig> corrconfigs;
149149
std::vector<GFW::CorrConfig> corrconfigsmc;
150-
TAxis* fPtAxis;
150+
TAxis* fPtAxis = nullptr;
151151
TRandom3* fRndm = new TRandom3(0);
152152
TRandom3* fRndmMc = new TRandom3(0);
153153
int lastRunNumber = -1;
@@ -543,17 +543,17 @@ struct FlowCumulantsUpc {
543543
if (cfgAcceptance.value.empty() == false) {
544544
mAcceptance = ccdb->getForTimeStamp<GFWWeights>(cfgAcceptance, timestamp);
545545
if (mAcceptance) {
546-
LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
546+
LOGF(info, "Loaded acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), static_cast<void*>(mAcceptance));
547547
} else {
548-
LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), (void*)mAcceptance);
548+
LOGF(warning, "Could not load acceptance weights from %s (%p)", cfgAcceptance.value.c_str(), static_cast<void*>(mAcceptance));
549549
}
550550
}
551551
if (cfgEfficiency.value.empty() == false) {
552552
mEfficiency = ccdb->getForTimeStamp<TH1D>(cfgEfficiency, timestamp);
553553
if (mEfficiency == nullptr) {
554554
LOGF(fatal, "Could not load efficiency histogram for trigger particles from %s", cfgEfficiency.value.c_str());
555555
}
556-
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), (void*)mEfficiency);
556+
LOGF(info, "Loaded efficiency histogram from %s (%p)", cfgEfficiency.value.c_str(), static_cast<void*>(mEfficiency));
557557
}
558558
correctionsLoaded = true;
559559
}
@@ -672,7 +672,6 @@ struct FlowCumulantsUpc {
672672

673673
// zdc time cut
674674
int neutronClass = -1;
675-
bool xnxn = false, onon = false, xnon = false, onxn = false;
676675
float energyCommonZNA = collision.energyCommonZNA(), energyCommonZNC = collision.energyCommonZNC();
677676
float timeZNA = collision.timeZNA(), timeZNC = collision.timeZNC();
678677
if (std::isinf(energyCommonZNA))
@@ -686,34 +685,29 @@ struct FlowCumulantsUpc {
686685
registry.fill(HIST("ZDCEnergy"), energyCommonZNC, energyCommonZNA);
687686
registry.fill(HIST("ZDCTime"), timeZNC, timeZNA);
688687
if (std::abs(timeZNA) > cfgZdcTimeCut && std::abs(timeZNC) > cfgZdcTimeCut) {
689-
onon = true;
690688
neutronClass = 0;
691689
registry.fill(HIST("neutronClass"), 0, 0);
692690
}
693691
if (std::abs(timeZNA) <= cfgZdcTimeCut && std::abs(timeZNC) > cfgZdcTimeCut) {
694-
xnon = true;
695692
neutronClass = 1;
696693
registry.fill(HIST("neutronClass"), 0, 1);
697694
}
698695
if (std::abs(timeZNA) > cfgZdcTimeCut && std::abs(timeZNC) <= cfgZdcTimeCut) {
699-
onxn = true;
700696
neutronClass = 2;
701697
registry.fill(HIST("neutronClass"), 1, 0);
702698
}
703699
if (std::abs(timeZNA) <= cfgZdcTimeCut && std::abs(timeZNC) <= cfgZdcTimeCut) {
704-
xnxn = true;
705700
neutronClass = 3;
706701
registry.fill(HIST("neutronClass"), 1, 1);
707702
}
708703
if (cfgZdcTime) {
709704
// reject 0n0n and XnXn
710-
if (neutronClass == 0 || neutronClass == 3) {
705+
if (neutronClass == 0 || neutronClass == 3) { // o2-linter: disable=magic-number
711706
return;
712707
}
713708
// if A or C gap is requested, keep corresponding neutron class
714709
if (cfgGapSideA || cfgGapSideC) {
715-
if ((cfgGapSideA && neutronClass == 1) ||
716-
(cfgGapSideC && neutronClass == 2)) {
710+
if ((cfgGapSideA && neutronClass == 1) || (cfgGapSideC && neutronClass == 2)) { // o2-linter: disable=magic-number
717711
// accepted
718712
} else {
719713
return;
@@ -836,8 +830,6 @@ struct FlowCumulantsUpc {
836830
registry.fill(HIST("hDCAxy"), track.dcaXY(), track.pt());
837831
nTracksRaw += 1.;
838832
nTracksCorrected += weff;
839-
}
840-
if (withinPtRef) {
841833
fGFW->Fill(eta, fPtAxis->FindBin(pt) - 1, phi, wacc * weff, 1);
842834
}
843835
if (withinPtPOI) {
@@ -942,8 +934,6 @@ struct FlowCumulantsUpc {
942934
registry.fill(HIST("hEtaMC"), eta);
943935
registry.fill(HIST("hPtRefMC"), pt);
944936
nTracksCorrected += weff;
945-
}
946-
if (withinPtRef) {
947937
fGFWMC->Fill(eta, fPtAxis->FindBin(pt) - 1, phi, wacc * weff, 1);
948938
}
949939
if (withinPtPOI) {

0 commit comments

Comments
 (0)