24#include "ILLDataVersion.h"
26#define READ_EVENT_SIZE 10000
75 int32_t headerSize = 0;
83 std::cout << R
"(Failed to open ")" << GetFilename() << "/" <<
Filename() << R
"("!)" << std::endl;
104 }
catch(std::exception& e) {
105 std::cout <<
"Caught " << e.what() <<
" at " << __FILE__ <<
" : " << __LINE__ << std::endl;
119 std::cout <<
"Successfully read " <<
FileSize() - headerSize <<
" bytes into buffer!" << std::endl;
130 for(uint8_t board = 0; board <
fNbBoards; ++board) {
136 std::string boardName =
"unset";
158 std::cout <<
"Warning, unknown board type " << boardType <<
" encountered, don't know what digitizer type is." << std::endl;
161 std::cout <<
"For " <<
static_cast<int>(board) <<
". board got header " <<
hex(
fBoardHeaders[board], 8) <<
": crate " <<
static_cast<int>(crate) <<
", event type " << eventType <<
", board type " <<
static_cast<int>(boardType) <<
" = " << boardName <<
" with " <<
static_cast<int>(nbChannels) <<
" channels." << std::endl;
162 for(uint8_t channel = 0; channel < nbChannels; ++channel) {
164 unsigned int address = (
static_cast<unsigned int>(crate) << 12) | (
static_cast<unsigned int>(board) << 6) | channel;
167 if(tmpChan ==
nullptr) {
169 tmpChan =
new TChannel(Form(
"TMP%02dXX%02dX", board, channel));
191 size_t LastReadSize = 0;
192 std::shared_ptr<TLstEvent> LstEvent = std::static_pointer_cast<TLstEvent>(event);
202 LastReadSize =
static_cast<size_t>(
fInputStream.gcount());
206 for(
size_t i = 0; i < LastReadSize; i++) {
210 }
catch(std::exception& e) {
211 std::cout <<
"Caught " << e.what() <<
" at " << __FILE__ <<
" : " << __LINE__ << std::endl;
224 std::cerr <<
"Sorry, but we can't skip events in an LST file, the whole file is treated as a single event!" << std::endl;
235 std::size_t foundslash =
Filename().rfind(
'/');
236 std::size_t found =
Filename().rfind(
".lst");
237 if(found == std::string::npos) {
240 std::size_t found2 =
Filename().rfind(
'-');
241 if((found2 < foundslash && foundslash != std::string::npos) || found2 == std::string::npos) {
244 if(found2 < foundslash && foundslash != std::string::npos) {
245 found2 = std::string::npos;
248 if(found2 == std::string::npos ||
Filename().compare(found2 + 4, 4,
".lst") != 0) {
249 temp =
Filename().substr(found - 5, 5);
251 temp =
Filename().substr(found - 9, 5);
253 return atoi(temp.c_str());
std::string hex(T val, int width=-1)
static void SetMnemonicClass(const TClassRef &cls)
void SetAddress(unsigned int tmpadd)
static TChannel * GetChannel(unsigned int temp_address, bool warn=false)
static void AddChannel(TChannel *, Option_t *opt="")
void SetDigitizerType(const TPriorityValue< std::string > &tmp)
Reader for ILL .lst files.
std::string Status(bool long_file_description=true) override
void Skip(size_t nofEvents) override
Skip nofEvents from the file.
int GetRunNumber() override
std::ifstream fInputStream
void Close() override
Close input file.
bool Open(const char *filename) override
Open input file.
TLstFile()=default
default constructor
~TLstFile() override
destructor
int GetSubRunNumber() override
int Read(std::shared_ptr< TRawEvent > lstEvent) override
Read one event from the file.
std::vector< char > & ReadBuffer()
virtual const char * GetFilename() const
Get the name of this file.
virtual size_t FileSize()
virtual std::string Filename() const
Get the name of this file.
void IncrementBytesRead(size_t val=1)
virtual size_t BytesRead()
void ResizeBuffer(size_t newSize)
static void ClearVersion()
static void SetRunInfo(int runnum=0, int subrunnum=-1)
static void SetVersion(const char *ver)
static void SetDetectorInformation(TDetectorInformation *inf)
static void SetRunLength()