57 LOG(info) <<
"[HMPID Cluster reader - init() ] ";
58 mClustersReceived = 0;
63 ic.
options().
get<std::string>(
"hmpid-cluster-infile" ));
70 auto ent = mTree->GetReadEntry() + 1;
76 const bool noEntry = ent >= mTree->GetEntries();
78 LOG(info) <<
"no entry to read, publishing empty output";
85 mClustersReceived += mClustersFromFile.size();
86 LOG(info) <<
"[HMPID ClusterReader - run() ] clusters = " << mClustersFromFile.size();
88 if (noEntry || mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
92 mExTimer.
logMes(
"End ClusterReader ! clusters = " +
97void ClusterReaderTask::initFileIn(
const std::string&
filename)
100 mTree.reset(
nullptr);
101 mFile = std::make_unique<TFile>(
filename.c_str(),
"OLD");
102 assert(mFile && !mFile->IsZombie());
104 if (!mFile->IsOpen() || mFile ==
nullptr) {
105 LOG(error) <<
"HMPID ClusterReaderTask::init() : Did not find any Clusters file " <<
filename.c_str() <<
" file !";
106 throw std::runtime_error(
"cannot open input clusters file");
108 LOG(info) <<
"HMPID ClusterReaderTask::init() : Found Clusters file " <<
filename.c_str();
111 if ((TTree*)mFile->Get(
"o2hmp")) {
112 mTree.reset((TTree*)mFile->Get(
"o2hmp"));
113 }
else if ((TTree*)mFile->Get(
"o2sim")) {
114 mTree.reset((TTree*)mFile->Get(
"o2sim"));
117 <<
"HMPID ClusterReaderTask::init() : Did not find either Tree o2sim or o2hmp tree in "
119 throw std::runtime_error(
120 "HMPID ClusterReaderTask::init() : Did not find "
121 "o2sim file in clusters tree");
124 if (mTree->GetBranchStatus(
"HMPIDClusters") == 1) {
125 mTree->SetBranchAddress(
"HMPIDClusters", &mClustersFromFilePtr);
126 }
else if (mTree->GetBranchStatus(
"HMPIDclusters") == 1) {
127 mTree->SetBranchAddress(
"HMPIDclusters", &mClustersFromFilePtr);
130 <<
"HMPID ClusterReaderTask::init() : Did not find Branch in "
132 throw std::runtime_error(
133 "HMPID ClusterReaderTask::init() : Did not find Branch HMPIDClusters in clusters tree");
136 mTree->SetBranchAddress(
"InteractionRecords", &mClusterTriggersFromFilePtr);
137 mTree->Print(
"toponly");
145 std::vector<o2::framework::OutputSpec> outputs;
146 outputs.emplace_back(
"HMP",
"CLUSTERS", 0, o2::framework::Lifetime::Timeframe);
147 outputs.emplace_back(
"HMP",
"INTRECORDS1", 0, o2::framework::Lifetime::Timeframe);
154 Options{{
"hmpid-cluster-infile" , VariantType::String,
"hmpidclusters.root", {
"Name of the input file with clusters"}},
155 {
"input-dir", VariantType::String,
"./", {
"Input directory"}}}};
A raw page parser for DPL input.
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.
virtual void endOfStream(EndOfStreamContext &context)
This is invoked whenever we have an EndOfStream event.
void init(framework::InitContext &ic) final
void run(framework::ProcessingContext &pc) final
void stop()
stop : stops the timer
void logMes(std::string const message)
Defining ITS Vertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
o2::framework::DataProcessorSpec getClusterReaderSpec()
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 std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"