Skip to content

Commit fae2d5f

Browse files
authored
Merge branch 'AliceO2Group:dev' into new-detector4
2 parents a22c25a + f08023c commit fae2d5f

File tree

29 files changed

+378
-157
lines changed

29 files changed

+378
-157
lines changed

Common/ML/include/ML/OrtInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class OrtModel
116116
int32_t mInputsTotal = 0, mOutputsTotal = 0; // Total number of inputs and outputs
117117

118118
// Environment settings
119-
bool mInitialized = false;
119+
bool mInitialized = false, mDeterministicMode = false;
120120
std::string mModelPath, mEnvName = "", mDeviceType = "CPU", mThreadAffinity = ""; // device options should be cpu, rocm, migraphx, cuda
121121
int32_t mIntraOpNumThreads = 1, mInterOpNumThreads = 1, mDeviceId = -1, mEnableProfiling = 0, mLoggingLevel = 0, mAllocateDeviceMemory = 0, mEnableOptimizations = 0;
122122

Common/ML/src/OrtInterface.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ void OrtModel::initOptions(std::unordered_map<std::string, std::string> optionsM
6868
mEnableProfiling = (optionsMap.contains("enable-profiling") ? std::stoi(optionsMap["enable-profiling"]) : 0);
6969
mEnableOptimizations = (optionsMap.contains("enable-optimizations") ? std::stoi(optionsMap["enable-optimizations"]) : 0);
7070
mEnvName = (optionsMap.contains("onnx-environment-name") ? optionsMap["onnx-environment-name"] : "onnx_model_inference");
71+
mDeterministicMode = (optionsMap.contains("deterministic-compute") ? std::stoi(optionsMap["deterministic-compute"]) : 0);
7172

7273
if (mDeviceType == "CPU") {
7374
(mPImplOrt->sessionOptions).SetIntraOpNumThreads(mIntraOpNumThreads);
@@ -99,6 +100,10 @@ void OrtModel::initOptions(std::unordered_map<std::string, std::string> optionsM
99100
(mPImplOrt->sessionOptions).DisableProfiling();
100101
}
101102

103+
if (mDeterministicMode > 0) {
104+
(mPImplOrt->sessionOptions).AddConfigEntry("session_options.use_deterministic_compute", "1");
105+
}
106+
102107
(mPImplOrt->sessionOptions).SetGraphOptimizationLevel(GraphOptimizationLevel(mEnableOptimizations));
103108
(mPImplOrt->sessionOptions).SetLogSeverityLevel(OrtLoggingLevel(mLoggingLevel));
104109

DataFormats/Detectors/TOF/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ o2_add_library(DataFormatsTOF
1616
src/CalibLHCphaseTOF.cxx
1717
src/CalibTimeSlewingParamTOF.cxx
1818
src/CTF.cxx
19-
src/ParameterContainers.cxx
2019
src/CalibInfoCluster.cxx
2120
src/CosmicInfo.cxx
2221
src/Diagnostic.cxx

DataFormats/Detectors/TOF/include/DataFormatsTOF/ParameterContainers.h

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Parameters
3737
Parameters(std::array<std::string, nPar> parNames, std::string name) : mName{name}, mPar{}, mParNames{parNames} {};
3838

3939
/// Default destructor
40-
~Parameters() = default;
40+
virtual ~Parameters() = default; // Ensure proper cleanup in derived classes
4141

4242
/// Setter for the parameter at position iparam
4343
/// \param iparam index in the array of the parameters
@@ -183,10 +183,27 @@ class ParameterCollection : public TNamed
183183
/// @param value parameter to add to the stored information
184184
/// @param pass key to look for in the stored information e.g. pass
185185
/// @return true if found and configured false if not fully configured
186-
bool addParameter(const std::string& pass, const std::string& parName, float value);
186+
bool addParameter(const std::string& pass, const std::string& parName, float value)
187+
{
188+
const bool alreadyPresent = hasKey(pass);
189+
if (alreadyPresent) {
190+
LOG(debug) << "Changing parametrization corresponding to key " << pass << " from size " << mParameters[pass].size() << " to " << parName;
191+
} else {
192+
mParameters[pass] = std::unordered_map<std::string, paramvar_t>{};
193+
LOG(debug) << "Adding new parametrization corresponding to key " << pass << ": " << parName;
194+
}
195+
mParameters[pass][parName] = value;
196+
return true;
197+
}
187198

188199
/// @return the size of the container i.e. the number of stored keys (or passes)
189-
int getSize(const std::string& pass) const;
200+
int getSize(const std::string& pass) const
201+
{
202+
if (!hasKey(pass)) {
203+
return -1;
204+
}
205+
return mParameters.at(pass).size();
206+
}
190207

191208
/// @brief Function to push the parameters from the sub container into the collection and store it under a given key
192209
/// @tparam ParType type of the parameter container
@@ -214,10 +231,26 @@ class ParameterCollection : public TNamed
214231

215232
/// @brief printing function for the content of the pass
216233
/// @param pass pass to print
217-
void print(const std::string& pass) const;
234+
void print(const std::string& pass) const
235+
{
236+
const auto& size = getSize(pass);
237+
if (size < 0) {
238+
LOG(info) << "empty pass: " << pass;
239+
return;
240+
}
241+
LOG(info) << "Pass \"" << pass << "\" with size " << size;
242+
for (const auto& [par, value] : mParameters.at(pass)) {
243+
LOG(info) << "par name = " << par << ", value = " << value;
244+
}
245+
}
218246

219247
/// @brief printing function for the full content of the container
220-
void print() const;
248+
void print() const
249+
{
250+
for (const auto& [pass, pars] : mParameters) {
251+
print(pass);
252+
}
253+
}
221254

222255
/// @brief Getter of the full map of parameters stored in the container
223256
/// @return returns the full map of parameters

DataFormats/Detectors/TOF/src/ParameterContainers.cxx

Lines changed: 0 additions & 62 deletions
This file was deleted.

DataFormats/Reconstruction/include/ReconstructionDataFormats/DecayNBodyIndex.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,19 @@ class DecayNBodyIndex
5555
class V0Index : public DecayNBodyIndex<2>
5656
{
5757
public:
58+
enum V0Type : uint8_t {
59+
kStandaloneV0 = 0,
60+
kPhotonOnly,
61+
kCollinear,
62+
};
5863
using DecayNBodyIndex<2>::DecayNBodyIndex;
5964
V0Index(int v, GIndex p, GIndex n) : DecayNBodyIndex<2>(v, {p, n}) {}
60-
bool isStandaloneV0() const { return testBit(0); }
61-
bool isPhotonOnly() const { return testBit(1); }
62-
bool isCollinear() const { return testBit(2); }
63-
void setStandaloneV0() { setBit(0); }
64-
void setPhotonOnly() { setBit(1); }
65-
void setCollinear() { setBit(2); }
65+
bool isStandaloneV0() const { return testBit(kStandaloneV0); }
66+
bool isPhotonOnly() const { return testBit(kPhotonOnly); }
67+
bool isCollinear() const { return testBit(kCollinear); }
68+
void setStandaloneV0() { setBit(kStandaloneV0); }
69+
void setPhotonOnly() { setBit(kPhotonOnly); }
70+
void setCollinear() { setBit(kCollinear); }
6671
ClassDefNV(V0Index, 1);
6772
};
6873

DataFormats/Reconstruction/include/ReconstructionDataFormats/TrackParametrization.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,8 @@ class TrackParametrization
248248
#ifndef GPUCA_ALIGPUCODE
249249
std::string asString() const;
250250
std::string asStringHexadecimal();
251+
size_t hash() const { return hash(getX(), getAlpha(), getY(), getZ(), getSnp(), getTgl(), getQ2Pt()); }
252+
static size_t hash(float x, float alp, float y, float z, float snp, float tgl, float q2pt);
251253
#endif
252254

253255
GPUd() void updateParam(value_t delta, int i);
@@ -752,6 +754,21 @@ GPUdi() void TrackParametrization<value_T>::updateParams(const value_t* delta)
752754
}
753755
}
754756

757+
#ifndef GPUCA_ALIGPUCODE
758+
template <typename value_T>
759+
size_t TrackParametrization<value_T>::hash(float x, float alp, float y, float z, float snp, float tgl, float q2pt)
760+
{
761+
size_t h = std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(x, 0xFFFFFFF0));
762+
h ^= std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(alp, 0xFFFFFFF0)) << 1;
763+
h ^= std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(y, 0xFFFFFFF0)) << 1;
764+
h ^= std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(z, 0xFFFFFFF0)) << 1;
765+
h ^= std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(snp, 0xFFFFFF00)) << 1;
766+
h ^= std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(tgl, 0xFFFFFF00)) << 1;
767+
h ^= std::hash<float>{}(o2::math_utils::detail::truncateFloatFraction(q2pt, 0xFFFFFC00)) << 1;
768+
return h;
769+
}
770+
#endif
771+
755772
} // namespace track
756773
} // namespace o2
757774

DataFormats/simulation/include/SimulationDataFormat/O2DatabasePDG.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,15 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG* db)
470470
0.185, 0, "Resonance", ionCode);
471471
}
472472

473+
// Lambda(1405)0
474+
ionCode = 102132;
475+
if (!db->GetParticle(ionCode)) {
476+
db->AddParticle("Lambda_1405_0", "Lambda_1405_0", 1.405, kFALSE, 0.05, 0, "Resonance", ionCode);
477+
}
478+
if (!db->GetParticle(-ionCode)) {
479+
db->AddParticle("AntiLambda_1405_0", "AntiLambda_1405_0", 1.405, kFALSE, 0.05, 0, "Resonance", -ionCode);
480+
}
481+
473482
// Lambda(1520)0
474483
ionCode = 102134;
475484
if (!db->GetParticle(ionCode)) {

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class AODProducerWorkflowDPL : public Task
246246
std::mt19937 mGenerator{}; ///< random generator for trackQA sampling
247247
o2::base::Propagator::MatCorrType mMatCorr{o2::base::Propagator::MatCorrType::USEMatCorrLUT};
248248
o2::dataformats::MeanVertexObject mVtx;
249-
float mMinPropR{o2::constants::geom::XTPCInnerRef + 0.1f};
249+
float mMaxPropXiu{5.0f}; // max X_IU for which track is to be propagated if mPropTracks is true. (other option: o2::constants::geom::XTPCInnerRef + 0.1f)
250250

251251
std::unordered_set<GIndex> mGIDUsedBySVtx;
252252
std::unordered_set<GIndex> mGIDUsedByStr;

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ void AODProducerWorkflowDPL::fillTrackTablesPerCollision(int collisionID,
540540
}
541541
const auto& trOrig = data.getTrackParam(trackIndex);
542542
bool isProp = false;
543-
if (mPropTracks && trOrig.getX() < mMinPropR &&
543+
if (mPropTracks && trOrig.getX() < mMaxPropXiu &&
544544
mGIDUsedBySVtx.find(trackIndex) == mGIDUsedBySVtx.end() &&
545545
mGIDUsedByStr.find(trackIndex) == mGIDUsedByStr.end()) { // Do not propagate track assoc. to V0s and str. tracking
546546
auto trackPar(trOrig);
@@ -1688,6 +1688,7 @@ void AODProducerWorkflowDPL::init(InitContext& ic)
16881688
mEMCselectLeading = ic.options().get<bool>("emc-select-leading");
16891689
mThinTracks = ic.options().get<bool>("thin-tracks");
16901690
mPropTracks = ic.options().get<bool>("propagate-tracks");
1691+
mMaxPropXiu = ic.options().get<float>("propagate-tracks-max-xiu");
16911692
mPropMuons = ic.options().get<bool>("propagate-muons");
16921693
if (auto s = ic.options().get<std::string>("with-streamers"); !s.empty()) {
16931694
mStreamerFlags.set(s);
@@ -3299,6 +3300,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
32993300
ConfigParamSpec{"ctpreadout-create", VariantType::Int, 0, {"Create CTP digits from detector readout and CTP inputs. !=1 -- off, 1 -- on"}},
33003301
ConfigParamSpec{"emc-select-leading", VariantType::Bool, false, {"Flag to select if only the leading contributing particle for an EMCal cell should be stored"}},
33013302
ConfigParamSpec{"propagate-tracks", VariantType::Bool, false, {"Propagate tracks (not used for secondary vertices) to IP"}},
3303+
ConfigParamSpec{"propagate-tracks-max-xiu", VariantType::Float, 5.0f, {"Propagate tracks to IP if X_IU smaller than this value (and if propagate tracks enabled)"}},
33023304
ConfigParamSpec{"hepmc-update", VariantType::String, "always", {"When to update HepMC Aux tables: always - force update, never - never update, all - if all keys are present, any - when any key is present (not valid yet)"}},
33033305
ConfigParamSpec{"propagate-muons", VariantType::Bool, false, {"Propagate muons to IP"}},
33043306
ConfigParamSpec{"thin-tracks", VariantType::Bool, false, {"Produce thinned track tables"}},

0 commit comments

Comments
 (0)