Skip to content

Commit b9c4567

Browse files
authored
[Common] Introducing a configurable cut on ZN TDCs to select more clean samples (#9205)
1 parent a03acc5 commit b9c4567

File tree

2 files changed

+73
-59
lines changed

2 files changed

+73
-59
lines changed

Common/DataModel/ZDCInterCalib.h

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11+
12+
/// \file ZDCInterCalib.h
13+
/// \brief ZDC tower intercalibration task
14+
/// \author Chiara Oppedisano <chiara.oppedisano@cern.ch>, INFN Torino
15+
1116
#ifndef COMMON_DATAMODEL_ZDCINTERCALIB_H_
1217
#define COMMON_DATAMODEL_ZDCINTERCALIB_H_
1318

@@ -17,30 +22,34 @@ namespace o2::aod
1722
{
1823
namespace znoutput
1924
{
20-
DECLARE_SOA_COLUMN(pmcZNA, ZNAcommonPM, float); //! PMC ZNA
21-
DECLARE_SOA_COLUMN(pm1ZNA, ZNAPM1, float); //! PM1 ZNA
22-
DECLARE_SOA_COLUMN(pm2ZNA, ZNAPM2, float); //! PM2 ZNA
23-
DECLARE_SOA_COLUMN(pm3ZNA, ZNAPM3, float); //! PM3 ZNA
24-
DECLARE_SOA_COLUMN(pm4ZNA, ZNAPM4, float); //! PM4 ZNA
25-
DECLARE_SOA_COLUMN(pmcZNC, ZNCcommonPM, float); //! PMC ZNC
26-
DECLARE_SOA_COLUMN(pm1ZNC, ZNCPM1, float); //! PM1 ZNC
27-
DECLARE_SOA_COLUMN(pm2ZNC, ZNCPM2, float); //! PM2 ZNC
28-
DECLARE_SOA_COLUMN(pm3ZNC, ZNCPM3, float); //! PM3 ZNC
29-
DECLARE_SOA_COLUMN(pm4ZNC, ZNCPM4, float); //! PM4 ZNC
25+
DECLARE_SOA_COLUMN(ZNApmc, commonPMZNA, float); //! PMC ZNA // o2-linter: disable=name/o2-column
26+
DECLARE_SOA_COLUMN(ZNApm1, ZNAPM1, float); //! PM1 ZNA // o2-linter: disable=name/o2-column
27+
DECLARE_SOA_COLUMN(ZNApm2, ZNAPM2, float); //! PM2 ZNA // o2-linter: disable=name/o2-column
28+
DECLARE_SOA_COLUMN(ZNApm3, ZNAPM3, float); //! PM3 ZNA // o2-linter: disable=name/o2-column
29+
DECLARE_SOA_COLUMN(ZNApm4, ZNAPM4, float); //! PM4 ZNA // o2-linter: disable=name/o2-column
30+
DECLARE_SOA_COLUMN(ZNAtdc, ZNATDC, float); //! TDC ZNA // o2-linter: disable=name/o2-column
31+
DECLARE_SOA_COLUMN(ZNCpmc, commonPMZNC, float); //! PMC ZNC // o2-linter: disable=name/o2-column
32+
DECLARE_SOA_COLUMN(ZNCpm1, ZNCPM1, float); //! PM1 ZNC // o2-linter: disable=name/o2-column
33+
DECLARE_SOA_COLUMN(ZNCpm2, ZNCPM2, float); //! PM2 ZNC // o2-linter: disable=name/o2-column
34+
DECLARE_SOA_COLUMN(ZNCpm3, ZNCPM3, float); //! PM3 ZNC // o2-linter: disable=name/o2-column
35+
DECLARE_SOA_COLUMN(ZNCpm4, ZNCPM4, float); //! PM4 ZNC // o2-linter: disable=name/o2-column
36+
DECLARE_SOA_COLUMN(ZNCtdc, ZNCTDC, float); //! TDC ZNC // o2-linter: disable=name/o2-column
3037

3138
} // namespace znoutput
3239

3340
DECLARE_SOA_TABLE(ZDCInterCalib, "AOD", "ZDCIC", o2::soa::Index<>,
34-
znoutput::pmcZNA,
35-
znoutput::pm1ZNA,
36-
znoutput::pm2ZNA,
37-
znoutput::pm3ZNA,
38-
znoutput::pm4ZNA,
39-
znoutput::pmcZNC,
40-
znoutput::pm1ZNC,
41-
znoutput::pm2ZNC,
42-
znoutput::pm3ZNC,
43-
znoutput::pm4ZNC);
41+
znoutput::ZNApmc,
42+
znoutput::ZNApm1,
43+
znoutput::ZNApm2,
44+
znoutput::ZNApm3,
45+
znoutput::ZNApm4,
46+
znoutput::ZNAtdc,
47+
znoutput::ZNCpmc,
48+
znoutput::ZNCpm1,
49+
znoutput::ZNCpm2,
50+
znoutput::ZNCpm3,
51+
znoutput::ZNCpm4,
52+
znoutput::ZNCtdc);
4453
} // namespace o2::aod
4554

4655
#endif // COMMON_DATAMODEL_ZDCINTERCALIB_H_

Common/TableProducer/zdc-task-intercalib.cxx

Lines changed: 44 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11-
///
11+
12+
/// \file zdc-task-intercalib.cxx
1213
/// \brief Task for ZDC tower inter-calibration
1314
/// \author chiara.oppedisano@cern.ch
14-
// Minimal example to run this task:
15-
// export OPTIONS="-b --configuration json://config.json --aod-file AO2D.root"
16-
// o2-analysis-timestamp ${OPTIONS} |
17-
// o2-analysis-event-selection ${OPTIONS} |
18-
// o2-analysis-track-propagation ${OPTIONS} |
19-
// o2-analysis-mm-zdc-task-intercalib ${OPTIONS}
2015

16+
// o2-linter: disable=name/workflow-file
17+
// o2-linter: disable=name/file-cpp
2118
#include "Framework/AnalysisTask.h"
2219
#include "Framework/AnalysisDataModel.h"
2320
#include "Framework/HistogramRegistry.h"
@@ -37,63 +34,71 @@ using namespace o2::framework;
3734
using namespace o2::framework::expressions;
3835
using namespace o2::aod::evsel;
3936

40-
constexpr double kVeryNegative = -1.e12;
41-
4237
using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
4338
using ColEvSels = soa::Join<aod::Collisions, aod::EvSels>;
4439

45-
struct zdcInterCalib {
40+
struct ZDCCalibTower {
4641

4742
Produces<aod::ZDCInterCalib> zTab;
4843

4944
// Configurable parameters
5045
//
5146
Configurable<int> nBins{"nBins", 400, "n bins"};
52-
Configurable<float> MaxZN{"MaxZN", 399.5, "Max ZN signal"};
47+
Configurable<float> maxZN{"maxZN", 399.5, "Max ZN signal"};
48+
Configurable<bool> tdcCut{"tdcCut", false, "Flag for TDC cut"};
49+
Configurable<float> tdcZNmincut{"tdcZNmincut", -2.5, "Min ZN TDC cut"};
50+
Configurable<float> tdcZNmaxcut{"tdcZNmaxcut", -2.5, "Max ZN TDC cut"};
5351
//
5452
HistogramRegistry registry{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
5553

5654
void init(InitContext const&)
5755
{
58-
registry.add("ZNApmc", "ZNApmc; ZNA PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
59-
registry.add("ZNCpmc", "ZNCpmc; ZNC PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
60-
registry.add("ZNApm1", "ZNApm1; ZNA PM1; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
61-
registry.add("ZNApm2", "ZNApm2; ZNA PM2; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
62-
registry.add("ZNApm3", "ZNApm3; ZNA PM3; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
63-
registry.add("ZNApm4", "ZNApm4; ZNA PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
64-
registry.add("ZNCpm1", "ZNCpm1; ZNC PM1; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
65-
registry.add("ZNCpm2", "ZNCpm2; ZNC PM2; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
66-
registry.add("ZNCpm3", "ZNCpm3; ZNC PM3; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
67-
registry.add("ZNCpm4", "ZNCpm4; ZNC PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
68-
registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
69-
registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, MaxZN}}});
56+
registry.add("ZNApmc", "ZNApmc; ZNA PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
57+
registry.add("ZNCpmc", "ZNCpmc; ZNC PMC; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
58+
registry.add("ZNApm1", "ZNApm1; ZNA PM1; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
59+
registry.add("ZNApm2", "ZNApm2; ZNA PM2; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
60+
registry.add("ZNApm3", "ZNApm3; ZNA PM3; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
61+
registry.add("ZNApm4", "ZNApm4; ZNA PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
62+
registry.add("ZNCpm1", "ZNCpm1; ZNC PM1; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
63+
registry.add("ZNCpm2", "ZNCpm2; ZNC PM2; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
64+
registry.add("ZNCpm3", "ZNCpm3; ZNC PM3; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
65+
registry.add("ZNCpm4", "ZNCpm4; ZNC PM4; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
66+
registry.add("ZNAsumq", "ZNAsumq; ZNA uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
67+
registry.add("ZNCsumq", "ZNCsumq; ZNC uncalib. sum PMQ; Entries", {HistType::kTH1F, {{nBins, -0.5, maxZN}}});
7068
}
7169

7270
void process(ColEvSels const& cols, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcs*/)
7371
{
7472
// collision-based event selection
75-
for (auto& collision : cols) {
73+
for (auto const& collision : cols) {
7674
const auto& foundBC = collision.foundBC_as<BCsRun3>();
7775
if (foundBC.has_zdc()) {
7876
const auto& zdc = foundBC.zdc();
7977

8078
// To assure that ZN have a genuine signal (tagged by the relative TDC)
8179
// we can check that the amplitude is >0 or that ADC is NOT very negative (-inf)
82-
// If this is not the case, signals are set to kVeryNegative values
80+
8381
double pmcZNC = zdc.energyCommonZNC();
8482
double pmcZNA = zdc.energyCommonZNA();
83+
bool isZNChit = false, isZNAhit = false;
8584
//
86-
// double tdcZNC = zdc.zdc.timeZNC();
87-
// double tdcZNA = zdc.zdc.timeZNA();
88-
//
89-
bool isZNChit = true, isZNAhit = true;
90-
if (pmcZNC < kVeryNegative) {
91-
pmcZNC = kVeryNegative;
92-
isZNChit = false;
93-
}
94-
if (pmcZNA < kVeryNegative) {
95-
pmcZNA = kVeryNegative;
96-
isZNAhit = false;
85+
double tdcZNC = zdc.timeZNC();
86+
double tdcZNA = zdc.timeZNA();
87+
// OR we can select a narrow window in both ZN TDCs using the configurable parameters
88+
if (tdcCut) { // a narrow TDC window is set
89+
if ((tdcZNC >= tdcZNmincut) && (tdcZNC <= tdcZNmaxcut)) {
90+
isZNChit = true;
91+
}
92+
if ((tdcZNA >= tdcZNmincut) && (tdcZNA <= tdcZNmaxcut)) {
93+
isZNAhit = true;
94+
}
95+
} else { // if no window on TDC is set
96+
if (pmcZNC > -1.) {
97+
isZNChit = true;
98+
}
99+
if (pmcZNA > -1.) {
100+
isZNAhit = true;
101+
}
97102
}
98103
//
99104
double sumZNC = 0;
@@ -137,14 +142,14 @@ struct zdcInterCalib {
137142
registry.get<TH1>(HIST("ZNAsumq"))->Fill(sumZNA);
138143
}
139144
if (isZNAhit || isZNChit)
140-
zTab(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3]);
145+
zTab(pmcZNA, pmqZNA[0], pmqZNA[1], pmqZNA[2], pmqZNA[3], tdcZNC, pmcZNC, pmqZNC[0], pmqZNC[1], pmqZNC[2], pmqZNC[3], tdcZNA);
141146
}
142147
}
143148
}
144149
};
145150

146-
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
151+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) // o2-linter: disable=name/file-cpp
147152
{
148153
return WorkflowSpec{
149-
adaptAnalysisTask<zdcInterCalib>(cfgc)};
154+
adaptAnalysisTask<ZDCCalibTower>(cfgc)};
150155
}

0 commit comments

Comments
 (0)