24#include "ILLDataVersion.h"
26#define READ_EVENT_SIZE 10000
86 int32_t headerSize = 0;
116 }
catch(std::exception& e) {
117 std::cout<<
"Caught "<<e.what() <<
" at " << __FILE__ <<
" : " << __LINE__ <<std::endl;
131 std::cout<<
"Successfully read "<<
fFileSize - headerSize<<
" bytes into buffer!"<<std::endl;
142 for(uint8_t board = 0; board <
fNbBoards; ++board) {
148 std::string boardName =
"unset";
170 std::cout<<
"Warning, unknown board type "<<boardType<<
" encountered, don't know what digitizer type is."<<std::endl;
173 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;
174 for(uint8_t channel = 0; channel < nbChannels; ++channel) {
176 unsigned int address = (
static_cast<unsigned int>(crate)<<12) | (
static_cast<unsigned int>(board)<<6) | channel;
179 if(tmpChan ==
nullptr) {
181 tmpChan =
new TChannel(Form(
"TMP%02dXX%02dX", board, channel));
200 if( Event ==
nullptr )
203 size_t LastReadSize = 0;
204 std::shared_ptr<TLstEvent> LstEvent = std::static_pointer_cast<TLstEvent>(Event);
214 LastReadSize =
static_cast<size_t>(
fInputStream.gcount());
218 for(
size_t i = 0; i < LastReadSize; i++) {
222 }
catch(std::exception& e) {
223 std::cout<<
"Caught "<<e.what() <<
" at " << __FILE__ <<
" : " << __LINE__ <<std::endl;
236 std::cerr<<
"Sorry, but we can't skip events in an LST file, the whole file is treated as a single event!"<<std::endl;
247 std::size_t foundslash =
fFilename.rfind(
'/');
248 std::size_t found =
fFilename.rfind(
".lst");
249 if(found == std::string::npos) {
252 std::size_t found2 =
fFilename.rfind(
'-');
253 if((found2 < foundslash && foundslash != std::string::npos) || found2 == std::string::npos) {
256 if(found2 < foundslash && foundslash != std::string::npos) {
257 found2 = std::string::npos;
260 if(found2 == std::string::npos ||
fFilename.compare(found2 + 4, 4,
".lst") != 0) {
265 return atoi(temp.c_str());
std::string hex(T val, int width=-1)
ClassImp(THILMnemonic) void THILMnemonic
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
TLstFile()
default constructor
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() override
destructor
int GetSubRunNumber() override
int Read(std::shared_ptr< TRawEvent > lstEvent) override
Read one event from the file.
virtual const char * GetFilename() const
Get the name of this file.
std::vector< char > fReadBuffer
std::string fFilename
name of the currently open file
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()