Skip to content

Commit 8a7fe5b

Browse files
cnkosteralibuild
andauthored
[PWGCF] Added flag for selected events zdc qvector task (#8411)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent c4ddb15 commit 8a7fe5b

File tree

2 files changed

+31
-42
lines changed

2 files changed

+31
-42
lines changed

PWGCF/DataModel/SPTableZDC.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ DECLARE_SOA_COLUMN(Vx, vx, float);
3131
DECLARE_SOA_COLUMN(Vy, vy, float);
3232
DECLARE_SOA_COLUMN(Vz, vz, float);
3333
DECLARE_SOA_COLUMN(QXA, qxA, float);
34-
DECLARE_SOA_COLUMN(QXC, qxC, float);
3534
DECLARE_SOA_COLUMN(QYA, qyA, float);
35+
DECLARE_SOA_COLUMN(QXC, qxC, float);
3636
DECLARE_SOA_COLUMN(QYC, qyC, float);
37-
// keep track of where we are in steps and iterations.
37+
DECLARE_SOA_COLUMN(IsSelected, isSelected, bool);
3838
DECLARE_SOA_COLUMN(Iteration, iteration, int);
3939
DECLARE_SOA_COLUMN(Step, step, int);
4040

@@ -47,9 +47,10 @@ DECLARE_SOA_TABLE(SPTableZDC, "AOD", "SPZDC",
4747
sptablezdc::Vy,
4848
sptablezdc::Vz,
4949
sptablezdc::QXA,
50-
sptablezdc::QXC,
5150
sptablezdc::QYA,
51+
sptablezdc::QXC,
5252
sptablezdc::QYC,
53+
sptablezdc::IsSelected,
5354
sptablezdc::Iteration,
5455
sptablezdc::Step);
5556
} // namespace o2::aod

PWGCF/Flow/TableProducer/ZDCQvectors.cxx

Lines changed: 27 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#include <numeric>
1818
#include <vector>
1919
#include <typeinfo>
20+
#include <memory>
21+
#include <string>
2022

2123
#include "CCDB/BasicCCDBManager.h"
2224
#include "Common/CCDB/EventSelectionParams.h"
@@ -60,7 +62,7 @@ using namespace o2::aod::track;
6062
using namespace o2::aod::evsel;
6163

6264
// define my.....
63-
using myCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>>;
65+
using myCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>;
6466
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
6567

6668
namespace o2::analysis::qvectortask
@@ -89,7 +91,6 @@ std::vector<TProfile2D*> mean_vz_Run(4, nullptr); // hQXA, hQYA, hQXC, hQY
8991
// Energy calibration:
9092
std::vector<TString> names_Ecal(10, "");
9193
std::vector<std::vector<TString>> names(5, std::vector<TString>()); //(1x 4d 4x 1d)
92-
std::vector<TString> vnames = {"hvertex_vx", "hvertex_vy"};
9394

9495
// https://alice-notes.web.cern.ch/system/files/notes/analysis/620/017-May-31-analysis_note-ALICE_analysis_note_v2.pdf
9596
std::vector<double> ZDC_px = {-1.75, 1.75, -1.75, 1.75};
@@ -105,9 +106,10 @@ std::vector<double> meanEZN(10); // mean energies from calibration histos (commo
105106
std::vector<double> e(8, 0.); // calibrated energies (a1, a2, a3, a4, c1, c2, c3, c4))
106107

107108
// Define variables needed to do the recentring steps.
108-
double centrality;
109-
int runnumber;
110-
std::vector<double> v(3); // vx, vy, vz
109+
double centrality = 0;
110+
int runnumber = 0;
111+
std::vector<double> v(3, 0); // vx, vy, vz
112+
bool isSelected = false;
111113

112114
} // namespace o2::analysis::qvectortask
113115

@@ -123,7 +125,7 @@ struct ZDCqvectors {
123125
ConfigurableAxis axisVx_big{"axisVx_big", {3, -0.006, -0.006}, "for Pos X of collision"};
124126
ConfigurableAxis axisVy_big{"axisVy_big", {3, -0.003, 0.003}, "for Pos Y of collision"};
125127
ConfigurableAxis axisVz_big{"axisVz_big", {3, -10, 10}, "for Pos Z of collision"};
126-
ConfigurableAxis axisVx{"axisVx", {10, -0.006, -0.006}, "for Pos X of collision"};
128+
ConfigurableAxis axisVx{"axisVx", {10, -0.006, 0.006}, "for Pos X of collision"};
127129
ConfigurableAxis axisVy{"axisVy", {10, -0.003, 0.003}, "for Pos Y of collision"};
128130
ConfigurableAxis axisVz{"axisVz", {10, -10, 1}, "for vz of collision"};
129131
ConfigurableAxis axisRun{"axisRun", {1e6, 0, 1e6}, "for runNumber in ThnSparse"};
@@ -146,9 +148,6 @@ struct ZDCqvectors {
146148
// Define output
147149
HistogramRegistry registry{"Registry"};
148150

149-
// Filters
150-
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
151-
152151
Service<ccdb::BasicCCDBManager> ccdb;
153152

154153
// keep track of calibration histos for each given step and iteration
@@ -234,10 +233,6 @@ struct ZDCqvectors {
234233
// recentered q-vectors (to check what steps are finished in the end)
235234
registry.add("hStep", "hStep", {HistType::kTH1D, {{10, 0., 10.}}});
236235
registry.add("hIteration", "hIteration", {HistType::kTH1D, {{10, 0., 10.}}});
237-
238-
// histos with mean v(x/y) per run.
239-
registry.add<TProfile>("vmean/hvertex_vx", "hvertex_vx", kTProfile, {{1, 0., 1.}}, "s");
240-
registry.add<TProfile>("vmean/hvertex_vy", "hvertex_vy", kTProfile, {{1, 0., 1.}}, "s");
241236
}
242237

243238
inline void fillRegistry(int iteration, int step)
@@ -495,14 +490,19 @@ struct ZDCqvectors {
495490
std::vector<double> xEnZN(2, 0.);
496491
std::vector<double> yEnZN(2, 0.);
497492

498-
if (!collision.sel8())
499-
return;
500493
auto cent = collision.centFT0C();
501-
if (cent < 0 || cent > 90)
494+
495+
if (cent < 0 || cent > 90) {
496+
SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0);
502497
return;
498+
}
503499

504500
const auto& foundBC = collision.foundBC_as<BCsRun3>();
505-
if (foundBC.has_zdc()) {
501+
502+
if (!foundBC.has_zdc()) {
503+
SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0);
504+
return;
505+
}
506506

507507
v[0] = collision.posX();
508508
v[1] = collision.posY();
@@ -524,14 +524,6 @@ struct ZDCqvectors {
524524
LOGF(info, " --> No Energy calibration files found.. -> Only Energy calibration will be done. ");
525525
}
526526
}
527-
// load the calibrations for the mean v
528-
loadCalibrations(0, 1, foundBC.timestamp(), cfgMeanv, vnames);
529-
if (!cal.calibfilesLoaded[0][1]) {
530-
if (counter < 1)
531-
LOGF(warning, " --> No mean V found.. -> THis wil lead to wrong axis for vx, vy (will be created in vmean/)");
532-
registry.get<TProfile>(HIST("vmean/hvertex_vx"))->Fill(Form("%d", runnumber), v[0]);
533-
registry.get<TProfile>(HIST("vmean/hvertex_vy"))->Fill(Form("%d", runnumber), v[1]);
534-
}
535527

536528
if (counter < 1)
537529
LOGF(info, "=====================> .....Start Energy Calibration..... <=====================");
@@ -571,10 +563,16 @@ struct ZDCqvectors {
571563
// if ZNA or ZNC not hit correctly.. do not use event in q-vector calculation
572564
if (!isZNAhit || !isZNChit) {
573565
counter++;
566+
SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0);
567+
return;
568+
}
569+
570+
if (!cal.calibfilesLoaded[0][0]) {
571+
counter++;
572+
SPtableZDC(0, 0, 0, 0, 0, 0, 0, 0, 0, false, 0, 0);
574573
return;
575574
}
576575

577-
if (cal.calibfilesLoaded[0][0]) {
578576
if (counter < 1)
579577
LOGF(info, "files for step 0 (energy Calibraton) are open!");
580578

@@ -618,13 +616,6 @@ struct ZDCqvectors {
618616
}
619617
}
620618

621-
if (cal.calibfilesLoaded[0][1]) {
622-
if (counter < 1)
623-
LOGF(info, "=====================> Setting v to vmean!");
624-
v[0] = v[0] - getCorrection<TProfile>(0, 1, vnames[0].Data());
625-
v[1] = v[1] - getCorrection<TProfile>(0, 1, vnames[1].Data());
626-
}
627-
628619
for (int iteration = 1; iteration < 5; iteration++) {
629620
std::vector<std::string> ccdb_dirs;
630621
if (iteration == 1)
@@ -645,7 +636,7 @@ struct ZDCqvectors {
645636
if (counter < 1)
646637
LOGF(warning, "Calibation files missing!!! Output created with q-vectors right after energy gain eq. !!");
647638
fillAllRegistries(0, 0);
648-
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], 0, 0);
639+
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);
649640
counter++;
650641
return;
651642
} else {
@@ -673,14 +664,11 @@ struct ZDCqvectors {
673664
if (counter < 1)
674665
LOGF(warning, "Calibation files missing!!! Output created with q-vectors at iteration %i and step %i!!!!", cal.atIteration, cal.atStep + 1);
675666
fillAllRegistries(cal.atIteration, cal.atStep + 1);
676-
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], cal.atIteration, cal.atStep);
667+
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);
677668
counter++;
678669
return;
679670
}
680-
} // end of cal.calibfilesLoaded[0]
681-
682-
} // end collision found ZDC
683-
counter++;
671+
LOGF(warning, "We return without saving table... -> THis is a problem");
684672
} // end of process
685673
};
686674

0 commit comments

Comments
 (0)