36ClusterReader<N>::ClusterReader(
bool useMC,
bool doStag,
bool usePatterns,
bool triggerOut) : mUseMC(useMC), mUsePatterns(usePatterns), mTriggerOut(triggerOut), mDetName(Origin.as<
std::
string>()), mDetNameLC(mDetName)
52 ic.
options().
get<std::string>((mDetNameLC +
"-cluster-infile").c_str()));
53 connectTree(mFileName);
59 auto ent = mTree->GetReadEntry() + 1;
60 assert(ent < mTree->GetEntries());
63 for (uint32_t iLayer = 0; iLayer < mLayers; ++iLayer) {
64 LOG(info) << mDetName <<
"ClusterReader" << (mDoStaggering ? std::format(
" on layer {}", iLayer) :
"") <<
" pushes " << mClusROFRec[iLayer]->
size() <<
" ROFRecords, " << mClusterCompArray[iLayer]->size() <<
" compact clusters at entry " << ent;
73 static std::vector<o2::itsmft::MC2ROFRecord> dummyMC2ROF;
78 std::vector<o2::itsmft::PhysTrigger> dummyTrig;
81 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
91 mFile.reset(TFile::Open(
filename.c_str()));
92 assert(mFile && !mFile->IsZombie());
93 mTree.reset((TTree*)mFile->Get(mClusTreeName.c_str()));
96 for (uint32_t iLayer = 0; iLayer < mLayers; ++iLayer) {
97 setBranchAddress(mClusROFBranchName, mClusROFRec[iLayer], iLayer);
98 setBranchAddress(mClusterCompBranchName, mClusterCompArray[iLayer], iLayer);
100 setBranchAddress(mClusterPattBranchName, mPatternsArray[iLayer], iLayer);
103 if (mTree->GetBranch(getBranchName(mClustMCTruthBranchName, iLayer).c_str())) {
104 setBranchAddress(mClustMCTruthBranchName, mClusterMCTruth[iLayer], iLayer);
106 LOG(info) <<
"MC-truth is missing";
111 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " << mTree->GetEntries() <<
" entries";
120 return mDetName + base;
124template <
typename Ptr>
127 const auto name = getBranchName(base,
layer);
128 if (Int_t ret = mTree->SetBranchAddress(
name.c_str(), &addr); ret != 0) {
129 LOGP(fatal,
"failed to set branch address for {} ret={}",
name, ret);
136std::vector<OutputSpec> makeOutChannels(
o2::header::DataOrigin detOrig,
bool mctruth,
bool doStag,
bool usePatterns,
bool triggerOut)
138 std::vector<OutputSpec> outputs;
140 outputs.emplace_back(detOrig,
"CLUSTERSROF", iLayer, Lifetime::Timeframe);
141 outputs.emplace_back(detOrig,
"COMPCLUSTERS", iLayer, Lifetime::Timeframe);
143 outputs.emplace_back(detOrig,
"PATTERNS", iLayer, Lifetime::Timeframe);
146 outputs.emplace_back(detOrig,
"CLUSTERSMCTR", iLayer, Lifetime::Timeframe);
147 outputs.emplace_back(detOrig,
"CLUSTERSMC2ROF", iLayer, Lifetime::Timeframe);
151 outputs.emplace_back(detOrig,
"PHYSTRIG", 0, Lifetime::Timeframe);
160 .
name =
"its-cluster-reader",
162 .outputs = makeOutChannels<o2::detectors::DetID::ITS>(
"ITS", useMC, doStag, usePatterns, triggerOut),
163 .algorithm =
AlgorithmSpec{adaptFromTask<ITSClusterReader>(useMC, doStag, usePatterns, triggerOut)},
165 {
"its-cluster-infile", VariantType::String,
"o2clus_its.root", {
"Name of the input cluster file"}},
166 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
172 .
name =
"mft-cluster-reader",
174 .outputs = makeOutChannels<o2::detectors::DetID::MFT>(
"MFT", useMC, doStag, usePatterns, triggerOut),
175 .algorithm =
AlgorithmSpec{adaptFromTask<MFTClusterReader>(useMC, doStag, usePatterns, triggerOut)},
177 {
"mft-cluster-infile", VariantType::String,
"mftclusters.root", {
"Name of the input cluster file"}},
178 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
Definition of the Names Generator class.
Definition Physics trigger record extracted from the ITS/MFT stream.
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
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.
void run(ProcessingContext &pc) final
std::string getBranchName(const std::string &base, int index) const
std::vector< std::vector< o2::itsmft::CompClusterExt > * > mClusterCompArray
void connectTree(const std::string &filename)
std::vector< std::vector< unsigned char > * > mPatternsArray
void init(InitContext &ic) final
void setBranchAddress(const std::string &base, Ptr &addr, int layer)
std::vector< std::vector< o2::itsmft::ROFRecord > * > mClusROFRec
std::vector< o2::dataformats::MCTruthContainer< o2::MCCompLabel > * > mClusterMCTruth
GLsizei const GLchar *const * string
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 getMFTClusterReaderSpec(bool useMC=true, bool doStag=false, bool usePatterns=true, bool useTriggers=true)
framework::DataProcessorSpec getITSClusterReaderSpec(bool useMC=true, bool doStag=false, bool usePatterns=true, bool useTriggers=true)
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 int getNLayers()
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"