Skip to content

Commit 387a7f3

Browse files
committed
Change new to unique_ptr
1 parent 527a71a commit 387a7f3

2 files changed

Lines changed: 43 additions & 39 deletions

File tree

PWGCF/Flow/Tasks/flowSP.cxx

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,18 @@ struct FlowSP {
259259
} spm;
260260

261261
struct ptMaps {
262-
TProfile* meanPTMap = new TProfile("meanPTMap", "meanPTMap", 8, -0.8, 0.8);
263-
TProfile* meanPTMapPos = new TProfile("meanPTMapPos", "meanPTMapPos", 8, -0.8, 0.8);
264-
TProfile* meanPTMapNeg = new TProfile("meanPTMapNeg", "meanPTMapNeg", 8, -0.8, 0.8);
262+
std::unique_ptr<TProfile> meanPTMap = std::make_unique<TProfile>("meanPTMap","meanPTMap",8, -0.8, 0.8);
263+
std::unique_ptr<TProfile> meanPTMapPos = std::make_unique<TProfile>("meanPTMapPos", "meanPTMapPos", 8, -0.8, 0.8);
264+
std::unique_ptr<TProfile> meanPTMapNeg = std::make_unique<TProfile>("meanPTMapNeg", "meanPTMapNeg", 8, -0.8, 0.8);
265265

266-
TProfile* relPxA = new TProfile("relPxA", "relPxA", 8, -0.8, 0.8);
267-
TProfile* relPxC = new TProfile("relPxC", "relPxC", 8, -0.8, 0.8);
266+
std::unique_ptr<TProfile> relPxA = std::make_unique<TProfile>("relPxA", "relPxA", 8, -0.8, 0.8);
267+
std::unique_ptr<TProfile> relPxC = std::make_unique<TProfile>("relPxC", "relPxC", 8, -0.8, 0.8);
268268

269-
TProfile* relPxANeg = new TProfile("relPxANeg", "relPxANeg", 8, -0.8, 0.8);
270-
TProfile* relPxAPos = new TProfile("relPxAPos", "relPxAPos", 8, -0.8, 0.8);
269+
std::unique_ptr<TProfile> relPxANeg = std::make_unique<TProfile>("relPxANeg", "relPxANeg", 8, -0.8, 0.8);
270+
std::unique_ptr<TProfile> relPxAPos = std::make_unique<TProfile>("relPxAPos", "relPxAPos", 8, -0.8, 0.8);
271271

272-
TProfile* relPxCNeg = new TProfile("relPxCNeg", "relPxCNeg", 8, -0.8, 0.8);
273-
TProfile* relPxCPos = new TProfile("relPxCPos", "relPxCPos", 8, -0.8, 0.8);
272+
std::unique_ptr<TProfile> relPxCNeg = std::make_unique<TProfile>("relPxCNeg", "relPxCNeg", 8, -0.8, 0.8);
273+
std::unique_ptr<TProfile> relPxCPos = std::make_unique<TProfile>("relPxCPos", "relPxCPos", 8, -0.8, 0.8);
274274
} ptmaps;
275275

276276
OutputObj<GFWWeights> fWeights{GFWWeights("weights")};
@@ -281,13 +281,13 @@ struct FlowSP {
281281
HistogramRegistry histos{"QAhistos", {}, OutputObjHandlingPolicy::AnalysisObject, false, true};
282282

283283
// Event selection cuts
284-
TF1* fPhiCutLow = nullptr;
285-
TF1* fPhiCutHigh = nullptr;
286-
TF1* fMultPVCutLow = nullptr;
287-
TF1* fMultPVCutHigh = nullptr;
288-
TF1* fMultCutLow = nullptr;
289-
TF1* fMultCutHigh = nullptr;
290-
TF1* fMultMultPVCut = nullptr;
284+
std::unique_ptr<TF1> fPhiCutLow = nullptr;
285+
std::unique_ptr<TF1> fPhiCutHigh = nullptr;
286+
std::unique_ptr<TF1> fMultPVCutLow = nullptr;
287+
std::unique_ptr<TF1> fMultPVCutHigh = nullptr;
288+
std::unique_ptr<TF1> fMultCutLow = nullptr;
289+
std::unique_ptr<TF1> fMultCutHigh = nullptr;
290+
std::unique_ptr<TF1> fMultMultPVCut = nullptr;
291291

292292
enum SelectionCriteria {
293293
evSel_FilteredEvent,
@@ -694,10 +694,10 @@ struct FlowSP {
694694
}
695695

696696
if (cfg.cEvSelsUseAdditionalEventCut) {
697-
fMultPVCutLow = new TF1("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
698-
fMultPVCutHigh = new TF1("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
699-
fMultCutLow = new TF1("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
700-
fMultCutHigh = new TF1("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
697+
fMultPVCutLow = std::make_unique<TF1>("fMultPVCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
698+
fMultPVCutHigh = std::make_unique<TF1>("fMultPVCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
699+
fMultCutLow = std::make_unique<TF1>("fMultCutLow", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
700+
fMultCutHigh = std::make_unique<TF1>("fMultCutHigh", "[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x", 0, 100);
701701

702702
std::vector<double> paramsMultPVCut;
703703
std::vector<double> paramsMultCut;
@@ -756,8 +756,8 @@ struct FlowSP {
756756
}
757757

758758
if (cfg.cTrackSelsUseAdditionalTrackCut) {
759-
fPhiCutLow = new TF1("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100);
760-
fPhiCutHigh = new TF1("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100);
759+
fPhiCutLow = std::make_unique<TF1>("fPhiCutLow", "0.06/x+pi/18.0-0.06", 0, 100);
760+
fPhiCutHigh = std::make_unique<TF1>("fPhiCutHigh", "0.1/x+pi/18.0+0.06", 0, 100);
761761
}
762762
} // end of init
763763

@@ -1498,7 +1498,7 @@ struct FlowSP {
14981498
}
14991499

15001500
// Always fill centrality histogram after event selections!
1501-
histos.fill(HIST("hCentralityCW"), spm.centrality);
1501+
histos.fill(HIST("hCentralityCW"), spm.centrality, spm.centWeight);
15021502

15031503
fillEventQA<kAfter>(collision, tracks);
15041504

@@ -1784,8 +1784,10 @@ struct FlowSP {
17841784
double centW = conf.hCentrality->GetBinContent(conf.hCentrality->FindBin(spm.centrality));
17851785

17861786
if (centW <= 0) {
1787-
spm.centWeight = 0;
1787+
spm.centWeight = 0.;
17881788
LOGF(fatal, "Centrality weight cannot be negative .. setting to 0. for (%.2f)", spm.centrality);
1789+
} else {
1790+
spm.centWeight = centW;
17891791
}
17901792
}
17911793

@@ -2147,4 +2149,4 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
21472149
{
21482150
return WorkflowSpec{
21492151
adaptAnalysisTask<FlowSP>(cfgc)};
2150-
}
2152+
}

Tutorials/PWGCF/EventPlane/src/spectatorPlaneTutorial.cxx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ struct SpectatorPlaneTutorial {
102102
AxisSpec axisEta = {64, -1.6, 1.6, "#eta"};
103103
AxisSpec axisEtaVn = {8, -.8, .8, "#eta"};
104104
AxisSpec axisCent = {90, 0, 90, "Centrality(%)"};
105-
AxisSpec axisPhiPlane = {100, -constants::math::PI, constants::math::PI, "#Psi"};
106-
AxisSpec axisQQ = {100, -0.2, 0.2, "#LT Q_{X}^{A}Q_{Y}^{C} #GT"};
105+
AxisSpec axisPhiPlane = {40, -constants::math::PI, constants::math::PI, "#Psi"};
106+
AxisSpec axisQQ = {10, -0.2, 0.2, "#LT Q_{X}^{A}Q_{Y}^{C} #GT"};
107107

108108
std::vector<double> ptbinning = {0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10};
109109
AxisSpec axisPt = {ptbinning, "#it{p}_{T} GeV/#it{c}"};
@@ -127,13 +127,13 @@ struct SpectatorPlaneTutorial {
127127
registry.add("CalibHistos/hEvPlaneRes", "Event Plane Resolution; #Events; Event Plane Resolution", {HistType::kTProfile, {axisCent}});
128128

129129
// Flow Histograms
130-
registry.add("flow/v1A", "", {HistType::kTProfile, {axisPt}});
131-
registry.add("flow/v1C", "", {HistType::kTProfile, {axisPt}});
130+
registry.add("flow/v1A", "", {HistType::kTProfile, {axisEtaVn}});
131+
registry.add("flow/v1C", "", {HistType::kTProfile, {axisEtaVn}});
132132

133-
registry.add("flow/vnAxCxUxMH", "", {HistType::kTProfile, {axisCent}});
134-
registry.add("flow/vnAyCyUxMH", "", {HistType::kTProfile, {axisCent}});
135-
registry.add("flow/vnAxCyUyMH", "", {HistType::kTProfile, {axisCent}});
136-
registry.add("flow/vnAyCxUyMH", "", {HistType::kTProfile, {axisCent}});
133+
registry.add("flow/v2AxCxUxMH", "", {HistType::kTProfile, {axisCent}});
134+
registry.add("flow/v2AyCyUxMH", "", {HistType::kTProfile, {axisCent}});
135+
registry.add("flow/v2AxCyUyMH", "", {HistType::kTProfile, {axisCent}});
136+
registry.add("flow/v2AyCxUyMH", "", {HistType::kTProfile, {axisCent}});
137137
}
138138

139139
void process(ZDCCollisions::iterator const& collision, aod::BCsWithTimestamps const&, UsedTracks const& tracks)
@@ -147,7 +147,7 @@ struct SpectatorPlaneTutorial {
147147
float centMin = 0;
148148
float centMax = 80;
149149

150-
if (centrality > centMax || centrality < centMin)
150+
if (centrality >= centMax || centrality < centMin)
151151
return;
152152

153153
if (collision.isSelected() == false)
@@ -174,10 +174,10 @@ struct SpectatorPlaneTutorial {
174174
// Fill the q-vector correlations
175175
registry.fill(HIST("qAqCXY"), centrality, qxA * qxC + qyA * qyC);
176176

177-
double corrQQx = 1;
178-
double corrQQy = 1;
179-
double corrQQ = 1;
180-
double evPlaneRes = 1;
177+
double corrQQx = 1.0;
178+
double corrQQy = 1.0;
179+
double corrQQ = 1.0 ;
180+
double evPlaneRes = 1.0;
181181

182182
// Get QQ-correlations from CCDB
183183
if (cfgCCDBdir_QQ.value.empty() == false) {
@@ -200,7 +200,6 @@ struct SpectatorPlaneTutorial {
200200
}
201201

202202
for (const auto& track : tracks) {
203-
204203
// constrain angle to 0 -> [0,0+2pi]
205204
auto phi = RecoDecay::constrainAngle(track.phi(), 0);
206205

@@ -210,6 +209,9 @@ struct SpectatorPlaneTutorial {
210209
double uxMH = std::cos(2 * phi);
211210
double uyMH = std::sin(2 * phi);
212211

212+
if(corrQQ==0 || corrQQx==0 || corrQQy==0)
213+
continue;
214+
213215
double v1A = (uy * qyA + ux * qxA) / std::sqrt(std::fabs(corrQQ));
214216
double v1C = (uy * qyC + ux * qxC) / std::sqrt(std::fabs(corrQQ));
215217

0 commit comments

Comments
 (0)