65 LOG(info) <<
"CTP : truth = data as CTP inputs are already digital";
72 ic.
options().
get<std::string>(
"ctp-digit-infile"));
81 gsl::span<const o2::dataformats::IRFrame> irFrames{};
84 irFrames = pc.
inputs().
get<gsl::span<o2::dataformats::IRFrame>>(
"driverInfo");
86 auto ent =
mTree->GetReadEntry();
94 const bool noEntry = ent >=
mTree->GetEntries();
96 LOG(info) <<
"no entry to read, publishing empty output";
100 LOG(info) <<
"DigitReader pushes " <<
mDigits.size() <<
" digits at entry " << ent;
103 if (noEntry ||
mTree->GetReadEntry() + 1 >=
mTree->GetEntries()) {
108 std::vector<o2::ctp::CTPDigit> digitSel;
109 if (irFrames.size()) {
116 const auto irMin = irfSel.
getIRFrames().front().getMin();
117 const auto irMax = irfSel.
getIRFrames().back().getMax();
118 LOGP(info,
"Selecting IRFrame {}-{}", irMin.asString(), irMax.asString());
119 while (ent < mTree->GetEntries()) {
120 if (ent >
mTree->GetReadEntry()) {
121 mTree->GetEntry(ent);
123 if (
mDigits.front().intRecord <= irMax &&
mDigits.back().intRecord >= irMin) {
127 if (dig.intRecord >= irMin && dig.intRecord <= irMax) {
128 digitSel.push_back(dig);
129 LOG(info) <<
"adding:" << dig.intRecord <<
" ent:" << ent;
133 if (
mDigits.back().intRecord < irMax) {
142 if (!irFrames.size() || irFrames.back().isLast()) {
151 mTree.reset(
nullptr);
167 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " <<
mTree->GetEntries() <<
" entries";
175 Outputs{{
"CTP",
"DIGITS", 0, Lifetime::Timeframe},
176 {
"CTP",
"LUMI", 0, o2::framework::Lifetime::Timeframe}},
179 {
"ctp-digit-infile", VariantType::String, defFile, {
"Name of the input digit file"}},
180 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
A const (ready only) version of MCTruthContainer.
definition of CTPDigit, CTPInputDigit
Class to check if give InteractionRecord or IRFrame is selected by the external IRFrame vector.
Definition of the Names Generator class.
std::vector< o2::ctp::CTPDigit > mDigits
std::string mLumiBranchName
void init(InitContext &ic) final
std::unique_ptr< TFile > mFile
~DigitReader() override=default
std::unique_ptr< TTree > mTree
void run(ProcessingContext &pc) final
std::vector< o2::ctp::CTPDigit > * mDigitsPtr
std::string mDigitBranchName
void connectTree(const std::string &filename)
o2::ctp::LumiInfo * mLumiPtr
bool hasOption(const char *key) const
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.
InputRecord & inputs()
The inputs associated with this processing context.
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 setSelectedIRFrames(const SPAN &sp, size_t bwd=0, size_t fwd=0, long shift=0, bool removeOverlaps=true)
framework::DataProcessorSpec getDigitsReaderSpec(bool propagateMC=true, const std::string &defFile="ctpdigits.root")
Defining ITS Vertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
std::vector< OutputSpec > Outputs
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"