Skip to content

Commit 21c615b

Browse files
authored
Add files via upload
1 parent 180568f commit 21c615b

File tree

1 file changed

+144
-0
lines changed

1 file changed

+144
-0
lines changed

Common/LegacyDataQA/pmdQa.cxx

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \file pmdqa.cxx
13+
///
14+
/// \brief QA task to check PMD info on Run 2 converted data
15+
/// \author Abhi Modak (abhi.modak@cern.ch)
16+
/// \since February 19, 2025
17+
18+
#include <cstdlib>
19+
#include <cmath>
20+
#include <vector>
21+
22+
#include "Framework/runDataProcessing.h"
23+
#include "Framework/AnalysisTask.h"
24+
#include "Framework/ASoA.h"
25+
#include "Framework/AnalysisDataModel.h"
26+
#include "Common/DataModel/EventSelection.h"
27+
#include "Framework/O2DatabasePDGPlugin.h"
28+
#include "CCDB/BasicCCDBManager.h"
29+
#include "TH1F.h"
30+
#include "TH2F.h"
31+
32+
using namespace o2;
33+
using namespace o2::aod::run2;
34+
using namespace o2::framework;
35+
using namespace o2::aod::evsel;
36+
using namespace o2::framework::expressions;
37+
38+
namespace o2::aod
39+
{
40+
namespace pmdtrack
41+
{
42+
DECLARE_SOA_INDEX_COLUMN(Collision, collision);
43+
DECLARE_SOA_ARRAY_INDEX_COLUMN(Collision, collisions);
44+
DECLARE_SOA_INDEX_COLUMN(BC, bc);
45+
DECLARE_SOA_SLICE_INDEX_COLUMN(Pmd, pmd);
46+
} // namespace pmdtrack
47+
48+
DECLARE_SOA_INDEX_TABLE_USER(PMDTracksIndex, BCs, "PMDTRKIDX", pmdtrack::CollisionId, pmdtrack::BCId, pmdtrack::PmdIdSlice);
49+
} // namespace o2::aod
50+
51+
struct BuiltPmdIndex {
52+
// build the index table PMDTracksIndex
53+
Builds<aod::PMDTracksIndex> idx;
54+
void init(InitContext const&) {}
55+
};
56+
57+
struct PmdQa {
58+
59+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
60+
ConfigurableAxis axisEventBin{"axisEventBin", {4, 0.5, 4.5}, ""};
61+
ConfigurableAxis axisVtxZBin{"axisVtxZBin", {40, -20, 20}, ""};
62+
ConfigurableAxis axisNPMDtracksBin{"axisNPMDtracksBin", {500, 0, 500}, "Number of pmdtracks"};
63+
ConfigurableAxis axisClsxyBin{"axisClsxyBin", {200, -100, 100}, ""};
64+
ConfigurableAxis axisAdcBin{"axisAdcBin", {200, 0, 2000}, ""};
65+
ConfigurableAxis axisEtaBin{"axisEtaBin", {10, 2.1, 4.1}, ""};
66+
ConfigurableAxis axisNcellBin{"axisNcellBin", {50, -0.5, 49.5}, ""};
67+
Configurable<int> fMipCut{"fMipCut", 432, "fMipCut"};
68+
Configurable<int> fNcellCut{"fNcellCut", 2, "fNcellCut"};
69+
Configurable<float> fEtalow{"fEtalow", 2.3, "fEtalow"};
70+
Configurable<float> fEtahigh{"fEtalow", 3.9, "fEtahigh"};
71+
72+
void init(InitContext&)
73+
{
74+
75+
AxisSpec axisEvent = {axisEventBin, "Event", "EventAxis"};
76+
AxisSpec axisVtxZ = {axisVtxZBin, "VtxZ", "VtxZAxis"};
77+
AxisSpec axisNPMDtracks = {axisNPMDtracksBin, "NPMDtracks", "NPMDtracksAxis"};
78+
AxisSpec axisClsxy = {axisClsxyBin, "Clsxy", "ClsxyAxis"};
79+
AxisSpec axisAdc = {axisAdcBin, "Adc", "AdcAxis"};
80+
AxisSpec axisEta = {axisEtaBin, "Eta", "EtaAxis"};
81+
AxisSpec axisNcell = {axisNcellBin, "Ncell", "NcellAxis"};
82+
83+
histos.add("hEventHist", "hEventHist", kTH1F, {axisEvent});
84+
histos.add("hVtxZHist", "hVtxZHist", kTH1F, {axisVtxZ});
85+
histos.add("hNPMDtracks", "Number of pmdtracks", kTH1F, {axisNPMDtracks});
86+
histos.add("hClusXY", "hClusXY", kTH2F, {axisClsxy, axisClsxy});
87+
histos.add("hClusAdc", "hClusAdc", kTH1F, {axisAdc});
88+
histos.add("hetacls", "hetacls", kTH1F, {axisEta});
89+
histos.add("hclsncell", "hclsncell", kTH1F, {axisNcell});
90+
}
91+
92+
using coltable = soa::Join<aod::Collisions, aod::PMDTracksIndex>;
93+
using colevsel = soa::Join<coltable, aod::EvSels>;
94+
95+
void process(colevsel::iterator const& collision, aod::Pmds const&)
96+
{
97+
histos.fill(HIST("hEventHist"), 1);
98+
if (collision.sel7()) {
99+
return;
100+
}
101+
histos.fill(HIST("hEventHist"), 2);
102+
if (std::abs(collision.posZ()) >= 10.) {
103+
return;
104+
}
105+
histos.fill(HIST("hEventHist"), 3);
106+
histos.fill(HIST("hVtxZHist"), collision.posZ());
107+
108+
if (collision.has_pmd()) {
109+
histos.fill(HIST("hEventHist"), 4);
110+
auto tracks = collision.pmd();
111+
histos.fill(HIST("hNPMDtracks"), tracks.size());
112+
for (const auto& track : tracks) {
113+
if (track.pmddet() == 1) {
114+
return;
115+
}
116+
if (track.pmdclsz() == 0) {
117+
return;
118+
}
119+
if (!track.pmdmodule()) {
120+
return;
121+
}
122+
histos.fill(HIST("hClusXY"), track.pmdclsx(), track.pmdclsy());
123+
histos.fill(HIST("hClusAdc"), track.pmdclsadc());
124+
float rdist = TMath::Sqrt(track.pmdclsx() * track.pmdclsx() + track.pmdclsy() * track.pmdclsy());
125+
float theta = TMath::ATan2(rdist, track.pmdclsz());
126+
float etacls = -TMath::Log(TMath::Tan(0.5 * theta));
127+
if (track.pmdclsadc() > fMipCut && track.pmdncell() > fNcellCut) {
128+
if (etacls > fEtalow && etacls < fEtahigh) {
129+
histos.fill(HIST("hetacls"), etacls);
130+
histos.fill(HIST("hclsncell"), track.pmdncell());
131+
}
132+
}
133+
}
134+
}
135+
}
136+
};
137+
138+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
139+
{
140+
return WorkflowSpec{
141+
adaptAnalysisTask<PmdQa>(cfgc),
142+
adaptAnalysisTask<BuiltPmdIndex>(cfgc),
143+
};
144+
}

0 commit comments

Comments
 (0)