65 fVarList(rhs.fVarList)
107 while(
auto* pcut =
static_cast<THaCut*
>( next() ))
117 while(
auto* pcut =
static_cast<THaCut*
>( next() ))
128 vector<THaCut*> bad_cuts;
131 while(
auto* pcut =
static_cast<THaCut*
>( next() )) {
133 if( pcut->IsError() ) {
134 Error(
"Compile",
"expression error, cut removed: %s %s block: %s",
135 pcut->GetName(), pcut->GetTitle(), pcut->GetBlockname() );
136 bad_cuts.push_back(pcut);
139 for(
const auto* pbad : bad_cuts )
140 Remove( pbad->GetName() );
166 Error(
"Define",
"no variable list set, cut not created" );
180 static const char*
here =
"THaCutList::Define";
182 if( !cutname || !*cutname || (strspn(cutname,
" ")==strlen(cutname)) ) {
183 Error(
here,
"empty cut name, cut not created" );
186 if( !expr || !*expr || (strspn(expr,
" ")==strlen(expr)) ) {
187 Error(
here,
"empty expression string, cut not created: %s", cutname );
190 if( !block || !*block || (strspn(block,
" ")==strlen(block)) ) {
191 Error(
here,
"empty block name, cut not created: %s %s", cutname, expr );
194 if( strpbrk(cutname,
"\"'` ") ) {
195 Error(
here,
"illegal character(s) in cut name, cut not created: "
196 "%s %s block: %s", cutname, expr, block );
200 Error(
here,
"duplicate cut name, cut not created: %s %s block: %s",
201 cutname, expr, block );
207 auto* pcut =
new THaCut( cutname, expr, block, lst,
this );
208 if( pcut->IsError() ) {
209 Error(
here,
"expression error, cut not created: %s %s block: %s",
210 cutname, expr, block );
224 plist->AddLast( pcut );
237 while(
auto* plist =
static_cast<THaNamedList*
>( next() ))
250 if( !plist )
return -1;
253 while(
TObject* pobj = next() ) {
256 ::Warning(
"THaCutList::EvalBlock()",
"List contains a non-THaCut:" );
261 static_cast<THaCut*
>(pobj)->EvalCut();
277inline static bool IsComment(
const string& s, string::size_type pos )
279 return ( pos != string::npos && pos < s.length() &&
280 (s[pos] ==
'#' || s.substr(pos,2) ==
"//") );
317 static const char*
const here =
"THaCutList::Load";
318 static const char*
const whtspc =
" \t";
321 Error(
here,
"invalid file name, no cuts loaded" );
327 Error(
here,
"error opening input file %s, no cuts loaded",
335 Int_t nlines_read = 0, nlines_ok = 0;
337 while( getline(ifile,
line) ) {
345 ostr <<
"Error in #include specification: " <<
line;
346 ::Error(
here,
"%s", ostr.str().c_str() );
351 ostr <<
"Error opening include file: " <<
line;
352 ::Error(
here,
"%s", ostr.str().c_str() );
359 ostr <<
"File cannot include itself: " <<
line;
360 ::Error(
here,
"%s", ostr.str().c_str() );
363 Load( incfilename.c_str() );
368 string::size_type
start, pos = 0;
370 || (
start =
line.find_first_not_of( whtspc )) == string::npos
375 while( (pos =
line.find_first_of(
"#/", pos+1)) != string::npos ) {
381 pos =
line.find_last_not_of( whtspc );
382 assert( pos != string::npos );
383 if( pos != string::npos && ++pos <
line.length() )
389 vector<string> lines( 1,
line );
390 if( gHaTextvars->Substitute(lines) )
393 for(
const auto& str : lines ) {
398 pos = str.find_first_of( whtspc,
start );
399 if( pos == string::npos ) {
400 Warning(
here,
"ignoring label without expression, line = \"%s\"",
407 pos = str.find_first_not_of( whtspc, pos );
408 assert( pos != string::npos );
409 if( pos == string::npos )
continue;
410 arg2 = str.substr( pos );
413 if( arg1 ==
"Block:" ) {
420 if( !
Define( arg1.c_str(), arg2.c_str(), block.c_str() ) ) nlines_ok++;
426 Int_t nbad = nlines_read-nlines_ok;
427 if( nbad>0 )
Warning(
here,
"%d cut(s) could not be defined, check input "
441 vector<UInt_t>
width{ 0, 0, 0, 0 };
443 while(
auto* pcut =
static_cast<THaCut*
>( next() )) {
445 (strlen(pcut->GetName())) );
447 (strlen(pcut->GetTitle())) );
449 (strlen(pcut->GetBlockname())) );
451 (pcut->GetNPassed()) ));
476 while(
auto* plist =
static_cast<THaNamedList*
>( next() )) {
478 if( is_stats && strlen( plist->GetName() ) )
479 cout <<
"BLOCK: " << plist->GetName() << endl;
480 plist->PrintOpt( opt.
Data() );
481 if ( is_stats ) cout << endl;
517 if( !opt.
IsLine() )
return;
518 cout.flags( ios::left );
519 cout << setw( opt.
GetValue(1) ) <<
"Name" <<
" "
520 << setw( opt.
GetValue(2) ) <<
"Def" <<
" ";
522 cout << setw(1) <<
"T" <<
" "
523 << setw( opt.
GetValue(3) ) <<
"Block" <<
" ";
525 cout << setw(9) <<
"Called" <<
" "
531 char*
line =
new char[
len+1 ];
532 for(
int i=0; i<
len; i++ )
line[i] =
'-';
534 cout <<
line << endl;
544 while(
auto* pcut =
static_cast<THaCut*
>( next() ))
558 Warning(
"Result",
"No such cut: %s", cutname );
561 return static_cast<Int_t>( pcut->GetResult() );
570 if ( !pcut )
return 0;
573 if ( plist ) plist->
Remove( pcut );
585 if( !plist )
return -1;
616 if(
n == 0 )
return 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
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 Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char mode
UInt_t IntDigits(Int_t n)
static bool IsComment(const string &s, string::size_type pos)
UInt_t IntDigits(Int_t n)
Option_t *const kPRINTLINE
Option_t *const kPRINTSTATS
static const char *const here
virtual void PrintBlock(const char *block=kDefaultBlockName, Option_t *option="") const
virtual void PrintCut(const char *cutname, Option_t *option="") const
virtual void ClearBlock(const char *block=kDefaultBlockName, Option_t *opt="")
virtual void Clear(Option_t *opt="")
virtual void PrintHeader(const THaPrintOption &opt) const
virtual Int_t RemoveBlock(const char *block=kDefaultBlockName)
const THaVarList * fVarList
virtual void SetList(THaVarList *lst)
virtual Int_t Load(const char *filename=kDefaultCutFile)
virtual Int_t Result(const char *cutname="", EWarnMode mode=kWarn)
virtual Int_t EvalBlock(const char *block=kDefaultBlockName)
virtual void Print(Option_t *option="") const
static const char *const kDefaultCutFile
virtual Int_t Remove(const char *cutname)
static void MakePrintOption(THaPrintOption &opt, const TList *plist)
THaNamedList * FindBlock(const char *block) const
virtual Int_t Define(const char *cutname, const char *expr, const char *block=kDefaultBlockName)
virtual void ClearAll(Option_t *opt="")
static const char *const kDefaultBlockName
virtual void Print(Option_t *opt="") const
const char * GetBlockname() const
virtual void PrintOpt(Option_t *opt) const
virtual void PrintOpt(Option_t *opt="") const
const char * Data() const
const char * GetOption(Int_t i=0) const
Int_t GetValue(Int_t i=0) const
void Delete(Option_t *option="") override
void Clear(Option_t *option="") override
TObject * Remove(TObject *obj) override
TObject * FindObject(const char *name) const override
void AddLast(TObject *obj) override
void Add(TObject *obj) override
TObject * Remove(const TObjLinkPtr_t &lnk)
virtual TObjLink * FirstLink() const
void Delete(Option_t *option="") override
TObject * GetObject() const
Int_t CheckIncludeFilePath(string &incfile)
Int_t GetIncludeFileName(const string &line, string &incfile)
double max(double x, double y)