12#ifndef DETECTOR_BASE_RAWFILEREADER_H
13#define DETECTOR_BASE_RAWFILEREADER_H
20#include <unordered_map>
68 static constexpr std::string_view
CardNames[] = {
"CRU",
"RORC"};
88 static constexpr std::string_view
ErrNames[] = {
90 "Wrong RDH.packetCounter increment",
91 "Wrong RDH.pageCnt increment",
92 "RDH.stop set of 1st HBF page",
93 "New HBF starts w/o closing old one",
94 "Data does not start with TF/HBF",
95 "Number of HBFs per TF not as expected",
96 "Number of TFs is less than expected",
97 "Wrong HBF orbit increment",
98 "TF does not start by new superpage",
99 "No SOX found on 1st page",
100 "Mismatch between flagged and calculated new TF start"
133 using OrigDescCard = std::tuple<o2::header::DataOrigin, o2::header::DataDescription, ReadoutCardType>;
134 using InputsMap = std::map<OrigDescCard, std::vector<std::string>>;
168 void print(
const std::string& pref =
"")
const;
196 template <
typename H>
215 void print(
bool verbose =
false,
const std::string& pref =
"")
const;
224 RawFileReader(
const std::string& config =
"",
int verbosity = 0,
size_t buffsize = 50 * 1024UL,
const std::string& onlyDet = {});
231 bool addFile(
const std::string& sname) {
return addFile(sname, mDefDataOrigin, mDefDataDescription, mDefCardType); }
250 void printStat(
bool verbose =
false)
const;
287 static InputsMap parseInput(
const std::string& confUri,
const std::string& onlyDet = {},
bool verbose =
false);
292 int getLinkLocalID(
const RDHAny& rdh,
int fileID);
293 bool preprocessFile(
int ifl);
302 std::vector<std::string> mFileNames;
303 std::vector<FILE*> mFiles;
304 std::vector<std::unique_ptr<char[]>> mFileBuffers;
305 std::vector<OrigDescCard> mDataSpecs;
306 bool mInitDone =
false;
308 std::unordered_map<LinkSpec_t, int> mLinkEntries;
309 std::vector<LinkData> mLinksData;
310 std::vector<int> mOrderedIDs;
316 size_t mBufferSize = 5 * 1024UL;
317 int mNominalSPageSize = 0x1 << 20;
318 int mCurrentFileID = 0;
319 long int mPosInFile = 0;
320 bool mMultiLinkFile =
false;
321 bool mCacheData =
false;
322 bool mStopProcessing =
false;
325 bool mPreferCalculatedTFStart =
false;
header::DataOrigin origin
unsigned short int uint16_t
o2::raw::RawFileWriter * raw
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
Static class with identifiers, bitmasks and names for ALICE detectors.
const std::vector< int > & getLinksOrder() const
void setCacheData(bool v)
uint32_t getOrbitMax() const
void printStat(bool verbose=false) const
uint32_t getNextTFToRead() const
void setVerbosity(int v=1)
static InputsMap parseInput(const std::string &confUri, const std::string &onlyDet={}, bool verbose=false)
ReadoutCardType getDefaultReadoutCardType() const
std::tuple< o2::header::DataOrigin, o2::header::DataDescription, ReadoutCardType > OrigDescCard
void setNextTFToRead(uint32_t tf)
void setDefaultDataDescription(const std::string &desc)
static std::string nochk_expl(ErrTypes e)
void setTFAutodetect(FirstTFDetection v)
FirstTFDetection getTFAutodetect() const
void setBufferSize(size_t s)
void setDefaultDataOrigin(const std::string &orig)
std::map< OrigDescCard, std::vector< std::string > > InputsMap
void setNominalSPageSize(int n=0x1<< 20)
uint32_t getMaxTFToRead() const
void setDefaultDataDescription(const o2::header::DataDescription d)
bool addFile(const std::string &sname)
static constexpr std::string_view CardNames[]
LinkSubSpec_t getLinkSubSpec(int i) const
void setDefaultDataOrigin(const o2::header::DataOrigin o)
uint32_t getCheckErrors() const
void loadFromInputsMap(const InputsMap &inp)
int getNominalSPageSize() const
void setMaxTFToRead(uint32_t n)
bool isProcessingStopped() const
LinkSpec_t getLinkSpec(int i) const
size_t getBufferSize() const
static constexpr bool ErrCheckDefaults[]
static constexpr std::string_view ErrNamesShort[]
uint32_t getNTimeFrames() const
static o2::header::DataDescription getDataDescription(const std::string &ors)
bool getCacheData() const
static std::string nochk_opt(ErrTypes e)
void setCheckErrors(uint32_t m=0xffffffff)
const LinkData & getLink(int i) const
LinkData & getLink(int i)
void setIROfSOX(const o2::InteractionRecord &ir)
@ ErrWrongPacketCounterIncrement
@ ErrWrongPageCounterIncrement
void setDefaultReadoutCardType(ReadoutCardType t=CRU)
o2::header::DataDescription getDefaultDataSpecification() const
static o2::header::DataOrigin getDataOrigin(const std::string &ors)
const LinkData & getLinkWithSpec(LinkSpec_t s) const
void imposeFirstTF(uint32_t orbit)
static constexpr std::string_view ErrNames[]
uint32_t getOrbitMin() const
o2::header::DataOrigin getDefaultDataOrigin() const
bool addFile(const std::string &sname, o2::header::DataOrigin origin, o2::header::DataDescription desc, ReadoutCardType t=CRU)
void setPreferCalculatedTFStart(bool v)
constexpr o2::header::DataDescription gDataDescriptionInvalid
constexpr o2::header::DataOrigin gDataOriginFLP
constexpr o2::header::DataOrigin gDataOriginInvalid
constexpr o2::header::DataDescription gDataDescriptionRawData
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::unique_ptr< GPUReconstructionTimeframe > tf
bool testFlag(uint8_t fl) const
std::unique_ptr< char[]> dataCache
different flags
void setFlag(uint8_t fl, bool v=true)
LinkBlock()=default
optional cache for fast access
uint16_t fileID
ir starting the block
LinkBlock(int fid, size_t offs)
bool preprocessCRUPage(const RDHAny &rdh, bool newSPage)
std::string describe() const
LinkSubSpec_t subspec
Link subspec augmented by its origin.
size_t readNextTF(char *buff)
o2::header::DataOrigin origin
size_t readNextSuperPage(char *buff, const PartStat *pstat=nullptr)
size_t getLargestSuperPage() const
uint32_t nTimeFrames
subspec according to DataDistribution
o2::header::DataDescription description
o2::InteractionRecord irOfSOX
RDH with the running info of the last RDH seen.
LinkData(const H &rdh, RawFileReader *r)
std::vector< LinkBlock > blocks
size_t getLargestTF() const
size_t getNextTFSuperPagesStat(std::vector< PartStat > &parts) const
LinkData()=default
next block which should be read
size_t readNextHBF(char *buff)
std::vector< std::pair< int, uint32_t > > tfStartBlock
bool continuousRO
CRU vs RORC detector.
size_t getNextHBFSize() const
bool rewindToTF(uint32_t tf)
size_t getNextTFSize() const
std::string rawChannelConfig
std::string metricChannel
o2::InteractionRecord ir(0, 0)