48 v =
v - ((
v >> 1) & 0x55555555);
49 v = (
v & 0x33333333) + ((
v >> 2) & 0x33333333);
50 return (((
v + (
v >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
65 TFormula(), fVarList(nullptr), fCutList(nullptr), fInstance(0)
69 Init(
nullptr,
nullptr );
76 :
TFormula(), fVarList(vlst), fCutList(clst), fInstance(0)
86 if(
Init(
name, expression ) != 0 ) {
104 const char*
const here =
"THaFormula";
125 if( chaine.
Length() == 0 ) {
126 Error(
here,
"expression may not be empty");
132 Bool_t gausNorm =
false, landauNorm =
false, linear =
false;
152 if( gausNorm || landauNorm )
160 TFormula(rhs), fVarDef(rhs.fVarDef),
161 fVarList(rhs.fVarList), fCutList(rhs.fCutList), fInstance(0)
208 :
type(rhs.type), obj(rhs.obj),
index(rhs.index)
273 const auto* pvar =
static_cast<const THaVar*
>( def.
obj );
310 const auto* var =
static_cast<const THaVar*
>(def.
obj);
314 if(
index >= var->GetLen() ) {
318 return var->GetValue(
index );
323 const auto* cut =
static_cast<const THaCut*
>(def.
obj);
325 return cut->GetResult();
345 Int_t ndata = func->GetNdata();
364 vector<Double_t> values;
365 values.reserve(ndata);
366 for(
Int_t instance = 0; instance < ndata; ++instance ) {
367 values.push_back( func->EvalInstance(instance) );
369 if( func->IsInvalid() ) {
375 y = accumulate( ALL(values),
static_cast<Double_t>(0.0) );
384 y = *max_element( ALL(values) );
387 y = *min_element( ALL(values) );
404 const auto* cut =
static_cast<const THaCut*
>(def.
obj);
406 return cut->GetNPassed();
411 const auto* cut =
static_cast<const THaCut*
>(def.
obj);
413 return cut->GetNCalled();
426 const char*
const numbers =
"0123456789";
431 const char* blacklist[] = {
"expo",
"gaus",
"landau",
"pol",
nullptr };
432 const char** item = blacklist;
436 if( pos ==
kNPOS )
continue;
438 if( func !=
"pol" ) {
439 if( (pos == 0 || (pos == 1 && strchr(
"xyzt",
name[0])) ||
440 (pos == 2 &&
name(0,2) ==
"xy")) &&
len == pos+
n )
443 if( (pos == 0 || (pos == 1 && strchr(
"xyzt",
name[0]))) &&
444 len > pos+
n && strchr(numbers,
name[pos+
n]) )
482 const auto* pvar =
static_cast<const THaVar*
>( def.
obj );
485 if( pvar->GetType() == kCharP ) {
509 Error(
"Compile",
" Unknown name : %s",
name.Data());
535 for( vector<FVarDef_t>::size_type i=0; i<
fVarDef.size(); ++i ) {
565 if( parsed_name.
IsError() )
return -1;
589 if( parsed_name.
GetNdim() != 1 )
593 index = parsed_name[0];
610 for( vector<FVarDef_t>::size_type i=0; i<
fVarDef.size(); ++i ) {
636 static const vector<FuncDef_t> func_defs = {
648 for(
const auto& def : func_defs ) {
649 if( def.form &&
name.BeginsWith(def.func) &&
name.EndsWith(
")") ) {
653 auto* func =
new THaFormula(def.form, subform,
false,
655 if( func->IsError() ) {
659 if( func->IsArray() ) {
660 if( func->IsVarArray() ) {
664 }
else if( func->GetNdata() == 0 ) {
669 fVarDef.emplace_back(def.type, func, def.code);
671 name = def.func;
name += func->GetExpFormula();
name +=
")";
681 else if( !def.form &&
name == def.func ) {
682 fVarDef.emplace_back(def.type,
nullptr, def.code);
705 if( instance < 0 || (!
IsArray() && instance != 0) ) {
725 for( vector<FVarDef_t>::size_type i = 0; ndata > 0 && i <
fVarDef.size();
731 const auto* pvar =
static_cast<const THaVar*
>(def.
obj);
733 assert( pvar->IsArray() );
734 assert( pvar->GetNdim() > 0 );
743 Int_t nfunc = func->GetNdata();
const ULong64_t kMaxULong64
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
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 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 type
static const char *const here
R__EXTERN TVirtualMutex * gROOTMutex
#define R__LOCKGUARD2(mutex)
void ResetAllBits(Bool_t value=kFALSE)
Bool_t TestBitNumber(UInt_t bitnumber) const
void SetBitNumber(UInt_t bitnumber, Bool_t value=kTRUE)
virtual TObject * Remove(TObject *obj)=0
virtual void Add(TObject *obj)=0
TObject * FindObject(const char *name) const override
const char * GetName() const
THaCut * FindCut(const char *name) const
virtual THaVar * Find(const char *name) const
Int_t Index(const char *subscripts) const
Bool_t IsVarArray() const
const void * GetValuePointer() const
virtual void SetTitle(const char *title="")
const char * GetName() const override
void Print(Option_t *option="") const override
virtual void SetName(const char *name)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual void Error(const char *method, const char *msgfmt,...) const
const char * Data() const
Bool_t IsWhitespace() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
unsigned long long ULong64_t
Double_t Min(Double_t a, Double_t b)
Double_t RMS(Iterator first, Iterator last)
Double_t Median(Long64_t n, const T *a, const Double_t *w=nullptr, Long64_t *work=nullptr)
Double_t GeomMean(Iterator first, Iterator last)
Double_t Mean(Iterator first, Iterator last)