Skip to content

Commit 2f749fa

Browse files
shahor02sawenzel
authored andcommitted
ITS: new geom.interface, standard Tr.frame, modern clusters
1) Major rewrite/modernization of old GeometryTGeo interface class to profit from base matrix cache class 2) ITS and MFT will share the same cluster class (moved to ITS/MFT/common) profiting from BaseCluster Point3D positions and Transform3D / Rot2D transformations. 3) Moved ITS clusters to ITSMFT/common since it can serve to both once MFT implements its own version of GeometryTGeo. Cluster does not contain the geom.interface pointer anymore, but the methods which need acces to matrices should be called with the relevant geometry interface as one of arguments of the method, see e.g. BaseCluster::getXYZglo 4) Same for digitizer: shared for ITS and MFT 5) Adapted all GeometryTGeo-dependent classes / macros to new interface. 6) Removed obsolete ITS classes DigitLayer DigitStave GeometryHandler
1 parent 8b94d0e commit 2f749fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1083
-2338
lines changed

Detectors/Base/include/DetectorsBase/BaseCluster.h

Lines changed: 57 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,66 +11,89 @@
1111
#ifndef ALICEO2_BASE_BASECLUSTER_H
1212
#define ALICEO2_BASE_BASECLUSTER_H
1313

14-
#include <Rtypes.h>
14+
#include <TObject.h>
1515
#include <bitset>
1616
#include <iomanip>
1717
#include <ios>
1818
#include <iostream>
1919
#include "MathUtils/Cartesian3D.h"
20-
20+
#include "DetectorsBase/DetMatrixCache.h"
2121
namespace o2
2222
{
23-
namespace Base
23+
namespace Base
2424
{
25+
2526
// Basic cluster class with X,Y,Z position detector ID information + user fields
26-
// The position is stored in tracking frame, either misaligned or not (check the
27-
// getter IsMisaligned). The errors are defined in *ideal* tracking frame
27+
// The position is ALWAYS stored in tracking frame and is misaligned (in opposite
28+
// to AliRoot). The errors are defined in *ideal* tracking frame
2829
// DetectorID should correspond to continuous (no jumps between detector layers
2930
// planes etc.) internal sensor ID within detector
3031
// Detector specific clusters should be composed by including it as data member
3132
template <typename T>
32-
class BaseCluster
33+
class BaseCluster : public TObject // temprarily derive from TObject
3334
{
34-
private:
35+
protected:
36+
3537
Point3D<T> mPos; // cartesian position
36-
T mSigY2; // error in Y direction (usually rphi)
37-
T mSigZ2; // error in Z direction (usually Z)
38-
T mSigYZ; // non-diagonal term of error matrix
39-
std::int16_t mSensorID; // the sensor id
38+
T mSigmaY2; // error in Y direction (usually rphi)
39+
T mSigmaZ2; // error in Z direction (usually Z)
40+
T mSigmaYZ; // non-diagonal term of error matrix
41+
std::uint16_t mSensorID=0; // the sensor id
4042
std::int8_t mCount = 0; // user field reserved for counting
4143
std::uint8_t mBits = 0; // user field reserved for bit flags
42-
enum masks_t : std::int32_t { kMisalignMask = (0x1 << 7), kUserBitsMask = ~kMisalignMask };
44+
enum masks_t : std::int32_t { kUserBitsMask = 0xff };
4345

4446
public:
4547
BaseCluster() = default;
4648

4749
// constructor
48-
BaseCluster(std::int16_t sensid, T x, T y, T z) : mPos(x, y, z), mSensorID(sensid) {}
50+
BaseCluster(std::uint16_t sensid, const Point3D<T>& xyz) : mPos(xyz), mSensorID(sensid) {}
51+
BaseCluster(std::uint16_t sensid, T x, T y, T z) : mPos(x, y, z), mSensorID(sensid) {}
52+
BaseCluster(std::uint16_t sensid, const Point3D<T>& xyz, T sy2, T sz2, T syz)
53+
: mPos(xyz), mSigmaY2(sy2), mSigmaZ2(sz2), mSigmaYZ(syz), mSensorID(sensid)
54+
{
55+
}
4956
BaseCluster(std::int16_t sensid, T x, T y, T z, T sy2, T sz2, T syz)
50-
: mPos(x, y, z), mSigY2(sy2), mSigZ2(sz2), mSigYZ(syz), mSensorID(sensid)
57+
: mPos(x, y, z), mSigmaY2(sy2), mSigmaZ2(sz2), mSigmaYZ(syz), mSensorID(sensid)
5158
{
5259
}
5360

5461
// getting the cartesian coordinates and errors
5562
T getX() const { return mPos.X(); }
5663
T getY() const { return mPos.Y(); }
5764
T getZ() const { return mPos.Z(); }
58-
T getSigY2() const { return mSigY2; }
59-
T getSigZ2() const { return mSigZ2; }
60-
T getSigYZ() const { return mSigYZ; }
61-
Point3D<T> getPos() const { return mPos; }
62-
Point3D<T>& getPos() { return mPos; }
65+
T getSigmaY2() const { return mSigmaY2; }
66+
T getSigmaZ2() const { return mSigmaZ2; }
67+
T getSigmaYZ() const { return mSigmaYZ; }
68+
Point3D<T> getXYZ() const { return mPos; }
69+
Point3D<T>& getXYZ() { return mPos; }
70+
71+
// position in local frame, no check for matrices cache validity
72+
Point3D<T> getXYZLoc(const DetMatrixCache& dm) {
73+
return dm.getMatrixT2L(mSensorID)(mPos);
74+
}
75+
76+
// position in global frame, no check for matrices cache validity
77+
Point3D<T> getXYZGlo(const DetMatrixCache& dm) {
78+
return dm.getMatrixT2G(mSensorID)(mPos);
79+
}
80+
81+
// position in global frame obtained as simple rotation from tracking one:
82+
// much faster for barrel detectors than using full 3D matrix.
83+
// no check for matrices cache validity
84+
Point3D<T> getXYZGloRot(const DetMatrixCache& dm) {
85+
return dm.getMatrixT2GRot(mSensorID)(mPos);
86+
}
87+
6388
// get sensor id
6489
std::int16_t getSensorID() const { return mSensorID; }
6590
// get count field
6691
std::int8_t getCount() const { return mCount; }
6792
// get bit field
6893
std::uint8_t getBits() const { return mBits; }
6994
bool isBitSet(int bit) const { return mBits & (0xff & (0x1 << bit)); }
70-
// check special reserved bit to flag cluster misalignment
71-
bool isMisaligned() const { return mBits & kMisalignMask; }
95+
7296
// cast to Point3D
73-
operator Point3D<T>() const { return mPos; }
7497
operator Point3D<T>&() { return mPos; }
7598
// modifiers
7699

@@ -82,8 +105,7 @@ class BaseCluster
82105
void setBits(std::uint8_t b) { mBits = b; }
83106
void setBit(int bit) { mBits |= kUserBitsMask & (0x1 << bit); }
84107
void resetBit(int bit) { mBits &= ~(kUserBitsMask & (0x1 << bit)); }
85-
// set special reserved bit to flag cluster misalignment
86-
void setMisaligned() { mBits |= kMisalignMask; }
108+
87109
// set position and errors
88110
void setX(T x) { mPos.SetX(x); }
89111
void setY(T y) { mPos.SetY(y); }
@@ -95,17 +117,21 @@ class BaseCluster
95117
setZ(z);
96118
}
97119
void setPos(const Point3D<T>& p) { mPos = p; }
98-
void setSigY2(T v) { mSigY2 = v; }
99-
void setSigZ2(T v) { mSigZ2 = v; }
100-
void setSigYZ(T v) { mSigYZ = v; }
120+
void setSigmaY2(T v) { mSigmaY2 = v; }
121+
void setSigmaZ2(T v) { mSigmaZ2 = v; }
122+
void setSigmaYZ(T v) { mSigmaYZ = v; }
101123
void setErrors(T sy2, T sz2, T syz)
102124
{
103-
setSigY2(sy2);
104-
setSigZ2(sz2);
105-
setSigYZ(syz);
125+
setSigmaY2(sy2);
126+
setSigmaZ2(sz2);
127+
setSigmaYZ(syz);
106128
}
107129

108-
ClassDefNV(BaseCluster, 1)
130+
protected:
131+
~BaseCluster() override = default;
132+
133+
// ClassDefNV(BaseCluster, 1);
134+
ClassDefOverride(BaseCluster, 1); // temporarily
109135
};
110136

111137
template <class T>

Detectors/Base/include/DetectorsBase/Track.h

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222

2323
#include "DetectorsBase/Constants.h"
2424
#include "DetectorsBase/Utils.h"
25+
#include "DetectorsBase/BaseCluster.h"
26+
#include "MathUtils/Cartesian3D.h"
2527

2628
namespace o2 {
2729
namespace Base {
30+
2831
namespace Track {
2932

3033
// aliases for track elements
@@ -78,6 +81,8 @@ namespace o2 {
7881

7982
float GetP() const;
8083
float GetPt() const;
84+
85+
Point3D<float> GetXYZ() const;
8186
void GetXYZ(std::array<float,3> &xyz) const;
8287
bool GetPxPyPz(std::array<float,3> &pxyz) const;
8388
bool GetPosDir(std::array<float,9> &posdirp) const;
@@ -137,8 +142,25 @@ namespace o2 {
137142
bool PropagateTo(float xk, const std::array<float,3> &b);
138143
void Invert();
139144

140-
float GetPredictedChi2(const std::array<float,2> &p, const std::array<float,3> &cov) const;
141-
bool Update(const std::array<float,2> &p, const std::array<float,3> &cov);
145+
float GetPredictedChi2(const std::array<float,2> &p, const std::array<float,3> &cov) const;
146+
template <typename T>
147+
float GetPredictedChi2(const BaseCluster<T> &p) const
148+
{
149+
const std::array<float,2> pyz = { p.getY(),p.getZ() };
150+
const std::array<float,3> cov = { p.getSigmaY2(),p.getSigmaYZ(),p.getSigmaZ2() };
151+
return GetPredictedChi2(pyz, cov);
152+
}
153+
154+
155+
bool Update(const std::array<float,2> &p, const std::array<float,3> &cov);
156+
157+
template <typename T>
158+
bool Update(const BaseCluster<T> &p)
159+
{
160+
const std::array<float,2> pyz{ p.getY(),p.getZ() };
161+
const std::array<float,3> cov{ p.getSigmaY2(),p.getSigmaYZ(),p.getSigmaZ2() };
162+
return Update(pyz, cov);
163+
}
142164

143165
bool CorrectForMaterial(float x2x0,float xrho,float mass,bool anglecorr=false,float dedx=kCalcdEdxAuto);
144166

@@ -174,6 +196,13 @@ namespace o2 {
174196
Utils::RotateZ(xyz,GetAlpha());
175197
}
176198

199+
//_______________________________________________________
200+
inline Point3D<float> TrackParBase::GetXYZ() const {
201+
std::array<float,3> xyz = { GetX(), GetY(), GetZ() };
202+
Utils::RotateZ(xyz,GetAlpha());
203+
return Point3D<float>(xyz[0],xyz[1],xyz[2]);
204+
}
205+
177206
//_______________________________________________________
178207
inline float TrackParBase::GetPhiPos() const {
179208
// angle of track position

0 commit comments

Comments
 (0)