forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIOUtils.h
More file actions
122 lines (107 loc) · 4.37 KB
/
IOUtils.h
File metadata and controls
122 lines (107 loc) · 4.37 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// 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.
///
/// \file IOUtils.h
/// \brief
///
#ifndef TRACKINGITSU_INCLUDE_EVENTLOADER_H_
#define TRACKINGITSU_INCLUDE_EVENTLOADER_H_
#include <iosfwd>
#include <string>
#include <unordered_map>
#include <vector>
#include "DataFormatsITSMFT/ROFRecord.h"
#include "ITStracking/Configuration.h"
#include "ITStracking/ROframe.h"
#include "ITStracking/Label.h"
#include "ITStracking/Road.h"
#include "ITStracking/TrackingConfigParam.h"
#include "ITSMFTBase/SegmentationAlpide.h"
#include "ReconstructionDataFormats/BaseCluster.h"
#include "ITSMFTReconstruction/ChipMappingITS.h"
#include "DataFormatsITSMFT/CompCluster.h"
#include "DataFormatsITSMFT/TopologyDictionary.h"
namespace o2
{
class MCCompLabel;
namespace dataformats
{
template <typename T>
class MCTruthContainer;
}
namespace its
{
namespace ioutils
{
constexpr float DefClusErrorRow = o2::itsmft::SegmentationAlpide::PitchRow * 0.5;
constexpr float DefClusErrorCol = o2::itsmft::SegmentationAlpide::PitchCol * 0.5;
constexpr float DefClusError2Row = DefClusErrorRow * DefClusErrorRow;
constexpr float DefClusError2Col = DefClusErrorCol * DefClusErrorCol;
void loadEventData(ROframe& events, gsl::span<const itsmft::CompClusterExt> clusters,
gsl::span<const unsigned char>::iterator& pattIt, const itsmft::TopologyDictionary* dict,
const dataformats::MCTruthContainer<MCCompLabel>* clsLabels = nullptr);
int loadROFrameData(const o2::itsmft::ROFRecord& rof, ROframe& events, gsl::span<const itsmft::CompClusterExt> clusters,
gsl::span<const unsigned char>::iterator& pattIt, const itsmft::TopologyDictionary* dict,
const dataformats::MCTruthContainer<MCCompLabel>* mClsLabels = nullptr);
void convertCompactClusters(gsl::span<const itsmft::CompClusterExt> clusters,
gsl::span<const unsigned char>::iterator& pattIt,
std::vector<o2::BaseCluster<float>>& output,
const itsmft::TopologyDictionary* dict);
inline static const o2::itsmft::ChipMappingITS& getChipMappingITS()
{
static const o2::itsmft::ChipMappingITS MP;
return MP;
}
template <class iterator, typename T>
o2::math_utils::Point3D<T> extractClusterData(const itsmft::CompClusterExt& c, iterator& iter, const itsmft::TopologyDictionary* dict, T& sig2y, T& sig2z)
{
auto pattID = c.getPatternID();
sig2y = ioutils::DefClusError2Row;
sig2z = ioutils::DefClusError2Col; // Dummy COG errors (about half pixel size)
if (pattID != itsmft::CompCluster::InvalidPatternID) {
sig2y = dict->getErr2X(pattID);
sig2z = dict->getErr2Z(pattID);
if (!dict->isGroup(pattID)) {
return dict->getClusterCoordinates<T>(c);
} else {
o2::itsmft::ClusterPattern patt(iter);
return dict->getClusterCoordinates<T>(c, patt);
}
} else {
o2::itsmft::ClusterPattern patt(iter);
return dict->getClusterCoordinates<T>(c, patt, false);
}
}
// same method returning coordinates as an array (suitable for the TGeoMatrix)
template <class iterator, typename T>
std::array<T, 3> extractClusterDataA(const itsmft::CompClusterExt& c, iterator& iter, const itsmft::TopologyDictionary* dict, T& sig2y, T& sig2z)
{
auto pattID = c.getPatternID();
sig2y = ioutils::DefClusError2Row;
sig2z = ioutils::DefClusError2Col; // Dummy COG errors (about half pixel size)
if (pattID != itsmft::CompCluster::InvalidPatternID) {
sig2y = dict->getErr2X(pattID);
sig2z = dict->getErr2Z(pattID);
if (!dict->isGroup(pattID)) {
return dict->getClusterCoordinatesA<T>(c);
} else {
o2::itsmft::ClusterPattern patt(iter);
return dict->getClusterCoordinatesA<T>(c, patt);
}
} else {
o2::itsmft::ClusterPattern patt(iter);
return dict->getClusterCoordinatesA<T>(c, patt, false);
}
}
} // namespace ioutils
} // namespace its
} // namespace o2
#endif /* TRACKINGITSU_INCLUDE_EVENTLOADER_H_ */