Hall A ROOT/C++ Analyzer (podd)
Loading...
Searching...
No Matches
THaVform.h
Go to the documentation of this file.
1#ifndef Podd_THaVform_h_
2#define Podd_THaVform_h_
3
5// //
6// THaVform //
7// //
9
10#include "THaFormula.h"
11#include "THaOutput.h"
12#include "TTree.h"
13#include <string>
14#include <vector>
15#include <iostream>
16#include <memory>
17
18class THaVar;
19class THaVarList;
20class THaCut;
21class THaCutList;
22class THaVar;
23
24class THaVform : public THaFormula {
25
26public:
27
29 fData(0), fType(kUnknown), fDebug(0), fVarPtr(nullptr), fOdata(nullptr),
30 fPrefix(0) {}
31 THaVform( const char* type, const char* name, const char* formula,
32 const THaVarList* vlst=gHaVars, const THaCutList* clst=gHaCuts );
33 virtual ~THaVform();
34 THaVform(const THaVform& vform);
35 THaVform& operator=(const THaVform& vform);
36
37// Over-rides base class DefinedGlobalVariables
39// Self-explanatory printouts
40 void ShortPrint() const;
41 void LongPrint() const;
42// Must initialize the variables. They will go to the 'tree'
43// if you subsequently call SetOutput();
44 Int_t Init();
45// Must reattach if pointers to global variables redone
46 void ReAttach();
47// To explain the error return status from Init() if it's nonzero.
48 void ErrPrint(Int_t status) const;
49// Must 'SetOutput' at initialization if output to appear in tree.
50// Normally not desired for THaVforms that belong to THaVhist's
52// Must 'Process' once per event before processing the things
53// that use this object.
54 Int_t Process();
55// To get the data (from index of array). In the case of a
56// cut this will be a 0 or 1 (false or true).
57 Double_t GetData(Int_t index = 0) const;
58 // Set the eye offset if this IsEye()
59 void SetEyeOffset(Int_t offset) { if(IsEye()) fEyeOffset = offset; };
60// This object is either a formula, a variable sized array, a cut, or
61// an "eye" ("[I]" variable)
62
63 Bool_t IsFormula() const { return (fType == kForm); }
64 Bool_t IsVarray() const { return (fVarPtr && fType == kVarArray); }
65 Bool_t IsCut() const { return (fType == kCut); }
66 Bool_t IsEye() const { return (fType == kEye); }
67// Get the size (dimension) of this object
68 Int_t GetSize() const { return fObjSize; };
69// Get names of variable that are used by this formula.
70 std::vector<std::string> GetVars() const;
71
72protected:
73
74 enum FTy { kCut = 0, kForm, kEye, kVarArray, kUnknown };
75 enum FAr { kScaler = 0, kAElem, kFAType, kVAType };
76 enum FAp { kNoPrefix = 0, kAnd, kOr, kSum };
82
84 static const Int_t fgVFORM_HUGE = 10000;
85 std::string fAndStr, fOrStr, fSumStr;
86
87 Int_t MakeFormula(Int_t flo, Int_t fhi);
88 std::string StripPrefix(const char* formula);
89 std::string StripBracket(const std::string& var) const;
90 void GetForm(Int_t size);
91 void Create(const THaVform& vf);
92 void Uncreate();
93
94 std::vector<std::string> fVarName;
95 std::vector<Int_t> fVarStat;
96 std::vector<THaFormula*> fFormula;
97 std::vector<THaCut*> fCut;
98 std::vector<std::string> fSarray;
99 std::vector<std::string> fVectSform;
100 std::string fStitle;
104
105private:
106
107 ClassDef(THaVform,0) // Vector of formulas or a var-sized array
108};
109
110
111inline
113 if (IsEye())
114 return (Double_t)(index + fEyeOffset);
115 if (!fOdata)
116 return fData;
117 return (fObjSize > 1) ? fOdata->Get(index) : fOdata->Get();
118}
119
120#endif
121
122
int Int_t
bool Bool_t
double Double_t
#define ClassDef(name, id)
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 offset
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
R__EXTERN class THaVarList * gHaVars
Definition THaGlobals.h:11
R__EXTERN class THaCutList * gHaCuts
Definition THaGlobals.h:12
Double_t Get(Int_t index=0) const
Definition THaOutput.h:50
Int_t fNvar
Definition THaVform.h:79
Double_t fData
Definition THaVform.h:80
Int_t fObjSize
Definition THaVform.h:79
Int_t fPrefix
Definition THaVform.h:103
THaVform & operator=(const THaVform &vform)
Definition THaVform.cxx:91
@ kIllTyp
Definition THaVform.h:77
@ kArrZer
Definition THaVform.h:78
@ kIllPre
Definition THaVform.h:78
@ kIllVar
Definition THaVform.h:77
@ kUnkPre
Definition THaVform.h:78
@ kArrSiz
Definition THaVform.h:78
@ kIllMix
Definition THaVform.h:78
Int_t fEyeOffset
Definition THaVform.h:79
virtual ~THaVform()
Definition THaVform.cxx:85
Int_t MakeFormula(Int_t flo, Int_t fhi)
Definition THaVform.cxx:379
void SetEyeOffset(Int_t offset)
Definition THaVform.h:59
Bool_t IsVarray() const
Definition THaVform.h:64
@ kVAType
Definition THaVform.h:75
@ kScaler
Definition THaVform.h:75
@ kFAType
Definition THaVform.h:75
std::string fSumStr
Definition THaVform.h:85
void ShortPrint() const
Definition THaVform.cxx:172
Int_t fDebug
Definition THaVform.h:83
FTy fType
Definition THaVform.h:81
Bool_t IsCut() const
Definition THaVform.h:65
@ kUnknown
Definition THaVform.h:74
@ kVarArray
Definition THaVform.h:74
Int_t DefinedGlobalVariable(TString &variable)
Definition THaVform.cxx:668
Int_t GetSize() const
Definition THaVform.h:68
std::string fAndStr
Definition THaVform.h:85
void ErrPrint(Int_t status) const
Definition THaVform.cxx:184
void ReAttach()
Definition THaVform.cxx:363
Int_t Process()
Definition THaVform.cxx:564
THaVar * fVarPtr
Definition THaVform.h:101
@ kNoPrefix
Definition THaVform.h:76
std::vector< std::string > fVectSform
Definition THaVform.h:99
void Create(const THaVform &vf)
Definition THaVform.cxx:101
std::string StripBracket(const std::string &var) const
Definition THaVform.cxx:529
void GetForm(Int_t size)
Definition THaVform.cxx:722
static const Int_t fgVFORM_HUGE
Definition THaVform.h:84
THaOdata * fOdata
Definition THaVform.h:102
std::vector< std::string > fVarName
Definition THaVform.h:94
std::vector< THaFormula * > fFormula
Definition THaVform.h:96
Double_t GetData(Int_t index=0) const
Definition THaVform.h:112
Int_t SetOutput(TTree *tree)
Definition THaVform.cxx:547
std::vector< std::string > fSarray
Definition THaVform.h:98
Bool_t IsEye() const
Definition THaVform.h:66
std::vector< THaCut * > fCut
Definition THaVform.h:97
std::string StripPrefix(const char *formula)
Definition THaVform.cxx:486
std::string fStitle
Definition THaVform.h:100
void LongPrint() const
Definition THaVform.cxx:151
std::vector< std::string > GetVars() const
Definition THaVform.cxx:255
THaVform()
Definition THaVform.h:28
Int_t Init()
Definition THaVform.cxx:263
std::vector< Int_t > fVarStat
Definition THaVform.h:95
std::string fOrStr
Definition THaVform.h:85
void Uncreate()
Definition THaVform.cxx:140
Bool_t IsFormula() const
Definition THaVform.h:63