Skip to content

Commit 4574a1f

Browse files
cnkosteralibuild
andauthored
[PWGCF] Added pt bins and fixed bins in getCorrection function (AliceO2Group#8845)
Co-authored-by: ALICE Action Bot <[email protected]>
1 parent 4d77591 commit 4574a1f

File tree

2 files changed

+72
-55
lines changed

2 files changed

+72
-55
lines changed

PWGCF/Flow/TableProducer/zdcQVectors.cxx

+31-14
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ std::vector<double> e(8, 0.); // calibrated energies (a1, a2, a3, a4, c1, c2,
103103
double centrality = 0;
104104
int runnumber = 0;
105105
std::vector<double> v(3, 0); // vx, vy, vz
106-
bool isSelected = false;
106+
bool isSelected = true;
107107

108108
} // namespace o2::analysis::qvectortask
109109

@@ -133,6 +133,7 @@ struct ZdcQVectors {
133133
O2_DEFINE_CONFIGURABLE(cfgMagField, float, 99999, "Configurable magnetic field; default CCDB will be queried")
134134
O2_DEFINE_CONFIGURABLE(cfgEnergyCal, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/Energy", "ccdb path for energy calibration histos")
135135
O2_DEFINE_CONFIGURABLE(cfgMeanv, std::string, "Users/c/ckoster/ZDC/LHC23_zzh_pass4/vmean", "ccdb path for mean v histos")
136+
O2_DEFINE_CONFIGURABLE(cfgMinEntriesSparseBin, int, 100, "Minimal number of entries allowed in 4D recentering histogram to use for recentering.")
136137

137138
Configurable<std::vector<std::string>> cfgRec1{"cfgRec1", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it1_step5"}, "ccdb paths for recentering calibration histos iteration 1"};
138139
Configurable<std::vector<std::string>> cfgRec2{"cfgRec2", {"Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step1", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step2", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step3", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step4", "Users/c/ckoster/ZDC/LHC23_zzh_pass4/it2_step5"}, "ccdb paths for recentering calibration histos iteration 2"};
@@ -229,8 +230,11 @@ struct ZdcQVectors {
229230
// recentered q-vectors (to check what steps are finished in the end)
230231
registry.add("hStep", "hStep", {HistType::kTH1D, {{10, 0., 10.}}});
231232
registry.add("hIteration", "hIteration", {HistType::kTH1D, {{10, 0., 10.}}});
233+
232234
registry.add<TProfile>("vmean/hvertex_vx", "hvertex_vx", kTProfile, {{1, 0., 1.}});
233235
registry.add<TProfile>("vmean/hvertex_vy", "hvertex_vy", kTProfile, {{1, 0., 1.}});
236+
registry.add<TProfile>("vmean/hvertex_vz", "hvertex_vz", kTProfile, {{1, 0., 1.}});
237+
234238
registry.add<TH1>("QA/centrality_before", "centrality_before", kTH1D, {{200, 0, 100}});
235239
registry.add<TH1>("QA/centrality_after", "centrality_after", kTH1D, {{200, 0, 100}});
236240

@@ -420,14 +424,14 @@ struct ZdcQVectors {
420424
return;
421425
}
422426
if (counter < 1)
423-
LOGF(info, "<--------OK----------> Calibrations loaded for iteration %i and step %i", iteration, step + 1);
427+
LOGF(info, "<--------OK----------> Calibrations loaded for cal.calibfilesLoaded[%i][%i]", iteration, step);
424428
cal.calibfilesLoaded[iteration][step] = true;
425429
cal.atIteration = iteration;
426430
cal.atStep = step;
427431
return;
428432
} else {
429433
if (counter < 1)
430-
LOGF(info, "<--------X-----------> Calibrations not loaded for iteration %i and step %i cfg = empty!", iteration, step + 1);
434+
LOGF(info, "<--------X-----------> Calibrations not loaded for iteration %i and step %i cfg = empty!", iteration, step);
431435
}
432436
}
433437

@@ -465,22 +469,25 @@ struct ZdcQVectors {
465469
bin = h->GetXaxis()->FindBin(TString::Format("%i", runnumber));
466470
calibConstant = h->GetBinContent(bin);
467471
} else if (hist->InheritsFrom("THnSparse")) {
468-
std::vector<double> sparsePars;
472+
std::vector<int> sparsePars;
469473
THnSparseD* h = reinterpret_cast<THnSparseD*>(hist);
470474
if (step == 0 && iteration > 0) {
475+
// Axis(0) is runnuber, but we don't need this
471476
sparsePars.push_back(h->GetAxis(1)->FindBin(centrality));
472477
sparsePars.push_back(h->GetAxis(2)->FindBin(v[0]));
473478
sparsePars.push_back(h->GetAxis(3)->FindBin(v[1]));
474479
sparsePars.push_back(h->GetAxis(4)->FindBin(v[2]));
475480
}
476-
for (std::size_t i = 0; i < sparsePars.size(); i++) {
477-
h->GetAxis(i)->SetRange(sparsePars[i], sparsePars[i]);
481+
482+
for (std::size_t i = 0; i < sparsePars.size() + 1; i++) {
483+
h->GetAxis(i + 1)->SetRange(sparsePars[i], sparsePars[i]);
478484
}
479-
calibConstant = h->Projection(sparsePars.size())->GetMean();
485+
calibConstant = h->Projection(5)->GetMean();
480486

481-
if (h->Projection(sparsePars.size())->GetEntries() < 2) {
487+
if (h->Projection(sparsePars.size())->GetEntries() < cfgMinEntriesSparseBin) {
482488
LOGF(debug, "1 entry in sparse bin! Not used... (increase binsize)");
483489
calibConstant = 0;
490+
isSelected = false;
484491
}
485492
}
486493
return calibConstant;
@@ -503,10 +510,13 @@ struct ZdcQVectors {
503510
std::vector<double> xEnZN(2, 0.);
504511
std::vector<double> yEnZN(2, 0.);
505512

513+
isSelected = true;
514+
506515
auto cent = collision.centFT0C();
507516

508517
if (cent < 0 || cent > 90) {
509-
spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, false, 0, 0);
518+
isSelected = false;
519+
spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0);
510520
return;
511521
}
512522

@@ -515,7 +525,8 @@ struct ZdcQVectors {
515525
const auto& foundBC = collision.foundBC_as<BCsRun3>();
516526

517527
if (!foundBC.has_zdc()) {
518-
spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, false, 0, 0);
528+
isSelected = false;
529+
spTableZDC(runnumber, cent, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0);
519530
return;
520531
}
521532

@@ -548,6 +559,7 @@ struct ZdcQVectors {
548559
LOGF(warning, " --> No mean V found.. -> THis wil lead to wrong axis for vx, vy (will be created in vmean/)");
549560
registry.get<TProfile>(HIST("vmean/hvertex_vx"))->Fill(Form("%d", runnumber), v[0]);
550561
registry.get<TProfile>(HIST("vmean/hvertex_vy"))->Fill(Form("%d", runnumber), v[1]);
562+
registry.get<TProfile>(HIST("vmean/hvertex_vz"))->Fill(Form("%d", runnumber), v[2]);
551563
}
552564

553565
if (counter < 1)
@@ -588,13 +600,15 @@ struct ZdcQVectors {
588600
// if ZNA or ZNC not hit correctly.. do not use event in q-vector calculation
589601
if (!isZNAhit || !isZNChit) {
590602
counter++;
591-
spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, false, 0, 0);
603+
isSelected = false;
604+
spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0);
592605
return;
593606
}
594607

595608
if (!cal.calibfilesLoaded[0][0]) {
596609
counter++;
597-
spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, false, 0, 0);
610+
isSelected = false;
611+
spTableZDC(runnumber, centrality, v[0], v[1], v[2], 0, 0, 0, 0, isSelected, 0, 0);
598612
return;
599613
}
600614

@@ -674,11 +688,14 @@ struct ZdcQVectors {
674688
}
675689
}
676690

691+
if (counter < 1)
692+
LOGF(info, "We evaluate cal.atIteration=%i and cal.atStep=%i ", cal.atIteration, cal.atStep);
693+
677694
if (cal.atIteration == 0) {
678695
if (counter < 1)
679696
LOGF(warning, "Calibation files missing!!! Output created with q-vectors right after energy gain eq. !!");
680697
fillAllRegistries(0, 0);
681-
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[0][0][0], q[0][0][1], q[0][0][2], q[0][0][3], true, 0, 0);
698+
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[0][0][0], q[0][0][1], q[0][0][2], q[0][0][3], isSelected, 0, 0);
682699
counter++;
683700
return;
684701
} else {
@@ -707,7 +724,7 @@ struct ZdcQVectors {
707724
LOGF(info, "Output created with q-vectors at iteration %i and step %i!!!!", cal.atIteration, cal.atStep + 1);
708725
fillAllRegistries(cal.atIteration, cal.atStep + 1);
709726
registry.fill(HIST("QA/centrality_after"), centrality);
710-
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[cal.atIteration][cal.atStep][0], q[cal.atIteration][cal.atStep][1], q[cal.atIteration][cal.atStep][2], q[cal.atIteration][cal.atStep][3], true, cal.atIteration, cal.atStep);
727+
spTableZDC(runnumber, centrality, v[0], v[1], v[2], q[cal.atIteration][cal.atStep][0], q[cal.atIteration][cal.atStep][1], q[cal.atIteration][cal.atStep][2], q[cal.atIteration][cal.atStep][3], isSelected, cal.atIteration, cal.atStep);
711728
counter++;
712729
return;
713730
}

PWGCF/Flow/Tasks/flowSP.cxx

+41-41
Original file line numberDiff line numberDiff line change
@@ -119,33 +119,33 @@ struct FlowSP {
119119
registry.add("pt_phi_bef", "", {HistType::kTH2D, {ptAxis, phiModAxis}});
120120
registry.add("pt_phi_aft", "", {HistType::kTH2D, {ptAxis, phiModAxis}});
121121

122-
registry.add<TProfile>("v1_eta", "", kTProfile, {{10, -.8, .8}});
123-
registry.add<TProfile>("v1A_eta", "", kTProfile, {{10, -.8, .8}});
124-
registry.add<TProfile>("v1C_eta", "", kTProfile, {{10, -.8, .8}});
125-
registry.add<TProfile>("v1AC_eta", "", kTProfile, {{10, -.8, .8}});
122+
registry.add<TProfile2D>("v1_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
123+
registry.add<TProfile2D>("v1A_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
124+
registry.add<TProfile2D>("v1C_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
125+
registry.add<TProfile2D>("v1AC_eta", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
126126

127-
registry.add<TProfile>("v1_eta_odd", "", kTProfile, {{10, -.8, .8}});
128-
registry.add<TProfile>("v1_eta_even", "", kTProfile, {{10, -.8, .8}});
127+
registry.add<TProfile2D>("v1_eta_odd", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
128+
registry.add<TProfile2D>("v1_eta_even", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
129129

130-
registry.add<TProfile>("v1_eta_odd_dev", "", kTProfile, {{10, -.8, .8}});
131-
registry.add<TProfile>("v1_eta_even_dev", "", kTProfile, {{10, -.8, .8}});
130+
registry.add<TProfile2D>("v1_eta_odd_dev", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
131+
registry.add<TProfile2D>("v1_eta_even_dev", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
132132

133-
registry.add<TProfile>("v1_eta_odd_dev_pos", "", kTProfile, {{10, -.8, .8}});
134-
registry.add<TProfile>("v1_eta_even_dev_pos", "", kTProfile, {{10, -.8, .8}});
135-
registry.add<TProfile>("v1_eta_odd_pos", "", kTProfile, {{10, -.8, .8}});
136-
registry.add<TProfile>("v1_eta_even_pos", "", kTProfile, {{10, -.8, .8}});
133+
registry.add<TProfile2D>("v1_eta_odd_dev_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
134+
registry.add<TProfile2D>("v1_eta_even_dev_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
135+
registry.add<TProfile2D>("v1_eta_odd_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
136+
registry.add<TProfile2D>("v1_eta_even_pos", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
137137

138-
registry.add<TProfile>("v1_eta_odd_dev_neg", "", kTProfile, {{10, -.8, .8}});
139-
registry.add<TProfile>("v1_eta_even_dev_neg", "", kTProfile, {{10, -.8, .8}});
140-
registry.add<TProfile>("v1_eta_odd_neg", "", kTProfile, {{10, -.8, .8}});
141-
registry.add<TProfile>("v1_eta_even_neg", "", kTProfile, {{10, -.8, .8}});
138+
registry.add<TProfile2D>("v1_eta_odd_dev_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
139+
registry.add<TProfile2D>("v1_eta_even_dev_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
140+
registry.add<TProfile2D>("v1_eta_odd_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
141+
registry.add<TProfile2D>("v1_eta_even_neg", "", kTProfile2D, {{10, -.8, .8}, ptAxis});
142142

143-
registry.add<TProfile>("v2_cent", "", kTProfile, {{80, 0, 80}});
144-
registry.add<TProfile>("v2A_cent", "", kTProfile, {{80, 0, 80}});
145-
registry.add<TProfile>("v2C_cent", "", kTProfile, {{80, 0, 80}});
146-
registry.add<TProfile>("v2AC_cent", "", kTProfile, {{80, 0, 80}});
143+
registry.add<TProfile2D>("v2_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis});
144+
registry.add<TProfile2D>("v2A_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis});
145+
registry.add<TProfile2D>("v2C_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis});
146+
registry.add<TProfile2D>("v2AC_cent", "", kTProfile2D, {{80, 0, 80}, ptAxis});
147147

148-
registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{10, 0, 10}}});
148+
registry.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{11, 0, 11}}});
149149
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(1, "Filtered event");
150150
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(2, "sel8");
151151
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(3, "occupancy");
@@ -371,39 +371,39 @@ struct FlowSP {
371371

372372
double v1AC = std::cos(phi - (psiA - psiC));
373373

374-
registry.fill(HIST("v1_eta"), track.eta(), (1. / std::sqrt(2)) * (v1A - v1C));
375-
registry.fill(HIST("v1A_eta"), track.eta(), (v1A));
376-
registry.fill(HIST("v1C_eta"), track.eta(), (v1C));
377-
registry.fill(HIST("v1AC_eta"), track.eta(), (v1AC));
374+
registry.fill(HIST("v1_eta"), track.eta(), track.pt(), (1. / std::sqrt(2)) * (v1A - v1C));
375+
registry.fill(HIST("v1A_eta"), track.eta(), track.pt(), (v1A));
376+
registry.fill(HIST("v1C_eta"), track.eta(), track.pt(), (v1C));
377+
registry.fill(HIST("v1AC_eta"), track.eta(), track.pt(), (v1AC));
378378

379-
registry.fill(HIST("v1_eta_odd"), track.eta(), oddv1);
380-
registry.fill(HIST("v1_eta_even"), track.eta(), evenv1);
379+
registry.fill(HIST("v1_eta_odd"), track.eta(), track.pt(), oddv1);
380+
registry.fill(HIST("v1_eta_even"), track.eta(), track.pt(), evenv1);
381381

382-
registry.fill(HIST("v1_eta_odd_dev"), track.eta(), oddv1Dev);
383-
registry.fill(HIST("v1_eta_even_dev"), track.eta(), evenv1Dev);
382+
registry.fill(HIST("v1_eta_odd_dev"), track.eta(), track.pt(), oddv1Dev);
383+
registry.fill(HIST("v1_eta_even_dev"), track.eta(), track.pt(), evenv1Dev);
384384

385385
if (pos) {
386-
registry.fill(HIST("v1_eta_odd_pos"), track.eta(), oddv1);
387-
registry.fill(HIST("v1_eta_even_pos"), track.eta(), evenv1);
386+
registry.fill(HIST("v1_eta_odd_pos"), track.eta(), track.pt(), oddv1);
387+
registry.fill(HIST("v1_eta_even_pos"), track.eta(), track.pt(), evenv1);
388388

389-
registry.fill(HIST("v1_eta_odd_dev_pos"), track.eta(), oddv1Dev);
390-
registry.fill(HIST("v1_eta_even_dev_pos"), track.eta(), evenv1Dev);
389+
registry.fill(HIST("v1_eta_odd_dev_pos"), track.eta(), track.pt(), oddv1Dev);
390+
registry.fill(HIST("v1_eta_even_dev_pos"), track.eta(), track.pt(), evenv1Dev);
391391
} else {
392-
registry.fill(HIST("v1_eta_odd_neg"), track.eta(), oddv1);
393-
registry.fill(HIST("v1_eta_even_neg"), track.eta(), evenv1);
392+
registry.fill(HIST("v1_eta_odd_neg"), track.eta(), track.pt(), oddv1);
393+
registry.fill(HIST("v1_eta_even_neg"), track.eta(), track.pt(), evenv1);
394394

395-
registry.fill(HIST("v1_eta_odd_dev_neg"), track.eta(), oddv1Dev);
396-
registry.fill(HIST("v1_eta_even_dev_neg"), track.eta(), evenv1Dev);
395+
registry.fill(HIST("v1_eta_odd_dev_neg"), track.eta(), track.pt(), oddv1Dev);
396+
registry.fill(HIST("v1_eta_even_dev_neg"), track.eta(), track.pt(), evenv1Dev);
397397
}
398398

399399
double v2A = std::cos(2 * (phi - psiA));
400400
double v2C = std::cos(2 * (phi - psiC));
401401
double v2AC = std::cos(2 * (phi - (psiA - psiC)));
402402

403-
registry.fill(HIST("v2_cent"), centrality, (1. / std::sqrt(2)) * (v2A - v2C));
404-
registry.fill(HIST("v2A_cent"), centrality, (v2A));
405-
registry.fill(HIST("v2C_cent"), centrality, (v2C));
406-
registry.fill(HIST("v2AC_cent"), centrality, (v2AC));
403+
registry.fill(HIST("v2_cent"), centrality, track.pt(), (1. / std::sqrt(2)) * (v2A - v2C));
404+
registry.fill(HIST("v2A_cent"), centrality, track.pt(), (v2A));
405+
registry.fill(HIST("v2C_cent"), centrality, track.pt(), (v2C));
406+
registry.fill(HIST("v2AC_cent"), centrality, track.pt(), (v2AC));
407407
}
408408

409409
float qIm = collision.qvecIm()[0];

0 commit comments

Comments
 (0)