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>
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