40 assert(
id == o2::detectors::DetID::TRK ||
id == o2::detectors::DetID::FT3);
68 auto ent =
mTree->GetReadEntry() + 1;
74 const bool noEntry = ent >=
mTree->GetEntries();
76 LOG(info) <<
"no entry to read, publishing empty output";
81 static const std::vector<o2::trkft3::ROFRecord> noDigROFRec;
82 static const std::vector<o2::trkft3::Digit> noDigits;
83 for (
int iLayer = 0; iLayer <
mLayers; ++iLayer) {
84 const auto& digROFRec = noEntry ? noDigROFRec : *
mDigROFRec[iLayer];
86 LOG(info) <<
mDetName <<
"DigitReader on layer " << iLayer <<
" pushes " << digROFRec.size() <<
" ROFRecords, "
87 <<
digits.size() <<
" digits at entry " << ent;
98 mPLabels[iLayer]->copyandflatten(sharedlabels);
109 if (noEntry ||
mTree->GetReadEntry() + 1 >=
mTree->GetEntries()) {
117 mTree.reset(
nullptr);
123 for (
int iLayer = 0; iLayer <
mLayers; ++iLayer) {
128 if (!
mTree->GetBranch(mctruthBranch.c_str())) {
129 throw std::runtime_error(
"MC data requested but missing branch(es) at layer " +
std::to_string(iLayer) +
130 ": " + mctruthBranch);
138 throw std::runtime_error(
"GBT calibration data requested but not found in the tree");
142 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " <<
mTree->GetEntries() <<
" entries";
153template <
typename Ptr>
157 if (Int_t ret =
mTree->SetBranchAddress(
name.c_str(), &addr); ret != 0) {
158 LOGP(fatal,
"failed to set branch address for {} ret={}",
name, ret);
164template <
int DetID,
typename Reader>
165DataProcessorSpec getDigitReaderSpecT(
bool useMC,
bool useCalib, std::string defname)
168 std::vector<OutputSpec> outputSpec;
170 for (
int iLayer = 0; iLayer < NLayers; ++iLayer) {
171 outputSpec.emplace_back(
origin,
"DIGITS", iLayer, Lifetime::Timeframe);
172 outputSpec.emplace_back(
origin,
"DIGITSROF", iLayer, Lifetime::Timeframe);
174 outputSpec.emplace_back(
origin,
"DIGITSMCTR", iLayer, Lifetime::Timeframe);
178 outputSpec.emplace_back(
origin,
"GBTCALIB", 0, Lifetime::Timeframe);
182 std::transform(detNameLC.begin(), detNameLC.end(), detNameLC.begin(), ::tolower);
184 .
name = detNameLC +
"-digit-reader",
186 .outputs = outputSpec,
187 .algorithm =
AlgorithmSpec{adaptFromTask<Reader>(useMC, useCalib)},
189 {detNameLC +
"-digit-infile", VariantType::String, defname, {
"Name of the input digit file"}}}};
195 return getDigitReaderSpecT<o2::detectors::DetID::TRK, TRKDigitReader>(useMC, useCalib, std::move(defname));
200 return getDigitReaderSpecT<o2::detectors::DetID::FT3, FT3DigitReader>(useMC, useCalib, std::move(defname));
header::DataOrigin origin
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.
static constexpr const char * getName(ID id)
names of defined 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.
int mLayers
TRK's AlmiraParam entries or FT3's discs.
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
constexpr o2::header::DataOrigin gDataOriginTRK
constexpr o2::header::DataOrigin gDataOriginFT3
Defining ITS Vertex explicitly as messageable.
std::vector< InputSpec > Inputs
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")
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