61 ic.
options().
get<std::string>(
"hmpid-digit-infile"));
62 mFile.reset(TFile::Open(
filename.c_str()));
64 LOG(info) <<
"HMPID DigitWriterSpec::init() : Trying to read File : " <<
filename.c_str();
67 if (!mFile->IsOpen()) {
68 LOG(error) <<
"HMPID DigitWriterSpec::init() : Did not find any digits file " <<
filename.c_str() <<
" file !";
69 throw std::runtime_error(
"cannot open input digits file");
72 if ((TTree*)mFile->Get(
"o2sim") !=
nullptr) {
73 mTree.reset((TTree*)mFile->Get(
"o2sim"));
74 }
else if ((TTree*)mFile->Get(
"o2hmp") !=
nullptr) {
75 mTree.reset((TTree*)mFile->Get(
"o2hmp"));
77 LOG(error) <<
"Did not find o2hmp tree in " <<
filename.c_str();
78 throw std::runtime_error(
"Did Not find Any correct Tree in HMPID Digits File");
82 LOG(error) <<
"Did not find o2hmp tree in " <<
filename.c_str();
83 throw std::runtime_error(
"Did Not find Any correct Tree in HMPID Digits File");
91 std::vector<o2::hmpid::Digit> mDigitsFromFile, *mDigitsFromFilePtr = &mDigitsFromFile;
92 std::vector<o2::hmpid::Trigger> mTriggersFromFile, *mTriggersFromFilePtr = &mTriggersFromFile;
95 if (mTree->GetBranchStatus(
"HMPDigit")) {
96 mTree->SetBranchAddress(
"HMPDigit", &mDigitsFromFilePtr);
97 }
else if (mTree->GetBranchStatus(
"HMPIDDigits")) {
98 mTree->SetBranchAddress(
"HMPIDDigits", &mDigitsFromFilePtr);
101 <<
"HMPID DigitWriterSpec::init() : Did not find any branch for Digits";
102 throw std::runtime_error(
"Did Not find Any correct Branch for Digits in HMPID Digits File");
105 if (mTree->GetBranchStatus(
"InteractionRecords")) {
106 mTree->SetBranchAddress(
"InteractionRecords", &mTriggersFromFilePtr);
109 <<
"HMPID DigitWriterSpec::init() : Did not find branch for Triggers";
110 throw std::runtime_error(
"Did Not find Branch For triggers in HMPID Digits File");
114 auto ent = mTree->GetReadEntry() + 1;
115 assert(ent < mTree->GetEntries());
116 mTree->GetEntry(ent);
120 mDigitsReceived += mDigitsFromFile.size();
121 LOG(info) <<
"[HMPID DigitsReader - run() ] digits = " << mDigitsFromFile.size();
123 if (mTree->GetReadEntry() + 1 >= mTree->GetEntries()) {
127 mExTimer.
logMes(
"End DigitsReader ! digits = " +
134 std::vector<OutputSpec> outputs;
135 outputs.emplace_back(
"HMP",
"DIGITS", 0, o2::framework::Lifetime::Timeframe);
136 outputs.emplace_back(
"HMP",
"INTRECORDS", 0, o2::framework::Lifetime::Timeframe);
143 Options{{
"hmpid-digit-infile" , VariantType::String,
"hmpiddigits.root", {
"Name of the input file with digits"}},
144 {
"input-dir", VariantType::String,
"./", {
"Input directory"}}}};
A raw page parser for DPL input.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Definition of the Names Generator class.
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 run(o2::framework::ProcessingContext &pc) final
void init(o2::framework::InitContext &ic) 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 getDigitsReaderSpec()
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"