Project
Loading...
Searching...
No Matches
IOUtils.h
Go to the documentation of this file.
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#include <gsl/gsl>
18#include "ITStracking/IOUtils.h"
20#include "ITS3Base/SpecsV2.h"
21
23{
29
30template <class iterator, typename T = float>
32{
33 auto pattID = c.getPatternID();
34 // Dummy COG errors (about half pixel size)
38 sig2y = dict->getErr2X(pattID) * sig2y; // Error is given in detector coordinates
39 sig2z = dict->getErr2Z(pattID) * sig2z;
40 if (!dict->isGroup(pattID)) {
41 return dict->getClusterCoordinates<T>(c);
42 } else {
44 return dict->getClusterCoordinates<T>(c, patt);
45 }
46 } else {
48 return dict->getClusterCoordinates<T>(c, patt, false);
49 }
50}
51
52template <class iterator, typename T = float>
53o2::math_utils::Point3D<T> extractClusterData(const itsmft::CompClusterExt& c, iterator& iter, const its3::TopologyDictionary* dict, T& sig2y, T& sig2z, uint8_t& cls)
54{
55 auto pattID = c.getPatternID();
56 auto iterC = iter;
57 unsigned int clusterSize{999};
58 if (pattID == itsmft::CompCluster::InvalidPatternID || dict->isGroup(pattID)) {
60 clusterSize = patt.getNPixels();
61 } else {
62 clusterSize = dict->getNpixels(pattID);
63 }
64 cls = static_cast<uint8_t>(std::clamp(clusterSize, static_cast<unsigned int>(std::numeric_limits<uint8_t>::min()), static_cast<unsigned int>(std::numeric_limits<uint8_t>::max())));
65 return extractClusterData(c, iter, dict, sig2y, sig2z);
66}
67
68void convertCompactClusters(gsl::span<const itsmft::CompClusterExt> clusters,
69 gsl::span<const unsigned char>::iterator& pattIt,
70 std::vector<o2::BaseCluster<float>>& output,
71 const its3::TopologyDictionary* dict);
72
74 gsl::span<o2::itsmft::ROFRecord> rofs,
75 gsl::span<const itsmft::CompClusterExt> clusters,
76 gsl::span<const unsigned char>::iterator& pattIt,
77 const its3::TopologyDictionary* dict,
78 const dataformats::MCTruthContainer<MCCompLabel>* mcLabels = nullptr);
79
80} // namespace o2::its3::ioutils
Definition of the ITSMFT compact cluster.
Definition of the BuildTopologyDictionary class for ITS3.
Definition of the ITSMFT ROFrame (trigger) record.
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
Definition of a container to keep Monte Carlo truth external to simulation objects.
uint32_t c
Definition RawData.h:2
Definition of the SegmentationSuperAlpide class.
int clusterSize
A container to hold and manage MC truth information/labels.
Segmentation and response for pixels in ITS3 upgrade.
math_utils::Point3D< T > getClusterCoordinates(const itsmft::CompClusterExt &cl) const
Returns the local position of a compact cluster.
float getErr2X(int n) const
Returns the error^2 on the x position of the COG for the n_th element.
bool isGroup(int n) const
Returns true if the element corresponds to a group of rare topologies.
int getNpixels(int n) const
Returns the number of fired pixels of the n_th element.
float getErr2Z(int n) const
Returns the error^2 on the z position of the COG for the n_th element.
int getNPixels() const
Returns the number of fired pixels.
static constexpr unsigned short InvalidPatternID
Definition CompCluster.h:46
bool isDetITS3(T detID)
Definition SpecsV2.h:161
constexpr float DefClusError2Row
Definition IOUtils.h:27
constexpr float DefClusErrorCol
Definition IOUtils.h:26
int loadROFrameDataITS3(its::TimeFrame *tf, gsl::span< o2::itsmft::ROFRecord > rofs, gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, const its3::TopologyDictionary *dict, const dataformats::MCTruthContainer< MCCompLabel > *mcLabels=nullptr)
Definition IOUtils.cxx:61
constexpr float DefClusError2Col
Definition IOUtils.h:28
void convertCompactClusters(gsl::span< const itsmft::CompClusterExt > clusters, gsl::span< const unsigned char >::iterator &pattIt, std::vector< o2::BaseCluster< float > > &output, const its3::TopologyDictionary *dict)
convert compact clusters to 3D spacepoints
Definition IOUtils.cxx:31
constexpr float DefClusErrorRow
Definition IOUtils.h:25
o2::math_utils::Point3D< T > extractClusterData(const itsmft::CompClusterExt &c, iterator &iter, const its3::TopologyDictionary *dict, T &sig2y, T &sig2z)
Definition IOUtils.h:31
constexpr float DefClusError2Col
Definition IOUtils.h:55
constexpr float DefClusError2Row
Definition IOUtils.h:54
std::unique_ptr< GPUReconstructionTimeframe > tf
std::vector< Cluster > clusters