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;
71 assert(ent < mTree->GetEntries());
76 mClustersReceived += mClustersFromFile.size();
77 LOG(info) <<
"[HMPID ClusterReader - run() ] clusters = " << mClustersFromFile.size();
79 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
83 mExTimer.
logMes(
"End ClusterReader ! clusters = " +
88void ClusterReaderTask::initFileIn(
const std::string&
filename)
92 mFile = std::make_unique<TFile>(
filename.c_str(),
"OLD");
93 assert(mFile && !mFile->IsZombie());
95 if (!mFile->IsOpen() || mFile ==
nullptr) {
96 LOG(error) <<
"HMPID ClusterReaderTask::init() : Did not find any Clusters file " <<
filename.c_str() <<
" file !";
97 throw std::runtime_error(
"cannot open input clusters file");
99 LOG(info) <<
"HMPID ClusterReaderTask::init() : Found Clusters file " <<
filename.c_str();
102 if ((TTree*)mFile->Get(
"o2hmp")) {
103 mTree.reset((TTree*)mFile->Get(
"o2hmp"));
104 }
else if ((TTree*)mFile->Get(
"o2sim")) {
105 mTree.reset((TTree*)mFile->Get(
"o2sim"));
108 <<
"HMPID ClusterReaderTask::init() : Did not find either Tree o2sim or o2hmp tree in "
110 throw std::runtime_error(
111 "HMPID ClusterReaderTask::init() : Did not find "
112 "o2sim file in clusters tree");
115 if (mTree->GetBranchStatus(
"HMPIDClusters") == 1) {
116 mTree->SetBranchAddress(
"HMPIDClusters", &mClustersFromFilePtr);
117 }
else if (mTree->GetBranchStatus(
"HMPIDclusters") == 1) {
118 mTree->SetBranchAddress(
"HMPIDclusters", &mClustersFromFilePtr);
121 <<
"HMPID ClusterReaderTask::init() : Did not find Branch in "
123 throw std::runtime_error(
124 "HMPID ClusterReaderTask::init() : Did not find Branch HMPIDClusters in clusters tree");
127 mTree->SetBranchAddress(
"InteractionRecords", &mClusterTriggersFromFilePtr);
128 mTree->Print(
"toponly");
136 std::vector<o2::framework::OutputSpec> outputs;
137 outputs.emplace_back(
"HMP",
"CLUSTERS", 0, o2::framework::Lifetime::Timeframe);
138 outputs.emplace_back(
"HMP",
"INTRECORDS1", 0, o2::framework::Lifetime::Timeframe);
145 Options{{
"hmpid-cluster-infile" , VariantType::String,
"hmpidclusters.root", {
"Name of the input file with clusters"}},
146 {
"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 PrimaryVertex 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"