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;
3734using namespace o2 ::framework::expressions;
3835using namespace o2 ::aod::evsel;
3936
40- constexpr double kVeryNegative = -1 .e12 ;
41-
4237using BCsRun3 = soa::Join<aod::BCs, aod::Timestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
4338using 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