Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions Detectors/Upgrades/ALICE3/TRK/workflow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,21 @@
# or submit itself to any jurisdiction.

o2_add_library(TRKWorkflow
TARGETVARNAME targetName
SOURCES src/DigitReaderSpec.cxx
src/DigitWriterSpec.cxx
# src/RecoWorkflow.cxx
# src/ClusterWriterWorkflow.cxx
# src/ClustererSpec.cxx
# src/ClusterWriterSpec.cxx
# src/TrackerSpec.cxx
# src/TrackWriterSpec.cxx
# src/TrackReaderSpec.cxx
# src/VertexReaderSpec.cxx
src/TrackerSpec.cxx
src/RecoWorkflow.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2::GPUWorkflow
O2::SimConfig
O2::DataFormatsITSMFT
O2::SimulationDataFormat
O2::DPLUtils)

# o2_add_executable(reco-workflow
# SOURCES src/trk-reco-workflow.cxx
# COMPONENT_NAME alice3-trk
# PUBLIC_LINK_LIBRARIES O2::TRKWorkflow)
o2_add_executable(reco-workflow
SOURCES src/trk-reco-workflow.cxx
COMPONENT_NAME alice3-trk
PUBLIC_LINK_LIBRARIES O2::TRKWorkflow
O2::TRKSimulation
O2::ITStracking)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#ifndef O2_TRK_RECOWORKFLOW_H
#define O2_TRK_RECOWORKFLOW_H

#include "Framework/WorkflowSpec.h"
#include "GPUDataTypes.h"

namespace o2::trk
{
namespace reco_workflow
{

o2::framework::WorkflowSpec getWorkflow(bool useMC,
bool upstreamDigits = false,
bool upstreamClusters = false,
bool disableRootOutput = false,
bool useGPUWF = false,
o2::gpu::GPUDataTypes::DeviceType dType = o2::gpu::GPUDataTypes::DeviceType::CPU);
}

} // namespace o2::trk

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

/// @file TrackerSpec.h

#ifndef O2_TRK_TRACKERDPL
#define O2_TRK_TRACKERDPL

#include "DataFormatsITSMFT/TopologyDictionary.h"

#include "Framework/DataProcessorSpec.h"
#include "Framework/Task.h"

#include "ITStracking/TrackingInterface.h"
#include "GPUDataTypes.h"

#include "DetectorsBase/GRPGeomHelper.h"

#include "TStopwatch.h"

namespace o2::trk
{
class TrackerDPL : public framework::Task
{
public:
TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
bool isMC,
gpu::GPUDataTypes::DeviceType dType = gpu::GPUDataTypes::DeviceType::CPU);
~TrackerDPL() override = default;
void init(framework::InitContext& ic) final;
void run(framework::ProcessingContext& pc) final;
void endOfStream(framework::EndOfStreamContext& ec) final;
// void finaliseCCDB(framework::ConcreteDataMatcher& matcher, void* obj) final;
void stop() final;

private:
void updateTimeDependentParams(framework::ProcessingContext& pc);
// std::unique_ptr<o2::gpu::GPUReconstruction> mRecChain = nullptr;
// std::unique_ptr<o2::gpu::GPUChainITS> mChainITS = nullptr;
// std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
// ITSTrackingInterface mITSTrackingInterface;
TStopwatch mTimer;
};

framework::DataProcessorSpec getTrackerSpec(bool useMC, gpu::GPUDataTypes::DeviceType dType = gpu::GPUDataTypes::DeviceType::CPU);

} // namespace o2::trk
#endif /* O2_TRK_TRACKERDPL */
31 changes: 31 additions & 0 deletions Detectors/Upgrades/ALICE3/TRK/workflow/src/RecoWorkflow.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "TRKWorkflow/RecoWorkflow.h"
#include "TRKWorkflow/TrackerSpec.h"
#include "Framework/CCDBParamSpec.h"

namespace o2::trk::reco_workflow
{

framework::WorkflowSpec getWorkflow(bool useMC,
bool upstreamDigits,
bool upstreamClusters,
bool disableRootOutput,
bool useGPUWF,
o2::gpu::GPUDataTypes::DeviceType dtype)
{
framework::WorkflowSpec specs;
specs.emplace_back(o2::trk::getTrackerSpec(useMC, dtype));
return specs;
}

} // namespace o2::trk::reco_workflow
116 changes: 116 additions & 0 deletions Detectors/Upgrades/ALICE3/TRK/workflow/src/TrackerSpec.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include <vector>

#include "Framework/ControlService.h"
#include "Framework/ConfigParamRegistry.h"
#include "Framework/CCDBParamSpec.h"
#include "TRKWorkflow/TrackerSpec.h"

namespace o2
{
using namespace framework;
namespace trk
{
using Vertex = o2::dataformats::Vertex<o2::dataformats::TimeStamp<int>>;

TrackerDPL::TrackerDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
bool isMC,
o2::gpu::GPUDataTypes::DeviceType dType)
{
// mITSTrackingInterface.setTrackingMode(trMode);
}

void TrackerDPL::init(InitContext& ic)
{
// mTimer.Stop();
// mTimer.Reset();
// o2::base::GRPGeomHelper::instance().setRequest(mGGCCDBRequest);
// mChainITS.reset(mRecChain->AddChain<o2::gpu::GPUChainITS>());
// mITSTrackingInterface.setTraitsFromProvider(mChainITS->GetITSVertexerTraits(),
// mChainITS->GetITSTrackerTraits(),
// mChainITS->GetITSTimeframe());
}

void TrackerDPL::stop()
{
LOGF(info, "CPU Reconstruction total timing: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}

void TrackerDPL::run(ProcessingContext& pc)
{
auto cput = mTimer.CpuTime();
auto realt = mTimer.RealTime();
mTimer.Start(false);
// mITSTrackingInterface.updateTimeDependentParams(pc);
// mITSTrackingInterface.run(pc);
mTimer.Stop();
LOGP(info, "CPU Reconstruction time for this TF {} s (cpu), {} s (wall)", mTimer.CpuTime() - cput, mTimer.RealTime() - realt);
}

// void TrackerDPL::finaliseCCDB(ConcreteDataMatcher& matcher, void* obj)
// {
// // mITSTrackingInterface.finaliseCCDB(matcher, obj);
// }

void TrackerDPL::endOfStream(EndOfStreamContext& ec)
{
LOGF(info, "TRK CA-Tracker total timing: Cpu: %.3e Real: %.3e s in %d slots", mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
}

DataProcessorSpec getTrackerSpec(bool useMC, o2::gpu::GPUDataTypes::DeviceType dType)
{
std::vector<InputSpec> inputs;

// inputs.emplace_back("compClusters", "TRK", "COMPCLUSTERS", 0, Lifetime::Timeframe);
// inputs.emplace_back("patterns", "TRK", "PATTERNS", 0, Lifetime::Timeframe);
// inputs.emplace_back("ROframes", "TRK", "CLUSTERSROF", 0, Lifetime::Timeframe);

// inputs.emplace_back("itscldict", "TRK", "CLUSDICT", 0, Lifetime::Condition, ccdbParamSpec("ITS/Calib/ClusterDictionary"));
// inputs.emplace_back("itsalppar", "TRK", "ALPIDEPARAM", 0, Lifetime::Condition, ccdbParamSpec("ITS/Config/AlpideParam"));
auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(false, // orbitResetTime
false, // GRPECS=true
false, // GRPLHCIF
false, // GRPMagField
false, // askMatLUT
o2::base::GRPGeomRequest::None, // geometry, but ignored until it will be put in the CCDB
inputs,
true);
std::vector<OutputSpec> outputs;
outputs.emplace_back("TRK", "TRACKS", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "TRACKCLSID", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "TRKTrackROF", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "VERTICES", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "VERTICESROF", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "IRFRAMES", 0, Lifetime::Timeframe);

if (useMC) {
// inputs.emplace_back("trkmclabels", "TRK", "CLUSTERSMCTR", 0, Lifetime::Timeframe);
// inputs.emplace_back("TRKMC2ROframes", "TRK", "CLUSTERSMC2ROF", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "VERTICESMCTR", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "VERTICESMCPUR", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "TRACKSMCTR", 0, Lifetime::Timeframe);
// outputs.emplace_back("TRK", "TRKTrackMC2ROF", 0, Lifetime::Timeframe);
}

return DataProcessorSpec{
"trk-tracker",
inputs,
outputs,
AlgorithmSpec{adaptFromTask<TrackerDPL>(ggRequest,
useMC,
dType)},
Options{}};
}

} // namespace trk
} // namespace o2
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "TRKWorkflow/RecoWorkflow.h"
#include "CommonUtils/ConfigurableParam.h"
#include "ITStracking/TrackingConfigParam.h"
#include "ITStracking/Configuration.h"

#include "Framework/CallbacksPolicy.h"
#include "Framework/ConfigContext.h"
#include "Framework/CompletionPolicyHelpers.h"

#include <vector>

using namespace o2::framework;

void customize(std::vector<CallbacksPolicy>& policies)
{
// o2::raw::HBFUtilsInitializer::addNewTimeSliceCallback(policies);
}

void customize(std::vector<CompletionPolicy>& policies)
{
// ordered policies for the writers
policies.push_back(CompletionPolicyHelpers::consumeWhenAllOrdered(".*(?:TRK|trk).*[W,w]riter.*"));
}

void customize(std::vector<ConfigParamSpec>& workflowOptions)
{
// option allowing to set parameters
std::vector<ConfigParamSpec> options{
{"digits-from-upstream", VariantType::Bool, false, {"digits will be provided from upstream, skip digits reader"}},
{"clusters-from-upstream", VariantType::Bool, false, {"clusters will be provided from upstream, skip clusterizer"}},
{"disable-root-output", VariantType::Bool, false, {"do not write output root files"}},
{"disable-mc", VariantType::Bool, false, {"disable MC propagation even if available"}},
{"disable-tracking", VariantType::Bool, false, {"disable tracking step"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings"}},
{"use-gpu-workflow", VariantType::Bool, false, {"use GPU workflow (default: false)"}},
{"gpu-device", VariantType::Int, 1, {"use gpu device: CPU=1,CUDA=2,HIP=3 (default: CPU)"}}};
std::swap(workflowOptions, options);
}

#include "Framework/runDataProcessing.h"
#include "Framework/Logger.h"

WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
{
// Update the (declared) parameters if changed from the command line
auto useMC = !configcontext.options().get<bool>("disable-mc");
auto useGpuWF = configcontext.options().get<bool>("use-gpu-workflow");
auto gpuDevice = static_cast<o2::gpu::GPUDataTypes::DeviceType>(configcontext.options().get<int>("gpu-device"));
auto extDigits = configcontext.options().get<bool>("digits-from-upstream");
auto extClusters = configcontext.options().get<bool>("clusters-from-upstream");
auto disableRootOutput = configcontext.options().get<bool>("disable-root-output");
o2::conf::ConfigurableParam::updateFromString(configcontext.options().get<std::string>("configKeyValues"));

// write the configuration used for the reco workflow
o2::conf::ConfigurableParam::writeINI("o2itsrecoflow_configuration.ini");

return o2::trk::reco_workflow::getWorkflow(useMC, extDigits, extClusters, disableRootOutput, useGpuWF, gpuDevice);
}