Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ o2_add_library(TRKReconstruction
O2::DataFormatsTRKFT3
O2::SimulationDataFormat
O2::TRKBase
O2::FT3Base
nlohmann_json::nlohmann_json
${actsTarget})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@
#include <array>
#include <memory>
#include <cstring>
#include <type_traits>
#include <utility>

namespace o2::ft3
{
class GeometryTGeo;
}

namespace o2::trk
{

Expand All @@ -56,6 +62,8 @@ class Clusterer
using ClusterTruth = o2::dataformats::MCTruthContainer<o2::MCCompLabel>;
using ConstDigitTruth = o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel>;
using Label = o2::MCCompLabel;
/// The geometry that gives a chip's sub-detector and layer.
using GeometryTGeo = std::conditional_t<DetID == o2::detectors::DetID::TRK, o2::trk::GeometryTGeo, o2::ft3::GeometryTGeo>;

//----------------------------------------------
struct BBox {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
/// \brief Implementation of the TRK cluster finder

#include "TRKReconstruction/Clusterer.h"
#include "FT3Base/GeometryTGeo.h"
#include "TRKBase/GeometryTGeo.h"
#include "TRKBase/SegmentationChip.h"

Expand Down Expand Up @@ -82,7 +83,7 @@ void Clusterer<DetID>::process(gsl::span<const Digit> digits,
mThread = std::make_unique<ClustererThread>(this);
}

auto* geom = o2::trk::GeometryTGeo::Instance();
auto* geom = GeometryTGeo::Instance();

for (size_t iROF = 0; iROF < digitROFs.size(); ++iROF) {
const auto& inROF = digitROFs[iROF];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ o2_add_library(TRKWorkflow
src/DigitWriterSpec.cxx
src/ClustererSpec.cxx
src/ClusterWriterSpec.cxx
src/ClusterReaderSpec.cxx
src/RecoWorkflow.cxx
PUBLIC_LINK_LIBRARIES O2::Framework
O2::GPUWorkflow
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// 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 ClusterReaderSpec.h
/// @brief Reads the TRK or FT3 clusters the cluster writer stored, one stream per layer

#ifndef O2_TRK_CLUSTERREADER
#define O2_TRK_CLUSTERREADER

#include <memory>
#include <string>
#include <vector>

#include "TFile.h"
#include "TTree.h"
#include "DataFormatsTRKFT3/Cluster.h"
#include "DataFormatsTRKFT3/ROFRecord.h"
#include "SimulationDataFormat/MCCompLabel.h"
#include "SimulationDataFormat/MCTruthContainer.h"
#include "Framework/DataProcessorSpec.h"
#include "Framework/Task.h"
#include "TRKBase/AlmiraParam.h"

namespace o2::trk
{

template <int DetID>
class ClusterReader : public framework::Task
{
public:
explicit ClusterReader(bool useMC);
void init(framework::InitContext& ic) final;
void run(framework::ProcessingContext& pc) final;

static constexpr int NLayers = DetID == o2::detectors::DetID::TRK ? static_cast<int>(o2::trk::AlmiraParam::kNLayers) : o2::trk::constants::MLOTDisks::nLayers;

private:
void connectTree(const std::string& filename);
template <typename Ptr>
void setBranchAddress(const std::string& base, int layer, Ptr& address);

std::vector<std::vector<o2::trkft3::Cluster<DetID>>*> mClusters;
std::vector<std::vector<unsigned char>*> mPatterns;
std::vector<std::vector<o2::trkft3::ROFRecord>*> mROFs;
std::vector<o2::dataformats::MCTruthContainer<o2::MCCompLabel>*> mLabels;

std::unique_ptr<TFile> mFile;
std::unique_ptr<TTree> mTree;
bool mUseMC = true;
};

using TRKClusterReader = ClusterReader<o2::detectors::DetID::TRK>;
using FT3ClusterReader = ClusterReader<o2::detectors::DetID::FT3>;

/// The reader of \a defname, by default the cluster writer's file.
framework::DataProcessorSpec getTRKClusterReaderSpec(bool useMC = true, std::string defname = "o2clus_trk.root");
framework::DataProcessorSpec getFT3ClusterReaderSpec(bool useMC = true, std::string defname = "o2clus_ft3.root");

} // namespace o2::trk

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
#ifndef O2_TRK_CLUSTERERDPL
#define O2_TRK_CLUSTERERDPL

#include "DetectorsCommonDataFormats/DetID.h"
#include "Framework/DataProcessorSpec.h"
#include "Framework/Task.h"
#include "TRKBase/AlmiraParam.h"
#include "TRKReconstruction/Clusterer.h"
#ifdef O2_WITH_ACTS
#include "TRKReconstruction/ClustererACTS.h"
Expand All @@ -23,6 +23,8 @@
namespace o2::trk
{

/// Clusterises the digits of TRK or FT3, layer by layer.
template <int DetID>
class ClustererDPL : public o2::framework::Task
{
public:
Expand All @@ -31,17 +33,19 @@ class ClustererDPL : public o2::framework::Task
void run(o2::framework::ProcessingContext& pc) final;

private:
static constexpr int mLayers = o2::trk::AlmiraParam::kNLayers;
bool mUseMC = true;
int mNThreads = 1;
o2::trk::TRKClusterer mClusterer;
Clusterer<DetID> mClusterer;
#ifdef O2_WITH_ACTS
bool mUseACTS = false;
bool mUseACTS = false; // TRK only
o2::trk::ClustererACTS mClustererACTS;
#endif
};

/// The clusterer of TRK's digits.
o2::framework::DataProcessorSpec getClustererSpec(bool useMC);
/// The clusterer of FT3's digits.
o2::framework::DataProcessorSpec getFT3ClustererSpec(bool useMC);

} // namespace o2::trk

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "Framework/Task.h"
#include "Headers/DataHeader.h"
#include "DetectorsCommonDataFormats/DetID.h"
#include "TRKBase/AlmiraParam.h"

using namespace o2::framework;

Expand All @@ -48,7 +47,7 @@ class DigitReader : public Task
void setBranchAddress(const std::string& base, Ptr& addr, int layer = -1);
std::string getBranchName(const std::string& base, int index) const;

static constexpr int mLayers = o2::trk::AlmiraParam::kNLayers;
int mLayers = 0; ///< TRK's AlmiraParam entries or FT3's discs

std::vector<std::vector<o2::trkft3::Digit>*> mDigits{nullptr};
std::vector<o2::itsmft::GBTCalibData> mCalib, *mCalibPtr = &mCalib;
Expand Down Expand Up @@ -84,9 +83,20 @@ class TRKDigitReader : public DigitReader
}
};

class FT3DigitReader : public DigitReader
{
public:
FT3DigitReader(bool useMC = true, bool useCalib = false)
: DigitReader(o2::detectors::DetID::FT3, useMC, useCalib)
{
mOrigin = o2::header::gDataOriginFT3;
}
};

/// create a processor spec
/// read ITS/MFT Digit data from a root file
/// read TRK/FT3 Digit data from a root file
framework::DataProcessorSpec getTRKDigitReaderSpec(bool useMC = true, bool useCalib = false, std::string defname = "trkdigits.root");
framework::DataProcessorSpec getFT3DigitReaderSpec(bool useMC = true, bool useCalib = false, std::string defname = "ft3digits.root");

} // namespace trk
} // namespace o2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@
#ifndef O2_TRK_RECOWORKFLOW_H
#define O2_TRK_RECOWORKFLOW_H

#include "DetectorsCommonDataFormats/DetID.h"
#include "Framework/WorkflowSpec.h"

namespace o2::trk
{
namespace reco_workflow
{

/// The digit readers, clusterers and cluster writers of \a detectors, TRK and/or FT3.
o2::framework::WorkflowSpec getWorkflow(bool useMC,
bool upstreamDigits = false,
bool upstreamClusters = false,
bool disableRootOutput = false);
bool disableRootOutput = false,
o2::detectors::DetID::mask_t detectors = o2::detectors::DetID::getMask(o2::detectors::DetID::TRK));
}

} // namespace o2::trk
Expand Down
Loading
Loading