Skip to content

Commit c90db70

Browse files
udmitriealibuild
andauthored
[Common] Rename ZDCInterCalibTask and update it (#13417)
Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 9636af2 commit c90db70

File tree

5 files changed

+172
-89
lines changed

5 files changed

+172
-89
lines changed

Common/DataModel/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ o2physics_add_header_only_library(DataModel
2626
Qvectors.h
2727
MatchMFTFT0.h
2828
MftmchMatchingML.h
29-
ZDCInterCalib.h
29+
ZDCExtra.h
3030
EseTable.h
3131
FwdTrackReAlignTables.h)

Common/DataModel/ZDCExtra.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
12+
/// \file ZDCExtra.h
13+
/// \brief ZDC extra table producer
14+
/// \author Chiara Oppedisano <chiara.oppedisano@cern.ch>, INFN Torino
15+
/// \author Uliana Dmitrieva <uliana.dmitrieva@cern.ch>, INFN Torino
16+
17+
#ifndef COMMON_DATAMODEL_ZDCEXTRA_H_
18+
#define COMMON_DATAMODEL_ZDCEXTRA_H_
19+
20+
#include <Framework/AnalysisDataModel.h>
21+
22+
#include <cstdint>
23+
24+
namespace o2::aod
25+
{
26+
namespace zdcextra
27+
{
28+
DECLARE_SOA_COLUMN(ZnaTowC, znaTowC, float); //! Common tower ZNA
29+
DECLARE_SOA_COLUMN(ZnaTow1, znaTow1, float); //! Tower 1 ZNA
30+
DECLARE_SOA_COLUMN(ZnaTow2, znaTow2, float); //! Tower 2 ZNA
31+
DECLARE_SOA_COLUMN(ZnaTow3, znaTow3, float); //! Tower 3 ZNA
32+
DECLARE_SOA_COLUMN(ZnaTow4, znaTow4, float); //! Tower 4 ZNA
33+
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
36+
DECLARE_SOA_COLUMN(ZncTowC, zncTowC, float); //! Common tower ZNC
37+
DECLARE_SOA_COLUMN(ZncTow1, zncTow1, float); //! Tower 1 ZNC
38+
DECLARE_SOA_COLUMN(ZncTow2, zncTow2, float); //! Tower 2 ZNC
39+
DECLARE_SOA_COLUMN(ZncTow3, zncTow3, float); //! Tower 3 ZNC
40+
DECLARE_SOA_COLUMN(ZncTow4, zncTow4, float); //! Tower 4 ZNC
41+
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
44+
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
48+
DECLARE_SOA_COLUMN(Timestamp, timestamp, uint64_t); //! Timestamp
49+
DECLARE_SOA_COLUMN(SelectionBits, selectionBits, uint8_t); //! Selection Flags
50+
} // namespace zdcextra
51+
52+
DECLARE_SOA_TABLE(ZdcExtras, "AOD", "ZDCEXTRA", o2::soa::Index<>,
53+
zdcextra::ZnaTowC,
54+
zdcextra::ZnaTow1,
55+
zdcextra::ZnaTow2,
56+
zdcextra::ZnaTow3,
57+
zdcextra::ZnaTow4,
58+
zdcextra::ZnaTdc,
59+
zdcextra::ZnaQx,
60+
zdcextra::ZnaQy,
61+
zdcextra::ZncTowC,
62+
zdcextra::ZncTow1,
63+
zdcextra::ZncTow2,
64+
zdcextra::ZncTow3,
65+
zdcextra::ZncTow4,
66+
zdcextra::ZncTdc,
67+
zdcextra::ZncQx,
68+
zdcextra::ZncQy,
69+
zdcextra::Centrality,
70+
zdcextra::Vx,
71+
zdcextra::Vy,
72+
zdcextra::Vz,
73+
zdcextra::Timestamp,
74+
zdcextra::SelectionBits);
75+
} // namespace o2::aod
76+
77+
#endif // COMMON_DATAMODEL_ZDCEXTRA_H_

Common/DataModel/ZDCInterCalib.h

Lines changed: 0 additions & 62 deletions
This file was deleted.

Common/TableProducer/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ o2physics_add_dpl_workflow(match-mft-ft0
148148
O2::DetectorsBase O2::DetectorsCommonDataFormats
149149
COMPONENT_NAME Analysis)
150150

151-
o2physics_add_dpl_workflow(zdc-task-inter-calib
152-
SOURCES zdcTaskInterCalib.cxx
151+
o2physics_add_dpl_workflow(zdc-extra-table-producer
152+
SOURCES zdcExtraTableProducer.cxx
153153
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore
154154
COMPONENT_NAME Analysis)
155155

Common/TableProducer/zdcTaskInterCalib.cxx renamed to Common/TableProducer/zdcExtraTableProducer.cxx

Lines changed: 92 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
1111

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

1617
#include "Common/CCDB/EventSelectionParams.h"
1718
#include "Common/DataModel/Centrality.h"
1819
#include "Common/DataModel/EventSelection.h"
19-
#include "Common/DataModel/ZDCInterCalib.h"
20+
#include "Common/DataModel/ZDCExtra.h"
2021

2122
#include <Framework/AnalysisDataModel.h>
2223
#include <Framework/AnalysisHelpers.h>
@@ -29,6 +30,7 @@
2930
#include <Framework/runDataProcessing.h>
3031

3132
#include <TH1.h>
33+
#include <TH2.h>
3234

3335
#include <cstdint>
3436

@@ -40,17 +42,18 @@ using namespace o2::aod::evsel;
4042
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
4143
using ColEvSels = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Cs>;
4244

43-
struct ZdcTaskInterCalib {
45+
struct ZdcExtraTableProducer {
4446

45-
Produces<aod::ZDCInterCalib> zTab;
47+
Produces<aod::ZdcExtras> zdcextras;
4648

4749
// Configurable parameters
4850
//
4951
Configurable<int> nBins{"nBins", 400, "n bins"};
5052
Configurable<float> maxZN{"maxZN", 399.5, "Max ZN signal"};
5153
Configurable<bool> tdcCut{"tdcCut", false, "Flag for TDC cut"};
5254
Configurable<float> tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"};
53-
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) "};
5457
// Event selections
5558
Configurable<bool> cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"};
5659
Configurable<float> cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"};
@@ -92,6 +95,9 @@ struct ZdcTaskInterCalib {
9295
registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
9396
registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
9497

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+
95101
registry.add("hEventCount", "Number of Event; Cut; #Events Passed Cut", {HistType::kTH1D, {{nEventSelections, 0, nEventSelections}}});
96102
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_allEvents + 1, "All events");
97103
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_zvtx + 1, "vtxZ");
@@ -101,7 +107,7 @@ struct ZdcTaskInterCalib {
101107
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodZvtxFT0vsPV + 1, "kIsGoodZvtxFT0vsPV");
102108
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kNoCollInTimeRangeStandard + 1, "kNoCollInTimeRangeStandard");
103109
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsVertexITSTPC + 1, "kIsVertexITSTPC");
104-
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kkIsGoodITSLayersAll");
110+
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(evSel_kIsGoodITSLayersAll + 1, "kIsGoodITSLayersAll");
105111
}
106112

107113
template <typename TCollision>
@@ -206,18 +212,8 @@ struct ZdcTaskInterCalib {
206212
//
207213
double sumZNC = 0;
208214
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-
};
215+
double pmqZNC[4] = {};
216+
double pmqZNA[4] = {};
221217
//
222218
if (isZNChit) {
223219
for (int it = 0; it < nTowers; it++) {
@@ -244,15 +240,87 @@ struct ZdcTaskInterCalib {
244240
registry.get<TH1>(HIST("ZNApm4"))->Fill(pmqZNA[3]);
245241
registry.get<TH1>(HIST("ZNAsumq"))->Fill(sumZNA);
246242
}
247-
if (isZNAhit || isZNChit)
248-
zTab(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+
}
249317
}
250318
}
251319
}
252320
};
253321

254-
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) // o2-linter: disable=name/file-cpp
322+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
255323
{
256324
return WorkflowSpec{
257-
adaptAnalysisTask<ZdcTaskInterCalib>(cfgc)};
325+
adaptAnalysisTask<ZdcExtraTableProducer>(cfgc)};
258326
}

0 commit comments

Comments
 (0)