Project
Loading...
Searching...
No Matches
RecoGeomHelper.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
15
16#ifndef ALICEO2_ITS_RECOGEOMHELPER_H
17#define ALICEO2_ITS_RECOGEOMHELPER_H
18
19#include <Rtypes.h>
20#include <vector>
21#include <array>
22#include "MathUtils/Cartesian.h"
23#include "MathUtils/Utils.h"
29
30namespace o2
31{
32namespace its
33{
35 //
38
39 enum Relation : int { Below = -1,
40 Inside = 0,
41 Above = 1 };
42
43 struct RecoChip {
45 uint16_t id = 0xffff; // global chip id
46 float alp = 0.f, snAlp = 0.f, csAlp = 0.f; // cos and sin of sensor alpha
47 float xRef = 0.f; // reference X
48 BracketF yRange = {1.e9, -1.e9}, zRange = {1.e9, -1.e9}; // bounding box in tracking frame
50
52 void print() const;
54 };
55
56 struct RecoLadder {
62 short id = 0; // assigned ladder ID within the layer
63 Overlap overlapWithNext = Undefined; // special flag saying if for double-hit layers this one is above, excluded or below the next one
65 BracketF zRange = {1e9, -1e9}; // Z ranges in lab frame
66 Vec2D xyEdges; // envelop for chip edges
67 float phiMean = 0., dphiH = 0.;
68 std::vector<RecoChip> chips;
69
70 Relation isPhiOutside(float phi, float toler = 0) const;
72 void init();
73 void print() const;
75 };
76
77 struct RecoLayer {
78 // navigation over ladders of single layer
79 int id = 0; // layer ID
80 int nLadders = 0; // number of ladders
82 float phi2bin = 0;
83 float z2chipID = 0; // conversion factor for Z (relative to zmin) to rough chip ID
84 float rInv = 0.; // inverse mean radius
85 BracketF rRange = {1e9, 0.}; // min and max radii
86 BracketF zRange = {1e9, -1e9}; // min and max Z
87 std::vector<RecoLadder> ladders;
88 std::vector<uint16_t> phi2ladder; // mapping from phi to ladderID
89
90 const RecoLadder& getLadder(int id) const { return ladders[id % nLadders]; }
91 void init();
93 void print() const;
94 int getLadderID(float phi) const;
95 int getChipID(float z) const;
97 };
98 //---------------------------<< aux classes
99
100 std::array<RecoLayer, o2::itsmft::ChipMappingITS::NLayers> layers;
101 static constexpr int getNLayers() { return o2::itsmft::ChipMappingITS::NLayers; }
102 static constexpr int getNChips() { return o2::itsmft::ChipMappingITS::getNChips(); }
104 static constexpr float ladderWidthInv() { return 1. / ladderWidth(); }
105
106 void init();
107 void print() const;
108
110};
111
112//_____________________________________________________________________
114{
115 // check if phi+-toler is out of the limits of the ladder phi.
116 // return -1 or +1 if phi is above or below the region. If inside, return 0
117 float dif = phi - phiMean, difa = fabs(dif);
118 if (difa < dphiH + toler) {
120 }
121 if (difa > o2::constants::math::PI) { // wraps?
122 difa = o2::constants::math::TwoPI - difa;
123 if (difa < dphiH + toler) {
125 }
127 }
129}
130
131//_____________________________________________________________________
133{
134 // Get chip ID within the ladder corresponding to this phi
135 // Note: this is an approximate method, one should check also the neighbouring ladders +/-1
136 int ic = (z - zRange.getMin()) * z2chipID;
137 return ic < 0 ? 0 : (ic < lastChipInLadder ? ic : lastChipInLadder);
138}
139
140//_____________________________________________________________________
141inline int RecoGeomHelper::RecoLayer::getLadderID(float phi) const
142{
143 // Get ladder ID corresponding to phi.
144 // Note: this is an approximate method, precise within 1/3 of average ladder width,
145 // one should check also the neighbouring ladders +/-1
146 o2::math_utils::bringTo02Pi(phi);
147 return phi2ladder[int(phi * phi2bin)];
148}
149
150} // namespace its
151} // namespace o2
152
153#endif /* ALICEO2_ITS_RECOGEOMHELPER_H */
General auxilliary methods.
useful math constants
Declarations of 2D primitives.
Definition of the SegmentationAlpide class.
static constexpr int getNChips()
number of chips per barrel
static constexpr int NLayers
static constexpr float SensorSizeRows
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr float TwoPI
constexpr float PI
detail::IntervalXY< float > IntervalXYf_t
Definition Primitive2D.h:35
detail::Bracket< float > Bracketf_t
Definition Primitive2D.h:40
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
void updateLimits(const o2::math_utils::Point3D< float > &pnt)
Relation isPhiOutside(float phi, float toler=0) const
void updateLimits(const o2::math_utils::Point3D< float > &pnt)
const RecoLadder & getLadder(int id) const
std::vector< RecoLadder > ladders
std::vector< uint16_t > phi2ladder
void updateLimits(const o2::math_utils::Point3D< float > &pnt)
std::array< RecoLayer, o2::itsmft::ChipMappingITS::NLayers > layers
static constexpr float ladderWidth()
static constexpr int getNLayers()
ClassDefNV(RecoGeomHelper, 0)
static constexpr int getNChips()
static constexpr float ladderWidthInv()