Skip to content

Commit b19f3c2

Browse files
authored
Add and refactor configurables
add a configurable option to apply or not apply the C-factor during centroid calculations (crucial for the analysis); rename some configurables.
1 parent c9ba366 commit b19f3c2

1 file changed

Lines changed: 32 additions & 22 deletions

File tree

Common/TableProducer/zdcExtraTableProducer.cxx

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ struct ZdcExtraTableProducer {
5252
//
5353
Configurable<int> nBins{"nBins", 400, "n bins"};
5454
Configurable<float> maxZN{"maxZN", 399.5, "Max ZN signal"};
55-
Configurable<bool> tdcCut{"tdcCut", false, "Flag for TDC cut"};
56-
Configurable<float> tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"};
57-
Configurable<float> tdcZNmaxcut{"tdcZNmaxcut", 2.5, "Max ZN TDC cut"};
58-
Configurable<bool> cfgUsePMC{"cfgUsePMC", true, "Use common PM (true) or sum of PMs (false) "};
55+
Configurable<bool> applyTdcCut{"applyTdcCut", false, "Flag for TDC cut"};
56+
Configurable<float> tdcZnMin{"tdcZnMin", -2.5, "Min ZN TDC cut"};
57+
Configurable<float> tdcZnMax{"tdcZnMax", 2.5, "Max ZN TDC cut"};
58+
Configurable<bool> useCfactor{"useCfactor", true, "Use C normalization factor (depends on multiplicity) for centroid calculation"};
59+
Configurable<bool> usePMC{"usePMC", true, "Use common PM (true) or sum of PMs (false) "};
60+
5961
// Event selections
6062
Configurable<bool> cfgEvSelSel8{"cfgEvSelSel8", true, "Event selection: sel8"};
6163
Configurable<float> cfgEvSelVtxZ{"cfgEvSelVtxZ", 10, "Event selection: zVtx"};
@@ -66,11 +68,10 @@ struct ZdcExtraTableProducer {
6668
Configurable<bool> cfgEvSelsNoCollInTimeRangeStandard{"cfgEvSelsNoCollInTimeRangeStandard", false, "Event selection: no collision in time range standard"};
6769
Configurable<bool> cfgEvSelsIsVertexITSTPC{"cfgEvSelsIsVertexITSTPC", false, "Event selection: is vertex ITSTPC"};
6870
Configurable<bool> cfgEvSelsIsGoodITSLayersAll{"cfgEvSelsIsGoodITSLayersAll", false, "Event selection: is good ITS layers all"};
69-
// Calibration settings
70-
Configurable<float> cfgCalibrationDownscaling{"cfgCalibrationDownscaling", 1.f, "Percentage of events to be saved to derived table"};
71-
71+
7272
// Output settings
73-
Configurable<bool> cfgSaveQaHistos{"cfgSaveQaHistos", false, "Flag to save QA histograms"};
73+
Configurable<float> calibrationDownscaling{"calibrationDownscaling", 1.f, "Percentage of events to be saved to derived table"};
74+
Configurable<bool> saveQaHistos{"saveQaHistos", false, "Flag to save QA histograms"};
7475

7576
enum SelectionCriteria {
7677
ZVtxCut,
@@ -102,7 +103,7 @@ struct ZdcExtraTableProducer {
102103
registry.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(IsGoodITSLayersAll + 1, "IsGoodITSLayersAll");
103104

104105
// Skip histogram registration if QA flag is false
105-
if (!cfgSaveQaHistos) {
106+
if (!saveQaHistos) {
106107
return;
107108
}
108109

@@ -234,11 +235,11 @@ struct ZdcExtraTableProducer {
234235
double tdcZNA = zdc.timeZNA();
235236

236237
// OR we can select a narrow window in both ZN TDCs using the configurable parameters
237-
if (tdcCut) { // a narrow TDC window is set
238-
if ((tdcZNC >= tdcZNmincut) && (tdcZNC <= tdcZNmaxcut)) {
238+
if (applyTdcCut) { // a narrow TDC window is set
239+
if ((tdcZNC >= tdcZnMin) && (tdcZNC <= tdcZnMax)) {
239240
isZNChit = true;
240241
}
241-
if ((tdcZNA >= tdcZNmincut) && (tdcZNA <= tdcZNmaxcut)) {
242+
if ((tdcZNA >= tdcZnMin) && (tdcZNA <= tdcZnMax)) {
242243
isZNAhit = true;
243244
}
244245
} else { // if no window on TDC is set
@@ -261,7 +262,7 @@ struct ZdcExtraTableProducer {
261262
sumZNC += pmqZNC[it];
262263
}
263264

264-
if (cfgSaveQaHistos) {
265+
if (saveQaHistos) {
265266
registry.get<TH1>(HIST("ZNCpmc"))->Fill(pmcZNC);
266267
registry.get<TH1>(HIST("ZNCpm1"))->Fill(pmqZNC[0]);
267268
registry.get<TH1>(HIST("ZNCpm2"))->Fill(pmqZNC[1]);
@@ -276,7 +277,7 @@ struct ZdcExtraTableProducer {
276277
sumZNA += pmqZNA[it];
277278
}
278279
//
279-
if (cfgSaveQaHistos) {
280+
if (saveQaHistos) {
280281
registry.get<TH1>(HIST("ZNApmc"))->Fill(pmcZNA);
281282
registry.get<TH1>(HIST("ZNApm1"))->Fill(pmqZNA[0]);
282283
registry.get<TH1>(HIST("ZNApm2"))->Fill(pmqZNA[1]);
@@ -318,8 +319,8 @@ struct ZdcExtraTableProducer {
318319
float zncCommon = 0;
319320
float znaCommon = 0;
320321

321-
// Use sum of PMTs (cfgUsePMC == false) when common PMT is saturated
322-
if (cfgUsePMC) {
322+
// Use sum of PMTs (usePMC == false) when common PMT is saturated
323+
if (usePMC) {
323324
zncCommon = pmcZNC;
324325
znaCommon = pmcZNA;
325326
} else {
@@ -330,8 +331,13 @@ struct ZdcExtraTableProducer {
330331
float centroidZNC[2], centroidZNA[2];
331332

332333
if (denZNC != 0.) {
333-
float nSpecnC = zncCommon / kBeamEne;
334-
float cZNC = 1.89358 - 0.71262 / (nSpecnC + 0.71789);
334+
float cZNC = 1.0;
335+
336+
if (useCfactor) {
337+
float nSpecnC = zncCommon / kBeamEne;
338+
cZNC = 1.89358 - 0.71262 / (nSpecnC + 0.71789);
339+
}
340+
335341
centroidZNC[0] = cZNC * numXZNC / denZNC;
336342
centroidZNC[1] = cZNC * numYZNC / denZNC;
337343
} else {
@@ -340,15 +346,19 @@ struct ZdcExtraTableProducer {
340346
}
341347
//
342348
if (denZNA != 0.) {
343-
float nSpecnA = znaCommon / kBeamEne;
344-
float cZNA = 1.89358 - 0.71262 / (nSpecnA + 0.71789);
349+
float cZNA = 1.0;
350+
if (useCfactor) {
351+
float nSpecnA = znaCommon / kBeamEne;
352+
cZNA = 1.89358 - 0.71262 / (nSpecnA + 0.71789);
353+
}
354+
345355
centroidZNA[0] = cZNA * numXZNA / denZNA;
346356
centroidZNA[1] = cZNA * numYZNA / denZNA;
347357
} else {
348358
centroidZNA[0] = 999.;
349359
centroidZNA[1] = 999.;
350360
}
351-
if (cfgSaveQaHistos) {
361+
if (saveQaHistos) {
352362
if (isZNChit) {
353363
registry.get<TH2>(HIST("ZNCCentroid"))->Fill(centroidZNC[0], centroidZNC[1]);
354364
}
@@ -361,7 +371,7 @@ struct ZdcExtraTableProducer {
361371
auto vx = collision.posX();
362372
auto vy = collision.posY();
363373

364-
if ((isZNAhit || isZNChit) && (gRandom->Uniform() < cfgCalibrationDownscaling)) {
374+
if ((isZNAhit || isZNChit) && (gRandom->Uniform() < calibrationDownscaling)) {
365375
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(), foundBC.runNumber(), evSelection);
366376
}
367377
}

0 commit comments

Comments
 (0)