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();
89 assert(ent < mTree->GetEntries());
91 LOG(info) <<
"DigitReader pushes " <<
mDigits.size() <<
" digits at entry " << ent;
94 if (
mTree->GetReadEntry() + 1 >=
mTree->GetEntries()) {
99 std::vector<o2::ctp::CTPDigit> digitSel;
100 if (irFrames.size()) {
107 const auto irMin = irfSel.
getIRFrames().front().getMin();
108 const auto irMax = irfSel.
getIRFrames().back().getMax();
109 LOGP(info,
"Selecting IRFrame {}-{}", irMin.asString(), irMax.asString());
110 while (ent < mTree->GetEntries()) {
111 if (ent >
mTree->GetReadEntry()) {
112 mTree->GetEntry(ent);
114 if (
mDigits.front().intRecord <= irMax &&
mDigits.back().intRecord >= irMin) {
118 if (dig.intRecord >= irMin && dig.intRecord <= irMax) {
119 digitSel.push_back(dig);
120 LOG(info) <<
"adding:" << dig.intRecord <<
" ent:" << ent;
124 if (
mDigits.back().intRecord < irMax) {
133 if (!irFrames.size() || irFrames.back().isLast()) {
142 mTree.reset(
nullptr);
158 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " <<
mTree->GetEntries() <<
" entries";
166 Outputs{{
"CTP",
"DIGITS", 0, Lifetime::Timeframe},
167 {
"CTP",
"LUMI", 0, o2::framework::Lifetime::Timeframe}},
170 {
"ctp-digit-infile", VariantType::String, defFile, {
"Name of the input digit file"}},
171 {
"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 PrimaryVertex 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"