167 std::vector<int> recordEvents;
168 std::vector<long> recordPosition;
172 int currentRecordEvent{};
209 void addPosition(
long position){ recordPosition.push_back(position);}
219 currentRecord = -1; currentEvent = -1; currentRecordEvent = -1;
223 recordEvents.clear(); recordPosition.clear();
227 currentRecord = 0; currentEvent = 0; currentRecordEvent = 0;
256 std::ifstream inputStream;
257 long inputStreamSize{};
261 std::vector<long> tagsToRead;
263 short _verbose = {0} ;
265 std::map<std::string,std::string> userConfig;
288 reader(
const char *file, std::vector<int> tags){
290 for(
auto tag : tags)
setTags(tag);
322 void readUserConfig(std::map<std::string,std::string> &mapConfig);
326 void open(
const char *filename);
328 bool is_open(){
return inputStream.is_open();}
331 void setTags(
int tag){ tagsToRead.push_back(tag);}
334 void setTags(std::vector<long> tags){ tagsToRead=std::move(tags);}
356 bool next(std::vector<hipo::bank> &list);
360 std::vector<hipo::bank>
getBanks(std::vector<std::string> names);
386 std::vector<int>
getInt(
const char *
bank,
const char *column,
int max = -1);
393 std::vector<float>
getFloat(
const char *
bank,
const char *column,
int max = -1);
410 long nDataLimit = -1;
437 void run(std::function<
int(
int)> &&
function,
int nthreads){
438 std::vector<std::thread*> threads;
439 for(
int i = 0; i < nthreads; i++){
440 threads.push_back(
new std::thread(
function,i));
442 printf(
"-- created denoiser with %lu threads\n", threads.size());
443 for(
int k = 0; k < (int) threads.size(); k++) threads[k]->join();
444 for(
int k = 0; k < (int) threads.size(); k++)
delete threads[k];
456 std::unique_lock<std::mutex> lock(obj);
462 void pull(std::vector<hipo::event> &events){
464 std::unique_lock<std::mutex> lock(obj);
465 bool finished =
false;
466 if(nDataLimit>0){
if(nProcessed>nDataLimit) finished =
true;}
468 if(hr.
hasNext()==
false){ printf(
"\n");}
470 for(
int n = 0; n < (int) events.size(); n++){
475 if(hr.
next()==
true&&finished==
false){
476 hr.
read(events[n]); nProcessed++;
477 if(nProcessed%250==0) { printf(
"."); fflush(stdout);}
478 if(nProcessed%10000==0) printf(
" : %9lu \n",nProcessed);
Core HIPO data structures: structure, composite, and bank classes for tabular data access.
Represents a HIPO bank, a tabular data structure with rows and typed columns.
Collection of schema definitions, typically read from a HIPO file header.
Represents a HIPO event, a container for multiple structures/banks.
void addPosition(long position)
Register a record position.
bool gotoRecord(int irec)
Jump to a specific record.
bool loadRecord(int irec)
Load a specific record by index.
void clear()
Remove all record entries from the index.
void show()
Print index information to stdout.
void reset()
Reset counters to the first event of the first record.
bool canAdvanceInRecord()
Check if more events remain in the current record.
void rewind()
Reset the index to the beginning (before the first event).
int getRecordEventNumber()
bool canAdvance()
Check if there are more events to read.
bool advance()
Advance to the next event, loading new records as needed.
void addSize(int size)
Register a record with the given number of events.
bool gotoEvent(int eventNumber)
Jump to a specific event number.
long getPosition(int index)
Sequential reader for HIPO files.
void read(hipo::event &dataevent)
Read the current event into the given event object.
std::vector< hipo::bank > getBanks(std::vector< std::string > names)
Create bank objects for the given bank names.
void readDictionary(hipo::dictionary &dict)
Read the schema dictionary from the file header.
void getStructureNoCopy(hipo::structure &structure, int group, int item)
Extract a structure without copying (zero-copy).
void setTags(std::vector< long > tags)
Set the event tag filter list.
bool nextInRecord()
Advance to the next event within the current record.
reader(const char *file)
Construct and open a HIPO file.
void printWarning()
Print a warning message (e.g., end of file).
reader()
Default constructor.
void rewind()
Rewind to the beginning of the file.
reader(const char *file, std::vector< int > tags)
Construct and open a HIPO file with event tag filtering.
void setVerbose(short level=1)
Set the verbosity level.
void setTags(int tag)
Add an event tag to the read filter.
bool loadRecord(int irec)
Load a specific record by index into the internal buffer.
void getStructure(hipo::structure &structure, int group, int item)
Extract a structure from the current event by group and item.
bool next()
Advance to the next event.
std::vector< int > getInt(const char *bank, const char *column, int max=-1)
Read all integer values from a bank column across events.
void open(const char *filename)
Open a HIPO file for reading.
bool hasNext()
Check if more events are available without advancing.
void about()
Print file information to stdout.
bool gotoRecord(int irec)
Jump to a specific record.
bool gotoEvent(int eventNumber)
Jump to a specific event number.
std::vector< float > getFloat(const char *bank, const char *column, int max=-1)
Read all float values from a bank column across events.
void readUserConfig(std::map< std::string, std::string > &mapConfig)
Read user configuration key-value pairs from the file header.
Thread-safe reader for parallel event processing.
void pull(hipo::record &record, int index)
Thread-safe loading of a record by index.
void run(std::function< int(int)> &&function, int nthreads)
Launch worker threads that execute the given function.
void pull(std::vector< hipo::event > &events)
Thread-safe batch pull: resets each event in the vector, reads next events, and refills.
void open(const char *input)
Open a HIPO file for multi-threaded reading.
hipo::dictionary & dictionary()
void setLimit(long limit)
Set a limit on the number of events to process.
Represents a single HIPO record containing multiple events.
Low-level data structure representing a HIPO structure.
Utility functions for string manipulation, serialization, and HIPO file generation.
HIPO record reading and event extraction.
Metadata for a single record in a HIPO file.
long userWordOne
First user-defined word.
long userWordTwo
Second user-defined word.
int recordLength
Total record length in bytes.
long recordPosition
Byte position of the record in the file.
int recordEntries
Number of events in the record.
Utility functions and benchmark timer for HIPO library operations.