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{
28
29template <class iterator, typename T = float>
31{
32 auto pattID = c.getPatternID();
33 auto ib = constants::detID::isDetITS3(c.getSensorID());
34 // Dummy COG errors (about half pixel size)
38 sig2y = dict->getErr2X(pattID, ib);
39 sig2z = dict->getErr2Z(pattID, ib);
40 if (!dict->isGroup(pattID, ib)) {
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 ib = constants::detID::isDetITS3(c.getSensorID());
57 auto iterC = iter;
58 unsigned int clusterSize{999};
59 if (pattID == itsmft::CompCluster::InvalidPatternID || dict->isGroup(pattID, ib)) {
61 clusterSize = patt.getNPixels();
62 } else {
63 clusterSize = dict->getNpixels(pattID, ib);
64 }
65 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())));
66 return extractClusterData(c, iter, dict, sig2y, sig2z);
67}
68
69void convertCompactClusters(gsl::span<const itsmft::CompClusterExt> clusters,
70 gsl::span<const unsigned char>::iterator& pattIt,
71 std::vector<o2::BaseCluster<float>>& output,
72 const its3::TopologyDictionary* dict);
73
75 gsl::span<o2::itsmft::ROFRecord> rofs,
76 gsl::span<const itsmft::CompClusterExt> clusters,
77 gsl::span<const unsigned char>::iterator& pattIt,
78 const its3::TopologyDictionary* dict,
79 const dataformats::MCTruthContainer<MCCompLabel>* mcLabels = nullptr);
80
81} // 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 SegmentationMosaix class.
int clusterSize
A container to hold and manage MC truth information/labels.
static constexpr float PitchCol
static constexpr float PitchRow
math_utils::Point3D< T > getClusterCoordinates(const itsmft::CompClusterExt &cl) const
Returns the local position of a compact cluster.
float getErr2Z(int n, bool IB=true) const
Returns the error^2 on the z position of the COG for the n_th element.
int getNpixels(int n, bool IB=true) const
Returns the number of fired pixels of the n_th element.
bool isGroup(int n, bool IB=true) const
Returns true if the element corresponds to a group of rare topologies.
float getErr2X(int n, bool IB=true) const
Returns the error^2 on the x 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:211
constexpr float DefClusError2Row
Definition IOUtils.h:26
constexpr float DefClusErrorCol
Definition IOUtils.h:25
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:59
constexpr float DefClusError2Col
Definition IOUtils.h:27
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:29
constexpr float DefClusErrorRow
Definition IOUtils.h:24
o2::math_utils::Point3D< T > extractClusterData(const itsmft::CompClusterExt &c, iterator &iter, const its3::TopologyDictionary *dict, T &sig2y, T &sig2z)
Definition IOUtils.h:30
constexpr float DefClusError2Col
Definition IOUtils.h:55
constexpr float DefClusError2Row
Definition IOUtils.h:54
std::unique_ptr< GPUReconstructionTimeframe > tf
std::vector< Cluster > clusters