29#if __cplusplus >= 201402L
30# define MKCODAFILE make_unique<Decoder::THaCodaFile>()
32# define MKCODAFILE unique_ptr<Decoder::THaCodaFile>(new Decoder::THaCodaFile)
36static const char*
const fgRe1 =
"\\.[0-9]+$";
37static const char*
const fgRe2 =
"\\.[0-9]+\\.[0-9]+$";
57 const char* description )
64 for(
const auto & path : pathList) {
82 , fFilename(rhs.fFilename)
83 , fMaxScan(rhs.fMaxScan)
104 const auto& run =
dynamic_cast<const THaRun&
>(rhs);
110 catch(
const std::bad_cast& ) {
130 bool doing_init = (sopt.
Contains(
"INIT"));
146 if (
this == obj)
return 0;
147 const auto* rhs =
dynamic_cast<const THaRunBase*
>(obj);
148 if( !rhs )
return -1;
149 if( *
this < *rhs )
return -1;
150 else if( *rhs < *
this )
return 1;
151 const auto* rhsr =
dynamic_cast<const THaRun*
>(rhs);
152 if( !rhsr )
return 0;
153 if( fSegment < rhsr->
fSegment )
return -1;
154 else if( rhsr->fSegment <
fSegment )
return 1;
155 if( fStream < rhsr->
fStream )
return -1;
156 else if( rhsr->fStream <
fStream )
return 1;
165 static const char*
const here =
"Open";
168 Error(
here,
"CODA file name not set. Cannot open the run." );
172 Error(
here,
"Malformed file name or program bug. Call expert.");
182 Error(
here,
"Cannot determine CODA version from file. "
183 "Try analyzer->SetCodaVersion(2)");
187 cout <<
"in THaRun::Open: coda version "<<
fDataVersion<<endl;
202 cout <<
" \"" <<
GetTitle() <<
"\"";
206 cout <<
"CODA file: " <<
fFilename << endl;
224 static const char*
const here =
"THaRun::PrescanFile";
228 const UInt_t minscan = ifo ? ifo->fMinScan : 50;
233 evdata->EnableHelicity(
false);
234 evdata->EnablePrescanMode(
true);
236 if( evdata->SetDataVersion(ver) <= 0 ) {
237 Error(
here,
"Failed to set CODA version. Got %d, must be 2 or 3.", ver );
250 Error(
here,
"Error decoding event %u", nev);
253 Warning(
here,
"Skipping event %u due to warnings", nev);
263 cout <<
"Prestart at " << nev << endl;
265 cout <<
"Prescales at " << nev << endl;
267 cout <<
"DAQ info at " << setw(2) << nev
268 <<
" len " << evdata->GetEvLength() << endl;
272 Error(
here,
"Failed to read CODA file at event %u", nev);
317 for(
Int_t i = 0; i <= 9; i++ ) {
320 dirn[pos+4] = TString::Itoa(i,10)[0];
321 s = dirn +
"/" + base;
336 static const char*
const here =
"ReadInitInfo";
359 cout <<
"THaRun: Reading init info from " << fname << endl;
360 unique_ptr<Decoder::THaCodaData> save_coda = std::move(
fCodaData);
378 static const char*
const here =
"SetFilename";
392 Error(
here,
"Illegal file name or program bug. Call expert.");
450 ostr <<
"Error compiling regular expressions: "
452 throw std::runtime_error(ostr.str());
464 stream = sStream.
Atoi();
465 segment = sSegmnt.
Atoi();
472 segment = sSegmnt.
Atoi();
477 segment = stream = -1;
480 catch (
const exception&
e ) {
481 cerr <<
"Error parsing segment and/or stream number in run file name "
482 <<
"\"" <<
filename <<
"\": " <<
e.what() << endl;
483 segment = stream = -1;
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
R__EXTERN class TClass * gHaDecoder
static const char *const fgRe1
static const int fgMaxScan
static const char *const fgRe2
static const char *const here
char * Form(const char *fmt,...)
R__EXTERN TSystem * gSystem
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
virtual const UInt_t * GetEvBuffer() const
std::unique_ptr< Decoder::THaCodaData > fCodaData
static Int_t ReturnCode(Int_t coda_retcode)
virtual THaCodaRun & operator=(const THaRunBase &)
virtual Int_t ReadEvent()
void EnableScalers(Bool_t enable=true)
Bool_t Contains(const std::string &token) const
virtual Int_t Update(const THaEvData *evdata)
virtual Bool_t HasInfo(UInt_t bits) const
virtual Int_t PrescanFile()
virtual Bool_t ProvidesInitInfo()
virtual Bool_t FindSegmentNumber()
THaRun(const char *filename="", const char *description="")
virtual Int_t SetFilename(const char *name)
virtual TString GetInitInfoFileName(TString fname)
void SetMinScan(UInt_t n)
virtual TString FindInitInfoFile(const TString &fname)
virtual Int_t ReadInitInfo(Int_t level)
const char * GetFilename() const
virtual void Print(Option_t *opt="") const
virtual void Clear(Option_t *opt="")
virtual Int_t Compare(const TObject *obj) const
static Bool_t StdFindSegmentNumber(const TString &filename, TString &stem, Int_t &segment, Int_t &stream)
virtual THaRun & operator=(const THaRunBase &rhs)
const char * GetTitle() const override
void Print(Option_t *option="") const override
void Clear(Option_t *option="") override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
Ssiz_t Last(char c) const
TString & Append(char c, Ssiz_t rep=1)
TString & Remove(EStripType s, char c)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual const char * DirName(const char *pathname)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
virtual const char * BaseName(const char *pathname)