Skip to content

Commit 9c73182

Browse files
committed
ALICE3: make the PV finder run
1 parent c398e45 commit 9c73182

5 files changed

Lines changed: 30 additions & 16 deletions

File tree

Detectors/Upgrades/ALICE3/GlobalReconstruction/workflow/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ o2_add_library(ALICE3GlobalReconstructionWorkflow
1313
TARGETVARNAME targetName
1414
SOURCES src/TrackerSpec.cxx
1515
src/TrackWriterSpec.cxx
16+
src/MagneticFieldHelper.cxx
1617
src/PrimaryVertexingSpec.cxx
1718
src/PrimaryVertexWriterSpec.cxx
1819
src/RecoWorkflow.cxx
1920
PUBLIC_LINK_LIBRARIES O2::Framework
2021
O2::CommonConstants
2122
O2::CommonDataFormat
23+
O2::Field
2224
O2::GPUWorkflow
2325
O2::SimConfig
2426
O2::DataFormatsITSMFT

Detectors/Upgrades/ALICE3/GlobalReconstruction/workflow/include/ALICE3GlobalReconstructionWorkflow/PrimaryVertexingSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
namespace o2::trk
1818
{
1919

20-
framework::DataProcessorSpec getPrimaryVertexingSpec(bool useMC, bool skip);
20+
framework::DataProcessorSpec getPrimaryVertexingSpec(bool useMC, bool skip, float bz);
2121

2222
} // namespace o2::trk
2323

Detectors/Upgrades/ALICE3/GlobalReconstruction/workflow/src/PrimaryVertexingSpec.cxx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313

1414
#include "ALICE3GlobalReconstructionWorkflow/PrimaryVertexingSpec.h"
1515

16+
#include "ALICE3GlobalReconstructionWorkflow/MagneticFieldHelper.h"
1617
#include "CommonConstants/LHCConstants.h"
1718
#include "CommonDataFormat/BunchFilling.h"
1819
#include "CommonUtils/ConfigurableParam.h"
1920
#include "CommonUtils/NameConf.h"
2021
#include "DataFormatsITS/TrackITS.h"
22+
#include "DetectorsBase/Propagator.h"
2123
#include "DetectorsVertexing/PVertexer.h"
2224
#include "DetectorsVertexing/PVertexerHelpers.h"
2325
#include "Framework/ConfigParamRegistry.h"
@@ -48,22 +50,24 @@ using VtxTrackIndex = o2::dataformats::VtxTrackIndex;
4850
class PrimaryVertexingSpec final : public Task
4951
{
5052
public:
51-
PrimaryVertexingSpec(bool useMC, bool skip) : mUseMC(useMC), mSkip(skip) {}
53+
PrimaryVertexingSpec(bool useMC, bool skip, float bz) : mUseMC(useMC), mSkip(skip), mBz(bz) {}
5254

5355
void init(InitContext& ic) final
5456
{
5557
mTimer.Stop();
5658
mTimer.Reset();
5759
mVertexer.setPoolDumpDirectory(ic.options().get<std::string>("pool-dumps-directory"));
5860
mVertexer.setTrackSources(GTrackID::getSourceMask(GTrackID::ITS));
61+
mVertexer.setMatCorrType(o2::base::Propagator::MatCorrType::USEMatCorrNONE);
5962
mVertexer.setITSROFrameLength(ic.options().get<float>("alice3-pv-rof-length-bc") * o2::constants::lhc::LHCBunchSpacingMUS);
63+
ensureAlice3Field(mBz);
6064
o2::BunchFilling bunchFilling;
6165
for (int bc = 0; bc < o2::constants::lhc::LHCMaxBunches; ++bc) {
6266
bunchFilling.setBC(bc);
6367
}
6468
mVertexer.setBunchFilling(bunchFilling);
6569
mVertexer.init();
66-
mVertexer.setBz(ic.options().get<float>("alice3-pv-bz"));
70+
mVertexer.setBz(mBz);
6771
}
6872

6973
void run(ProcessingContext& pc) final
@@ -150,13 +154,14 @@ class PrimaryVertexingSpec final : public Task
150154
private:
151155
bool mUseMC{false};
152156
bool mSkip{false};
157+
float mBz{5.f};
153158
o2::vertexing::PVertexer mVertexer;
154159
TStopwatch mTimer;
155160
};
156161

157162
} // namespace
158163

159-
DataProcessorSpec getPrimaryVertexingSpec(bool useMC, bool skip)
164+
DataProcessorSpec getPrimaryVertexingSpec(bool useMC, bool skip, float bz)
160165
{
161166
std::vector<InputSpec> inputs;
162167
inputs.emplace_back("tracks", "TRK", "TRACKS", 0, Lifetime::Timeframe);
@@ -176,9 +181,8 @@ DataProcessorSpec getPrimaryVertexingSpec(bool useMC, bool skip)
176181
"alice3-primary-vertexing",
177182
inputs,
178183
outputs,
179-
AlgorithmSpec{adaptFromTask<PrimaryVertexingSpec>(useMC, skip)},
184+
AlgorithmSpec{adaptFromTask<PrimaryVertexingSpec>(useMC, skip, bz)},
180185
Options{{"pool-dumps-directory", VariantType::String, "", {"Destination directory for the tracks pool dumps"}},
181-
{"alice3-pv-bz", VariantType::Float, 5.f, {"Nominal ALICE3 Bz field in kG for primary vertex refits"}},
182186
{"alice3-pv-rof-length-bc", VariantType::Float, 1.f, {"Effective TRK readout length in BC used by pvertexer time clustering"}}}};
183187
}
184188

Detectors/Upgrades/ALICE3/GlobalReconstruction/workflow/src/RecoWorkflow.cxx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,23 @@
1616
#include "ALICE3GlobalReconstructionWorkflow/PrimaryVertexWriterSpec.h"
1717
#include "Framework/Logger.h"
1818

19+
#include <fstream>
20+
#include <nlohmann/json.hpp>
21+
1922
namespace o2::trk::global_reco_workflow
2023
{
2124

25+
namespace
26+
{
27+
float getBzFromConfig(const std::string& hitRecoConfig, const std::string& clusterRecoConfig)
28+
{
29+
const auto& configPath = !hitRecoConfig.empty() ? hitRecoConfig : clusterRecoConfig;
30+
std::ifstream configFile(configPath);
31+
const auto config = nlohmann::json::parse(configFile);
32+
return config["geometry"]["bz"].get<float>();
33+
}
34+
} // namespace
35+
2236
framework::WorkflowSpec getWorkflow(bool useMC,
2337
const std::string& hitRecoConfig,
2438
const std::string& clusterRecoConfig,
@@ -34,7 +48,7 @@ framework::WorkflowSpec getWorkflow(bool useMC,
3448
LOG_IF(info, !clusterRecoConfig.empty()) << "Using cluster reco config from file " << clusterRecoConfig;
3549
specs.emplace_back(o2::trk::getTrackerSpec(useMC, hitRecoConfig, clusterRecoConfig, dtype));
3650
if (enablePrimaryVertexing) {
37-
specs.emplace_back(o2::trk::getPrimaryVertexingSpec(useMC, skipPrimaryVertexing));
51+
specs.emplace_back(o2::trk::getPrimaryVertexingSpec(useMC, skipPrimaryVertexing, getBzFromConfig(hitRecoConfig, clusterRecoConfig)));
3852
}
3953
if (!disableRootOutput) {
4054
specs.emplace_back(o2::trk::getTrackWriterSpec(useMC));

Detectors/Upgrades/ALICE3/GlobalReconstruction/workflow/src/TrackerSpec.cxx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@
1616
#include <format>
1717
#include <fstream>
1818

19+
#include "ALICE3GlobalReconstructionWorkflow/MagneticFieldHelper.h"
1920
#include "DataFormatsTRK/Cluster.h"
2021
#include "DataFormatsTRK/ROFRecord.h"
2122
#include "DetectorsBase/GeometryManager.h"
2223
#include "ITStracking/TimeFrame.h"
2324
#include "ITStracking/Configuration.h"
24-
#include "Field/MagneticField.h"
25-
#include "Field/MagFieldParam.h"
2625
#include "Framework/ControlService.h"
2726
#include "Framework/ConfigParamRegistry.h"
2827
#include "Framework/CCDBParamSpec.h"
@@ -40,7 +39,6 @@
4039
#include "ITStrackingGPU/TrackerTraitsGPU.h"
4140
#endif
4241
#include "ALICE3GlobalReconstructionWorkflow/TrackerSpec.h"
43-
#include <TGeoGlobalMagField.h>
4442

4543
#ifdef O2_WITH_ACTS
4644
#include "ALICE3GlobalReconstruction/TrackerACTS.h"
@@ -298,9 +296,7 @@ void TrackerDPL::run(ProcessingContext& pc)
298296
LOGP(info, "Starting {} reconstruction from hits for {} events", trackerTraits.getName(), nEvents);
299297

300298
trackerTraits.setBz(mHitRecoConfig["geometry"]["bz"].get<float>());
301-
auto field = new field::MagneticField("ALICE3Mag", "ALICE 3 Magnetic Field", mHitRecoConfig["geometry"]["bz"].get<float>() / 5.f, 0.0, o2::field::MagFieldParam::k5kGUniform);
302-
TGeoGlobalMagField::Instance()->SetField(field);
303-
TGeoGlobalMagField::Instance()->Lock();
299+
ensureAlice3Field(mHitRecoConfig["geometry"]["bz"].get<float>());
304300

305301
nRofs = timeFrame.loadROFsFromHitTree(hitsTree, gman, mHitRecoConfig);
306302
const int inROFpileup{mHitRecoConfig.contains("inROFpileup") ? mHitRecoConfig["inROFpileup"].get<int>() : 1};
@@ -312,9 +308,7 @@ void TrackerDPL::run(ProcessingContext& pc)
312308
o2::trk::GeometryTGeo::Instance();
313309

314310
trackerTraits.setBz(mClusterRecoConfig["geometry"]["bz"].get<float>());
315-
auto field = new field::MagneticField("ALICE3Mag", "ALICE 3 Magnetic Field", mClusterRecoConfig["geometry"]["bz"].get<float>() / 5.f, 0.0, o2::field::MagFieldParam::k5kGUniform);
316-
TGeoGlobalMagField::Instance()->SetField(field);
317-
TGeoGlobalMagField::Instance()->Lock();
311+
ensureAlice3Field(mClusterRecoConfig["geometry"]["bz"].get<float>());
318312

319313
constexpr int nLayers{11};
320314
std::array<gsl::span<const o2::trk::Cluster>, nLayers> layerClusters;

0 commit comments

Comments
 (0)