24#include "TObjString.h"
29#include "TGo4EventErrorException.h"
30#include "TGo4EventEndException.h"
32#include "TGo4AnalysisImp.h"
47 GO4TRACE((15,
"TGo4MbsFile::TGo4MbsFile()",__LINE__, __FILE__));
59 GO4TRACE((15,
"TGo4MbsFile::TGo4MbsFile(const char *)",__LINE__, __FILE__));
78 GO4TRACE((15,
"TGo4MbsFile::TGo4MbsFile(TGo4MbsFileParameter*)",__LINE__, __FILE__));
95 GO4TRACE((15,
"TGo4MbsFile::~TGo4MbsFile()",__LINE__, __FILE__));
103 if (!name || !*name)
return;
107 bool read_multi =
false;
116 }
else if(fname.Contains(
"*") || fname.Contains(
"?")) {
122 SetErrMess(TString::Format(
"No lmd file with mask %s", GetName()).Data());
129 lst->SetOwner(kFALSE);
134 }
else if (!isonly) {
150 std::ifstream ff(fname.Data());
153 SetErrMess(TString::Format(
"Error opening multiple file:%s", fname.Data()).Data());
174 SetName(
"LmdFilesSelection");
184 GO4TRACE((12,
"TGo4MbsFile::NextEvent()",__LINE__, __FILE__));
254 GO4TRACE((12,
"TGo4MbsFile::Close()",__LINE__, __FILE__));
268 GO4TRACE((12,
"TGo4MbsFile::Open()",__LINE__, __FILE__));
305 const char *command =
nullptr;
306 const char *rem1 =
nullptr;
307 const char *rem2 =
nullptr;
320 nextline = obj->GetName();
327 rem1 = strstr(nextline.Data(),
"!");
328 rem2 = strstr(nextline.Data(),
"#");
329 command = strstr(nextline.Data(),
"@");
330 if(command && !(rem1 && rem1 < command) && !(rem2 && rem2 < command)) {
336 gROOT->ProcessLineSync(command);
338 }
while(nextline.IsNull() || rem1 || rem2 || command);
339 convs = sscanf(nextline.Data(),
"%s %s %lu %lu %lu",nextfile,nexttag,
349 if(!strcmp(nexttag,
"0") || !strcmp(nexttag,
""))
389 const_cast<char *
>(tagfile),
391 (Char_t**) headptr, 0);
418 ana->SetNewInputFile(kTRUE);
422 if(ana->IsAutoSaveFileChange()) {
424 fname.ReplaceAll(
".lmd",4,
"_ASF",4);
425 if(dosave) ana->AutoSave();
426 ana->ClearObjects(
"Histograms");
427 TString asfname = fname+
".root";
428 std::cout <<
"Setting autosavefile to name " << asfname << std::endl;
429 ana->SetAutoSaveFile(asfname.Data());
430 if(dosave) ana->AutoSave();
static TGo4Analysis * Instance()
return analysis instance
void Message(Int_t prio, const char *text,...)
Display a user message.
Exception to throw on event source timeout.
Exception to be thrown on error of event source.
Int_t Handle() override
This is a default handler function for the respective exception type.
void SetErrMess(const char *txt)
To be used for modification of the message by the event source implementation.
void SetEventStatus(Int_t status)
Status of the last event.
Int_t GetEventStatus() const
Status of the last event.
Int_t GetCreateStatus() const
Status value of server/file open.
void SetCreateStatus(Int_t status)
Status value of event source init (file/server open).
static TList * ProducesFilesList(const char *mask)
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Int_t NumMoreFiles() const
Number of more file names in parameter.
const char * GetTagName() const
Name of the Tagfile.
const char * GetMoreName(Int_t n) const
Returns name of extra files names, configured in the parameter.
static const char * fgcFILELISTSUF
standard suffix for list of listmode files
const char * GetActiveName() const override
interface from eventsource base class to give active file
Int_t NextEvent() override
Requests the next event from mbs source.
Int_t Open() override
Open the file or connection.
TString fxCurrentFile
Currently processed file (for multiple input mode).
const char * GetTagName() const
Name of the Tagfile.
Int_t NewFileAction(Bool_t dosave=kTRUE)
Called whenever new file is opened in multiple mode.
Bool_t fbFileOpen
This indicates if the current file is open or not.
static const char * fgcNOTAGFILE
string to indicate that no lmd tagfile is chosen
static const char * fgcLMDSUF
standard suffix for listmode data files
void AddFileName(const char *name, const char *tagname=nullptr, bool isonly=kFALSE)
TString fxCurrentTag
Currently processed tagfile (for multiple input mode).
TList * fxMultiFile
file that contains the list of mbs filenames.
const char * GetCurrentTagName() const
Int_t NextFile()
For multiple input mode: Open next file in list.
Int_t Close() override
Close the file or connection.
Int_t OpenFile()
Open current file/tagfile.
Int_t CloseFile()
Close current file/tagfile.
const char * GetCurrentFileName() const
TString fxTagFile
Name of the tagfile associated with the listmode event file.
Bool_t fbShowInfo
Indicates if mbs file should show information about new open file.
ULong_t fuStopEvent
Index of last event to process.
ULong_t fuStartEvent
Index of first event to process.
s_filhe * fxInfoHeader
Reference to header info delivered by source.
s_evt_channel * fxInputChannel
Event channel structure used by event source.
Bool_t fbFirstEvent
Indicates if first event should be extracted.
ULong_t fuEventCounter
Current event index counter.
TGo4MbsSource()
default for streamer
ULong_t fuEventInterval
Number of events to skip from file in between two read events.
INTS4 f_evt_get_tagclose(s_evt_channel *)
INTS4 f_evt_get_tagopen(s_evt_channel *, CHARS *, CHARS *, CHARS **, INTS4)
INTS4 f_evt_get_tagnext(s_evt_channel *, INTS4, INTS4 **)
INTS4 f_evt_error(INTS4, CHARS *, INTS4)