23#include <unordered_set>
36constexpr int PrimaryVertexLayerId{-1};
37constexpr int EventLabelsSeparator{-1};
50 gsl::span<const unsigned char>::iterator& pattIt,
55 bool applyMisalignment =
false;
57 const auto& chmap = getChipMappingITS();
58 for (
int il = 0; il < chmap.NLayers; il++) {
59 if (conf.sysErrY2[il] > 0.f || conf.sysErrZ2[il] > 0.f) {
60 applyMisalignment =
true;
66 float sigmaY2, sigmaZ2, sigmaYZ = 0;
69 if (applyMisalignment) {
70 auto lrID = chmap.getLayer(
c.getSensorID());
71 sigmaY2 += conf.sysErrY2[lrID];
72 sigmaZ2 += conf.sysErrZ2[lrID];
74 cl3d.setErrors(sigmaY2, sigmaZ2, sigmaYZ);
83 std::cerr <<
"Missing clusters." << std::endl;
93 float sigmaY2, sigmaZ2, sigmaYZ = 0;
95 auto sensorID =
c.getSensorID();
101 event.addTrackingFrameInfoToLayer(
layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), trkXYZ.x(), geom->
getSensorRefAlpha(sensorID),
102 std::array<float, 2>{trkXYZ.y(), trkXYZ.z()},
103 std::array<float, 3>{sigmaY2, sigmaYZ, sigmaZ2});
106 event.addClusterToLayer(
layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(),
event.getClustersOnLayer(
layer).size());
109 event.setMClabelsContainer(clsLabels);
111 event.addClusterExternalIndexToLayer(
layer, clusterId);
126 for (
auto&
c : clusters_in_frame) {
128 float sigmaY2, sigmaZ2, sigmaYZ = 0;
130 auto sensorID =
c.getSensorID();
136 event.addTrackingFrameInfoToLayer(
layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), trkXYZ.x(), geom->
getSensorRefAlpha(sensorID),
137 std::array<float, 2>{trkXYZ.y(), trkXYZ.z()},
138 std::array<float, 3>{sigmaY2, sigmaYZ, sigmaZ2});
141 event.addClusterToLayer(
layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(),
event.getClustersOnLayer(
layer).size());
144 event.setMClabelsContainer(mcLabels);
146 event.addClusterExternalIndexToLayer(
layer,
first + clusterId);
149 return clusters_in_frame.size();
152std::vector<std::unordered_map<int, Label>>
ioutils::loadLabels(
const int eventsNum,
const std::string& fileName)
154 std::vector<std::unordered_map<int, Label>> labelsMap{};
155 std::unordered_map<int, Label> currentEventLabelsMap{};
156 std::ifstream inputStream{};
158 int monteCarloId{}, pdgCode{}, numberOfClusters{};
159 float transverseMomentum{}, phi{}, pseudorapidity{};
161 labelsMap.reserve(eventsNum);
163 inputStream.open(fileName);
164 std::getline(inputStream, line);
166 while (std::getline(inputStream, line)) {
168 std::istringstream inputStringStream(line);
170 if (inputStringStream >> monteCarloId) {
172 if (monteCarloId == EventLabelsSeparator) {
174 labelsMap.emplace_back(currentEventLabelsMap);
175 currentEventLabelsMap.clear();
179 if (inputStringStream >> transverseMomentum >> phi >> pseudorapidity >> pdgCode >> numberOfClusters) {
183 currentEventLabelsMap.emplace(std::piecewise_construct, std::forward_as_tuple(monteCarloId),
184 std::forward_as_tuple(monteCarloId, transverseMomentum, phi,
185 pseudorapidity, pdgCode, numberOfClusters));
192 labelsMap.emplace_back(currentEventLabelsMap);
General auxilliary methods.
Definition of the GeometryTGeo class.
Definition of a container to keep Monte Carlo truth external to simulation objects.
static const TrackerParamConfig & Instance()
const Mat3D & getMatrixL2G(int sensID) const
const Mat3D & getMatrixT2L(int lay, int hba, int sta, int det) const
int getLayer(int index) const
Get chip layer, from 0.
float getSensorRefAlpha(int isn) const
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
gsl::span< const T > getROFData(const gsl::span< const T > tfdata) const
int getFirstEntry() const
GLenum GLuint GLint GLint layer
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)
convert compact clusters to 3D spacepoints
o2::math_utils::Point3D< T > extractClusterData(const itsmft::CompClusterExt &c, iterator &iter, const itsmft::TopologyDictionary *dict, T &sig2y, T &sig2z)
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)
std::vector< std::unordered_map< int, Label > > loadLabels(const int, const std::string &)
void from_json(const nlohmann::json &j, TrackingParameters &par)
void to_json(nlohmann::json &j, const TrackingParameters &par)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::vector< Cluster > clusters