154 std::vector<int> recordEvents;
155 std::vector<long> recordPosition;
159 int currentRecordEvent{};
180 void addPosition(
long position){ recordPosition.push_back(position);}
187 currentRecord = -1; currentEvent = -1; currentRecordEvent = -1;
190 recordEvents.clear(); recordPosition.clear();
193 currentRecord = 0; currentEvent = 0; currentRecordEvent = 0;
203 std::ifstream inputStream;
204 long inputStreamSize{};
208 std::vector<long> tagsToRead;
210 short _verbose = {0} ;
212 std::map<std::string,std::string> userConfig;
227 reader(
const char *file, std::vector<int> tags){
229 for(
auto tag : tags)
setTags(tag);
243 void readUserConfig(std::map<std::string,std::string> &mapConfig);
246 void open(
const char *filename);
247 bool is_open(){
return inputStream.is_open();}
248 void setTags(
int tag){ tagsToRead.push_back(tag);}
249 void setTags(std::vector<long> tags){ tagsToRead=std::move(tags);}
258 bool next(std::vector<hipo::bank> &list);
259 std::vector<hipo::bank>
getBanks(std::vector<std::string> names);
269 std::vector<int>
getInt(
const char *
bank,
const char *column,
int max = -1);
270 std::vector<float>
getFloat(
const char *
bank,
const char *column,
int max = -1);
280 long nDataLimit = -1;
299 void run(std::function<
int(
int)> &&function,
int nthreads){
300 std::vector<std::thread*> threads;
301 for(
int i = 0; i < nthreads; i++){
302 threads.push_back(
new std::thread(function,i));
304 printf(
"-- created denoiser with %lu threads\n", threads.size());
305 for(
int k = 0; k < (int) threads.size(); k++) threads[k]->join();
306 for(
int k = 0; k < (int) threads.size(); k++)
delete threads[k];
313 std::unique_lock<std::mutex> lock(obj);
317 void pull(std::vector<hipo::event> &events){
319 std::unique_lock<std::mutex> lock(obj);
320 bool finished =
false;
321 if(nDataLimit>0){
if(nProcessed>nDataLimit) finished =
true;}
323 if(hr.
hasNext()==
false){ printf(
"\n");}
325 for(
int n = 0; n < (int) events.size(); n++){
330 if(hr.
next()==
true&&finished==
false){
331 hr.
read(events[n]); nProcessed++;
332 if(nProcessed%250==0) { printf(
"."); fflush(stdout);}
333 if(nProcessed%10000==0) printf(
" : %9lu \n",nProcessed);
Collection of schema definitions, typically read from a HIPO file header.
Definition dictionary.h:157
READER index class is used to construct entire events sequence from all records, and provides ability...
Definition reader.h:150
int getMaxEvents()
Returns maximum number of events available to read.
Definition reader.cpp:549
void addPosition(long position)
Definition reader.h:180
bool gotoRecord(int irec)
Sets the event pointer to the first even of provided record.
Definition reader.cpp:561
bool loadRecord(int irec)
Implemented by Derek for clas12tool purposes (I think - therefore I am)
Definition reader.cpp:576
void clear()
Definition reader.h:189
void show()
Definition reader.cpp:540
void reset()
Definition reader.h:192
bool canAdvanceInRecord()
Checks to verify if the next event is in the same record as current one.
Definition reader.cpp:597
void rewind()
Definition reader.h:186
int getRecordEventNumber()
Definition reader.h:177
bool canAdvance()
Checks to determine if there are events left in the index buffer.
Definition reader.cpp:486
int getEventNumber()
Definition reader.h:175
bool advance()
Advances the event pointer to next.
Definition reader.cpp:495
void addSize(int size)
Adds record size (number of events) to the list of records.
Definition reader.cpp:473
int getRecordNumber()
Definition reader.h:176
bool gotoEvent(int eventNumber)
Moves the event pointer to give event number.
Definition reader.cpp:517
int getNRecords() const
Definition reader.h:184
long getPosition(int index)
Definition reader.h:181
void read(hipo::event &dataevent)
Reads current event from the record without advancing the current event position.
Definition reader.cpp:233
std::vector< hipo::bank > getBanks(std::vector< std::string > names)
Definition reader.cpp:279
void readDictionary(hipo::dictionary &dict)
Reads the dictionary for the file.
Definition reader.cpp:318
void getStructureNoCopy(hipo::structure &structure, int group, int item)
Reads the structure from the current event without copying the event buffer and without copying the s...
Definition reader.cpp:260
void setTags(std::vector< long > tags)
Definition reader.h:249
~reader()
Default destructor.
Definition reader.cpp:62
bool nextInRecord()
Definition reader.cpp:444
reader(const char *file)
Definition reader.h:225
void printWarning()
Prints out warning if the LZ4 library was not linked to the compiled library.
Definition reader.cpp:453
reader()
The constructor for reader, printWarning routine will printout a warning message if the library was n...
Definition reader.cpp:54
void rewind()
Definition reader.h:238
reader(const char *file, std::vector< int > tags)
Definition reader.h:227
void setVerbose(short level=1)
Definition reader.h:250
bool is_open()
Definition reader.h:247
void setTags(int tag)
Definition reader.h:248
bool loadRecord(int irec)
Definition reader.cpp:401
void getStructure(hipo::structure &structure, int group, int item)
Reads the structure from the current event without copying the event buffer.
Definition reader.cpp:244
reader(const reader &r)
Definition reader.h:233
int getEntries()
Definition reader.h:268
bool next()
Advances the event pointer to the next event.
Definition reader.cpp:341
int getNRecords() const
Definition reader.h:264
std::vector< int > getInt(const char *bank, const char *column, int max=-1)
Definition reader.cpp:413
void open(const char *filename)
Open file, if file stream is open, it is closed first.
Definition reader.cpp:78
bool hasNext()
Checks if there are more events in the file to advance to.
Definition reader.cpp:204
void about()
Definition reader.cpp:68
bool gotoRecord(int irec)
Moves the current event pointer to the new record # irec.
Definition reader.cpp:390
bool gotoEvent(int eventNumber)
Moves the pointer of the event to the event number provided.
Definition reader.cpp:362
std::vector< float > getFloat(const char *bank, const char *column, int max=-1)
Definition reader.cpp:428
void readUserConfig(std::map< std::string, std::string > &mapConfig)
Definition reader.cpp:289
void pull(hipo::record &record, int index)
Definition reader.h:312
void run(std::function< int(int)> &&function, int nthreads)
Definition reader.h:299
void pull(std::vector< hipo::event > &events)
Definition reader.h:317
void open(const char *input)
Definition reader.h:288
virtual ~readerstream()
Definition reader.h:287
void setLimit(long limit)
Definition reader.h:295
hipo::reader & reader()
Definition reader.h:309
hipo::dictionary & dictionary()
Definition reader.h:310
readerstream()
Definition reader.h:285
HIPO namespace is used for the classes that read/write files and records.
Definition bank.cpp:45
long userWordOne
Definition reader.h:137
long userWordTwo
Definition reader.h:138
int recordLength
Definition reader.h:135
long recordPosition
Definition reader.h:134
int recordEntries
Definition reader.h:136