Skip to content

Commit 7925b83

Browse files
authored
Merge branch 'AliceO2Group:master' into master
2 parents d57c9f9 + b7c8c72 commit 7925b83

File tree

90 files changed

+7007
-3612
lines changed

Some content is hidden

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

90 files changed

+7007
-3612
lines changed

ALICE3/Core/FastTracker.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
516516
for (int ii = 0; ii < o2::track::kCovMatSize; ii++)
517517
covMat[ii] = outputTrack.getCov()[ii];
518518
TMatrixDSym m(5);
519-
float fcovm[5][5];
519+
double fcovm[5][5]; // double precision is needed for regularisation
520520

521521
for (int ii = 0, k = 0; ii < 5; ++ii) {
522522
for (int j = 0; j < ii + 1; ++j, ++k) {

Common/Core/CollisionTypeHelper.cxx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
///
1717

1818
#include "Common/Core/CollisionTypeHelper.h"
19+
20+
#include "DataFormatsParameters/GRPLHCIFData.h"
21+
1922
#include <fairlogger/Logger.h>
23+
2024
#include <string>
21-
#include "DataFormatsParameters/GRPLHCIFData.h"
2225

23-
std::string CollisionSystemType::getCollisionSystemName(collType collSys)
26+
std::string o2::common::core::CollisionSystemType::getCollisionSystemName(collType collSys)
2427
{
2528
switch (collSys) {
2629
case kCollSyspp:
@@ -36,7 +39,7 @@ std::string CollisionSystemType::getCollisionSystemName(collType collSys)
3639
}
3740
}
3841

39-
int CollisionSystemType::getCollisionTypeFromGrp(o2::parameters::GRPLHCIFData* grplhcif)
42+
int o2::common::core::CollisionSystemType::getCollisionTypeFromGrp(o2::parameters::GRPLHCIFData* grplhcif)
4043
{
4144
const int ZBeamA = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamA);
4245
const int ZBeamC = grplhcif->getBeamZ(o2::constants::lhc::BeamDirection::BeamC);

Common/Core/CollisionTypeHelper.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@
1818
#ifndef COMMON_CORE_COLLISIONTYPEHELPER_H_
1919
#define COMMON_CORE_COLLISIONTYPEHELPER_H_
2020

21-
#include <string>
2221
#include "DataFormatsParameters/GRPLHCIFData.h"
2322

23+
#include <string>
24+
25+
namespace o2::common::core
26+
{
2427
// Container for the collision system type
2528
struct CollisionSystemType {
2629
// Enum type for the collision system
@@ -38,4 +41,8 @@ struct CollisionSystemType {
3841
static int getCollisionTypeFromGrp(o2::parameters::GRPLHCIFData* grplhcif);
3942
};
4043

44+
} // namespace o2::common::core
45+
46+
using CollisionSystemType = o2::common::core::CollisionSystemType;
47+
4148
#endif // COMMON_CORE_COLLISIONTYPEHELPER_H_

Common/Core/MetadataHelper.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@
2020
#include "Framework/InitContext.h"
2121
#include "Framework/RunningWorkflowInfo.h"
2222

23+
using namespace o2::common::core;
24+
2325
MetadataHelper::MetadataHelper()
2426
{
25-
const std::array<std::string, 5> keyList = {"DataType",
27+
const std::array<std::string, 8> keyList = {"DataType",
2628
"RecoPassName",
2729
"Run",
2830
"AnchorPassName",
29-
"AnchorProduction"};
31+
"AnchorProduction",
32+
"ROOTVersion",
33+
"LPMProductionTag",
34+
"O2Version"};
3035
for (const auto& key : keyList) {
3136
mMetadata[key] = "undefined";
3237
}

Common/Core/MetadataHelper.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@
1818
#ifndef COMMON_CORE_METADATAHELPER_H_
1919
#define COMMON_CORE_METADATAHELPER_H_
2020

21-
#include <string>
22-
#include <map>
2321
#include "Framework/ConfigContext.h"
2422

23+
#include <map>
24+
#include <string>
25+
26+
namespace o2::common::core
27+
{
28+
2529
struct MetadataHelper {
2630
/// @brief Constructor for the MetadataHelper. Defines the all the metadata keys that will be looked for and accessible
2731
MetadataHelper();
@@ -64,4 +68,8 @@ struct MetadataHelper {
6468
bool mIsInitialized = false; /// < Flag to check if the metadata has been initialized
6569
};
6670

71+
} // namespace o2::common::core
72+
73+
using MetadataHelper = o2::common::core::MetadataHelper; // Alias for the MetadataHelper
74+
6775
#endif // COMMON_CORE_METADATAHELPER_H_

Common/TableProducer/mftmchMatchingML.cxx

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include <math.h>
13-
#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
14-
#include <onnxruntime/core/session/experimental_onnxruntime_cxx_api.h>
15-
#else
1613
#include <onnxruntime_cxx_api.h>
17-
#endif
1814
#include <string>
1915
#include <regex>
2016
#include <TLorentzVector.h>
@@ -77,11 +73,7 @@ struct mftmchMatchingML {
7773

7874
Ort::Env env{ORT_LOGGING_LEVEL_WARNING, "model-explorer"};
7975
Ort::SessionOptions session_options;
80-
#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
81-
std::shared_ptr<Ort::Experimental::Session> onnx_session = nullptr;
82-
#else
8376
std::shared_ptr<Ort::Session> onnx_session = nullptr;
84-
#endif
8577
OnnxModel model;
8678

8779
template <typename F, typename M>
@@ -158,12 +150,6 @@ struct mftmchMatchingML {
158150
std::vector<std::string> output_names;
159151
std::vector<std::vector<int64_t>> output_shapes;
160152

161-
#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
162-
input_names = onnx_session->GetInputNames();
163-
input_shapes = onnx_session->GetInputShapes();
164-
output_names = onnx_session->GetOutputNames();
165-
output_shapes = onnx_session->GetOutputShapes();
166-
#else
167153
Ort::AllocatorWithDefaultOptions tmpAllocator;
168154
for (size_t i = 0; i < onnx_session->GetInputCount(); ++i) {
169155
input_names.push_back(onnx_session->GetInputNameAllocated(i, tmpAllocator).get());
@@ -177,7 +163,6 @@ struct mftmchMatchingML {
177163
for (size_t i = 0; i < onnx_session->GetOutputCount(); ++i) {
178164
output_shapes.emplace_back(onnx_session->GetOutputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape());
179165
}
180-
#endif
181166

182167
auto input_shape = input_shapes[0];
183168
input_shape[0] = 1;
@@ -187,11 +172,6 @@ struct mftmchMatchingML {
187172

188173
if (input_tensor_values[8] < cfgXYWindow) {
189174
std::vector<Ort::Value> input_tensors;
190-
#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
191-
input_tensors.push_back(Ort::Experimental::Value::CreateTensor<float>(input_tensor_values.data(), input_tensor_values.size(), input_shape));
192-
193-
std::vector<Ort::Value> output_tensors = onnx_session->Run(input_names, input_tensors, output_names);
194-
#else
195175
Ort::MemoryInfo mem_info =
196176
Ort::MemoryInfo::CreateCpu(OrtAllocatorType::OrtArenaAllocator, OrtMemType::OrtMemTypeDefault);
197177
input_tensors.push_back(Ort::Value::CreateTensor<float>(mem_info, input_tensor_values.data(), input_tensor_values.size(), input_shape.data(), input_shape.size()));
@@ -206,7 +186,6 @@ struct mftmchMatchingML {
206186
[&](const std::string& str) { return str.c_str(); });
207187

208188
std::vector<Ort::Value> output_tensors = onnx_session->Run(runOptions, inputNamesChar.data(), input_tensors.data(), input_tensors.size(), outputNamesChar.data(), outputNamesChar.size());
209-
#endif
210189

211190
const float* output_value = output_tensors[0].GetTensorData<float>();
212191

DPG/Tasks/AOTTrack/qaImpPar.cxx

Lines changed: 70 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,32 @@
1010
// or submit itself to any jurisdiction.
1111
/// \author Mattia Faggin <mattia.faggin@cern.ch>, Padova University and INFN
1212

13-
#include <string>
14-
15-
#include "Framework/AnalysisTask.h"
16-
#include "Framework/HistogramRegistry.h"
17-
#include "ReconstructionDataFormats/DCA.h"
13+
#include "Common/Core/TrackSelection.h"
1814
#include "Common/Core/trackUtilities.h" // for propagation to primary vertex
19-
2015
#include "Common/DataModel/EventSelection.h"
21-
#include "Common/DataModel/TrackSelectionTables.h"
2216
#include "Common/DataModel/PIDResponse.h"
23-
#include "DetectorsBase/Propagator.h"
24-
#include "DetectorsBase/GeometryManager.h"
25-
#include "CommonUtils/NameConf.h"
26-
#include "Framework/AnalysisDataModel.h"
27-
#include "Common/Core/TrackSelection.h"
28-
#include "DetectorsVertexing/PVertexer.h"
29-
#include "ReconstructionDataFormats/Vertex.h"
17+
#include "Common/DataModel/TrackSelectionTables.h"
18+
3019
#include "CCDB/BasicCCDBManager.h"
31-
#include "DataFormatsParameters/GRPMagField.h"
32-
#include "Framework/RunningWorkflowInfo.h"
3320
#include "CCDB/CcdbApi.h"
34-
#include "DataFormatsCalibration/MeanVertexObject.h"
3521
#include "CommonConstants/GeomConstants.h"
22+
#include "CommonUtils/NameConf.h"
23+
#include "DataFormatsCalibration/MeanVertexObject.h"
24+
#include "DataFormatsParameters/GRPMagField.h"
25+
#include "DetectorsBase/GeometryManager.h"
26+
#include "DetectorsBase/Propagator.h"
27+
#include "DetectorsVertexing/PVertexer.h"
28+
#include "Framework/AnalysisDataModel.h"
29+
#include "Framework/AnalysisTask.h"
30+
#include "Framework/HistogramRegistry.h"
31+
#include "Framework/RunningWorkflowInfo.h"
32+
#include "ReconstructionDataFormats/DCA.h"
33+
#include "ReconstructionDataFormats/Vertex.h"
3634

3735
#include <iostream>
38-
#include <vector>
3936
#include <set>
37+
#include <string>
38+
#include <vector>
4039

4140
using namespace o2::framework;
4241
using namespace o2::framework::expressions;
@@ -153,38 +152,72 @@ struct QaImpactPar {
153152
/// Data
154153
using CollisionRecoTable = o2::soa::Join<o2::aod::Collisions, o2::aod::EvSels>;
155154
using TrackTable = o2::soa::Join<o2::aod::Tracks, o2::aod::TracksCov, o2::aod::TracksExtra>;
156-
using TrackFullTable = o2::soa::Join<o2::aod::Tracks, o2::aod::TrackSelection, o2::aod::TracksCov, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TracksDCACov,
155+
using TrackFullTableNoPid = o2::soa::Join<o2::aod::Tracks, o2::aod::TrackSelection, o2::aod::TracksCov, o2::aod::TracksExtra, o2::aod::TracksDCA, o2::aod::TracksDCACov>;
156+
using TrackFullTable = o2::soa::Join<TrackFullTableNoPid,
157157
o2::aod::pidTPCFullPi, o2::aod::pidTPCFullKa, o2::aod::pidTPCFullPr,
158158
o2::aod::pidTOFFullPi, o2::aod::pidTOFFullKa, o2::aod::pidTOFFullPr>;
159159
using TrackTableIU = o2::soa::Join<o2::aod::TracksIU, o2::aod::TracksCovIU, o2::aod::TracksExtra>;
160+
///
161+
/// @brief process function in data, without the usage of PID info
160162
void processData(o2::soa::Filtered<CollisionRecoTable>::iterator const& collision,
161163
const TrackTable& tracksUnfiltered,
162-
const o2::soa::Filtered<TrackFullTable>& tracks,
164+
const o2::soa::Filtered<TrackFullTableNoPid>& tracks,
163165
const TrackTableIU& tracksIU,
164166
o2::aod::BCsWithTimestamps const&)
165167
{
166168
/// here call the template processReco function
167169
auto bc = collision.bc_as<o2::aod::BCsWithTimestamps>();
168-
processReco<false>(collision, tracksUnfiltered, tracks, tracksIU, 0, bc);
170+
processReco<false, false>(collision, tracksUnfiltered, tracks, tracksIU, 0, bc);
169171
}
170172
PROCESS_SWITCH(QaImpactPar, processData, "process data", true);
173+
///
174+
/// @brief process function in data, with the possibility to use PID info
175+
void processDataWithPid(o2::soa::Filtered<CollisionRecoTable>::iterator const& collision,
176+
const TrackTable& tracksUnfiltered,
177+
const o2::soa::Filtered<TrackFullTable>& tracks,
178+
const TrackTableIU& tracksIU,
179+
o2::aod::BCsWithTimestamps const&)
180+
{
181+
/// here call the template processReco function
182+
auto bc = collision.bc_as<o2::aod::BCsWithTimestamps>();
183+
processReco<false, true>(collision, tracksUnfiltered, tracks, tracksIU, 0, bc);
184+
}
185+
PROCESS_SWITCH(QaImpactPar, processDataWithPid, "process data with PID", false);
171186

172187
/// MC
173188
using CollisionMCRecoTable = o2::soa::Join<CollisionRecoTable, o2::aod::McCollisionLabels>;
189+
using TrackMCFullTableNoPid = o2::soa::Join<TrackFullTableNoPid, o2::aod::McTrackLabels>;
174190
using TrackMCFullTable = o2::soa::Join<TrackFullTable, o2::aod::McTrackLabels>;
191+
///
192+
/// @brief process function in MC, without the usage of PID info
175193
void processMC(o2::soa::Filtered<CollisionMCRecoTable>::iterator const& collision,
176194
TrackTable const& tracksUnfiltered,
177-
o2::soa::Filtered<TrackMCFullTable> const& tracks,
195+
o2::soa::Filtered<TrackMCFullTableNoPid> const& tracks,
178196
const TrackTableIU& tracksIU,
179197
const o2::aod::McParticles& mcParticles,
180198
const o2::aod::McCollisions&,
181199
o2::aod::BCsWithTimestamps const&)
182200
{
183201
/// here call the template processReco function
184202
auto bc = collision.bc_as<o2::aod::BCsWithTimestamps>();
185-
processReco<true>(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc);
203+
processReco<true, false>(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc);
186204
}
187205
PROCESS_SWITCH(QaImpactPar, processMC, "process MC", false);
206+
///
207+
/// @brief process function in MC,with the possibility to use PID info
208+
void processMCWithPid(o2::soa::Filtered<CollisionMCRecoTable>::iterator const& collision,
209+
TrackTable const& tracksUnfiltered,
210+
o2::soa::Filtered<TrackMCFullTable> const& tracks,
211+
const TrackTableIU& tracksIU,
212+
const o2::aod::McParticles& mcParticles,
213+
const o2::aod::McCollisions&,
214+
o2::aod::BCsWithTimestamps const&)
215+
{
216+
/// here call the template processReco function
217+
auto bc = collision.bc_as<o2::aod::BCsWithTimestamps>();
218+
processReco<true, true>(collision, tracksUnfiltered, tracks, tracksIU, mcParticles, bc);
219+
}
220+
PROCESS_SWITCH(QaImpactPar, processMCWithPid, "process MC with PID", false);
188221

189222
/// core template process function
190223
/// template<bool IS_MC, typename C, typename T, typename T_MC>
@@ -197,6 +230,11 @@ struct QaImpactPar {
197230
/// init function - declare and define histograms
198231
void init(InitContext&)
199232
{
233+
std::array<bool, 4> processes = {doprocessData, doprocessDataWithPid, doprocessMC, doprocessMCWithPid};
234+
if (std::accumulate(processes.begin(), processes.end(), 0) != 1) {
235+
LOGP(fatal, "One and only one process function for collision study must be enabled at a time.");
236+
}
237+
200238
// Primary vertex
201239
const AxisSpec collisionXAxis{100, -20.f, 20.f, "X (cm)"};
202240
const AxisSpec collisionYAxis{100, -20.f, 20.f, "Y (cm)"};
@@ -367,7 +405,7 @@ struct QaImpactPar {
367405
}
368406

369407
/// core template process function
370-
template <bool IS_MC, typename C, typename T, typename T_MC>
408+
template <bool IS_MC, bool USE_PID, typename C, typename T, typename T_MC>
371409
void processReco(const C& collision, const TrackTable& unfilteredTracks, const T& tracks,
372410
const TrackTableIU& tracksIU, const T_MC& /*mcParticles*/,
373411
o2::aod::BCsWithTimestamps::iterator const& bc)
@@ -596,12 +634,14 @@ struct QaImpactPar {
596634

597635
pt = track.pt();
598636
p = track.p();
599-
tpcNSigmaPion = track.tpcNSigmaPi();
600-
tpcNSigmaKaon = track.tpcNSigmaKa();
601-
tpcNSigmaProton = track.tpcNSigmaPr();
602-
tofNSigmaPion = track.tofNSigmaPi();
603-
tofNSigmaKaon = track.tofNSigmaKa();
604-
tofNSigmaProton = track.tofNSigmaPr();
637+
if constexpr (USE_PID) {
638+
tpcNSigmaPion = track.tpcNSigmaPi();
639+
tpcNSigmaKaon = track.tpcNSigmaKa();
640+
tpcNSigmaProton = track.tpcNSigmaPr();
641+
tofNSigmaPion = track.tofNSigmaPi();
642+
tofNSigmaKaon = track.tofNSigmaKa();
643+
tofNSigmaProton = track.tofNSigmaPr();
644+
}
605645

606646
histograms.fill(HIST("Reco/pt"), pt);
607647
histograms.fill(HIST("Reco/hNSigmaTPCPion"), pt, tpcNSigmaPion);

EventFiltering/PWGHF/HFFilterPrepareMLSamples.cxx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
#include "Common/DataModel/PIDResponseTPC.h"
2929
#include "Common/DataModel/TrackSelectionTables.h"
3030

31-
#if __has_include(<onnxruntime/core/session/onnxruntime_cxx_api.h>)
32-
#include <onnxruntime/core/session/experimental_onnxruntime_cxx_api.h> // needed for HFFilterHelpers, to be fixed
33-
#else
3431
#include <onnxruntime_cxx_api.h>
35-
#endif
3632

3733
#include <CCDB/BasicCCDBManager.h>
3834
#include <CCDB/CcdbApi.h>

0 commit comments

Comments
 (0)