36 assert(
id == o2::detectors::DetID::TRK);
63 auto ent =
mTree->GetReadEntry() + 1;
69 const bool noEntry = ent >=
mTree->GetEntries();
71 LOG(info) <<
"no entry to read, publishing empty output";
76 static const std::vector<o2::trkft3::ROFRecord> noDigROFRec;
77 static const std::vector<o2::trkft3::Digit> noDigits;
78 for (
int iLayer = 0; iLayer <
mLayers; ++iLayer) {
79 const auto& digROFRec = noEntry ? noDigROFRec : *
mDigROFRec[iLayer];
81 LOG(info) <<
mDetName <<
"DigitReader on layer " << iLayer <<
" pushes " << digROFRec.size() <<
" ROFRecords, "
82 <<
digits.size() <<
" digits at entry " << ent;
93 mPLabels[iLayer]->copyandflatten(sharedlabels);
104 if (noEntry ||
mTree->GetReadEntry() + 1 >=
mTree->GetEntries()) {
112 mTree.reset(
nullptr);
118 for (
int iLayer = 0; iLayer <
mLayers; ++iLayer) {
123 if (!
mTree->GetBranch(mctruthBranch.c_str())) {
124 throw std::runtime_error(
"MC data requested but missing branch(es) at layer " +
std::to_string(iLayer) +
125 ": " + mctruthBranch);
133 throw std::runtime_error(
"GBT calibration data requested but not found in the tree");
137 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " <<
mTree->GetEntries() <<
" entries";
148template <
typename Ptr>
152 if (Int_t ret =
mTree->SetBranchAddress(
name.c_str(), &addr); ret != 0) {
153 LOGP(fatal,
"failed to set branch address for {} ret={}",
name, ret);
160 std::vector<OutputSpec> outputSpec;
161 for (
int iLayer = 0; iLayer < nLayers; ++iLayer) {
162 outputSpec.emplace_back(
"TRK",
"DIGITS", iLayer, Lifetime::Timeframe);
163 outputSpec.emplace_back(
"TRK",
"DIGITSROF", iLayer, Lifetime::Timeframe);
165 outputSpec.emplace_back(
"TRK",
"DIGITSMCTR", iLayer, Lifetime::Timeframe);
169 outputSpec.emplace_back(
"TRK",
"GBTCALIB", 0, Lifetime::Timeframe);
176 AlgorithmSpec{adaptFromTask<TRKDigitReader>(useMC, useCalib)},
178 {
"trk-digit-infile", VariantType::String, defname, {
"Name of the input digit file"}}}};
A const (ready only) version of MCTruthContainer.
A special IO container - splitting a given vector to enable ROOT IO.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Static class with identifiers, bitmasks and names for ALICE detectors.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
o2::header::DataHeader::SubSpecificationType SubSpecificationType
decltype(auto) make(const Output &spec, Args... args)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
virtual void endOfStream(EndOfStreamContext &context)
This is invoked whenever we have an EndOfStream event.
static constexpr int mLayers
std::vector< std::vector< o2::trkft3::ROFRecord > * > mDigROFRec
void run(ProcessingContext &pc) final
std::unique_ptr< TTree > mTree
std::vector< o2::dataformats::IOMCTruthContainerView * > mPLabels
std::string mDigtMCTruthBranchName
std::vector< std::vector< o2::trkft3::Digit > * > mDigits
o2::header::DataOrigin mOrigin
void setBranchAddress(const std::string &base, Ptr &addr, int layer=-1)
std::string mDigitBranchName
std::vector< o2::itsmft::GBTCalibData > * mCalibPtr
std::string mCalibBranchName
std::unique_ptr< TFile > mFile
std::string getBranchName(const std::string &base, int index) const
void init(InitContext &ic) final
std::string mDigROFBranchName
std::vector< o2::itsmft::GBTCalibData > mCalib
void connectTree(const std::string &filename)
GLuint const GLchar * name
GLenum GLuint GLint GLint layer
Defining ITS Vertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getTRKDigitReaderSpec(bool useMC=true, bool useCalib=false, std::string defname="trkdigits.root")
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
static constexpr size_t kNLayers
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Digit > digits