Skip to content

Commit d3ceec3

Browse files
committed
Add centroid calculations, centroid histos and new columns to the produced table; fix typos
1 parent 3420411 commit d3ceec3

File tree

2 files changed

+96
-16
lines changed

2 files changed

+96
-16
lines changed

Common/DataModel/ZDCExtra.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@ DECLARE_SOA_COLUMN(ZnaTow2, znaTow2, float); //! Tower 2 ZNA
3131
DECLARE_SOA_COLUMN(ZnaTow3, znaTow3, float); //! Tower 3 ZNA
3232
DECLARE_SOA_COLUMN(ZnaTow4, znaTow4, float); //! Tower 4 ZNA
3333
DECLARE_SOA_COLUMN(ZnaTdc, znaTdc, float); //! TDC ZNA
34+
DECLARE_SOA_COLUMN(ZnaQx, znaQx, float); //! Q-vector X ZNA
35+
DECLARE_SOA_COLUMN(ZnaQy, znaQy, float); //! Q-vector Y ZNA
3436
DECLARE_SOA_COLUMN(ZncTowC, zncTowC, float); //! Common tower ZNC
3537
DECLARE_SOA_COLUMN(ZncTow1, zncTow1, float); //! Tower 1 ZNC
3638
DECLARE_SOA_COLUMN(ZncTow2, zncTow2, float); //! Tower 2 ZNC
3739
DECLARE_SOA_COLUMN(ZncTow3, zncTow3, float); //! Tower 3 ZNC
3840
DECLARE_SOA_COLUMN(ZncTow4, zncTow4, float); //! Tower 4 ZNC
3941
DECLARE_SOA_COLUMN(ZncTdc, zncTdc, float); //! TDC ZNC
42+
DECLARE_SOA_COLUMN(ZncQx, zncQx, float); //! Q-vector X ZNC
43+
DECLARE_SOA_COLUMN(ZncQy, zncQy, float); //! Q-vector Y ZNC
4044
DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality
45+
DECLARE_SOA_COLUMN(Vx, vx, float); //! Vertex X
46+
DECLARE_SOA_COLUMN(Vy, vy, float); //! Vertex Y
47+
DECLARE_SOA_COLUMN(Vz, vz, float); //! Vertex Z
4148
DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp
4249
DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags
4350
} // namespace zdcextra
@@ -49,13 +56,20 @@ DECLARE_SOA_TABLE(ZdcExtras, "AOD", "ZDCEXTRA", o2::soa::Index<>,
4956
zdcextra::ZnaTow3,
5057
zdcextra::ZnaTow4,
5158
zdcextra::ZnaTdc,
59+
zdcextra::ZnaQx,
60+
zdcextra::ZnaQy,
5261
zdcextra::ZncTowC,
5362
zdcextra::ZncTow1,
5463
zdcextra::ZncTow2,
5564
zdcextra::ZncTow3,
5665
zdcextra::ZncTow4,
5766
zdcextra::ZncTdc,
67+
zdcextra::ZncQx,
68+
zdcextra::ZncQy,
5869
zdcextra::Centrality,
70+
zdcextra::Vx,
71+
zdcextra::Vy,
72+
zdcextra::Vz,
5973
zdcextra::Timestamp,
6074
zdcextra::SelectionBits);
6175
} // namespace o2::aod

Common/TableProducer/zdcExtraTableProducer.cxx

Lines changed: 82 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ struct ZdcExtraTableProducer {
5252
Configurable<float> maxZN{"maxZN", 399.5, "Max ZN signal"};
5353
Configurable<bool> tdcCut{"tdcCut", false, "Flag for TDC cut"};
5454
Configurable<float> tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"};
55-
Configurable<float> tdcZNmaxcut{"tdcZNmaxcut", -2.5, "Max ZN TDC cut"};
55+
Configurable<float> tdcZNmaxcut{"tdcZNmaxcut", 2.5, "Max ZN TDC cut"};
56+
Configurable<bool> cfgUsePMC{"cfgUsePMC", true, "Use common PM (true) or sum of PMs (false) "};
5657
// Event selections
5758
Configurable<bool> cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"};
5859
Configurable<float> cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"};
@@ -94,6 +95,9 @@ struct ZdcExtraTableProducer {
9495
registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
9596
registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
9697

98+
registry.add("ZNACentroid", "ZNACentroid; ZNA Centroid; X; Y", {HistType::kTH2F, {{50, -1.5, 1.5}, {50, -1.5, 1.5}}});
99+
registry.add("ZNCCentroid", "ZNCCentroid; ZNC Centroid; X; Y", {HistType::kTH2F, {{50, -1.5, 1.5}, {50, -1.5, 1.5}}});
100+
97101
registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}});
98102
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events");
99103
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ");
@@ -103,7 +107,7 @@ struct ZdcExtraTableProducer {
103107
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
104108
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
105109
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC");
106-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll");
110+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll");
107111
}
108112

109113
template <typename TCollision>
@@ -208,18 +212,8 @@ struct ZdcExtraTableProducer {
208212
//
209213
double sumZNC = 0;
210214
double sumZNA = 0;
211-
double pmqZNC[4] = {
212-
0,
213-
0,
214-
0,
215-
0,
216-
};
217-
double pmqZNA[4] = {
218-
0,
219-
0,
220-
0,
221-
0,
222-
};
215+
double pmqZNC[4] = {};
216+
double pmqZNA[4] = {};
223217
//
224218
if (isZNChit) {
225219
for (int it = 0; it < nTowers; it++) {
@@ -246,8 +240,80 @@ struct ZdcExtraTableProducer {
246240
registry.get<TH1>(HIST("ZNApm4"))->Fill(pmqZNA[3]);
247241
registry.get<TH1>(HIST("ZNAsumq"))->Fill(sumZNA);
248242
}
249-
if (isZNAhit || isZNChit)
250-
zdcextras(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNC, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNA, centrality, foundBC.timestamp(), evSelection);
243+
244+
// Q-vectors (centroid) calculation
245+
// kBeamEne -- LHC Run 3 Pb-Pb collision energy (5.36 TeV per nucleon pair)
246+
constexpr float kBeamEne = 5.36 * 0.5;
247+
248+
// Provide coordinates of centroid over ZN (side C) front face
249+
constexpr float X[4] = {-1.75, 1.75, -1.75, 1.75};
250+
constexpr float Y[4] = {-1.75, -1.75, 1.75, 1.75};
251+
constexpr float kAlpha = 0.395; // saturation correction
252+
253+
float numXZNC = 0., numYZNC = 0., denZNC = 0.;
254+
float numXZNA = 0., numYZNA = 0., denZNA = 0.;
255+
256+
// Calculate weighted sums of the x and y coordinates
257+
constexpr int kNTowers = 4; // number of ZDC towers
258+
for (int i = 0; i < kNTowers; i++) {
259+
if (pmqZNC[i] > 0.) {
260+
float wZNC = std::pow(pmqZNC[i], kAlpha);
261+
numXZNC -= X[i] * wZNC; // numerator x (minus sign due to opposite orientation of ZNC)
262+
numYZNC += Y[i] * wZNC; // numerator y
263+
denZNC += wZNC; // denominator
264+
}
265+
if (pmqZNA[i] > 0.) {
266+
float wZNA = std::pow(pmqZNA[i], kAlpha);
267+
numXZNA += X[i] * wZNA; // numerator x
268+
numYZNA += Y[i] * wZNA; // numerator y
269+
denZNA += wZNA; // denominator
270+
}
271+
}
272+
// Calculate centroid coordinates (in cm) with correction factor c depending on the number of spectator nucleons (nSpec)
273+
274+
float zncCommon = 0;
275+
float znaCommon = 0;
276+
277+
// Use sum of PMTs (cfgUsePMC == false) when common PMT is saturated
278+
if (cfgUsePMC) {
279+
zncCommon = pmcZNC;
280+
znaCommon = pmcZNA;
281+
} else {
282+
zncCommon = sumZNC;
283+
znaCommon = sumZNA;
284+
}
285+
286+
float centroidZNC[2], centroidZNA[2];
287+
288+
if (denZNC != 0.) {
289+
float nSpecnC = zncCommon / kBeamEne;
290+
float cZNC = 1.89358 - 0.71262 / (nSpecnC + 0.71789);
291+
centroidZNC[0] = cZNC * numXZNC / denZNC;
292+
centroidZNC[1] = cZNC * numYZNC / denZNC;
293+
} else {
294+
centroidZNC[0] = 999.;
295+
centroidZNC[1] = 999.;
296+
}
297+
//
298+
if (denZNA != 0.) {
299+
float nSpecnA = znaCommon / kBeamEne;
300+
float cZNA = 1.89358 - 0.71262 / (nSpecnA + 0.71789);
301+
centroidZNA[0] = cZNA * numXZNA / denZNA;
302+
centroidZNA[1] = cZNA * numYZNA / denZNA;
303+
} else {
304+
centroidZNA[0] = 999.;
305+
centroidZNA[1] = 999.;
306+
}
307+
registry.get<TH2>(HIST("ZNCCentroid"))->Fill(centroidZNC[0], centroidZNC[1]);
308+
registry.get<TH2>(HIST("ZNACentroid"))->Fill(centroidZNA[0], centroidZNA[1]);
309+
310+
auto vz = collision.posZ();
311+
auto vx = collision.posX();
312+
auto vy = collision.posY();
313+
314+
if (isZNAhit || isZNChit) {
315+
zdcextras(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNA, centroidZNA[0], centroidZNA[1], pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNC, centroidZNC[0], centroidZNC[1], centrality, vx, vy, vz, foundBC.timestamp(), evSelection);
316+
}
251317
}
252318
}
253319
}

0 commit comments

Comments
 (0)