76 auto rlim = ccdb.getRunDuration(tinfo.runNumber);
77 long ts = (rlim.first + rlim.second) / 2;
92 gsl::span<const o2::dataformats::IRFrame> irFrames{};
94 irFrames = pc.
inputs().
get<gsl::span<o2::dataformats::IRFrame>>(
"driverInfo");
100 auto ent =
mTree->GetReadEntry();
104 assert(ent < mTree->GetEntries());
105 mTree->GetEntry(ent);
113 std::vector<o2::itsmft::PhysTrigger> dummyTrig;
123 if (
mTree->GetReadEntry() + 1 >=
mTree->GetEntries()) {
128 std::vector<o2::itsmft::Digit> digitsSel;
129 std::vector<o2::itsmft::GBTCalibData> calibSel;
130 std::vector<o2::itsmft::ROFRecord> digROFRecSel;
131 std::vector<o2::itsmft::MC2ROFRecord> digMC2ROFsSel;
134 if (irFrames.size()) {
140 const auto irMin = irfSel.
getIRFrames().front().getMin();
141 const auto irMax = irfSel.
getIRFrames().back().getMax();
142 LOGP(info,
"Selecting IRFrame {}-{}", irMin.asString(), irMax.asString());
143 while (ent < mTree->GetEntries()) {
145 if (ent >
mTree->GetReadEntry()) {
152 mTree->GetEntry(ent);
159 std::vector<int> rofOld2New;
165 if (irfSel.
check({rof.getBCData(), rof.getBCData() + mROFLengthInBC - 1}) != -1) {
166 rofOld2New[irof] = (
int)digROFRecSel.size();
167 LOGP(
debug,
"Adding selected ROF {}", rof.getBCData().asString());
168 digROFRecSel.push_back(rof);
169 int offs = digitsSel.size();
170 digROFRecSel.back().setFirstEntry(offs);
171 std::copy(
mDigits.begin() + rof.getFirstEntry(),
mDigits.begin() + rof.getFirstEntry() + rof.getNEntries(), std::back_inserter(digitsSel));
172 for (
int id = 0;
id < rof.getNEntries();
id++) {
176 std::copy(
mCalib.begin() + irof *
mNRUs,
mCalib.begin() + (irof + 1) *
mNRUs, std::back_inserter(calibSel));
183 for (
auto& mc2rof : digMC2ROFsSel) {
184 if (mc2rof.rofRecordID < 0) {
187 unsigned int mn = 0xffff, mx = 0;
188 for (
int ir = mc2rof.minROF;
ir <= mc2rof.maxROF;
ir++) {
189 if (rofOld2New[
ir] >= 0) {
196 mc2rof.rofRecordID = mn == 0xffff ? -1 :
int(mn);
214 std::vector<o2::itsmft::PhysTrigger> dummyTrig;
223 if (!irFrames.size() || irFrames.back().isLast()) {
232 mTree.reset(
nullptr);
242 throw std::runtime_error(
"GBT calibration data requested but not found in the tree");
248 throw std::runtime_error(
"MC data requested but not found in the tree");
252 LOG(info) <<
"Loaded tree from " <<
filename <<
" with " <<
mTree->GetEntries() <<
" entries";
257 std::vector<OutputSpec> outputSpec;
258 outputSpec.emplace_back(
"ITS",
"DIGITS", 0, Lifetime::Timeframe);
259 outputSpec.emplace_back(
"ITS",
"DIGITSROF", 0, Lifetime::Timeframe);
261 outputSpec.emplace_back(
"ITS",
"GBTCALIB", 0, Lifetime::Timeframe);
264 outputSpec.emplace_back(
"ITS",
"DIGITSMCTR", 0, Lifetime::Timeframe);
265 outputSpec.emplace_back(
"ITS",
"DIGITSMC2ROF", 0, Lifetime::Timeframe);
268 outputSpec.emplace_back(
"ITS",
"PHYSTRIG", 0, Lifetime::Timeframe);
274 AlgorithmSpec{adaptFromTask<ITSDigitReader>(useMC, useCalib)},
276 {
"its-digit-infile", VariantType::String, defname, {
"Name of the input digit file"}},
277 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
282 std::vector<OutputSpec> outputSpec;
283 outputSpec.emplace_back(
"MFT",
"DIGITS", 0, Lifetime::Timeframe);
284 outputSpec.emplace_back(
"MFT",
"DIGITSROF", 0, Lifetime::Timeframe);
286 outputSpec.emplace_back(
"MFT",
"GBTCALIB", 0, Lifetime::Timeframe);
289 outputSpec.emplace_back(
"MFT",
"DIGITSMCTR", 0, Lifetime::Timeframe);
290 outputSpec.emplace_back(
"MFT",
"DIGITSMC2ROF", 0, Lifetime::Timeframe);
293 outputSpec.emplace_back(
"MFT",
"PHYSTRIG", 0, Lifetime::Timeframe);
299 AlgorithmSpec{adaptFromTask<MFTDigitReader>(useMC, useCalib)},
301 {
"mft-digit-infile", VariantType::String, defname, {
"Name of the input digit file"}},
302 {
"input-dir", VariantType::String,
"none", {
"Input directory"}}}};
A const (ready only) version of MCTruthContainer.
Class to check if give InteractionRecord or IRFrame is selected by the external IRFrame vector.
Class to delimit start and end IR of certain time period.
Definition of the Names Generator class.
Definition Physics trigger record extracted from the ITS/MFT stream.
static BasicCCDBManager & instance()
static const DPLAlpideParam< N > & Instance()
Static class with identifiers, bitmasks and names for ALICE detectors.
bool hasOption(const char *key) const
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
decltype(auto) make(const Output &spec, Args... args)
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.
static constexpr int getNRUs()
total number of chips
static constexpr Int_t getNRUs()
< total number of RUs
void connectTree(const std::string &filename)
void init(InitContext &ic) final
o2::header::DataOrigin mOrigin
std::vector< o2::itsmft::MC2ROFRecord > mDigMC2ROFs
std::vector< o2::itsmft::GBTCalibData > * mCalibPtr
std::vector< o2::itsmft::GBTCalibData > mCalib
std::unique_ptr< TTree > mTree
std::vector< o2::itsmft::Digit > mDigits
std::string mDigitBranchName
std::string mDigtMC2ROFBranchName
void run(ProcessingContext &pc) final
std::vector< o2::itsmft::ROFRecord > mDigROFRec
std::vector< o2::itsmft::MC2ROFRecord > * mDigMC2ROFsPtr
std::vector< o2::itsmft::ROFRecord > * mDigROFRecPtr
o2::dataformats::ConstMCTruthContainer< o2::MCCompLabel > mConstLabels
std::unique_ptr< TFile > mFile
std::string mDigROFBranchName
std::string mDigtMCTruthBranchName
std::vector< o2::itsmft::Digit > * mDigitsPtr
std::string mCalibBranchName
long check(o2::dataformats::IRFrame fr, size_t bwd=0, size_t fwd=0)
void setSelectedIRFrames(const SPAN &sp, size_t bwd=0, size_t fwd=0, long shift=0, bool removeOverlaps=true)
constexpr o2::header::DataOrigin gDataOriginITS
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
std::vector< InputSpec > Inputs
framework::DataProcessorSpec getITSDigitReaderSpec(bool useMC=true, bool useCalib=false, bool useTriggers=true, std::string defname="o2_itsdigits.root")
framework::DataProcessorSpec getMFTDigitReaderSpec(bool useMC=true, bool useCalib=false, bool useTriggers=true, std::string defname="o2_mftdigits.root")
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
int roFrameBiasInBC
bias of the start of ROF wrt orbit start: t_irof = (irof*roFrameLengthInBC + roFrameBiasInBC)*BClengt...
int roFrameLengthInBC
ROF length in BC for continuos mode.
static std::string rectifyDirectory(const std::string_view p)
static std::string concat_string(Ts const &... ts)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
o2::InteractionRecord ir(0, 0)