Skip to content

Commit bcae390

Browse files
author
Emil Gorm Nielsen
committed
Some more O2 linter
1 parent e55677b commit bcae390

File tree

3 files changed

+92
-83
lines changed

3 files changed

+92
-83
lines changed

PWGCF/GenericFramework/Core/FlowPtContainer.cxx

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file FlowPtContainer.cxx
13+
/// \brief Class to handle angular and transverse momentum correlations
14+
/// \author Emil Gorm Nielsen, NBI, [email protected]
15+
1216
#include "FlowPtContainer.h"
1317
#include <algorithm>
1418
#include <vector>
@@ -478,9 +482,9 @@ void FlowPtContainer::fillArray(FillType a, FillType b, double c, double d)
478482
int k = ( ( idx - j * 3 - i ) / 9 ) % 3;
479483
int l = ( ( idx - k * 9 - j * 3 - i ) / 27 ) % 3;
480484
if (std::holds_alternative<std::complex<double>>(a) && std::holds_alternative<std::complex<double>>(b)) {
481-
arr[idx] += std::pow(std::get<0>(a), i) * std::pow(std::get<0>(b), j) * std::pow(c, k) * pow(d, l);
485+
arr[idx] += std::pow(std::get<0>(a), i) * std::pow(std::get<0>(b), j) * std::pow(c, k) * std::pow(d, l);
482486
} else if (std::holds_alternative<double>(a) && std::holds_alternative<double>(b)) {
483-
warr[idx] += std::pow(std::get<1>(a), i) * std::pow(std::get<1>(b), j) * std::pow(c, k) * pow(d, l);
487+
warr[idx] += std::pow(std::get<1>(a), i) * std::pow(std::get<1>(b), j) * std::pow(c, k) * std::pow(d, l);
484488
} else {
485489
LOGF(error, "FillType variant should hold same type for a and b during single function c");
486490
}
@@ -898,44 +902,44 @@ Long64_t FlowPtContainer::Merge(TCollection* collist)
898902
if (!fCorrList || !fCMTermList)
899903
return 0;
900904
Long64_t nmerged = 0;
901-
TIter all_PTC(collist);
902-
FlowPtContainer* l_PTC = 0;
903-
while ((l_PTC = dynamic_cast<FlowPtContainer*>(all_PTC()))) {
904-
TList* t_CMTerm = l_PTC->fCMTermList;
905-
TList* t_Corr = l_PTC->fCorrList;
906-
TList* t_Cov = l_PTC->fCovList;
907-
TList* t_Cum = l_PTC->fCumulantList;
908-
TList* t_CM = l_PTC->fCentralMomentList;
909-
if (t_CMTerm) {
905+
TIter allPTC(collist);
906+
FlowPtContainer* lPTC = 0;
907+
while ((lPTC = dynamic_cast<FlowPtContainer*>(allPTC()))) {
908+
TList* tCMTerm = lPTC->fCMTermList;
909+
TList* tCorr = lPTC->fCorrList;
910+
TList* tCov = lPTC->fCovList;
911+
TList* tCum = lPTC->fCumulantList;
912+
TList* tCM = lPTC->fCentralMomentList;
913+
if (tCMTerm) {
910914
if (!fCMTermList)
911-
fCMTermList = dynamic_cast<TList*>(t_CMTerm->Clone());
915+
fCMTermList = dynamic_cast<TList*>(tCMTerm->Clone());
912916
else
913-
mergeBSLists(fCMTermList, t_CMTerm);
917+
mergeBSLists(fCMTermList, tCMTerm);
914918
nmerged++;
915919
}
916-
if (t_Corr) {
920+
if (tCorr) {
917921
if (!fCorrList)
918-
fCorrList = dynamic_cast<TList*>(t_Corr->Clone());
922+
fCorrList = dynamic_cast<TList*>(tCorr->Clone());
919923
else
920-
mergeBSLists(fCorrList, t_Corr);
924+
mergeBSLists(fCorrList, tCorr);
921925
}
922-
if (t_Cov) {
926+
if (tCov) {
923927
if (!fCovList)
924-
fCovList = dynamic_cast<TList*>(t_Cov->Clone());
928+
fCovList = dynamic_cast<TList*>(tCov->Clone());
925929
else
926-
mergeBSLists(fCovList, t_Cov);
930+
mergeBSLists(fCovList, tCov);
927931
}
928-
if (t_Cum) {
932+
if (tCum) {
929933
if (!fCumulantList)
930-
fCumulantList = dynamic_cast<TList*>(t_Cum->Clone());
934+
fCumulantList = dynamic_cast<TList*>(tCum->Clone());
931935
else
932-
mergeBSLists(fCumulantList, t_Cum);
936+
mergeBSLists(fCumulantList, tCum);
933937
}
934-
if (t_CM) {
938+
if (tCM) {
935939
if (!fCentralMomentList)
936-
fCentralMomentList = dynamic_cast<TList*>(t_CM->Clone());
940+
fCentralMomentList = dynamic_cast<TList*>(tCM->Clone());
937941
else
938-
mergeBSLists(fCentralMomentList, t_CM);
942+
mergeBSLists(fCentralMomentList, tCM);
939943
}
940944
}
941945
return nmerged;
@@ -947,9 +951,9 @@ void FlowPtContainer::mergeBSLists(TList* source, TList* target)
947951
return;
948952
}
949953
for (int i = 0; i < source->GetEntries(); i++) {
950-
BootstrapProfile* l_obj = dynamic_cast<BootstrapProfile*>(source->At(i));
951-
BootstrapProfile* t_obj = dynamic_cast<BootstrapProfile*>(target->At(i));
952-
l_obj->MergeBS(t_obj);
954+
BootstrapProfile* lObj = dynamic_cast<BootstrapProfile*>(source->At(i));
955+
BootstrapProfile* tObj = dynamic_cast<BootstrapProfile*>(target->At(i));
956+
lObj->MergeBS(tObj);
953957
}
954958
}
955959
TH1* FlowPtContainer::raiseHistToPower(TH1* inh, double p)
@@ -967,6 +971,3 @@ TH1* FlowPtContainer::raiseHistToPower(TH1* inh, double p)
967971
}
968972
return reth;
969973
}
970-
/// \file FlowPtContainer.cxx
971-
/// \brief Class to handle angular and transverse momentum correlations
972-
/// \author Emil Gorm Nielsen, NBI, [email protected]

PWGCF/GenericFramework/Core/FlowPtContainer.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file FlowPtContainer.cxx
13+
/// \brief Class to handle angular and transverse momentum correlations
14+
/// \author Emil Gorm Nielsen, NBI, [email protected]
15+
1216
#ifndef PWGCF_GENERICFRAMEWORK_CORE_FLOWPTCONTAINER_H_
1317
#define PWGCF_GENERICFRAMEWORK_CORE_FLOWPTCONTAINER_H_
1418

@@ -80,8 +84,8 @@ class FlowPtContainer : public TNamed
8084
void setUseGapMethod(bool newval) { fUseGap = newval; }
8185
bool usesCentralMoments() { return fUseCentralMoments; }
8286
bool usesGap() { return fUseGap; }
83-
void rebinMulti(Int_t nbins);
84-
void rebinMulti(Int_t nbins, double* binedges);
87+
void rebinMulti(int nbins);
88+
void rebinMulti(int nbins, double* binedges);
8589
TH1* getCentralMomentHist(int ind, int m);
8690
TH1* getCumulantHist(int ind, int m);
8791
TH1* getCorrHist(int ind, int m);

PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx

Lines changed: 54 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

12+
/// \file FlowPtContainer.cxx
13+
/// \brief Task to analyse angular and transverse momentum correlations with GFW
14+
/// \author Emil Gorm Nielsen, NBI, [email protected]
15+
1216
#include <CCDB/BasicCCDBManager.h>
1317
#include <DataFormatsParameters/GRPObject.h>
1418
#include <DataFormatsParameters/GRPMagField.h>
@@ -125,7 +129,7 @@ struct GenericFramework {
125129
// Define output
126130
OutputObj<FlowContainer> fFC{FlowContainer("FlowContainer")};
127131
OutputObj<FlowPtContainer> fFCpt{FlowPtContainer("FlowPtContainer")};
128-
OutputObj<FlowContainer> fFC_gen{FlowContainer("FlowContainer_gen")};
132+
OutputObj<FlowContainer> fFCgen{FlowContainer("FlowContainer_gen")};
129133
OutputObj<TList> fWeightList{"WeightList", OutputObjHandlingPolicy::AnalysisObject};
130134
HistogramRegistry registry{"registry"};
131135

@@ -286,9 +290,9 @@ struct GenericFramework {
286290
fFC->Initialize(oba, multAxis, cfgNbootstrap);
287291
}
288292
if (doprocessMCGen) {
289-
fFC_gen->SetName("FlowContainer_gen");
290-
fFC_gen->SetXAxis(fPtAxis);
291-
fFC_gen->Initialize(oba, multAxis, cfgNbootstrap);
293+
fFCgen->SetName("FlowContainer_gen");
294+
fFCgen->SetXAxis(fPtAxis);
295+
fFCgen->Initialize(oba, multAxis, cfgNbootstrap);
292296
}
293297
delete oba;
294298
fFCpt->setUseCentralMoments(cfgUseCentralMoments);
@@ -594,7 +598,7 @@ struct GenericFramework {
594598
return true;
595599
}
596600

597-
enum datatype {
601+
enum DataType {
598602
kReco,
599603
kGen
600604
};
@@ -655,7 +659,7 @@ struct GenericFramework {
655659
return;
656660
}
657661

658-
template <datatype dt>
662+
template <DataType dt>
659663
void fillOutputContainers(const float& centmult, const double& rndm)
660664
{
661665
fFCpt->calculateCorrelations();
@@ -670,25 +674,25 @@ struct GenericFramework {
670674
continue;
671675
auto val = fGFW->Calculate(corrconfigs.at(l_ind), 0, kFALSE).real() / dnx;
672676
if (std::abs(val) < 1) {
673-
(dt == kGen) ? fFC_gen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, dnx, rndm) : fFC->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, dnx, rndm);
677+
(dt == kGen) ? fFCgen->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, dnx, rndm) : fFC->FillProfile(corrconfigs.at(l_ind).Head.c_str(), centmult, val, dnx, rndm);
674678
if (cfgUseGapMethod)
675679
fFCpt->fillVnPtProfiles(centmult, val, dnx, rndm, configs.GetpTCorrMasks()[l_ind]);
676680
}
677681
continue;
678682
}
679-
for (Int_t i = 1; i <= fPtAxis->GetNbins(); i++) {
683+
for (int i = 1; i <= fPtAxis->GetNbins(); i++) {
680684
auto dnx = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kTRUE).real();
681685
if (dnx == 0)
682686
continue;
683687
auto val = fGFW->Calculate(corrconfigs.at(l_ind), i - 1, kFALSE).real() / dnx;
684688
if (std::abs(val) < 1)
685-
(dt == kGen) ? fFC_gen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, dnx, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, dnx, rndm);
689+
(dt == kGen) ? fFCgen->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, dnx, rndm) : fFC->FillProfile(Form("%s_pt_%i", corrconfigs.at(l_ind).Head.c_str(), i), centmult, val, dnx, rndm);
686690
}
687691
}
688692
return;
689693
}
690694

691-
template <datatype dt, typename TCollision, typename TTracks>
695+
template <DataType dt, typename TCollision, typename TTracks>
692696
void processCollision(TCollision collision, TTracks tracks, const float& centrality, const int& field)
693697
{
694698
if (tracks.size() < 1)
@@ -699,12 +703,12 @@ struct GenericFramework {
699703
float vtxz = collision.posZ();
700704
fGFW->Clear();
701705
fFCpt->clearVector();
702-
float l_Random = fRndm->Rndm();
706+
float lRandom = fRndm->Rndm();
703707
for (const auto& track : tracks) {
704708
processTrack(track, centrality, vtxz, field);
705709
}
706710
if (!cfgFillWeights)
707-
fillOutputContainers<dt>((cfgUseNch) ? tracks.size() : centrality, l_Random);
711+
fillOutputContainers<dt>((cfgUseNch) ? tracks.size() : centrality, lRandom);
708712
}
709713

710714
template <typename TTrack>
@@ -726,21 +730,21 @@ struct GenericFramework {
726730
if (cfgUseAdditionalTrackCut && !trackSelected(track, field))
727731
return;
728732

729-
int pid_index = 0;
733+
int pidIndex = 0;
730734
if (cfgUsePID) {
731735
if (mcParticle.pdgCode() == 211)
732-
pid_index = 1;
736+
pidIndex = 1;
733737
if (mcParticle.pdgCode() == 321)
734-
pid_index = 2;
738+
pidIndex = 2;
735739
if (mcParticle.pdgCode() == 2212)
736-
pid_index = 3;
740+
pidIndex = 3;
737741
}
738742

739743
if (cfgFillWeights) {
740744
fillWeights(mcParticle, vtxz, centrality, 0);
741745
} else {
742746
fillPtSums<kReco>(track, vtxz);
743-
fillGFW<kReco>(mcParticle, vtxz, pid_index);
747+
fillGFW<kReco>(mcParticle, vtxz, pidIndex);
744748
}
745749

746750
if (cfgFillQA)
@@ -755,18 +759,18 @@ struct GenericFramework {
755759
if (track.eta() < etalow || track.eta() > etaup || track.pt() < ptlow || track.pt() > ptup)
756760
return;
757761

758-
int pid_index = 0;
762+
int pidIndex = 0;
759763
if (cfgUsePID) {
760764
if (track.pdgCode() == 211)
761-
pid_index = 1;
765+
pidIndex = 1;
762766
if (track.pdgCode() == 321)
763-
pid_index = 2;
767+
pidIndex = 2;
764768
if (track.pdgCode() == 2212)
765-
pid_index = 3;
769+
pidIndex = 3;
766770
}
767771

768772
fillPtSums<kGen>(track, vtxz);
769-
fillGFW<kGen>(track, vtxz, pid_index);
773+
fillGFW<kGen>(track, vtxz, pidIndex);
770774

771775
if (cfgFillQA)
772776
fillTrackQA<kGen, kAfter>(track, vtxz);
@@ -779,23 +783,23 @@ struct GenericFramework {
779783
if (cfgUseAdditionalTrackCut && !trackSelected(track, field))
780784
return;
781785

782-
int pid_index = 0;
786+
int pidIndex = 0;
783787
if (cfgUsePID) {
784788
// pid_index = getBayesPIDIndex(track);
785-
pid_index = getNsigmaPID(track);
789+
pidIndex = getNsigmaPID(track);
786790
}
787791
if (cfgFillWeights) {
788-
fillWeights(track, vtxz, centrality, pid_index);
792+
fillWeights(track, vtxz, centrality, pidIndex);
789793
} else {
790794
fillPtSums<kReco>(track, vtxz);
791-
fillGFW<kReco>(track, vtxz, pid_index);
795+
fillGFW<kReco>(track, vtxz, pidIndex);
792796
}
793797
if (cfgFillQA)
794798
fillTrackQA<kReco, kAfter>(track, vtxz);
795799
}
796800
}
797801

798-
template <datatype dt, typename TTrack>
802+
template <DataType dt, typename TTrack>
799803
inline void fillPtSums(TTrack track, const double& vtxz)
800804
{
801805
double wacc = (dt == kGen) ? 1. : getAcceptance(track, vtxz, -1);
@@ -813,32 +817,32 @@ struct GenericFramework {
813817
}
814818
}
815819

816-
template <datatype dt, typename TTrack>
820+
template <DataType dt, typename TTrack>
817821
inline void fillGFW(TTrack track, const double& vtxz, int pid_index)
818822
{
819823
if (cfgUsePID) { // Analysing POI flow with id'ed particles
820824
double ptmins[] = {ptpoilow, ptpoilow, 0.3, 0.5};
821825
double ptmaxs[] = {ptpoiup, ptpoiup, 6.0, 6.0};
822-
bool WithinPtRef = (track.pt() > ptreflow && track.pt() < ptrefup);
823-
bool WithinPtPOI = (track.pt() > ptmins[pid_index] && track.pt() < ptmaxs[pid_index]);
824-
bool WithinPtNch = (track.pt() > ptmins[0] && track.pt() < ptmaxs[0]);
825-
if (!WithinPtPOI && !WithinPtRef)
826+
bool withinPtRef = (track.pt() > ptreflow && track.pt() < ptrefup);
827+
bool withinPtPOI = (track.pt() > ptmins[pid_index] && track.pt() < ptmaxs[pid_index]);
828+
bool withinPtNch = (track.pt() > ptmins[0] && track.pt() < ptmaxs[0]);
829+
if (!withinPtPOI && !withinPtRef)
826830
return;
827-
double wacc_ref = (dt == kGen) ? 1. : getAcceptance(track, vtxz, -1);
828-
double wacc_poi = (dt == kGen) ? 1. : WithinPtPOI ? getAcceptance(track, vtxz, pid_index)
831+
double waccRef = (dt == kGen) ? 1. : getAcceptance(track, vtxz, -1);
832+
double waccPOI = (dt == kGen) ? 1. : withinPtPOI ? getAcceptance(track, vtxz, pid_index)
829833
: getAcceptance(track, vtxz, 0); //
830-
if (WithinPtRef && WithinPtPOI && pid_index)
831-
wacc_ref = wacc_poi; // if particle is both (then it's overlap), override ref with POI
832-
if (WithinPtRef)
833-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_ref, 1);
834-
if (WithinPtPOI && pid_index)
835-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, (1 << (pid_index + 1)));
836-
if (WithinPtNch)
837-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, 2);
838-
if (WithinPtPOI && WithinPtRef && pid_index)
839-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, (1 << (pid_index + 5)));
840-
if (WithinPtNch && WithinPtRef)
841-
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), wacc_poi, 32);
834+
if (withinPtRef && withinPtPOI && pid_index)
835+
waccRef = waccPOI; // if particle is both (then it's overlap), override ref with POI
836+
if (withinPtRef)
837+
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), waccRef, 1);
838+
if (withinPtPOI && pid_index)
839+
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), waccPOI, (1 << (pid_index + 1)));
840+
if (withinPtNch)
841+
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), waccPOI, 2);
842+
if (withinPtPOI && withinPtRef && pid_index)
843+
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), waccPOI, (1 << (pid_index + 5)));
844+
if (withinPtNch && withinPtRef)
845+
fGFW->Fill(track.eta(), fPtAxis->FindBin(track.pt()) - 1, track.phi(), waccPOI, 32);
842846
} else { // Analysing only integrated flow
843847
double weff = (dt == kGen) ? 1. : getEfficiency(track);
844848
if (weff < 0)
@@ -849,7 +853,7 @@ struct GenericFramework {
849853
return;
850854
}
851855

852-
template <datatype dt, QAFillTime ft, typename TTrack>
856+
template <DataType dt, QAFillTime ft, typename TTrack>
853857
inline void fillTrackQA(TTrack track, const float vtxz)
854858
{
855859
if constexpr (dt == kGen) {
@@ -881,9 +885,9 @@ struct GenericFramework {
881885

882886
Filter collisionFilter = nabs(aod::collision::posZ) < cfgVtxZ;
883887
Filter trackFilter = nabs(aod::track::eta) < cfgEta && aod::track::pt > cfgPtmin&& aod::track::pt < cfgPtmax && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && nabs(aod::track::dcaXY) < cfgDCAxy&& nabs(aod::track::dcaZ) < cfgDCAz;
884-
using myTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::pidTOFPi, aod::pidTPCPi, aod::pidTOFKa, aod::pidTPCKa, aod::pidTOFPr, aod::pidTPCPr>>;
888+
using GFWTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::pidTOFPi, aod::pidTPCPi, aod::pidTOFKa, aod::pidTPCKa, aod::pidTOFPr, aod::pidTPCPr>>;
885889

886-
void processData(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs>>::iterator const& collision, aod::BCsWithTimestamps const&, myTracks const& tracks)
890+
void processData(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs>>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks)
887891
{
888892
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
889893
int run = bc.runNumber();
@@ -957,7 +961,7 @@ struct GenericFramework {
957961
}
958962
PROCESS_SWITCH(GenericFramework, processMCGen, "Process analysis for MC generated events", false);
959963

960-
void processRun2(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentRun2V0Ms>>::iterator const& collision, aod::BCsWithTimestamps const&, myTracks const& tracks)
964+
void processRun2(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentRun2V0Ms>>::iterator const& collision, aod::BCsWithTimestamps const&, GFWTracks const& tracks)
961965
{
962966
if (!collision.sel7())
963967
return;

0 commit comments

Comments
 (0)