Skip to content

Commit 8cfdb93

Browse files
MichaelLettrichshahor02
authored andcommitted
[ALIGN] port AliAlgPoint
1 parent 8cafc35 commit 8cfdb93

5 files changed

Lines changed: 76 additions & 59 deletions

File tree

Detectors/Align/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ o2_add_library(Align
1919
#src/AliAlgDetTRD.cxx
2020
src/AliAlgDOFStat.cxx
2121
#src/AliAlgMPRecord.cxx
22-
#src/AliAlgPoint.cxx
22+
src/AliAlgPoint.cxx
2323
#src/AliAlgRes.cxx
2424
#src/AliAlgResFast.cxx
2525
#src/AliAlgSens.cxx
@@ -34,6 +34,7 @@ o2_add_library(Align
3434
#src/AliAlgVtx.cxx
3535
#src/Mille.cxx
3636
PUBLIC_LINK_LIBRARIES O2::FrameworkLogger
37+
O2::ReconstructionDataFormats
3738
ROOT::Core
3839
ROOT::Geom
3940
ROOT::Gpad
@@ -53,7 +54,7 @@ o2_target_root_dictionary(
5354
#include/Align/AliAlgDetTRD.h
5455
#include/Align/AliAlgDetHMPID.h
5556
#include/Align/AliAlgMPRecord.h
56-
#include/Align/AliAlgPoint.h
57+
include/Align/AliAlgPoint.h
5758
#include/Align/AliAlgSens.h
5859
#include/Align/AliAlgSensITS.h
5960
#include/Align/AliAlgSensTOF.h

Detectors/Align/include/Align/AliAlgAux.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <TMath.h>
2020
#include <TString.h>
21+
#include "ReconstructionDataFormats/Track.h"
2122
// class AliCDBId;
2223
class TMap;
2324
class TList;
@@ -29,6 +30,13 @@ namespace o2
2930
namespace align
3031
{
3132

33+
using trackParam_t = typename track::TrackParametrizationWithError<double>;
34+
using value_t = typename trackParam_t::value_t;
35+
using dim2_t = typename trackParam_t::dim2_t;
36+
using dim3_t = typename trackParam_t::dim3_t;
37+
using params_t = typename trackParam_t::params_t;
38+
using covMat_t = typename trackParam_t::covMat_t;
39+
3240
namespace AliAlgAux
3341
{
3442
const double kAlmostZeroD = 1e-15;

Detectors/Align/include/Align/AliAlgPoint.h

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626
#include <TObject.h>
2727
#include <TMatrixD.h>
2828
#include <TVectorD.h>
29-
#include "Align/AliAlgSens.h"
30-
31-
//class AliExternalTrackParam;
29+
//#include "Align/AliAlgSens.h"
30+
#include "ReconstructionDataFormats/Track.h"
31+
#include "Framework/Logger.h"
32+
#include "Align/AliAlgAux.h"
3233

3334
namespace o2
3435
{
@@ -38,19 +39,13 @@ namespace align
3839
class AliAlgPoint : public TObject
3940
{
4041
public:
41-
enum { kMaterialBit = BIT(14) // point contains material
42-
,
43-
kMeasurementBit = BIT(15) // point contains measurement
44-
,
45-
kUpdateFromTrackBit = BIT(16) // point needs to recalculate itself using track info
46-
,
47-
kVaryELossBit = BIT(17) // ELoss variation allowed
48-
,
49-
kUseBzOnly = BIT(18) // use only Bz component (ITS)
50-
,
51-
kInvDir = BIT(19) // propagation via this point is in decreasing X direction (upper cosmic leg)
52-
,
53-
kStatOK = BIT(20) // point is accounted in global statistics
42+
enum { kMaterialBit = BIT(14), // point contains material
43+
kMeasurementBit = BIT(15), // point contains measurement
44+
kUpdateFromTrackBit = BIT(16), // point needs to recalculate itself using track info
45+
kVaryELossBit = BIT(17), // ELoss variation allowed
46+
kUseBzOnly = BIT(18), // use only Bz component (ITS)
47+
kInvDir = BIT(19), // propagation via this point is in decreasing X direction (upper cosmic leg)
48+
kStatOK = BIT(20) // point is accounted in global statistics
5449
};
5550
enum { kParY = 0 // track parameters
5651
,
@@ -69,7 +64,7 @@ class AliAlgPoint : public TObject
6964
virtual ~AliAlgPoint() {}
7065
//
7166
void Init();
72-
void UpdatePointByTrackInfo(const AliExternalTrackParam* t);
67+
void UpdatePointByTrackInfo(const trackParam_t* t);
7368
//
7469
Double_t GetAlphaSens() const { return fAlphaSens; }
7570
Double_t GetXSens() const { return fXSens; }
@@ -81,9 +76,9 @@ class AliAlgPoint : public TObject
8176
const Double_t* GetXYZTracking() const { return fXYZTracking; }
8277
const Double_t* GetYZErrTracking() const { return fErrYZTracking; }
8378
//
84-
const AliAlgSens* GetSensor() const { return fSensor; }
85-
UInt_t GetVolID() const { return fSensor->GetVolID(); }
86-
void SetSensor(AliAlgSens* s) { fSensor = s; }
79+
// const AliAlgSens* GetSensor() const { return fSensor; } FIXME(milettri): needs AliAlgSens
80+
// UInt_t GetVolID() const { return fSensor->GetVolID(); } FIXME(milettri): needs AliAlgSens
81+
// void SetSensor(AliAlgSens* s) { fSensor = s; } FIXME(milettri): needs AliAlgSens
8782
Int_t GetDetID() const { return fDetID; }
8883
Int_t GetSID() const { return fSID; }
8984
Int_t GetMinLocVarID() const { return fMinLocVarID; }
@@ -138,8 +133,8 @@ class AliAlgPoint : public TObject
138133
Double_t* GetTrParamWSB() const { return (Double_t*)fTrParamWSB; }
139134
Double_t GetTrParamWSA(int ip) const { return fTrParamWSA[ip]; }
140135
Double_t GetTrParamWSB(int ip) const { return fTrParamWSB[ip]; }
141-
void GetTrWSA(AliExternalTrackParam& etp) const;
142-
void GetTrWSB(AliExternalTrackParam& etp) const;
136+
void GetTrWSA(trackParam_t& etp) const;
137+
void GetTrWSB(trackParam_t& etp) const;
143138
void SetTrParamWSA(const double* param)
144139
{
145140
for (int i = 5; i--;)
@@ -222,7 +217,7 @@ class AliAlgPoint : public TObject
222217
Double_t fTrParamWSA[kNMatDOFs]; // workspace for tracks params at this point AFTER material correction
223218
Double_t fTrParamWSB[kNMatDOFs]; // workspace for tracks params at this point BEFORE material correction
224219
//
225-
AliAlgSens* fSensor; // sensor of this point
220+
// AliAlgSens* fSensor; // sensor of this point FIXME(milettri): Needs AliAlgSens
226221
//
227222
ClassDef(AliAlgPoint, 1)
228223
};
@@ -272,9 +267,11 @@ inline void AliAlgPoint::GetResidualsDiag(const double* pos, double& resU, doubl
272267
//__________________________________________________________________
273268
inline void AliAlgPoint::IncrementStat()
274269
{
275-
// increment statistics for detectors this point depends on
276-
fSensor->IncrementStat();
277-
SetStatOK();
270+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
271+
// FIXME(milettri): needs AliAlgSens
272+
// // increment statistics for detectors this point depends on
273+
// fSensor->IncrementStat();
274+
// SetStatOK();
278275
}
279276
} // namespace align
280277
} // namespace o2

Detectors/Align/src/AliAlgPoint.cxx

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
/// @since 2021-02-01
1414
/// @brief Meausered point in the sensor.
1515

16-
#include <stdio.h>
16+
#include <cstdio>
1717
#include <TMath.h>
1818
#include <TString.h>
1919
#include "Align/AliAlgPoint.h"
20-
#include "Align/AliAlgAux.h"
21-
//#include "AliExternalTrackParam.h"
2220

2321
using namespace o2::align::AliAlgAux;
2422
using namespace TMath;
@@ -30,7 +28,7 @@ namespace align
3028

3129
//_____________________________________
3230
AliAlgPoint::AliAlgPoint()
33-
: fMinLocVarID(0), fMaxLocVarID(0), fDetID(-1), fSID(-1), fAlphaSens(0), fXSens(0), fCosDiagErr(0), fSinDiagErr(0), fX2X0(0), fXTimesRho(0), fNGloDOFs(0), fDGloOffs(0), fSensor(0)
31+
: fMinLocVarID(0), fMaxLocVarID(0), fDetID(-1), fSID(-1), fAlphaSens(0), fXSens(0), fCosDiagErr(0), fSinDiagErr(0), fX2X0(0), fXTimesRho(0), fNGloDOFs(0), fDGloOffs(0) //, fSensor(0) FIXME(milettri): Needs AliAlgSens
3432
{
3533
// def c-tor
3634
for (int i = 3; i--;) {
@@ -90,10 +88,12 @@ void AliAlgPoint::Init()
9088
}
9189

9290
//_____________________________________
93-
void AliAlgPoint::UpdatePointByTrackInfo(const AliExternalTrackParam* t)
91+
void AliAlgPoint::UpdatePointByTrackInfo(const trackParam_t* t)
9492
{
95-
// recalculate point errors using info about the track in the sensor tracking frame
96-
fSensor->UpdatePointByTrackInfo(this, t);
93+
LOG(FATAL) << __PRETTY_FUNCTION__ << " is disabled";
94+
//FIXME(milettri): needs AliAlgSens
95+
// // recalculate point errors using info about the track in the sensor tracking frame
96+
// fSensor->UpdatePointByTrackInfo(this, t);
9797
}
9898

9999
//_____________________________________
@@ -176,29 +176,34 @@ void AliAlgPoint::DumpCoordinates() const
176176
{
177177
// dump various corrdinates for inspection
178178
// global xyz
179-
double xyz[3];
180-
GetXYZGlo(xyz);
181-
for (int i = 0; i < 3; i++)
182-
printf("%+.4e ", xyz[i]);
183-
//
184-
AliExternalTrackParam wsb;
185-
AliExternalTrackParam wsa;
179+
dim3_t xyz;
180+
GetXYZGlo(xyz.data());
181+
182+
auto print3d = [](dim3_t& xyz) {
183+
for (auto i : xyz) {
184+
printf("%+.4e ", i);
185+
}
186+
};
187+
188+
print3d(xyz);
189+
trackParam_t wsb;
190+
trackParam_t wsa;
186191
GetTrWSB(wsb);
187192
GetTrWSA(wsa);
188-
wsb.GetXYZ(xyz);
189-
for (int i = 0; i < 3; i++)
190-
printf("%+.4e ", xyz[i]); // track before mat corr
191-
wsa.GetXYZ(xyz);
192-
for (int i = 0; i < 3; i++)
193-
printf("%+.4e ", xyz[i]); // track after mat corr
194-
//
193+
194+
wsb.getXYZGlo(xyz);
195+
print3d(xyz); // track before mat corr
196+
197+
wsa.getXYZGlo(xyz);
198+
print3d(xyz); // track after mat corr
199+
195200
printf("%+.4f ", fAlphaSens);
196201
printf("%+.4e ", GetXPoint());
197202
printf("%+.4e ", GetYTracking());
198203
printf("%+.4e ", GetZTracking());
199204
//
200-
printf("%+.4e %.4e ", wsb.GetY(), wsb.GetZ());
201-
printf("%+.4e %.4e ", wsa.GetY(), wsa.GetZ());
205+
printf("%+.4e %.4e ", wsb.getY(), wsb.getZ());
206+
printf("%+.4e %.4e ", wsa.getY(), wsa.getZ());
202207
//
203208
printf("%4e %4e", Sqrt(fErrYZTracking[0]), Sqrt(fErrYZTracking[2]));
204209
printf("\n");
@@ -215,7 +220,7 @@ void AliAlgPoint::Clear(Option_t*)
215220
fNGloDOFs = 0;
216221
fDGloOffs = 0;
217222
//
218-
fSensor = 0;
223+
// fSensor = 0; FIXME(milettri): needs AliAlgSens
219224
}
220225

221226
//__________________________________________________________________
@@ -355,29 +360,35 @@ void AliAlgPoint::DiagMatCorr(const float* nodiag, float* diag) const
355360
}
356361

357362
//__________________________________________________________________
358-
void AliAlgPoint::GetTrWSA(AliExternalTrackParam& etp) const
363+
void AliAlgPoint::GetTrWSA(trackParam_t& etp) const
359364
{
360365
// assign WSA (after material corrections) parameters to supplied track
361-
double covDum[15] = {
366+
const trackParam_t::covMat_t covDum{
362367
1.e-4,
363368
0, 1.e-4,
364369
0, 0, 1.e-4,
365370
0, 0, 0, 1.e-4,
366371
0, 0, 0, 0, 1e-4};
367-
etp.Set(GetXPoint(), GetAlphaSens(), fTrParamWSA, covDum);
372+
params_t tmp;
373+
std::copy(std::begin(fTrParamWSA), std::end(fTrParamWSA), std::begin(tmp));
374+
375+
etp.set(GetXPoint(), GetAlphaSens(), tmp, covDum);
368376
}
369377

370378
//__________________________________________________________________
371-
void AliAlgPoint::GetTrWSB(AliExternalTrackParam& etp) const
379+
void AliAlgPoint::GetTrWSB(trackParam_t& etp) const
372380
{
373381
// assign WSB parameters (before material corrections) to supplied track
374-
double covDum[15] = {
382+
const trackParam_t::covMat_t covDum{
375383
1.e-4,
376384
0, 1.e-4,
377385
0, 0, 1.e-4,
378386
0, 0, 0, 1.e-4,
379387
0, 0, 0, 0, 1e-4};
380-
etp.Set(GetXPoint(), GetAlphaSens(), fTrParamWSB, covDum);
388+
params_t tmp;
389+
std::copy(std::begin(fTrParamWSB), std::end(fTrParamWSB), std::begin(tmp));
390+
391+
etp.set(GetXPoint(), GetAlphaSens(), tmp, covDum);
381392
}
382393

383394
} // namespace align

Detectors/Align/src/AlignLinkDef.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//#pragma link C++ class o2::align::AliAlgDetTRD + ;
1313
//#pragma link C++ class o2::align::AliAlgDetHMPID + ;
1414
//#pragma link C++ class o2::align::AliAlgMPRecord + ;
15-
//#pragma link C++ class o2::align::AliAlgPoint + ;
15+
#pragma link C++ class o2::align::AliAlgPoint + ;
1616
//#pragma link C++ class o2::align::AliAlgSens + ;
1717
//#pragma link C++ class o2::align::AliAlgSensITS + ;
1818
//#pragma link C++ class o2::align::AliAlgSensTOF + ;

0 commit comments

Comments
 (0)