Skip to content

Commit 28ab351

Browse files
committed
[DPG] Add task for split tracks
1 parent c9ab87e commit 28ab351

2 files changed

Lines changed: 124 additions & 0 deletions

File tree

DPG/Tasks/AOTTrack/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ o2physics_add_dpl_workflow(qa-prim-vtx-vs-time
7070
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
7171
COMPONENT_NAME Analysis)
7272

73+
o2physics_add_dpl_workflow(qa-tracksplitting
74+
SOURCES qaTrackSplitting.cxx
75+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
76+
COMPONENT_NAME Analysis)
77+
7378
o2physics_add_dpl_workflow(tag-and-probe-dmesons
7479
SOURCES tagAndProbeDmesons.cxx
7580
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2::DetectorsVertexing
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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+
///
13+
/// \file qaTrackSplitting.cxx
14+
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
15+
/// \brief Task to analyse the numbers of particles reconstructed more than once
16+
///
17+
18+
#include "Framework/AnalysisTask.h"
19+
#include "Framework/runDataProcessing.h"
20+
#include "Framework/HistogramRegistry.h"
21+
#include "Common/DataModel/EventSelection.h"
22+
#include "Common/Core/TrackSelectionDefaults.h"
23+
#include "Common/DataModel/TrackSelectionTables.h"
24+
25+
using namespace o2::framework;
26+
27+
struct qaTrackSplitting {
28+
Configurable<int> pdg{"pdg", 2212, "PDG code of the particle to be analysed"};
29+
struct : ConfigurableGroup {
30+
Configurable<bool> enableTrackCuts{"enableTrackCuts", false, "Enable the custom track cuts"};
31+
Configurable<int> itsPattern{"itsPattern", 0, "0 = Run3ITSibAny, 1 = Run3ITSallAny, 2 = Run3ITSall7Layers, 3 = Run3ITSibTwo"};
32+
Configurable<bool> requireITS{"requireITS", true, "Additional cut on the ITS requirement"};
33+
Configurable<bool> requireTPC{"requireTPC", true, "Additional cut on the TPC requirement"};
34+
Configurable<bool> requireGoldenChi2{"requireGoldenChi2", true, "Additional cut on the GoldenChi2"};
35+
Configurable<int> minITScl{"minITScl", 4, "Additional cut on the ITS cluster"};
36+
Configurable<float> minNCrossedRowsTPC{"minNCrossedRowsTPC", 70.f, "Additional cut on the minimum number of crossed rows in the TPC"};
37+
Configurable<float> minNCrossedRowsOverFindableClustersTPC{"minNCrossedRowsOverFindableClustersTPC", 0.8f, "Additional cut on the minimum value of the ratio between crossed rows and findable clusters in the TPC"};
38+
Configurable<float> maxChi2PerClusterTPC{"maxChi2PerClusterTPC", 4.f, "Additional cut on the maximum value of the chi2 per cluster in the TPC"};
39+
Configurable<float> maxChi2PerClusterITS{"maxChi2PerClusterITS", 36.f, "Additional cut on the maximum value of the chi2 per cluster in the ITS"};
40+
Configurable<float> maxDcaXY{"maxDcaXY", 10000.f, "Additional cut on the maximum abs value of the DCA xy"};
41+
Configurable<float> maxDcaZ{"maxDcaZ", 2.f, "Additional cut on the maximum abs value of the DCA z"};
42+
Configurable<float> minTPCNClsFound{"minTPCNClsFound", 0.f, "Additional cut on the minimum value of the number of found clusters in the TPC"};
43+
} cfgCustomTrackCuts;
44+
45+
// Histograms
46+
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
47+
TrackSelection customTrackCuts;
48+
49+
void init(InitContext&)
50+
{
51+
histos.add("tracks", "tracsk", kTH1D, {{10, -0.5, 9.5, "Track selection"}});
52+
histos.add("numberOfRecoed", "recoed", kTH1D, {{10, -0.5, 9.5, "Number of tracks associated to a particle"}});
53+
histos.add("map", "map", kTH3D, {{100, -1, 1, "#Delta #eta"}, {100, -1, 1, "#Delta #varphi"}, {100, -1, 1, "#Delta #it{p}_{T}"}});
54+
55+
customTrackCuts = getGlobalTrackSelectionRun3ITSMatch(cfgCustomTrackCuts.itsPattern);
56+
LOG(info) << "Customizing track cuts:";
57+
customTrackCuts.SetRequireITSRefit(cfgCustomTrackCuts.requireITS);
58+
customTrackCuts.SetRequireTPCRefit(cfgCustomTrackCuts.requireTPC);
59+
customTrackCuts.SetRequireGoldenChi2(cfgCustomTrackCuts.requireGoldenChi2);
60+
customTrackCuts.SetRequireHitsInITSLayers(cfgCustomTrackCuts.minITScl.value, {0, 1, 2, 3, 4, 5, 6});
61+
customTrackCuts.SetMaxChi2PerClusterTPC(cfgCustomTrackCuts.maxChi2PerClusterTPC);
62+
customTrackCuts.SetMaxChi2PerClusterITS(cfgCustomTrackCuts.maxChi2PerClusterITS);
63+
customTrackCuts.SetMinNCrossedRowsTPC(cfgCustomTrackCuts.minNCrossedRowsTPC);
64+
customTrackCuts.SetMinNClustersTPC(cfgCustomTrackCuts.minTPCNClsFound);
65+
customTrackCuts.SetMinNCrossedRowsOverFindableClustersTPC(cfgCustomTrackCuts.minNCrossedRowsOverFindableClustersTPC);
66+
customTrackCuts.SetMaxDcaXYPtDep([&](float /*pt*/) { return cfgCustomTrackCuts.maxDcaXY; }); // No DCAxy cut will be used, this is done via the member function of the task
67+
customTrackCuts.SetMaxDcaZ(cfgCustomTrackCuts.maxDcaZ);
68+
customTrackCuts.print();
69+
}
70+
71+
// Global process
72+
using TrackCandidates = o2::soa::Join<o2::aod::Tracks, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::McTrackLabels>;
73+
void process(o2::soa::Join<o2::aod::Collisions, o2::aod::McCollisionLabels, o2::aod::EvSels>::iterator const& collision,
74+
TrackCandidates const& tracks,
75+
o2::aod::McParticles const&)
76+
{
77+
if (!collision.sel8()) {
78+
return;
79+
}
80+
typedef std::shared_ptr<TrackCandidates::iterator> trkType;
81+
82+
std::map<int64_t, std::vector<trkType>> particleUsageCounter;
83+
for (auto track : tracks) {
84+
histos.fill(HIST("tracks"), 0);
85+
if (!track.has_mcParticle()) {
86+
continue;
87+
}
88+
histos.fill(HIST("tracks"), 1);
89+
if (track.mcParticle().pdgCode() != pdg) {
90+
continue;
91+
}
92+
histos.fill(HIST("tracks"), 2);
93+
if (!track.mcParticle().isPhysicalPrimary()) {
94+
continue;
95+
}
96+
histos.fill(HIST("tracks"), 3);
97+
if (cfgCustomTrackCuts.enableTrackCuts.value && !customTrackCuts.IsSelected(track)) {
98+
continue;
99+
}
100+
histos.fill(HIST("tracks"), 4);
101+
particleUsageCounter[track.mcParticleId()].push_back(std::make_shared<decltype(track)>(track));
102+
}
103+
for (const auto& [mcId, tracks] : particleUsageCounter) {
104+
histos.fill(HIST("numberOfRecoed"), tracks.size());
105+
if (tracks.size() > 1) {
106+
bool isFirst = true;
107+
for (const auto& track : tracks) {
108+
if (isFirst) {
109+
isFirst = false;
110+
continue;
111+
}
112+
histos.fill(HIST("map"), track->eta() - tracks[0]->eta(), track->phi() - tracks[0]->phi(), track->pt() - tracks[0]->pt());
113+
}
114+
}
115+
}
116+
}
117+
};
118+
119+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc) { return WorkflowSpec{adaptAnalysisTask<qaTrackSplitting>(cfgc)}; }

0 commit comments

Comments
 (0)