Skip to content

Commit 2bdcbbd

Browse files
authored
Merge branch 'AliceO2Group:dev' into cpu-hip-filter
2 parents 2236772 + 16b6488 commit 2bdcbbd

88 files changed

Lines changed: 2804 additions & 1312 deletions

File tree

Some content is hidden

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

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
/Detectors/TPC @davidrohr @wiechula @shahor02
7474
/Detectors/TRD @f3sch @bazinski @wille10
7575
/Detectors/Upgrades @mconcas
76-
/Detectors/Upgrades/ALICE3 @mconcas @njacazio @fcolamar
76+
/Detectors/Upgrades/ALICE3 @mconcas @njacazio @fcolamar @pbutti
7777
/Detectors/Upgrades/ITS3 @fgrosa @arossi81 @mconcas @f3sch
7878
/Detectors/ZDC @coppedis @cortesep
7979
/Detectors/CTF @shahor02

Common/Field/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ o2_add_library(Field
1616
src/MagFieldParam.cxx
1717
src/MagneticField.cxx
1818
src/MagneticWrapperChebyshev.cxx
19+
src/FieldOriginBiasParam.cxx
1920
src/ALICE3MagneticField.cxx
2021
PUBLIC_LINK_LIBRARIES O2::MathUtils FairRoot::Base O2::CommonUtils)
2122

@@ -26,6 +27,7 @@ o2_target_root_dictionary(Field
2627
include/Field/MagFieldContFact.h
2728
include/Field/MagFieldFast.h
2829
include/Field/MagFieldFact.h
30+
include/Field/FieldOriginBiasParam.h
2931
include/Field/ALICE3MagneticField.h)
3032

3133
o2_add_test(MagneticField
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 the origin of the magnetic field
15+
16+
#ifndef ALICEO2_FIELDORIGIN_BIAS_PARAM_H
17+
#define ALICEO2_FIELDORIGIN_BIAS_PARAM_H
18+
19+
#include "CommonUtils/ConfigurableParam.h"
20+
#include "CommonUtils/ConfigurableParamHelper.h"
21+
22+
namespace o2
23+
{
24+
namespace field
25+
{
26+
27+
struct FieldOriginBiasParam : public o2::conf::ConfigurableParamHelper<FieldOriginBiasParam> {
28+
double x = 0.;
29+
double y = 0.;
30+
double z = 0.;
31+
32+
O2ParamDef(FieldOriginBiasParam, "FieldOriginBias");
33+
};
34+
35+
} // namespace field
36+
} // end namespace o2
37+
38+
#endif

Common/Field/include/Field/MagneticField.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ namespace o2
3232
namespace field
3333
{
3434
class MagneticWrapperChebyshev;
35+
class FieldOriginBiasParam;
3536
}
3637
} // namespace o2
3738
namespace o2
@@ -249,6 +250,7 @@ class MagneticField : public FairField
249250
void setBeamType(MagFieldParam::BeamType_t type) { mBeamType = type; }
250251

251252
void setBeamEnergy(float energy) { mBeamEnergy = energy; }
253+
void checkOriginBias();
252254

253255
private:
254256
std::unique_ptr<MagneticWrapperChebyshev> mMeasuredMap; //! Measured part of the field map
@@ -273,6 +275,8 @@ class MagneticField : public FairField
273275

274276
TNamed mParameterNames; ///< file and parameterization loaded
275277

278+
static const FieldOriginBiasParam* gOriginBias;
279+
276280
static const Double_t sSolenoidToDipoleZ; ///< conventional Z of transition from L3 to Dipole field
277281
static const UShort_t sPolarityConvention; ///< convention for the mapping of the curr.sign on main component sign
278282

Common/Field/src/FieldLinkDef.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@
2222
#pragma link C++ class o2::field::MagFieldFast + ;
2323
#pragma link C++ class o2::field::ALICE3MagneticField + ;
2424

25+
#pragma link C++ class o2::field::FieldOriginBiasParam + ;
26+
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::field::FieldOriginBiasParam> + ;
27+
2528
#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 the origin of the magnetic field
15+
16+
#include "Field/FieldOriginBiasParam.h"
17+
18+
O2ParamImpl(o2::field::FieldOriginBiasParam);

Common/Field/src/MagneticField.cxx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
/// \author ruben.shahoyan@cern.ch
1515

1616
#include "Field/MagneticField.h"
17+
#include "Field/FieldOriginBiasParam.h"
1718
#include <TFile.h> // for TFile
1819
#include <TPRegexp.h> // for TPRegexp
1920
#include <TString.h> // for TString
@@ -27,6 +28,8 @@ using namespace o2::field;
2728

2829
ClassImp(MagneticField);
2930

31+
const FieldOriginBiasParam* MagneticField::gOriginBias = nullptr;
32+
3033
const Double_t MagneticField::sSolenoidToDipoleZ = -700.;
3134

3235
/// Explanation for polarity conventions: these are the mapping between the
@@ -88,6 +91,9 @@ MagneticField::MagneticField()
8891
* Default constructor
8992
*/
9093
fType = 2; // flag non-constant field
94+
if (!gOriginBias) {
95+
checkOriginBias();
96+
}
9197
}
9298

9399
MagneticField::MagneticField(const char* name, const char* title, Double_t factorSol, Double_t factorDip,
@@ -116,8 +122,10 @@ MagneticField::MagneticField(const char* name, const char* title, Double_t facto
116122
/*
117123
* Constructor for human readable params
118124
*/
119-
120125
setDataFileName(path.c_str());
126+
if (!gOriginBias) {
127+
checkOriginBias();
128+
}
121129
CreateField();
122130
}
123131

@@ -145,8 +153,10 @@ MagneticField::MagneticField(const MagFieldParam& param)
145153
/*
146154
* Constructor for FairParam derived params
147155
*/
148-
149156
setDataFileName(param.GetMapPath());
157+
if (!gOriginBias) {
158+
checkOriginBias();
159+
}
150160
CreateField();
151161
}
152162

@@ -261,12 +271,12 @@ Bool_t MagneticField::loadParameterization()
261271
return kTRUE;
262272
}
263273

264-
void MagneticField::Field(const Double_t* __restrict__ xyz, Double_t* __restrict__ b)
274+
void MagneticField::Field(const Double_t* __restrict__ xyzExt, Double_t* __restrict__ b)
265275
{
266276
/*
267277
* query field value at point
268278
*/
269-
279+
double xyz[3] = {xyzExt[0] - gOriginBias->x, xyzExt[1] - gOriginBias->y, xyzExt[2] - gOriginBias->z};
270280
// b[0]=b[1]=b[2]=0.0;
271281
if (mFastField && mFastField->Field(xyz, b)) {
272282
return;
@@ -288,12 +298,12 @@ void MagneticField::Field(const Double_t* __restrict__ xyz, Double_t* __restrict
288298
}
289299
}
290300

291-
Double_t MagneticField::getBz(const Double_t* xyz) const
301+
Double_t MagneticField::getBz(const Double_t* xyzExt) const
292302
{
293303
/*
294304
* query field Bz component at point
295305
*/
296-
306+
double xyz[3] = {xyzExt[0] - gOriginBias->x, xyzExt[1] - gOriginBias->y, xyzExt[2] - gOriginBias->z};
297307
if (mFastField) {
298308
double bz = 0;
299309
if (mFastField->GetBz(xyz, bz)) {
@@ -728,3 +738,14 @@ void MagneticField::AllowFastField(bool v)
728738
mFastField.reset(nullptr);
729739
}
730740
}
741+
742+
//_____________________________________________________________________________
743+
void MagneticField::checkOriginBias()
744+
{
745+
// posibility to globally bias all data members with the proper env.var
746+
if (const auto* biasString = std::getenv("O2_DPL_FIELDORIGINBIAS"); biasString && *biasString) {
747+
o2::conf::ConfigurableParam::updateFromString(biasString);
748+
}
749+
gOriginBias = &FieldOriginBiasParam::Instance();
750+
LOGP(info, "Field origin is set to: XYZ: {:.4f},{:.4f},{:.4f}", gOriginBias->x, gOriginBias->y, gOriginBias->z);
751+
}

Common/ML/src/OrtInterface.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ void OrtModel::initEnvironment()
140140

141141
void OrtModel::initSessionFromBuffer(const char* buffer, size_t bufferSize)
142142
{
143+
if (mAllocateDeviceMemory) {
144+
memoryOnDevice(mDeviceId);
145+
}
143146
mPImplOrt->sessionOptions.AddConfigEntry("session.load_model_format", "ONNX");
144147
mPImplOrt->sessionOptions.AddConfigEntry("session.use_ort_model_bytes_directly", "1");
145148

DataFormats/Calibration/include/DataFormatsCalibration/MeanVertexObject.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class MeanVertexObject : public VertexBase
110110

111111
void setMeanXYVertexAtZ(VertexBase& v, float z) const
112112
{
113+
v = *this;
113114
v.setX(getXAtZ(z));
114115
v.setY(getYAtZ(z));
115116
v.setZ(z);

DataFormats/Detectors/TPC/include/DataFormatsTPC/ClusterNative.h

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,21 @@ struct ClusterNative {
7373
uint8_t sigmaTimePacked; //< Sigma of the time in packed format
7474
uint8_t sigmaPadPacked; //< Sigma of the pad in packed format
7575
uint16_t qMax; //< QMax of the cluster
76-
uint16_t qTot; //< Total charge of the cluster
76+
uint16_t qTotPacked; //< Total charge of the cluster
7777

7878
GPUd() static uint16_t packPad(float pad) { return (uint16_t)(pad * scalePadPacked + 0.5); }
7979
GPUd() static uint32_t packTime(float time) { return (uint32_t)(time * scaleTimePacked + 0.5); }
8080
GPUd() static float unpackPad(uint16_t pad) { return float(pad) * (1.f / scalePadPacked); }
8181
GPUd() static float unpackTime(uint32_t time) { return float(time) * (1.f / scaleTimePacked); }
8282

8383
GPUdDefault() ClusterNative() = default;
84-
GPUd() ClusterNative(uint32_t time, uint8_t flags, uint16_t pad, uint8_t sigmaTime, uint8_t sigmaPad, uint16_t qmax, uint16_t qtot) : padPacked(pad), sigmaTimePacked(sigmaTime), sigmaPadPacked(sigmaPad), qMax(qmax), qTot(qtot)
84+
GPUd() ClusterNative(uint32_t time, uint8_t flags, uint16_t pad, uint8_t sigmaTime, uint8_t sigmaPad, uint16_t qmax, uint16_t qtotPacked) : padPacked(pad), sigmaTimePacked(sigmaTime), sigmaPadPacked(sigmaPad), qMax(qmax), qTotPacked(qtotPacked)
8585
{
8686
setTimePackedFlags(time, flags);
8787
}
8888

8989
GPUd() uint16_t getQmax() const { return qMax; }
90-
GPUd() uint16_t getQtot() const
91-
{
92-
if (isSaturated()) [[unlikely]] {
93-
auto sQtot = getSaturatedQtot();
94-
return sQtot < USHRT_MAX ? sQtot : USHRT_MAX;
95-
}
96-
return qTot;
97-
}
90+
GPUd() uint32_t getQtot() const { return isSaturated() ? getSaturatedQtot() : (uint32_t)qTotPacked; }
9891
GPUd() uint8_t getFlags() const { return timeFlagsPacked >> 24; }
9992
GPUd() uint32_t getTimePacked() const { return timeFlagsPacked & 0xFFFFFF; }
10093
GPUd() void setTimePackedFlags(uint32_t timePacked, uint8_t flags)
@@ -155,19 +148,19 @@ struct ClusterNative {
155148
sigmaPadPacked = tmp;
156149
}
157150

158-
GPUd() bool isSaturated() const { return qTot > maxRegularQtot; }
151+
GPUd() bool isSaturated() const { return qTotPacked > maxRegularQtot; }
159152

160153
GPUd() void setSaturatedQtot(uint32_t qtot)
161154
{
162-
this->qTot = USHRT_MAX;
155+
this->qTotPacked = USHRT_MAX;
163156
if (qtot < maxSaturatedQtot) {
164-
this->qTot = ((qtot + scaleSaturatedQtot / 2) / scaleSaturatedQtot) + maxRegularQtot;
157+
this->qTotPacked = ((qtot + scaleSaturatedQtot / 2) / scaleSaturatedQtot) + maxRegularQtot;
165158
}
166159
}
167160

168161
GPUd() uint32_t getSaturatedQtot() const
169162
{
170-
return uint32_t(qTot - maxRegularQtot) * scaleSaturatedQtot;
163+
return uint32_t(qTotPacked - maxRegularQtot) * scaleSaturatedQtot;
171164
}
172165

173166
GPUd() void setSaturatedTailLength(uint32_t tail)
@@ -192,8 +185,8 @@ struct ClusterNative {
192185
return (this->sigmaPadPacked < rhs.sigmaPadPacked);
193186
} else if (this->qMax != rhs.qMax) {
194187
return (this->qMax < rhs.qMax);
195-
} else if (this->qTot != rhs.qTot) {
196-
return (this->qTot < rhs.qTot);
188+
} else if (this->qTotPacked != rhs.qTotPacked) {
189+
return (this->getQtot() < rhs.getQtot());
197190
} else {
198191
return (this->getFlags() < rhs.getFlags());
199192
}
@@ -206,7 +199,7 @@ struct ClusterNative {
206199
this->sigmaTimePacked == rhs.sigmaTimePacked &&
207200
this->sigmaPadPacked == rhs.sigmaPadPacked &&
208201
this->qMax == rhs.qMax &&
209-
this->qTot == rhs.qTot &&
202+
this->qTotPacked == rhs.qTotPacked &&
210203
this->getFlags() == rhs.getFlags();
211204
}
212205

0 commit comments

Comments
 (0)