32ITS3DigitReader::ITS3DigitReader(
bool useMC,
bool doStag,
bool useCalib) : mUseMC(useMC), mDoStaggering(doStag), mUseCalib(useCalib), mDetNameLC(mDetName =
"IT3"), mDigTreeName(
"o2sim")
49 auto ent =
mTree->GetReadEntry() + 1;
50 assert(ent < mTree->GetEntries());
55 throw std::runtime_error(
"ITS3 digit reader requires all 7 layer branches to be present and populated in every entry");
57 LOG(info) <<
mDetName <<
"DigitReader pushes " <<
mDigROFRec[iLayer]->size() <<
" ROFRecords, " <<
mDigits[iLayer]->size() <<
" digits at entry " << ent <<
" on layer " << iLayer;
62 throw std::runtime_error(
"ITS3 digit reader requires MC truth branches for all 7 layers to be present and populated in every entry");
65 mPLabels[iLayer]->copyandflatten(sharedlabels);
71 if (
mTree->GetReadEntry() + 1 >=
mTree->GetEntries()) {
77template <
typename Ptr>
81 if (Int_t ret =
mTree->SetBranchAddress(
name.c_str(), &addr); ret != 0) {
82 LOGP(fatal,
"failed to set branch address for {} ret={}",
name, ret);
96 if (!
mTree->GetBranch(rofBranchName.c_str()) || !
mTree->GetBranch(digBranchName.c_str())) {
97 throw std::runtime_error(
"ITS3 digit reader requires all branches in the input file");
103 throw std::runtime_error(
"ITS3 digit reader requires MC truth branches for all 7 layers in the input file");
110 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " <<
mTree->GetEntries() <<
" entries";
115 std::vector<OutputSpec> outputSpec;
117 outputSpec.emplace_back(
"IT3",
"DIGITS", iLayer, Lifetime::Timeframe);
118 outputSpec.emplace_back(
"IT3",
"DIGITSROF", iLayer, Lifetime::Timeframe);
120 outputSpec.emplace_back(
"IT3",
"DIGITSMCTR", iLayer, Lifetime::Timeframe);
125 .
name =
"its3-digit-reader",
127 .outputs = outputSpec,
128 .algorithm =
AlgorithmSpec{adaptFromTask<ITS3DigitReader>(useMC, doStag, useCalib)},
130 {
"it3-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.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
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.
std::unique_ptr< TFile > mFile
std::array< std::vector< o2::itsmft::ROFRecord > *, NLayers > mDigROFRec
std::string mDigMCTruthBranchName
std::unique_ptr< TTree > mTree
void run(ProcessingContext &pc) final
static constexpr int NLayers
void setBranchAddress(const std::string &base, Ptr &addr, int layer)
std::array< o2::dataformats::IOMCTruthContainerView *, NLayers > mPLabels
void init(InitContext &ic) final
std::string getBranchName(const std::string &base, int index) const
std::array< std::vector< o2::itsmft::Digit > *, NLayers > mDigits
ITS3DigitReader(bool useMC, bool doStag, bool useCalib)
std::string mDigBranchName
void connectTree(const std::string &filename)
std::string mDigROFBranchName
const o2::header::DataOrigin mOrigin
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 getITS3DigitReaderSpec(bool useMC=true, bool doStag=false, bool useCalib=false, std::string defname="it3digits.root")
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"