Skip to content

Commit 2fb6bed

Browse files
committed
modify following o2 code-check
1 parent 59e4877 commit 2fb6bed

1 file changed

Lines changed: 61 additions & 33 deletions

File tree

PWGCF/Flow/Tasks/flowMc.cxx

Lines changed: 61 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ using namespace o2::framework;
6868
using namespace o2::framework::expressions;
6969
using namespace o2::aod::rctsel;
7070

71-
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) \
72-
using ConfigTmp_##NAME = TYPE; \
73-
Configurable<ConfigTmp_##NAME> NAME{#NAME, (DEFAULT), HELP};
71+
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, (DEFAULT), (HELP)}; // NOLINT(bugprone-macro-parentheses)
7472

7573
struct FlowMc {
7674
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
@@ -581,8 +579,9 @@ struct FlowMc {
581579
initHadronicRate(bc);
582580
double hadronicRate = mRateFetcher.fetch(ccdb.service, bc.timestamp(), mRunNumber, "ZNC hadronic") * 1.e-3; //
583581
double seconds = bc.timestamp() * 1.e-3 - mMinSeconds;
584-
if (cfgIRCutEnabled && (hadronicRate < cfgIRMin || hadronicRate > cfgIRMax)) // cut on hadronic rate
582+
if (cfgIRCutEnabled && (hadronicRate < cfgIRMin || hadronicRate > cfgIRMax)) { // cut on hadronic rate
585583
return;
584+
}
586585
gCurrentHadronicRate->Fill(seconds, hadronicRate);
587586
}
588587

@@ -595,8 +594,9 @@ struct FlowMc {
595594
}
596595
histos.fill(HIST("RecoEventCounter"), 1.5);
597596
for (auto const& collision : collisions) {
598-
if (!eventSelected(collision))
597+
if (!eventSelected(collision)) {
599598
return;
599+
}
600600
}
601601
histos.fill(HIST("RecoEventCounter"), 2.5);
602602
}
@@ -622,12 +622,15 @@ struct FlowMc {
622622
double q4x = 0, q4y = 0;
623623
for (auto const& mcParticle : mcParticles) {
624624
int pdgCode = std::abs(mcParticle.pdgCode());
625-
if (pdgCode != PDG_t::kElectron && pdgCode != PDG_t::kMuonMinus && pdgCode != PDG_t::kPiPlus && pdgCode != kKPlus && pdgCode != PDG_t::kProton)
625+
if (pdgCode != PDG_t::kElectron && pdgCode != PDG_t::kMuonMinus && pdgCode != PDG_t::kPiPlus && pdgCode != kKPlus && pdgCode != PDG_t::kProton) {
626626
continue;
627-
if (!mcParticle.isPhysicalPrimary())
627+
}
628+
if (!mcParticle.isPhysicalPrimary()) {
628629
continue;
629-
if (std::fabs(mcParticle.eta()) > cfgCutEta) // main acceptance
630+
}
631+
if (std::fabs(mcParticle.eta()) > cfgCutEta) { // main acceptance
630632
continue;
633+
}
631634
nChGen++;
632635
if (mcParticle.has_tracks()) {
633636
auto const& tracks = mcParticle.tracks_as<FilteredTracks>();
@@ -675,18 +678,21 @@ struct FlowMc {
675678
if (cfgK0Lambda0Enabled) {
676679
extraPDGType = (pdgCode != PDG_t::kK0Short && pdgCode != PDG_t::kLambda0);
677680
}
678-
if (extraPDGType && pdgCode != PDG_t::kElectron && pdgCode != PDG_t::kMuonMinus && pdgCode != PDG_t::kPiPlus && pdgCode != kKPlus && pdgCode != PDG_t::kProton)
681+
if (extraPDGType && pdgCode != PDG_t::kElectron && pdgCode != PDG_t::kMuonMinus && pdgCode != PDG_t::kPiPlus && pdgCode != kKPlus && pdgCode != PDG_t::kProton) {
679682
continue;
683+
}
680684

681685
bool isPhysicalPrimary = mcParticle.isPhysicalPrimary();
682686
const int producedByDecay = 4;
683687
bool isSecondary = (mcParticle.has_mothers() && mcParticle.getProcess() == producedByDecay);
684688
bool isAcceptedSecondary = (cfgAcceptSecondaries) ? isSecondary : false;
685-
if (!isPhysicalPrimary && !isAcceptedSecondary)
689+
if (!isPhysicalPrimary && !isAcceptedSecondary) {
686690
continue;
691+
}
687692

688-
if (std::fabs(mcParticle.eta()) > cfgCutEta) // main acceptance
693+
if (std::fabs(mcParticle.eta()) > cfgCutEta) { // main acceptance
689694
continue;
695+
}
690696

691697
float deltaPhi = mcParticle.phi() - mcCollision.eventPlaneAngle();
692698
deltaPhi = RecoDecay::constrainAngle(deltaPhi);
@@ -695,26 +701,34 @@ struct FlowMc {
695701
histos.fill(HIST("hPtNchGenerated"), mcParticle.pt(), nChGlobal);
696702
histos.fill(HIST("hPtMCGen"), mcParticle.pt());
697703
histos.fill(HIST("hEtaPtVtxzMCGen"), mcParticle.eta(), mcParticle.pt(), vtxz);
698-
if (pdgCode == PDG_t::kPiPlus)
704+
if (pdgCode == PDG_t::kPiPlus) {
699705
histos.fill(HIST("hPtNchGeneratedPion"), mcParticle.pt(), nChGlobal);
700-
if (pdgCode == PDG_t::kKPlus)
706+
}
707+
if (pdgCode == PDG_t::kKPlus) {
701708
histos.fill(HIST("hPtNchGeneratedKaon"), mcParticle.pt(), nChGlobal);
702-
if (pdgCode == PDG_t::kProton)
709+
}
710+
if (pdgCode == PDG_t::kProton) {
703711
histos.fill(HIST("hPtNchGeneratedProton"), mcParticle.pt(), nChGlobal);
704-
if (pdgCode == PDG_t::kK0Short)
712+
}
713+
if (pdgCode == PDG_t::kK0Short) {
705714
histos.fill(HIST("hPtNchGeneratedK0"), mcParticle.pt(), nChGlobal);
706-
if (pdgCode == PDG_t::kLambda0)
715+
}
716+
if (pdgCode == PDG_t::kLambda0) {
707717
histos.fill(HIST("hPtNchGeneratedLambda"), mcParticle.pt(), nChGlobal);
718+
}
708719
if (mcParticle.has_daughters()) {
709720
for (const auto& d : mcParticle.template daughters_as<FilteredMcParticles>()) {
710721
if (std::abs(d.pdgCode()) == PDG_t::kPiPlus) {
711-
if (pdgCode == PDG_t::kK0Short)
722+
if (pdgCode == PDG_t::kK0Short) {
712723
histos.fill(HIST("hPtNchGeneratedK0Pions"), d.pt(), nChGlobal);
713-
if (pdgCode == PDG_t::kLambda0)
724+
}
725+
if (pdgCode == PDG_t::kLambda0) {
714726
histos.fill(HIST("hPtNchGeneratedLambdaPions"), d.pt(), nChGlobal);
727+
}
715728
}
716-
if (pdgCode == PDG_t::kLambda0 && std::abs(d.pdgCode()) == PDG_t::kProton)
729+
if (pdgCode == PDG_t::kLambda0 && std::abs(d.pdgCode()) == PDG_t::kProton) {
717730
histos.fill(HIST("hPtNchGeneratedLambdaProtons"), d.pt(), nChGlobal);
731+
}
718732
}
719733
}
720734
nCh++;
@@ -758,10 +772,12 @@ struct FlowMc {
758772
}
759773
bool withinPtRef = (cfgCutPtRefMin < mcParticle.pt()) && (mcParticle.pt() < cfgCutPtRefMax); // within RF pT range
760774
bool withinPtPOI = (cfgCutPtPOIMin < mcParticle.pt()) && (mcParticle.pt() < cfgCutPtPOIMax); // within POI pT range
761-
if (cfgOutputNUAWeights && withinPtRef)
775+
if (cfgOutputNUAWeights && withinPtRef) {
762776
fWeights->fill(mcParticle.phi(), mcParticle.eta(), vtxz, mcParticle.pt(), 0, 0);
763-
if (!setCurrentParticleWeights(weff, wacc, mcParticle.phi(), mcParticle.eta(), mcParticle.pt(), vtxz))
777+
}
778+
if (!setCurrentParticleWeights(weff, wacc, mcParticle.phi(), mcParticle.eta(), mcParticle.pt(), vtxz)) {
764779
continue;
780+
}
765781
if (cfgTrackDensityCorrUse && cfgFlowCumulantEnabled && withinPtRef) {
766782
double fphi = v2 * std::cos(2 * (mcParticle.phi() - psi2Est)) + v3 * std::cos(3 * (mcParticle.phi() - psi3Est)) + v4 * std::cos(4 * (mcParticle.phi() - psi4Est));
767783
fphi = (1 + 2 * fphi);
@@ -777,20 +793,26 @@ struct FlowMc {
777793
}
778794

779795
if (cfgFlowCumulantEnabled) {
780-
if (withinPtRef)
796+
if (withinPtRef) {
781797
fGFWTrue->Fill(mcParticle.eta(), fPtAxis->FindBin(mcParticle.pt()) - 1, mcParticle.phi(), wacc * weff, 1);
782-
if (withinPtPOI)
798+
}
799+
if (withinPtPOI) {
783800
fGFWTrue->Fill(mcParticle.eta(), fPtAxis->FindBin(mcParticle.pt()) - 1, mcParticle.phi(), wacc * weff, 2);
784-
if (withinPtPOI && withinPtRef)
801+
}
802+
if (withinPtPOI && withinPtRef) {
785803
fGFWTrue->Fill(mcParticle.eta(), fPtAxis->FindBin(mcParticle.pt()) - 1, mcParticle.phi(), wacc * weff, 4);
804+
}
786805

787806
if (validGlobal) {
788-
if (withinPtRef)
807+
if (withinPtRef) {
789808
fGFWReco->Fill(mcParticle.eta(), fPtAxis->FindBin(mcParticle.pt()) - 1, mcParticle.phi(), wacc * weff, 1);
790-
if (withinPtPOI)
809+
}
810+
if (withinPtPOI) {
791811
fGFWReco->Fill(mcParticle.eta(), fPtAxis->FindBin(mcParticle.pt()) - 1, mcParticle.phi(), wacc * weff, 2);
792-
if (withinPtPOI && withinPtRef)
812+
}
813+
if (withinPtPOI && withinPtRef) {
793814
fGFWReco->Fill(mcParticle.eta(), fPtAxis->FindBin(mcParticle.pt()) - 1, mcParticle.phi(), wacc * weff, 4);
815+
}
794816
}
795817
}
796818

@@ -811,21 +833,27 @@ struct FlowMc {
811833
histos.fill(HIST("hPtNchGlobal"), mcParticle.pt(), nChGlobal);
812834
histos.fill(HIST("hPtMCGlobal"), mcParticle.pt());
813835
histos.fill(HIST("hEtaPtVtxzMCGlobal"), mcParticle.eta(), mcParticle.pt(), vtxz);
814-
if (pdgCode == PDG_t::kPiPlus)
836+
if (pdgCode == PDG_t::kPiPlus) {
815837
histos.fill(HIST("hPtNchGlobalPion"), mcParticle.pt(), nChGlobal);
816-
if (pdgCode == PDG_t::kKPlus)
838+
}
839+
if (pdgCode == PDG_t::kKPlus) {
817840
histos.fill(HIST("hPtNchGlobalKaon"), mcParticle.pt(), nChGlobal);
818-
if (pdgCode == PDG_t::kProton)
841+
}
842+
if (pdgCode == PDG_t::kProton) {
819843
histos.fill(HIST("hPtNchGlobalProton"), mcParticle.pt(), nChGlobal);
820-
if (pdgCode == PDG_t::kK0Short)
844+
}
845+
if (pdgCode == PDG_t::kK0Short) {
821846
histos.fill(HIST("hPtNchGlobalK0"), mcParticle.pt(), nChGlobal);
822-
if (pdgCode == PDG_t::kLambda0)
847+
}
848+
if (pdgCode == PDG_t::kLambda0) {
823849
histos.fill(HIST("hPtNchGlobalLambda"), mcParticle.pt(), nChGlobal);
850+
}
824851
if (!cfgRequireTOF || validTOFTrack) {
825852
if (mcParticle.has_mothers()) {
826853
for (const auto& m : mcParticle.template mothers_as<FilteredMcParticles>()) {
827-
if (!m.isPhysicalPrimary())
854+
if (!m.isPhysicalPrimary()) {
828855
continue;
856+
}
829857
if (pdgCode == PDG_t::kPiPlus) {
830858
if (m.pdgCode() == PDG_t::kK0Short) {
831859
histos.fill(HIST("hPtNchGlobalK0Pions"), mcParticle.pt(), nChGlobal);

0 commit comments

Comments
 (0)