Skip to content

Commit b52c7b9

Browse files
authored
Add simple task for strangeness tracking (AliceO2Group#2426)
1 parent fd5fe40 commit b52c7b9

2 files changed

Lines changed: 106 additions & 1 deletion

File tree

PWGLF/Tasks/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,4 +154,10 @@ o2physics_add_dpl_workflow(cascpostprocessing
154154
o2physics_add_dpl_workflow(hstrangecorrelation
155155
SOURCES hStrangeCorrelation.cxx
156156
PUBLIC_LINK_LIBRARIES O2::Framework O2::DetectorsBase O2Physics::AnalysisCore
157-
COMPONENT_NAME Analysis)
157+
COMPONENT_NAME Analysis)
158+
159+
o2physics_add_dpl_workflow(strangenesstracking
160+
SOURCES strangenesstracking.cxx
161+
PUBLIC_LINK_LIBRARIES O2::Framework O2::ReconstructionDataFormats O2Physics::AnalysisCore
162+
COMPONENT_NAME Analysis)
163+
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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+
#include "Framework/AnalysisTask.h"
13+
#include "Framework/AnalysisDataModel.h"
14+
#include "Framework/ASoA.h"
15+
#include "Framework/runDataProcessing.h"
16+
#include "Common/DataModel/TrackSelectionTables.h"
17+
#include "Common/Core/trackUtilities.h"
18+
#include "ReconstructionDataFormats/DCA.h"
19+
20+
using namespace o2;
21+
using namespace o2::framework;
22+
using namespace o2::framework::expressions;
23+
24+
struct StrangenessTrackingTask {
25+
using TracksExt = soa::Join<aod::TracksIU, aod::TracksCovIU, aod::TracksExtra, aod::McTrackLabels>;
26+
27+
Configurable<double> bz{"bz", 50., "magnetic field"};
28+
29+
OutputObj<TH1F> hDCA{"h_DCA"};
30+
31+
float Square(float x) { return x * x; }
32+
33+
void init(InitContext const&)
34+
{
35+
hDCA.setObject(new TH1F("h_dca", "DCA;DCA (cm)", 200, -2., 2.));
36+
}
37+
38+
void processTrackedCascades(aod::Collision const& collision,
39+
aod::TrackedCascades const& trackedCascades, aod::Cascades const& cascades,
40+
aod::V0s const& v0s, TracksExt const& tracks, aod::McParticles const& mcParticles)
41+
{
42+
for (const auto& trackedCascade : trackedCascades) {
43+
auto trackCovTrk = getTrackParCov(trackedCascade.track_as<TracksExt>());
44+
auto primaryVertex = getPrimaryVertex(collision);
45+
// auto covMatrixPV = primaryVertex.getCov();
46+
o2::dataformats::DCA impactParameterTrk;
47+
trackCovTrk.propagateToDCA(primaryVertex, bz, &impactParameterTrk);
48+
49+
hDCA->Fill(impactParameterTrk.getY());
50+
51+
const auto& casc = trackedCascade.cascade();
52+
const auto& bachelor = casc.bachelor_as<TracksExt>();
53+
const auto& v0 = casc.v0();
54+
const auto& ptrack = v0.posTrack_as<TracksExt>();
55+
const auto& ntrack = v0.negTrack_as<TracksExt>();
56+
57+
if (ptrack.mcParticle().has_mothers() && ntrack.mcParticle().has_mothers() &&
58+
ptrack.mcParticle().mothersIds()[0] == ntrack.mcParticle().mothersIds()[0]) {
59+
const auto v0part = ptrack.mcParticle().mothers_as<aod::McParticles>()[0];
60+
if (v0part.has_mothers() && bachelor.mcParticle().has_mothers() &&
61+
v0part.mothersIds()[0] == bachelor.mcParticle().mothersIds()[0])
62+
LOG(debug) << "cascade with PDG code: " << v0part.mothers_as<aod::McParticles>()[0].pdgCode();
63+
}
64+
}
65+
}
66+
PROCESS_SWITCH(StrangenessTrackingTask, processTrackedCascades, "process tracked cascades", true);
67+
68+
void processTrackedV0s(aod::Collision const& collision,
69+
aod::TrackedV0s const& trackedV0s, aod::V0s const& v0s,
70+
TracksExt const& tracks, aod::McParticles const& mcParticles)
71+
{
72+
for (const auto& trackedV0 : trackedV0s) {
73+
const auto& v0 = trackedV0.v0();
74+
v0.posTrack();
75+
v0.negTrack();
76+
}
77+
}
78+
PROCESS_SWITCH(StrangenessTrackingTask, processTrackedV0s, "process tracked V0s", true);
79+
80+
void processTracked3Bodys(aod::Collision const& collision,
81+
aod::Tracked3Bodys const& tracked3Bodys, aod::Decay3Bodys const& decay3Bodys,
82+
TracksExt const& tracks, aod::McParticles const& mcParticles)
83+
{
84+
for (const auto& tracked3Body : tracked3Bodys) {
85+
tracked3Body.itsTrack();
86+
const auto& decay3Body = tracked3Body.decay3Body();
87+
decay3Body.track0();
88+
decay3Body.track1();
89+
decay3Body.track2();
90+
}
91+
}
92+
PROCESS_SWITCH(StrangenessTrackingTask, processTracked3Bodys, "process tracked 3 body decays", true);
93+
};
94+
95+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
96+
{
97+
return WorkflowSpec{
98+
adaptAnalysisTask<StrangenessTrackingTask>(cfgc)};
99+
}

0 commit comments

Comments
 (0)