Skip to content

Commit d3deb6e

Browse files
committed
fix code checker
1 parent ddcd2a1 commit d3deb6e

1 file changed

Lines changed: 75 additions & 45 deletions

File tree

PWGCF/JCorran/Tasks/jEPFlowAnalysis.cxx

Lines changed: 75 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include <iterator>
6060
#include <string>
6161
#include <vector>
62+
#include <array>
6263

6364
using namespace o2;
6465
using namespace o2::framework;
@@ -79,15 +80,15 @@ struct JEPFlowAnalysis {
7980
kHistsel
8081
};
8182

82-
Service<o2::framework::O2DatabasePDG> pdg;
83+
Service<o2::framework::O2DatabasePDG> pdg{};
8384

8485
HistogramRegistry epFlowHistograms{"EPFlow", {}, OutputObjHandlingPolicy::AnalysisObject, true, true};
8586
EventPlaneHelper helperEP;
8687
o2::ft0::Geometry ft0geom;
8788
o2::fv0::Geometry* fv0geom = nullptr;
8889
FlowJHistManager histManager;
8990
bool debug = kFALSE;
90-
Service<o2::ccdb::BasicCCDBManager> ccdb;
91+
Service<o2::ccdb::BasicCCDBManager> ccdb{};
9192
o2::ccdb::CcdbApi ccdbApi;
9293

9394
struct : ConfigurableGroup {
@@ -204,7 +205,7 @@ struct JEPFlowAnalysis {
204205
float subleadingPhi = -999.;
205206
float subleadingEta = -999.;
206207

207-
std::vector<TProfile3D*> shiftprofile{};
208+
std::vector<TProfile3D*> shiftprofile;
208209
std::string fullCCDBShiftCorrPath;
209210

210211
THn* effMap = nullptr;
@@ -215,8 +216,8 @@ struct JEPFlowAnalysis {
215216
int nHighPt = 0;
216217
int minnHighPt = 2;
217218

218-
std::vector<float> ft0RelGainConst{};
219-
std::vector<float> fv0RelGainConst{};
219+
std::vector<float> ft0RelGainConst;
220+
std::vector<float> fv0RelGainConst;
220221

221222
bool q2sel(float q2, bool isHigh)
222223
{
@@ -226,13 +227,16 @@ struct JEPFlowAnalysis {
226227
if (idx < 0) {
227228
idx = 0;
228229
}
230+
229231
if (isHigh) {
230232
if (idx >= static_cast<int>(cfgMultq2high->size())) {
231233
idx = cfgMultq2high->size() - 1;
232234
}
233235
float sel = cfgMultq2high->at(idx);
234236
return q2 > sel;
235-
} else {
237+
}
238+
239+
if (!isHigh) {
236240
if (idx >= static_cast<int>(cfgMultq2low->size())) {
237241
idx = cfgMultq2low->size() - 1;
238242
}
@@ -246,54 +250,68 @@ struct JEPFlowAnalysis {
246250
{
247251
if (name.value == "FT0C") {
248252
return 0;
249-
} else if (name.value == "FT0A") {
253+
}
254+
if (name.value == "FT0A") {
250255
return 1;
251-
} else if (name.value == "FT0M") {
256+
}
257+
if (name.value == "FT0M") {
252258
return 2;
253-
} else if (name.value == "FV0A") {
259+
}
260+
if (name.value == "FV0A") {
254261
return 3;
255-
} else if (name.value == "TPCPos") {
262+
}
263+
if (name.value == "TPCPos") {
256264
return 4;
257-
} else if (name.value == "TPCNeg") {
265+
}
266+
if (name.value == "TPCNeg") {
258267
return 5;
259-
} else if (name.value == "TPCTot") {
268+
}
269+
if (name.value == "TPCTot") {
260270
return 6;
261-
} else {
262-
return 0;
263271
}
272+
return 0;
264273
}
265274

266275
template <typename Col>
267276
bool eventSel(const Col& coll)
268277
{
269-
if (std::abs(coll.posZ()) > cfgVertexZ)
278+
if (std::abs(coll.posZ()) > cfgVertexZ) {
270279
return false;
280+
}
281+
271282
switch (cfgEvtSel) {
272283
case 0: // Sel8
273-
if (!coll.sel8())
284+
if (!coll.sel8()) {
274285
return false;
286+
}
275287
break;
276288
case 1: // PbPb standard
277-
if (!coll.sel8() || !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup))
289+
if (!coll.sel8() || !coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) {
278290
return false;
291+
}
279292
break;
280293
case 2: // PbPb with pileup
281294
if (!coll.sel8() || !coll.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard) ||
282-
!coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup))
295+
!coll.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) {
283296
return false;
297+
}
284298
break;
285299
case 3: // Small systems (OO, NeNe, pp)
286-
if (!coll.sel8() || !coll.selection_bit(aod::evsel::kNoSameBunchPileup))
300+
if (!coll.sel8() || !coll.selection_bit(aod::evsel::kNoSameBunchPileup)) {
287301
return false;
302+
}
288303
break;
304+
305+
default:
306+
return false;
289307
}
290308
// Check occupancy
291-
if (coll.trackOccupancyInTimeRange() > cfgMaxOccupancy || coll.trackOccupancyInTimeRange() < cfgMinOccupancy)
309+
if (coll.trackOccupancyInTimeRange() > cfgMaxOccupancy || coll.trackOccupancyInTimeRange() < cfgMinOccupancy) {
292310
return false;
293-
294-
if (rctCut.requireRCTFlagChecker && !rctChecker(coll))
311+
}
312+
if (rctCut.requireRCTFlagChecker && !rctChecker(coll)) {
295313
return false;
296-
314+
}
297315
return true;
298316
}
299317

@@ -371,9 +389,9 @@ struct JEPFlowAnalysis {
371389
template <typename Col, typename Trk>
372390
void fillvn(const Col& coll, const Trk& tracks)
373391
{
374-
float eps[3] = {0.};
375-
float qx_shifted[3] = {0.};
376-
float qy_shifted[3] = {0.};
392+
std::array<float, 3> eps{};
393+
std::array<float, 3> qx_shifted{};
394+
std::array<float, 3> qy_shifted{};
377395

378396
for (int i = 0; i < cfgnMode; i++) { // loop over different harmonic orders
379397
harmInd = cfgnTotalSystem * 4 * (i) + 3; // harmonic index to access corresponding Q-vector as all Q-vectors are in same vector
@@ -445,8 +463,9 @@ struct JEPFlowAnalysis {
445463

446464
if (cfgSelEvtTwoHP && i == 0) {
447465
for (const auto& track : tracks) {
448-
if (cfgTrkSelFlag && trackSel(track))
466+
if (cfgTrkSelFlag && trackSel(track) != 0) {
449467
continue;
468+
}
450469

451470
if (leadingPt < track.pt()) {
452471
subleadingPt = leadingPt;
@@ -462,19 +481,23 @@ struct JEPFlowAnalysis {
462481
subleadingEta = track.eta();
463482
}
464483

465-
if (track.pt() > cfgHighPtSel)
484+
if (track.pt() > cfgHighPtSel) {
466485
nHighPt++;
486+
}
467487
}
468488
}
469489

470-
if (cfgSelEvtTwoHP && nHighPt < minnHighPt)
490+
if (cfgSelEvtTwoHP && nHighPt < minnHighPt) {
471491
continue;
492+
}
472493

473-
if (cfgSelEvtTwoHP && std::abs(RecoDecay::constrainAngle(leadingPhi - subleadingPhi, 0) - constants::math::PI) > cfgTwoLPAngle)
494+
if (cfgSelEvtTwoHP && std::abs(RecoDecay::constrainAngle(leadingPhi - subleadingPhi, 0) - constants::math::PI) > cfgTwoLPAngle) {
474495
continue;
496+
}
475497

476-
if (cfgSelEvtTwoHP && std::abs(leadingEta + subleadingEta) > cfgEtaBalancing)
498+
if (cfgSelEvtTwoHP && std::abs(leadingEta + subleadingEta) > cfgEtaBalancing) {
477499
continue;
500+
}
478501

479502
epFlowHistograms.fill(HIST("EpDet"), i + 2, cent, eps[0]);
480503
epFlowHistograms.fill(HIST("EpRefA"), i + 2, cent, eps[1]);
@@ -529,8 +552,9 @@ struct JEPFlowAnalysis {
529552
leadingPhi = 0.0;
530553
leadingEta = 0.0;
531554
for (const auto& track : tracks) {
532-
if (cfgTrkSelFlag && trackSel(track))
555+
if (cfgTrkSelFlag && trackSel(track) != 0) {
533556
continue;
557+
}
534558

535559
if (cfgEffCor) {
536560
weight = getEfficiencyCorrection(effMap, track.eta(), track.pt(), cent, coll.posZ());
@@ -574,13 +598,13 @@ struct JEPFlowAnalysis {
574598

575599
double getEfficiencyCorrection(THn* eff, float eta, float pt, float multiplicity, float posZ)
576600
{
577-
int effVars[4];
601+
std::array<int, 4> effVars{};
578602
effVars[0] = eff->GetAxis(0)->FindBin(eta);
579603
effVars[1] = eff->GetAxis(1)->FindBin(pt);
580604
effVars[2] = eff->GetAxis(2)->FindBin(multiplicity);
581605
effVars[3] = eff->GetAxis(3)->FindBin(posZ);
582606

583-
return eff->GetBinContent(effVars);
607+
return eff->GetBinContent(effVars.data());
584608
}
585609

586610
void init(InitContext const&)
@@ -655,7 +679,7 @@ struct JEPFlowAnalysis {
655679
epFlowHistograms.add("EpResQvecEvslDetRefBxx", "", {HistType::kTH3F, {axisMod, axisCent, axisQvec}});
656680
epFlowHistograms.add("EpResQvecEvslRefARefBxx", "", {HistType::kTH3F, {axisMod, axisCent, axisQvec}});
657681

658-
if (cfgq2analysis) {
682+
if (cfgq2analysis != 0) {
659683
epFlowHistograms.add("EpResQvecDetRefAxx_q2high", "", {HistType::kTH3F, {axisMod, axisCent, axisQvec}});
660684
epFlowHistograms.add("EpResQvecDetRefBxx_q2high", "", {HistType::kTH3F, {axisMod, axisCent, axisQvec}});
661685
epFlowHistograms.add("EpResQvecRefARefBxx_q2high", "", {HistType::kTH3F, {axisMod, axisCent, axisQvec}});
@@ -666,7 +690,7 @@ struct JEPFlowAnalysis {
666690

667691
epFlowHistograms.add("SPvnxx", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisEta, axisQvec}});
668692
epFlowHistograms.add("SPvnxy", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisEta, axisQvec}});
669-
if (cfgq2analysis) {
693+
if (cfgq2analysis != 0) {
670694
epFlowHistograms.add("SPvnxx_q2high", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisEta, axisQvec}});
671695
epFlowHistograms.add("SPvnxx_q2low", "", {HistType::kTHnSparseF, {axisMod, axisCent, axisPt, axisEta, axisQvec}});
672696
}
@@ -682,8 +706,9 @@ struct JEPFlowAnalysis {
682706
void processDefault(MyCollisions::iterator const& coll, soa::Filtered<MyTracks> const& tracks, aod::BCsWithTimestamps const&, aod::FT0s const&)
683707
{
684708
if (cfgAddEvtSel) {
685-
if (!eventSel(coll))
709+
if (!eventSel(coll)) {
686710
return;
711+
}
687712
}
688713

689714
if (cfgEffCor) {
@@ -765,21 +790,22 @@ struct JEPFlowAnalysis {
765790
}
766791
}
767792

768-
if (coll.qvecAmp()[detId] < minQvecAmp || coll.qvecAmp()[refAId] < minQvecAmp || coll.qvecAmp()[refBId] < minQvecAmp)
793+
if (coll.qvecAmp()[detId] < minQvecAmp || coll.qvecAmp()[refAId] < minQvecAmp || coll.qvecAmp()[refBId] < minQvecAmp) {
769794
return;
795+
}
770796

771797
qOvecM = calcFT0CRawQVecMag(coll, 2) / coll.qvecAmp()[detId]; // second order
772798
activity = calcFT0CLocalActivity(coll);
773799

774800
epFlowHistograms.fill(HIST("hQoverMCnt"), cent, qOvecM);
775801
epFlowHistograms.fill(HIST("hActivityCnt"), cent, activity);
776802

777-
if (cfgJetSubEvtSel & 1) {
803+
if ((cfgJetSubEvtSel & 1) != 0) {
778804
if (cfgJetSubEvlSelVar->at(0) < qOvecM) {
779805
return;
780806
}
781807
}
782-
if (cfgJetSubEvtSel & 2) {
808+
if ((cfgJetSubEvtSel & 2) != 0) {
783809
if (cfgJetSubEvlSelVar->at(1) < activity) {
784810
return;
785811
}
@@ -795,8 +821,9 @@ struct JEPFlowAnalysis {
795821
}
796822

797823
if (cfgAddEvtSel) {
798-
if (!eventSel(coll))
824+
if (!eventSel(coll)) {
799825
return;
826+
}
800827
}
801828

802829
cent = coll.centFT0C();
@@ -815,7 +842,7 @@ struct JEPFlowAnalysis {
815842
continue;
816843
}
817844

818-
if (trackSel(trk)) {
845+
if (trackSel(trk) != 0) {
819846
continue;
820847
}
821848

@@ -830,8 +857,9 @@ struct JEPFlowAnalysis {
830857

831858
void processMCGen(MyCollisionsMC::iterator const& coll, aod::McParticles const& mcParticles, aod::McCollisions const&)
832859
{
833-
if (!coll.has_mcCollision())
860+
if (!coll.has_mcCollision()) {
834861
return;
862+
}
835863
const auto mcColl = coll.mcCollision();
836864

837865
if (cfgAddEvtSel) {
@@ -843,8 +871,9 @@ struct JEPFlowAnalysis {
843871
cent = coll.centFT0C();
844872

845873
for (const auto& mcParticle : mcParticles) {
846-
if (std::abs(mcParticle.eta()) > cfgTrackCuts.cfgEtaMax)
874+
if (std::abs(mcParticle.eta()) > cfgTrackCuts.cfgEtaMax) {
847875
continue;
876+
}
848877

849878
auto p = pdg->GetParticle(mcParticle.pdgCode());
850879
if (p != nullptr) {
@@ -853,8 +882,9 @@ struct JEPFlowAnalysis {
853882
}
854883
}
855884

856-
if (!mcParticle.isPhysicalPrimary())
885+
if (!mcParticle.isPhysicalPrimary()) {
857886
continue;
887+
}
858888

859889
epFlowHistograms.fill(HIST("MC/hPartGen"), cent, mcColl.posZ(), mcParticle.eta(), mcParticle.phi(), mcParticle.pt());
860890
}

0 commit comments

Comments
 (0)