Skip to content

Commit 7215643

Browse files
authored
Merge branch 'dev' into iotofdigi
2 parents 7f7febe + 9429beb commit 7215643

17 files changed

Lines changed: 374 additions & 36 deletions

File tree

CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
/DataFormats/Detectors/GlobalTracking @shahor02
3535
/DataFormats/Detectors/GlobalTrackingWorkflow @shahor02
3636
/DataFormats/Detectors/HMPID @gvolpe79
37-
/DataFormats/Detectors/ITSMFT @fprino @mcoquet642 @shahor02
37+
/DataFormats/Detectors/ITSMFT @f3sch @fprino @mcoquet642 @shahor02
3838
/DataFormats/Detectors/MUON @AliceO2Group/muon-experts @shahor02
3939
/DataFormats/Detectors/PHOS @peressounko @kharlov
4040
/DataFormats/Detectors/Passive @sawenzel
@@ -65,7 +65,7 @@
6565
/Detectors/GlobalTracking @shahor02
6666
/Detectors/GlobalTrackingWorkflow @shahor02
6767
/Detectors/HMPID @gvolpe79
68-
/Detectors/ITSMFT @fprino @mcoquet642 @mconcas @shahor02
68+
/Detectors/ITSMFT @f3sch @fprino @mcoquet642 @mconcas @shahor02
6969
/Detectors/MUON @AliceO2Group/muon-experts @shahor02
7070
/Detectors/PHOS @peressounko @kharlov
7171
/Detectors/Passive @sawenzel

DataFormats/Calibration/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111

1212
o2_add_library(DataFormatsCalibration
1313
SOURCES src/MeanVertexObject.cxx
14+
SOURCES src/MeanVertexBiasParam.cxx
1415
PUBLIC_LINK_LIBRARIES O2::ReconstructionDataFormats
15-
O2::Framework)
16+
O2::Framework
17+
O2::CommonUtils)
1618

1719
o2_target_root_dictionary(DataFormatsCalibration
18-
HEADERS include/DataFormatsCalibration/MeanVertexObject.h)
20+
HEADERS include/DataFormatsCalibration/MeanVertexObject.h
21+
include/DataFormatsCalibration/MeanVertexBiasParam.h)
1922

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright 2019-2026 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+
12+
/// \author ruben.shahoyan@cern.ch
13+
14+
/// parameters to bias precalibrated mean vertex, e.g after the alignment shift
15+
16+
#ifndef ALICEO2_MEANVERTEX_BIAS_PARAM_H
17+
#define ALICEO2_MEANVERTEX_BIAS_PARAM_H
18+
19+
#include "CommonUtils/ConfigurableParam.h"
20+
#include "CommonUtils/ConfigurableParamHelper.h"
21+
22+
namespace o2
23+
{
24+
namespace dataformats
25+
{
26+
27+
struct MeanVertexBiasParam : public o2::conf::ConfigurableParamHelper<MeanVertexBiasParam> {
28+
float xyz[3] = {}; // position bias
29+
float slopeX = 0.f; // x slope bias
30+
float slopeY = 0.f; // y slope bias
31+
32+
O2ParamDef(MeanVertexBiasParam, "mvbias");
33+
};
34+
35+
} // namespace dataformats
36+
} // end namespace o2
37+
38+
#endif

DataFormats/Calibration/include/DataFormatsCalibration/MeanVertexObject.h

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,45 @@
1515
#include <array>
1616
#include "Framework/Logger.h"
1717
#include "ReconstructionDataFormats/Vertex.h"
18+
#include "DataFormatsCalibration/MeanVertexBiasParam.h"
1819

1920
namespace o2
2021
{
2122
namespace dataformats
2223
{
2324
class MeanVertexObject : public VertexBase
2425
{
25-
2626
public:
2727
MeanVertexObject(float x, float y, float z, float sigmax, float sigmay, float sigmaz, float slopeX, float slopeY)
2828
{
29+
if (!gMVBias) {
30+
checkExternalBias();
31+
}
2932
setXYZ(x, y, z);
3033
setSigma({sigmax, sigmay, sigmaz});
3134
mSlopeX = slopeX;
3235
mSlopeY = slopeY;
3336
}
37+
3438
MeanVertexObject(std::array<float, 3> pos, std::array<float, 3> sigma, float slopeX, float slopeY)
3539
{
40+
if (!gMVBias) {
41+
checkExternalBias();
42+
}
3643
math_utils::Point3D<float> p(pos[0], pos[1], pos[2]);
3744
setPos(p);
3845
setSigma(sigma);
3946
mSlopeX = slopeX;
4047
mSlopeY = slopeY;
4148
}
42-
MeanVertexObject() = default;
49+
50+
MeanVertexObject()
51+
{
52+
if (!gMVBias) {
53+
checkExternalBias();
54+
}
55+
}
56+
4357
~MeanVertexObject() = default;
4458
MeanVertexObject(const MeanVertexObject& other) = default;
4559
MeanVertexObject(MeanVertexObject&& other) = default;
@@ -57,14 +71,28 @@ class MeanVertexObject : public VertexBase
5771
void setSlopeX(float val) { mSlopeX = val; }
5872
void setSlopeY(float val) { mSlopeY = val; }
5973

60-
math_utils::Point3D<float>& getPos() { return getXYZ(); }
74+
// getting the cartesian coordinates and errors
75+
float getX() const { return VertexBase::getX() + gMVBias->xyz[0]; }
76+
float getY() const
77+
{
78+
return VertexBase::getY() + gMVBias->xyz[1];
79+
;
80+
}
81+
float getZ() const
82+
{
83+
return VertexBase::getZ() + gMVBias->xyz[2];
84+
;
85+
}
86+
float getR() const { return gpu::CAMath::Hypot(getX(), getY()); }
87+
88+
math_utils::Point3D<float> getXYZ() const { return {getX(), getY(), getZ()}; }
6189
math_utils::Point3D<float> getPos() const { return getXYZ(); }
6290

63-
float getSlopeX() const { return mSlopeX; }
64-
float getSlopeY() const { return mSlopeY; }
91+
float getSlopeX() const { return mSlopeX + gMVBias->slopeX; }
92+
float getSlopeY() const { return mSlopeY + gMVBias->slopeY; }
6593

66-
float getXAtZ(float z) const { return getX() + mSlopeX * (z - getZ()); }
67-
float getYAtZ(float z) const { return getY() + mSlopeY * (z - getZ()); }
94+
float getXAtZ(float z) const { return getX() + getSlopeX() * (z - getZ()); }
95+
float getYAtZ(float z) const { return getY() + getSlopeY() * (z - getZ()); }
6896

6997
void print() const;
7098
std::string asString() const;
@@ -82,21 +110,24 @@ class MeanVertexObject : public VertexBase
82110

83111
void setMeanXYVertexAtZ(VertexBase& v, float z) const
84112
{
85-
float dz = z - getZ();
86-
v.setX(getX() + mSlopeX * dz);
87-
v.setY(getY() + mSlopeY * dz);
113+
v.setX(getXAtZ(z));
114+
v.setY(getYAtZ(z));
88115
v.setZ(z);
89116
}
90117

91-
const VertexBase& getMeanVertex() const
118+
const VertexBase getMeanVertex() const
92119
{
93-
return (const VertexBase&)(*this);
120+
return getMeanVertex(getZ());
94121
}
95122

123+
static void checkExternalBias();
124+
96125
private:
97126
float mSlopeX{0.f}; // slope of x = f(z)
98127
float mSlopeY{0.f}; // slope of y = f(z)
99128

129+
static const MeanVertexBiasParam* gMVBias;
130+
100131
ClassDefNV(MeanVertexObject, 2);
101132
};
102133

DataFormats/Calibration/src/DataFormatsCalibrationLinkDef.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#pragma link off all classes;
1616
#pragma link off all functions;
1717

18-
#pragma link C++ struct o2::dataformats::MeanVertexObject + ;
18+
#pragma link C++ class o2::dataformats::MeanVertexObject + ;
19+
#pragma link C++ class o2::dataformats::MeanVertexBiasParam + ;
20+
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::dataformats::MeanVertexBiasParam> + ;
1921

2022
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2019-2026 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+
12+
/// \author ruben.shahoyan@cern.ch
13+
14+
/// parameters to bias precalibrated mean vertex, e.g after the alignment shift
15+
16+
#include "DataFormatsCalibration/MeanVertexBiasParam.h"
17+
18+
O2ParamImpl(o2::dataformats::MeanVertexBiasParam);

DataFormats/Calibration/src/MeanVertexObject.cxx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212
#include "DataFormatsCalibration/MeanVertexObject.h"
1313
#include "TRandom.h"
1414

15+
#include <cstdlib>
16+
1517
namespace o2
1618
{
1719
namespace dataformats
1820
{
21+
const MeanVertexBiasParam* MeanVertexObject::gMVBias = nullptr;
1922

2023
void MeanVertexObject::set(int icoord, float val)
2124
{
@@ -45,7 +48,9 @@ void MeanVertexObject::setSigma(int icoord, float val)
4548

4649
std::string MeanVertexObject::asString() const
4750
{
48-
return VertexBase::asString() + fmt::format(" Slopes {{{:+.4e},{:+.4e}}}", mSlopeX, mSlopeY);
51+
return fmt::format("Vtx {{{:+.4e},{:+.4e},{:+.4e}}} Cov.:{{{{{:.3e}..}},{{{:.3e},{:.3e}..}},{{{:.3e},{:.3e},{:.3e}}}}} | bias: XYZ: {:.4f},{:.4f},{:.4f} SlopeXY: {:.3e},{:.3e}",
52+
getX(), getY(), getZ(), mCov[0], mCov[1], mCov[2], mCov[3], mCov[4], mCov[5],
53+
gMVBias->xyz[0], gMVBias->xyz[1], gMVBias->xyz[2], gMVBias->slopeX, gMVBias->slopeY);
4954
}
5055

5156
std::ostream& operator<<(std::ostream& os, const o2::dataformats::MeanVertexObject& o)
@@ -70,5 +75,16 @@ math_utils::Point3D<float> MeanVertexObject::sample() const
7075
return math_utils::Point3D<float>(x, y, z);
7176
}
7277

78+
void MeanVertexObject::checkExternalBias()
79+
{
80+
// posibility to globally bias all data members with the proper env.var
81+
if (const auto* biasString = std::getenv("O2_DPL_MVBIAS"); biasString && *biasString) {
82+
o2::conf::ConfigurableParam::updateFromString(biasString);
83+
}
84+
gMVBias = &MeanVertexBiasParam::Instance();
85+
LOGP(info, "Mean vertex is biased by: XYZ: {:.4f},{:.4f},{:.4f} SlopeXY: {:.3e},{:.3e}",
86+
gMVBias->xyz[0], gMVBias->xyz[1], gMVBias->xyz[2], gMVBias->slopeX, gMVBias->slopeY);
87+
}
88+
7389
} // namespace dataformats
7490
} // namespace o2

Detectors/TPC/calibration/include/TPCCalibration/IDCFourierTransform.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,15 @@ class IDCFourierTransform : public IDCFourierTransformBase<Type>
4545
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, IDCFourierTransformBaseAggregator>::value)), int>::type = 0>
4646
IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformAggregator(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads)
4747
{
48-
initFFTW3Members();
49-
};
48+
}
5049

5150
/// constructor for EPN type
5251
/// \param rangeIDC number of IDCs for each interval which will be used to calculate the fourier coefficients
5352
/// \param nFourierCoefficientsStore number of courier coefficients (real+imag) which will be stored (the maximum can be 'rangeIDC + 2', should be an even number when using naive FT). If less than maximum is setn the inverse fourier transform will not work.
5453
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, IDCFourierTransformBaseEPN>::value)), int>::type = 0>
5554
IDCFourierTransform(const unsigned int rangeIDC = 200, const unsigned int nFourierCoefficientsStore = 200 + 2) : IDCFourierTransformEPN(rangeIDC), mFourierCoefficients{1, nFourierCoefficientsStore}, mVal1DIDCs(sNThreads), mCoefficients(sNThreads)
5655
{
57-
initFFTW3Members();
58-
};
56+
}
5957

6058
// Destructor
6159
~IDCFourierTransform();
@@ -72,6 +70,9 @@ class IDCFourierTransform : public IDCFourierTransformBase<Type>
7270
sNThreads = nThreads;
7371
}
7472

73+
/// initalizing fftw members, e.g. when changing sNThreads via setNThreads after first initialization
74+
void initFFTW3Members();
75+
7576
/// calculate fourier coefficients for one TPC side
7677
template <bool IsEnabled = true, typename std::enable_if<(IsEnabled && (std::is_same<Type, IDCFourierTransformBaseAggregator>::value)), int>::type = 0>
7778
void calcFourierCoefficients(const unsigned int timeFrames = 2000)
@@ -155,9 +156,6 @@ class IDCFourierTransform : public IDCFourierTransformBase<Type>
155156
/// \return returns maximum numbers of stored real/imag fourier coeffiecients
156157
unsigned int getNMaxCoefficients() const { return this->mRangeIDC / 2 + 1; }
157158

158-
/// initalizing fftw members
159-
void initFFTW3Members();
160-
161159
/// performing of ft using FFTW
162160
void fftwLoop(const std::vector<float>& idcOneExpanded, const std::vector<unsigned int>& offsetIndex, const unsigned int interval, const unsigned int thread);
163161

Detectors/TPC/calibration/src/IDCFourierTransform.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ o2::tpc::IDCFourierTransform<Type>::~IDCFourierTransform()
3535
template <class Type>
3636
void o2::tpc::IDCFourierTransform<Type>::initFFTW3Members()
3737
{
38+
mVal1DIDCs.resize(sNThreads);
39+
mCoefficients.resize(sNThreads);
3840
for (int thread = 0; thread < sNThreads; ++thread) {
3941
mVal1DIDCs[thread] = fftwf_alloc_real(this->mRangeIDC);
4042
mCoefficients[thread] = fftwf_alloc_complex(getNMaxCoefficients());

Detectors/TPC/calibration/test/testO2TPCIDCFourierTransform.cxx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ BOOST_AUTO_TEST_CASE(IDCFourierTransformAggregator_test)
6767
FtType::setNThreads(2);
6868

6969
FtType idcFourierTransform{rangeIDC, nFourierCoeff};
70+
idcFourierTransform.initFFTW3Members();
7071
const auto intervalsPerTF = getIntegrationIntervalsPerTF(integrationIntervals, tfs);
7172
idcFourierTransform.setIDCs(get1DIDCs(intervalsPerTF), intervalsPerTF);
7273
idcFourierTransform.setIDCs(get1DIDCs(intervalsPerTF), intervalsPerTF);
@@ -105,6 +106,7 @@ BOOST_AUTO_TEST_CASE(IDCFourierTransformEPN_test)
105106
const bool fft = iType == 0 ? false : true;
106107
FtType::setFFT(fft);
107108
FtType idcFourierTransform{rangeIDC, nFourierCoeff};
109+
idcFourierTransform.initFFTW3Members();
108110
const auto intervalsPerTF = getIntegrationIntervalsPerTF(integrationIntervals, tfs);
109111
idcFourierTransform.setIDCs(get1DIDCs(intervalsPerTF));
110112
idcFourierTransform.calcFourierCoefficients();

0 commit comments

Comments
 (0)