Skip to content

Commit 2182f53

Browse files
shahor02sawenzel
authored andcommitted
Aggregated track container + global index with more provenance enums
1 parent 754c370 commit 2182f53

7 files changed

Lines changed: 145 additions & 3 deletions

File tree

DataFormats/Reconstruction/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ o2_add_library(ReconstructionDataFormats
2121
src/PID.cxx
2222
src/DCA.cxx
2323
src/V0.cxx
24+
src/GlobalTrackID.cxx
2425
src/VtxTrackIndex.cxx
2526
src/VtxTrackRef.cxx
2627
PUBLIC_LINK_LIBRARIES O2::GPUCommon
@@ -41,6 +42,7 @@ o2_target_root_dictionary(
4142
include/ReconstructionDataFormats/PID.h
4243
include/ReconstructionDataFormats/DCA.h
4344
include/ReconstructionDataFormats/V0.h
45+
include/ReconstructionDataFormats/GlobalTrackID.h
4446
include/ReconstructionDataFormats/VtxTrackIndex.h
4547
include/ReconstructionDataFormats/VtxTrackRef.h)
4648

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// @file GlobalTrackAccessor.h
12+
/// \brief Accessor for TrackParCov derived objects from multiple containers
13+
/// \author ruben.shahoyan@cern.ch
14+
15+
#ifndef O2_GLOBAL_TRACK_ACCESSOR
16+
#define O2_GLOBAL_TRACK_ACCESSOR
17+
18+
#include "ReconstructionDataFormats/Track.h"
19+
#include "ReconstructionDataFormats/GlobalTrackID.h"
20+
#include "CommonDataFormat/AbstractRefAccessor.h"
21+
22+
namespace o2
23+
{
24+
namespace dataformats
25+
{
26+
using GlobalTrackAccessor = AbstractRefAccessor<o2::track::TrackParCov, GlobalTrackID::NSources>;
27+
}
28+
} // namespace o2
29+
30+
#endif
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// @file GlobalTrackID.h
12+
/// \brief Global index for barrel track: provides provenance (detectors combination), index in respective array and some number of bits
13+
/// \author ruben.shahoyan@cern.ch
14+
15+
#ifndef O2_GLOBAL_TRACK_ID
16+
#define O2_GLOBAL_TRACK_ID
17+
18+
#include "CommonDataFormat/AbstractRef.h"
19+
#include <iosfwd>
20+
#include <string>
21+
#include <array>
22+
#include <string_view>
23+
24+
namespace o2
25+
{
26+
namespace dataformats
27+
{
28+
29+
class GlobalTrackID : public AbstractRef<25, 4, 3>
30+
{
31+
public:
32+
enum Source : uint8_t { // provenance of the
33+
ITS,
34+
TPC,
35+
TRD, // standalone tracks
36+
ITSTPC,
37+
TPCTOF,
38+
TPCTRD, // 2-detector tracks
39+
ITSTPCTRD,
40+
ITSTPCTOF,
41+
TPCTRDTOF, // 3-detector tracks
42+
ITSTPCTRDTOF, // full barrel track
43+
NSources
44+
};
45+
static constexpr std::array<std::string_view, NSources> SourceNames = {
46+
"ITS", "TPC", "TRD", // standalone tracks
47+
"ITSTPC", "TPCTOF", "TPCTRD", // 2-detector tracks
48+
"ITSTPCTRD", "ITSTPCTOF", "TPCTRDTOF", // 3-detector tracks
49+
"ITSTPCTRDTOF" // full barrel track
50+
};
51+
52+
using AbstractRef<25, 4, 3>::AbstractRef;
53+
54+
static constexpr std::string_view getSourceName(int i) { return SourceNames[i]; }
55+
void print() const;
56+
std::string asString() const;
57+
58+
operator auto() const { return AbstractRef<25, 4, 3>(); }
59+
60+
ClassDefNV(GlobalTrackID, 1);
61+
};
62+
63+
std::ostream& operator<<(std::ostream& os, const o2::dataformats::GlobalTrackID& v);
64+
65+
} // namespace dataformats
66+
} // namespace o2
67+
68+
#endif
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// @file GlobalTrackID.cxx
12+
/// \brief Global index for barrel track: provides provenance (detectors combination), index in respective array and some number of bits
13+
/// \author ruben.shahoyan@cern.ch
14+
15+
#include "ReconstructionDataFormats/GlobalTrackID.h"
16+
#include "Framework/Logger.h"
17+
#include <fmt/printf.h>
18+
#include <iostream>
19+
#include <bitset>
20+
21+
using namespace o2::dataformats;
22+
23+
std::string GlobalTrackID::asString() const
24+
{
25+
std::bitset<NBitsFlags()> bits{getFlags()};
26+
return fmt::format("[{:d}/{:d}/{:s}]", getIndex(), getSource(), bits.to_string());
27+
}
28+
29+
std::ostream& o2::dataformats::operator<<(std::ostream& os, const o2::dataformats::GlobalTrackID& v)
30+
{
31+
// stream itself
32+
os << v.asString();
33+
return os;
34+
}
35+
36+
void GlobalTrackID::print() const
37+
{
38+
LOG(INFO) << asString();
39+
}

DataFormats/Reconstruction/src/ReconstructionDataFormatsLinkDef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@
4545
#pragma link C++ class std::vector < o2::dataformats::Vertex < o2::dataformats::TimeStampWithError < float, float>>> + ;
4646
#pragma link C++ class std::vector < o2::dataformats::PrimaryVertex> + ;
4747

48+
#pragma link C++ class o2::dataformats::GlobalTrackID + ;
49+
#pragma link C++ class std::vector < o2::dataformats::GlobalTrackID> + ;
50+
4851
#pragma link C++ class o2::dataformats::VtxTrackIndex + ;
4952
#pragma link C++ class std::vector < o2::dataformats::VtxTrackIndex> + ;
5053

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
581581
vCollRefsTPC[trackIndex.getIndex()] = collisionID;
582582
} else if (source == o2::vertexing::GIndex::Source::ITS) {
583583
vCollRefsITS[trackIndex.getIndex()] = collisionID;
584-
} else if (source == o2::vertexing::GIndex::Source::TPCITS) {
584+
} else if (source == o2::vertexing::GIndex::Source::ITSTPC) {
585585
vCollRefsTPCITS[trackIndex.getIndex()] = collisionID;
586586
} else {
587587
LOG(WARNING) << "Unsupported track type!";
@@ -648,7 +648,7 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
648648
}
649649

650650
if (mFillTracksITSTPC) {
651-
fillTracksTable(tracksITSTPC, vCollRefsTPCITS, tracksCursor, o2::vertexing::GIndex::Source::TPCITS); // fTrackType = 0
651+
fillTracksTable(tracksITSTPC, vCollRefsTPCITS, tracksCursor, o2::vertexing::GIndex::Source::ITSTPC); // fTrackType = 0
652652
for (int i = 0; i < tracksITSTPC.size(); i++) {
653653
auto& mcTruthITS = tracksITSTPC_ITSMC[i];
654654
auto& mcTruthTPC = tracksITSTPC_TPCMC[i];

Detectors/AOD/src/StandaloneAODProducer.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void fillCollisionAndTrackTable()
169169
track = &((*tpctracks)[trackindex.getIndex()]);
170170
} else if (source == o2::dataformats::VtxTrackIndex::Source::ITS) {
171171
track = &((*itstracks)[trackindex.getIndex()]);
172-
} else if (source == o2::dataformats::VtxTrackIndex::Source::TPCITS) {
172+
} else if (source == o2::dataformats::VtxTrackIndex::Source::ITSTPC) {
173173
track = &((*itstpctracks)[trackindex.getIndex()]);
174174
} else {
175175
LOG(WARNING) << "Unsupported track source";

0 commit comments

Comments
 (0)