Skip to content

Commit 09ad874

Browse files
authored
[DPG] timeDependentQa instead of mShapeQa (#9495)
1 parent 2622c7b commit 09ad874

File tree

2 files changed

+111
-14
lines changed

2 files changed

+111
-14
lines changed

DPG/Tasks/AOTEvent/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ o2physics_add_dpl_workflow(lumi-qa
1919
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase
2020
COMPONENT_NAME Analysis)
2121

22-
o2physics_add_dpl_workflow(mshape-qa
23-
SOURCES mshapeQa.cxx
22+
o2physics_add_dpl_workflow(time-dependent-qa
23+
SOURCES timeDependentQa.cxx
2424
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2::DetectorsBase O2::TPCCalibration
2525
COMPONENT_NAME Analysis)
2626

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

12+
/// \file timeDependentQa.cxx
13+
/// \brief Time-dependent QA for a number of observables
14+
///
15+
/// \author Evgeny Kryshen <evgeny.kryshen@cern.ch> and Igor Altsybeev <Igor.Altsybeev@cern.ch>
16+
17+
#include <map>
18+
#include <vector>
19+
#include <string>
20+
1221
#include "Framework/runDataProcessing.h"
1322
#include "Framework/AnalysisTask.h"
1423
#include "Framework/AnalysisDataModel.h"
15-
#include "CCDB/BasicCCDBManager.h"
1624
#include "Framework/HistogramRegistry.h"
17-
#include "TPCCalibration/TPCMShapeCorrection.h"
25+
#include "CCDB/BasicCCDBManager.h"
1826
#include "Common/DataModel/EventSelection.h"
1927
#include "Common/DataModel/TrackSelectionTables.h"
28+
#include "Common/CCDB/ctpRateFetcher.h"
29+
#include "TPCCalibration/TPCMShapeCorrection.h"
2030
#include "DataFormatsParameters/GRPECSObject.h"
31+
#include "DataFormatsITSMFT/ROFRecord.h"
32+
#include "ReconstructionDataFormats/Vertex.h"
2133

2234
#include "TTree.h"
2335

@@ -32,14 +44,16 @@ const AxisSpec axisSparseQoverPt{20, -5., 5., "q/p_{T}, 1/GeV"};
3244
const AxisSpec axisSparseDcaR{100, -5., 5., "DCA_{r}, cm"};
3345
const AxisSpec axisSparseDcaZ{100, -5., 5., "DCA_{z}, cm"};
3446

35-
struct MshapeQaTask {
36-
Configurable<double> confTimeBinWidthInSec{"TimeBinWidthInSec", 0.1, "Width of time bins in seconds"};
47+
struct TimeDependentQaTask {
48+
Configurable<double> confTimeBinWidthInSec{"TimeBinWidthInSec", 0.25, "Width of time bins in seconds"}; // o2-linter: disable=name/configurable
49+
Configurable<int> confTakeVerticesWithUPCsettings{"ConsiderVerticesWithUPCsettings", 0, "Take vertices: 0 - all , 1 - only without UPC settings, 2 - only with UPC settings"}; // o2-linter: disable=name/configurable
3750
Service<o2::ccdb::BasicCCDBManager> ccdb;
3851
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
3952
o2::tpc::TPCMShapeCorrection mshape; // object for simple access
4053
int lastRunNumber = -1;
4154
double maxSec = 1;
4255
double minSec = 0;
56+
ctpRateFetcher mRateFetcher;
4357
void init(InitContext&)
4458
{
4559
ccdb->setURL("http://alice-ccdb.cern.ch");
@@ -64,7 +78,10 @@ struct MshapeQaTask {
6478
maxSec = ceil(grpecs->getTimeEnd() / 1000.);
6579
int nTimeBins = static_cast<int>((maxSec - minSec) / confTimeBinWidthInSec);
6680
double timeInterval = nTimeBins * confTimeBinWidthInSec;
81+
6782
const AxisSpec axisSeconds{nTimeBins, 0, timeInterval, "seconds"};
83+
histos.add("hSecondsCollisions", "", kTH1F, {axisSeconds});
84+
6885
histos.add("hSecondsAsideQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt});
6986
histos.add("hSecondsAsideQoverPtSumDcaZ", "", kTH2F, {axisSeconds, axisSparseQoverPt});
7087
histos.add("hSecondsCsideQoverPtSumDcaR", "", kTH2F, {axisSeconds, axisSparseQoverPt});
@@ -80,11 +97,40 @@ struct MshapeQaTask {
8097
histos.add("hSecondsSumDcaZ", "", kTH1F, {axisSeconds});
8198
histos.add("hSecondsTracks", "", kTH1F, {axisSeconds});
8299
histos.add("hSecondsTracksMshape", "", kTH1F, {axisSeconds});
100+
83101
histos.add("hSecondsAsideITSTPCcontrib", "", kTH1F, {axisSeconds});
84102
histos.add("hSecondsCsideITSTPCcontrib", "", kTH1F, {axisSeconds});
85-
histos.add("hSecondsCollisions", "", kTH1F, {axisSeconds});
103+
histos.add("hSecondsIR", "", kTH1F, {axisSeconds});
104+
105+
// QA for UPC settings
106+
histos.add("hSecondsUPCvertices", "", kTH2F, {axisSeconds, {2, -0.5, 1.5, "Is vertex with UPC settings"}});
107+
108+
// QA for global tracks
109+
const AxisSpec axisChi2{40, 0., 20., "chi2/ndof"};
110+
const AxisSpec axisNclsITS{10, -0.5, 9.5, "n ITS cls"};
111+
const AxisSpec axisNclsTPC{40, -0.5, 159.5, "n TPC cls"};
112+
const AxisSpec axisFraction{40, 0, 1., "Fraction shared cls Tpc"};
113+
114+
histos.add("hSecondsAsideNumTracksGlobal", "", kTH1F, {axisSeconds});
115+
histos.add("hSecondsAsideSumDcaRglobal", "", kTH1F, {axisSeconds});
116+
histos.add("hSecondsAsideSumDcaZglobal", "", kTH1F, {axisSeconds});
117+
histos.add("hSecondsAsideNumClsItsGlobal", "", kTH2F, {axisSeconds, axisNclsITS});
118+
histos.add("hSecondsAsideChi2NClItsGlobal", "", kTH2F, {axisSeconds, axisChi2});
119+
histos.add("hSecondsAsideNumClsTpcGlobal", "", kTH2F, {axisSeconds, axisNclsTPC});
120+
histos.add("hSecondsAsideChi2NClTpcGlobal", "", kTH2F, {axisSeconds, axisChi2});
121+
histos.add("hSecondsAsideTpcFractionSharedClsGlobal_nTPCclsCut80", "", kTH2F, {axisSeconds, axisFraction});
86122

87-
const AxisSpec axisPhi{64, 0, TMath::TwoPi(), "#varphi"};
123+
histos.add("hSecondsCsideNumTracksGlobal", "", kTH1F, {axisSeconds});
124+
histos.add("hSecondsCsideSumDcaRglobal", "", kTH1F, {axisSeconds});
125+
histos.add("hSecondsCsideSumDcaZglobal", "", kTH1F, {axisSeconds});
126+
histos.add("hSecondsCsideNumClsItsGlobal", "", kTH2F, {axisSeconds, axisNclsITS});
127+
histos.add("hSecondsCsideChi2NClItsGlobal", "", kTH2F, {axisSeconds, axisChi2});
128+
histos.add("hSecondsCsideNumClsTpcGlobal", "", kTH2F, {axisSeconds, axisNclsTPC});
129+
histos.add("hSecondsCsideChi2NClTpcGlobal", "", kTH2F, {axisSeconds, axisChi2});
130+
histos.add("hSecondsCsideTpcFractionSharedClsGlobal_nTPCclsCut80", "", kTH2F, {axisSeconds, axisFraction});
131+
132+
const AxisSpec axisPhi{64, 0, TMath::TwoPi(), "#varphi"}; // o2-linter: disable=external-pi
133+
const AxisSpec axisEta{10, -0.8, 0.8, "#eta"};
88134
histos.add("hSecondsITSlayer0vsPhi", "", kTH2F, {axisSeconds, axisPhi});
89135
histos.add("hSecondsITSlayer1vsPhi", "", kTH2F, {axisSeconds, axisPhi});
90136
histos.add("hSecondsITSlayer2vsPhi", "", kTH2F, {axisSeconds, axisPhi});
@@ -96,24 +142,47 @@ struct MshapeQaTask {
96142
histos.add("hSecondsITSglobalVsPhi", "", kTH2F, {axisSeconds, axisPhi});
97143
histos.add("hSecondsITSTRDVsPhi", "", kTH2F, {axisSeconds, axisPhi});
98144
histos.add("hSecondsITSTOFVsPhi", "", kTH2F, {axisSeconds, axisPhi});
145+
histos.add("hSecondsITSglobalVsEtaPhi", "", kTH3F, {axisSeconds, axisEta, axisPhi});
146+
}
147+
148+
auto bc = col.bc_as<BCsRun3>();
149+
int64_t ts = bc.timestamp();
150+
double secFromSOR = ts / 1000. - minSec;
151+
152+
// check if a vertex is found in the UPC mode ITS ROF, flags from: https://github.com/AliceO2Group/AliceO2/blob/dev/DataFormats/Reconstruction/include/ReconstructionDataFormats/Vertex.h
153+
ushort flags = col.flags();
154+
bool isVertexUPC = flags & dataformats::Vertex<o2::dataformats::TimeStamp<int>>::Flags::UPCMode; // is vertex with UPC settings
155+
histos.fill(HIST("hSecondsUPCvertices"), secFromSOR, isVertexUPC ? 1 : 0);
156+
157+
if (confTakeVerticesWithUPCsettings > 0) {
158+
if (confTakeVerticesWithUPCsettings == 1 && isVertexUPC) // reject vertices with UPC settings
159+
return;
160+
if (confTakeVerticesWithUPCsettings == 2 && !isVertexUPC) // we want to select vertices with UPC settings --> reject vertices reconstructed with "normal" settings
161+
return;
162+
// LOGP(info, "flags={} nTracks = {}", flags, tracks.size());
99163
}
100164

101-
int64_t ts = col.bc_as<BCsRun3>().timestamp();
165+
histos.fill(HIST("hSecondsCollisions"), secFromSOR);
166+
167+
double hadronicRate = mRateFetcher.fetch(ccdb.service, ts, runNumber, "ZNC hadronic") * 1.e-3; //
168+
histos.fill(HIST("hSecondsIR"), secFromSOR, hadronicRate);
169+
170+
// checking mShape flags in time:
102171
auto mShapeTree = ccdb->getForTimeStamp<TTree>("TPC/Calib/MShapePotential", ts);
103172
mshape.setFromTree(*mShapeTree);
104173
bool isMshape = !mshape.getBoundaryPotential(ts).mPotential.empty();
105174

106-
double secFromSOR = ts / 1000. - minSec;
107-
108175
int nAsideITSTPCContrib = 0;
109176
int nCsideITSTPCContrib = 0;
110177
for (const auto& track : tracks) {
111178
if (!track.hasTPC() || !track.hasITS()) {
112179
continue;
113180
}
181+
114182
float qpt = track.signed1Pt();
115183
float dcaR = track.dcaXY();
116184
float dcaZ = track.dcaZ();
185+
117186
LOGP(debug, "dcaR = {} dcaZ = {}", dcaR, dcaZ);
118187
histos.fill(HIST("hQoverPt"), qpt);
119188
histos.fill(HIST("hDcaR"), dcaR);
@@ -124,7 +193,9 @@ struct MshapeQaTask {
124193
histos.fill(HIST("hSecondsSumDcaZ"), secFromSOR, dcaZ);
125194
histos.fill(HIST("hSecondsQoverPtSumDcaR"), secFromSOR, qpt, dcaR);
126195
histos.fill(HIST("hSecondsQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ);
196+
127197
histos.fill(HIST("hSecondsTracks"), secFromSOR);
198+
128199
if (track.tgl() > 0.) {
129200
histos.fill(HIST("hSecondsAsideQoverPtSumDcaR"), secFromSOR, qpt, dcaR);
130201
histos.fill(HIST("hSecondsAsideQoverPtSumDcaZ"), secFromSOR, qpt, dcaZ);
@@ -140,6 +211,31 @@ struct MshapeQaTask {
140211
if (isMshape) {
141212
histos.fill(HIST("hSecondsTracksMshape"), secFromSOR);
142213
}
214+
215+
if (track.hasTPC() && track.hasITS() && std::fabs(track.eta()) < 0.8 && std::fabs(track.pt()) > 0.2) {
216+
if (track.tgl() > 0.) {
217+
histos.fill(HIST("hSecondsAsideNumTracksGlobal"), secFromSOR);
218+
histos.fill(HIST("hSecondsAsideSumDcaRglobal"), secFromSOR, dcaR);
219+
histos.fill(HIST("hSecondsAsideSumDcaZglobal"), secFromSOR, dcaZ);
220+
histos.fill(HIST("hSecondsAsideNumClsItsGlobal"), secFromSOR, track.itsNCls());
221+
histos.fill(HIST("hSecondsAsideChi2NClItsGlobal"), secFromSOR, track.itsChi2NCl());
222+
histos.fill(HIST("hSecondsAsideNumClsTpcGlobal"), secFromSOR, track.tpcNClsFound());
223+
histos.fill(HIST("hSecondsAsideChi2NClTpcGlobal"), secFromSOR, track.tpcChi2NCl());
224+
if (track.tpcNClsFound() >= 80)
225+
histos.fill(HIST("hSecondsAsideTpcFractionSharedClsGlobal_nTPCclsCut80"), secFromSOR, track.tpcFractionSharedCls());
226+
} else {
227+
histos.fill(HIST("hSecondsCsideNumTracksGlobal"), secFromSOR);
228+
histos.fill(HIST("hSecondsCsideSumDcaRglobal"), secFromSOR, dcaR);
229+
histos.fill(HIST("hSecondsCsideSumDcaZglobal"), secFromSOR, dcaZ);
230+
histos.fill(HIST("hSecondsCsideNumClsItsGlobal"), secFromSOR, track.itsNCls());
231+
histos.fill(HIST("hSecondsCsideChi2NClItsGlobal"), secFromSOR, track.itsChi2NCl());
232+
histos.fill(HIST("hSecondsCsideNumClsTpcGlobal"), secFromSOR, track.tpcNClsFound());
233+
histos.fill(HIST("hSecondsCsideChi2NClTpcGlobal"), secFromSOR, track.tpcChi2NCl());
234+
if (track.tpcNClsFound() >= 80)
235+
histos.fill(HIST("hSecondsCsideTpcFractionSharedClsGlobal_nTPCclsCut80"), secFromSOR, track.tpcFractionSharedCls());
236+
}
237+
} // end of ITS+TPC tracks
238+
143239
if (track.isPVContributor()) {
144240
if (track.tgl() > 0.) {
145241
nAsideITSTPCContrib++;
@@ -168,15 +264,16 @@ struct MshapeQaTask {
168264
histos.fill(HIST("hSecondsITSlayer6vsPhi"), secFromSOR, track.phi());
169265
if (track.itsNCls() == 7)
170266
histos.fill(HIST("hSecondsITS7clsVsPhi"), secFromSOR, track.phi());
171-
if (track.hasITS() && track.hasTPC())
267+
if (track.hasITS() && track.hasTPC()) {
172268
histos.fill(HIST("hSecondsITSglobalVsPhi"), secFromSOR, track.phi());
269+
histos.fill(HIST("hSecondsITSglobalVsEtaPhi"), secFromSOR, track.eta(), track.phi());
270+
}
173271
if (track.hasTRD())
174272
histos.fill(HIST("hSecondsITSTRDVsPhi"), secFromSOR, track.phi());
175273
if (track.hasTOF())
176274
histos.fill(HIST("hSecondsITSTOFVsPhi"), secFromSOR, track.phi());
177275
}
178276
}
179-
histos.fill(HIST("hSecondsCollisions"), secFromSOR);
180277
histos.fill(HIST("hSecondsAsideITSTPCcontrib"), secFromSOR, nAsideITSTPCContrib);
181278
histos.fill(HIST("hSecondsCsideITSTPCcontrib"), secFromSOR, nCsideITSTPCContrib);
182279
}
@@ -185,5 +282,5 @@ struct MshapeQaTask {
185282
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
186283
{
187284
return WorkflowSpec{
188-
adaptAnalysisTask<MshapeQaTask>(cfgc)};
285+
adaptAnalysisTask<TimeDependentQaTask>(cfgc)};
189286
}

0 commit comments

Comments
 (0)