forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollisionTracksIteration.cxx
More file actions
67 lines (58 loc) · 2.26 KB
/
collisionTracksIteration.cxx
File metadata and controls
67 lines (58 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
///
/// \brief Shows how to loop over collisions and tracks of a data frame.
/// Requires V0s to be filled with. Therefore use
/// o2-analysis-weak-decay-indices --aod-file AO2D.root | o2-analysistutorial-collision-tracks-iteration
/// \author
/// \since
#include "Framework/runDataProcessing.h"
#include "Framework/AnalysisTask.h"
using namespace o2;
using namespace o2::framework;
struct TracksPerCollision {
void process(aod::Collision const& collision, aod::Tracks const& tracks)
{
// `tracks` contains tracks belonging to `collision`
LOGF(info, "Collision index : %d", collision.index());
LOGF(info, "Number of tracks: %d", tracks.size());
// process the tracks of a given collision
for (auto& track : tracks) {
LOGF(info, " track pT = %f GeV/c", track.pt());
}
}
};
struct TracksPerDataframe {
void process(aod::Collisions const& collisions, aod::Tracks const& tracks)
{
// `tracks` contains all tracks of a data frame
LOGF(info, "Number of collisions: %d", collisions.size());
LOGF(info, "Number of tracks : %d", tracks.size());
}
};
struct GroupByCollision {
void process(aod::Collision const& collision, aod::Tracks const& tracks, aod::V0s const& v0s)
{
// `tracks` contains tracks belonging to `collision`
// `v0s` contains V0s belonging to `collision`
LOGF(info, "Collision index : %d", collision.index());
LOGF(info, "Number of tracks: %d", tracks.size());
LOGF(info, "Number of v0s : %d", v0s.size());
}
};
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
{
return WorkflowSpec{
adaptAnalysisTask<TracksPerCollision>(cfgc),
adaptAnalysisTask<TracksPerDataframe>(cfgc),
adaptAnalysisTask<GroupByCollision>(cfgc),
};
}