Skip to content

Commit 591da6b

Browse files
committed
Centroid calculations, centroid histos and new columns to the produced table were added
1 parent 95e397d commit 591da6b

File tree

2 files changed

+115
-35
lines changed

2 files changed

+115
-35
lines changed

Common/DataModel/ZDCExtra.h

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/// \file ZDCExtra.h
1313
/// \brief ZDC extra table
14-
/// \author Chiara Oppedisano <chiara.oppedisano@cern.ch>, INFN Torino
14+
/// \author Chiara Oppedisano <chiara.oppedisano@cern.ch>, INFN Torino; Uliana Dmitrieva <uliana.dmitrieva@cern.ch>, INFN Torino
1515

1616
#ifndef COMMON_DATAMODEL_ZDCEXTRA_H_
1717
#define COMMON_DATAMODEL_ZDCEXTRA_H_
@@ -22,39 +22,53 @@
2222

2323
namespace o2::aod
2424
{
25-
namespace zdcextra
25+
namespace zdcextra
2626
{
27-
DECLARE_SOA_COLUMN(ZNApmc, commonPMZNA, float); //! PMC ZNA // o2-linter: disable=name/o2-column
28-
DECLARE_SOA_COLUMN(ZNApm1, ZNAPM1, float); //! PM1 ZNA // o2-linter: disable=name/o2-column
29-
DECLARE_SOA_COLUMN(ZNApm2, ZNAPM2, float); //! PM2 ZNA // o2-linter: disable=name/o2-column
30-
DECLARE_SOA_COLUMN(ZNApm3, ZNAPM3, float); //! PM3 ZNA // o2-linter: disable=name/o2-column
31-
DECLARE_SOA_COLUMN(ZNApm4, ZNAPM4, float); //! PM4 ZNA // o2-linter: disable=name/o2-column
32-
DECLARE_SOA_COLUMN(ZNAtdc, ZNATDC, float); //! TDC ZNA // o2-linter: disable=name/o2-column
33-
DECLARE_SOA_COLUMN(ZNCpmc, commonPMZNC, float); //! PMC ZNC // o2-linter: disable=name/o2-column
34-
DECLARE_SOA_COLUMN(ZNCpm1, ZNCPM1, float); //! PM1 ZNC // o2-linter: disable=name/o2-column
35-
DECLARE_SOA_COLUMN(ZNCpm2, ZNCPM2, float); //! PM2 ZNC // o2-linter: disable=name/o2-column
36-
DECLARE_SOA_COLUMN(ZNCpm3, ZNCPM3, float); //! PM3 ZNC // o2-linter: disable=name/o2-column
37-
DECLARE_SOA_COLUMN(ZNCpm4, ZNCPM4, float); //! PM4 ZNC // o2-linter: disable=name/o2-column
38-
DECLARE_SOA_COLUMN(ZNCtdc, ZNCTDC, float); //! TDC ZNC // o2-linter: disable=name/o2-column
27+
DECLARE_SOA_COLUMN(ZNApmc, znaPMC, float); //! PMC ZNA
28+
DECLARE_SOA_COLUMN(ZNApm1, znaPM1, float); //! PM1 ZNA
29+
DECLARE_SOA_COLUMN(ZNApm2, znaPM2, float); //! PM2 ZNA
30+
DECLARE_SOA_COLUMN(ZNApm3, znaPM3, float); //! PM3 ZNA
31+
DECLARE_SOA_COLUMN(ZNApm4, znaPM4, float); //! PM4 ZNA
32+
DECLARE_SOA_COLUMN(ZNAtdc, znaTDC, float); //! TDC ZNA
33+
DECLARE_SOA_COLUMN(ZNAQx, znaQx, float); //! Q-vector X ZNA
34+
DECLARE_SOA_COLUMN(ZNAQy, znaQy, float); //! Q-vector Y ZNA
35+
DECLARE_SOA_COLUMN(ZNCpmc, zncPMC, float); //! PMC ZNC
36+
DECLARE_SOA_COLUMN(ZNCpm1, zncPM1, float); //! PM1 ZNC
37+
DECLARE_SOA_COLUMN(ZNCpm2, zncPM2, float); //! PM2 ZNC
38+
DECLARE_SOA_COLUMN(ZNCpm3, zncPM3, float); //! PM3 ZNC
39+
DECLARE_SOA_COLUMN(ZNCpm4, zncPM4, float); //! PM4 ZNC
40+
DECLARE_SOA_COLUMN(ZNCtdc, zncTDC, float); //! TDC ZNC
41+
DECLARE_SOA_COLUMN(ZNCQx, zncQx, float); //! Q-vector X ZNC
42+
DECLARE_SOA_COLUMN(ZNCQy, zncQy, float); //! Q-vector Y ZNC
3943
DECLARE_SOA_COLUMN(Centrality, centrality, float); //! Centrality
44+
DECLARE_SOA_COLUMN(Vx, vx, float); //! Vertex X
45+
DECLARE_SOA_COLUMN(Vy, vy, float); //! Vertex Y
46+
DECLARE_SOA_COLUMN(Vz, vz, float); //! Vertex Z
4047
DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp
4148
DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags
4249
} // namespace zdcextra
4350

44-
DECLARE_SOA_TABLE(ZDCExtra, "AOD", "ZDCEXTRA", o2::soa::Index<>,
51+
DECLARE_SOA_TABLE(ZdcExtras, "AOD", "ZDCEXTRA", o2::soa::Index<>,
4552
zdcextra::ZNApmc,
4653
zdcextra::ZNApm1,
4754
zdcextra::ZNApm2,
4855
zdcextra::ZNApm3,
4956
zdcextra::ZNApm4,
5057
zdcextra::ZNAtdc,
58+
zdcextra::ZNAQx,
59+
zdcextra::ZNAQy,
5160
zdcextra::ZNCpmc,
5261
zdcextra::ZNCpm1,
5362
zdcextra::ZNCpm2,
5463
zdcextra::ZNCpm3,
5564
zdcextra::ZNCpm4,
5665
zdcextra::ZNCtdc,
66+
zdcextra::ZNCQx,
67+
zdcextra::ZNCQy,
5768
zdcextra::Centrality,
69+
zdcextra::Vx,
70+
zdcextra::Vy,
71+
zdcextra::Vz,
5872
zdcextra::Timestamp,
5973
zdcextra::SelectionBits);
6074
} // namespace o2::aod

Common/TableProducer/zdcExtraTableProducer.cxx

Lines changed: 86 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
// or submit itself to any jurisdiction.
1111

1212
/// \file zdcExtraTableProducer.cxx
13-
/// \brief Task creating table with ZDC PMTs energies
14-
/// \author chiara.oppedisano@cern.ch
13+
/// \brief Task creating table with ZDC PMTs energies and calculated centroid (Q-vector) to be used for spectator plane measurement
14+
/// \authors Chiara Oppedisano <chiara.oppedisano@cern.ch>, INFN Torino; Uliana Dmitrieva <uliana.dmitrieva@cern.ch>, INFN Torino
1515

1616
#include "Common/CCDB/EventSelectionParams.h"
1717
#include "Common/DataModel/Centrality.h"
1818
#include "Common/DataModel/EventSelection.h"
19-
#include "Common/DataModel/ZDCExtra.h"
19+
#include "Common/DataModel/zdcExtra.h"
2020

2121
#include <Framework/AnalysisDataModel.h>
2222
#include <Framework/AnalysisHelpers.h>
@@ -29,6 +29,7 @@
2929
#include <Framework/runDataProcessing.h>
3030

3131
#include <TH1.h>
32+
#include <TH2.h>
3233

3334
#include <cstdint>
3435

@@ -50,7 +51,8 @@ struct zdcExtraTableProducer {
5051
Configurable<float> maxZN{"maxZN", 399.5, "Max ZN signal"};
5152
Configurable<bool> tdcCut{"tdcCut", false, "Flag for TDC cut"};
5253
Configurable<float> tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"};
53-
Configurable<float> tdcZNmaxcut{"tdcZNmaxcut", -2.5, "Max ZN TDC cut"};
54+
Configurable<float> tdcZNmaxcut{"tdcZNmaxcut", 2.5, "Max ZN TDC cut"};
55+
Configurable<bool> cfgUsePMC{"cfgUsePMC", true, "Use common PM (true) or sum of PMs (false) "};
5456
// Event selections
5557
Configurable<bool> cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"};
5658
Configurable<float> cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"};
@@ -92,6 +94,9 @@ struct zdcExtraTableProducer {
9294
registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
9395
registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
9496

97+
registry.add("ZNACentroid", "ZNACentroid; ZNA Centroid; X; Y", {HistType::kTH2F, {{50, -1.5, 1.5}, {50, -1.5, 1.5}}});
98+
registry.add("ZNCCentroid", "ZNCCentroid; ZNC Centroid; X; Y", {HistType::kTH2F, {{50, -1.5, 1.5}, {50, -1.5, 1.5}}});
99+
95100
registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}});
96101
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events");
97102
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ");
@@ -101,7 +106,7 @@ struct zdcExtraTableProducer {
101106
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
102107
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
103108
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC");
104-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll");
109+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll");
105110
}
106111

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

254-
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
320+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
255321
{
256322
return WorkflowSpec{
257323
adaptAnalysisTask<zdcExtraTableProducer>(cfgc)};

0 commit comments

Comments
 (0)