Hall C ROOT/C++ Analyzer (hcana)
Loading...
Searching...
No Matches
THcFormula.cxx
Go to the documentation of this file.
1
17#include "THcFormula.h"
18#include "THcParmList.h"
19#include "THaArrayString.h"
20#include "THaVarList.h"
21#include "THaCutList.h"
22#include "THaCut.h"
23#include "TMath.h"
24
25#include <iostream>
26#include <cassert>
27#include <numeric>
28
29using namespace std;
30
31//static const Double_t kBig = 1e38; // Error value
32
35
36#define ALL(c) (c).begin(), (c).end()
37
38//_____________________________________________________________________________
39THcFormula::THcFormula(const char* name, const char* expression,
40 const THcParmList* plst, const THaVarList* vlst,
41 const THaCutList* clst ) :
43{
44 Bool_t do_register=0;
45
46 fParmList = plst;
47 fVarList = vlst;
48 fCutList = clst;
49
50 if( Init( name, expression ) != 0 ) {
51 RegisterFormula(false);
52 return;
53 }
54
55 SetBit(kNotGlobal,!do_register);
56
57 Compile(); // This calls our own Compile()
58
59 if( do_register )
61}
62
63//_____________________________________________________________________________
65{
66 if( this != &rhs ) {
68 fParmList = rhs.fParmList;
69 }
70 return *this;
71}
72
73//_____________________________________________________________________________
75 THaFormula(rhs), fParmList(rhs.fParmList)
76{
77 // Copy ctor
78}
79
80//_____________________________________________________________________________
82{
83 // Destructor
84}
85
86//_____________________________________________________________________________
88{
89 // Check if 'name' is a known cut. If so, enter it in the local list of
90 // variables used in this formula.
91
92 EVariableType thistype;
93 TString realname;
94 Int_t period = name.Index('.');
95 if(period < 0) {
96 realname = name;
97 thistype = kCut;
98 } else {
99 realname = name(0,period);
100 TString attribute(name(period+1,name.Length()-period-1));
101 if(attribute.CompareTo("scaler")==0 || attribute.CompareTo("npassed")==0) {
102 thistype = (EVariableType) kCutScaler;
103 } else if (attribute.CompareTo("ncalled")==0) {
104 thistype = (EVariableType) kCutNCalled;
105 } else {
106 thistype = kCut;
107 }
108 }
109 return DefinedCutWithType(realname, thistype);
110}
111
112//_____________________________________________________________________________
118
119
120//_____________________________________________________________________________
121
int Int_t
bool Bool_t
EFuncCode
ClassImp(VDC::AnalyticTTDConv) using namespace std
@ kMax
@ kSum
@ kMedian
@ kIteration
@ kStdDev
@ kNumSetBits
@ kMin
@ kGeoMean
@ kMean
@ kLength
Int_t Init(const char *name, const char *expression)
virtual Int_t Compile(const char *expression="")
virtual void RegisterFormula(Bool_t add=true)
virtual Int_t DefinedCutWithType(TString &variable, EVariableType type)
const THaVarList * fVarList
const THaCutList * fCutList
virtual Int_t DefinedGlobalVariableExtraList(TString &variable, const THaVarList *extralist)
THaFormula & operator=(const THaFormula &rhs)
Enhanced THaFormula for use in report files.
Definition THcFormula.h:15
virtual Int_t DefinedGlobalVariable(TString &variable)
virtual Int_t DefinedCut(TString &variable)
const THcParmList * fParmList
Definition THcFormula.h:31
THcFormula(const char *name, const char *formula, const THcParmList *, const THaVarList *, const THaCutList *clst)
THcFormula & operator=(const THcFormula &rhs)
virtual ~THcFormula()
A list parameters and their values.
Definition THcParmList.h:27
void SetBit(UInt_t f)
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
STL namespace.