ROOT logo
Podd » SRC » THaOutput

class THaOutput


 THaOutput

 Defines the tree and histogram output for THaAnalyzer.
 This class reads a file 'output.def' (an example is in /examples)
 to define which global variables, including arrays, and formulas
 (THaFormula's), and histograms go to the ROOT output.

 author:  R. Michaels    Sept 2002



Function Members (Methods)

public:
THaOutput()
virtual~THaOutput()
static TClass*Class()
virtual Int_tEnd()
virtual TTree*GetTree() const
virtual Int_tInit(const char* filename = "output.def")
virtual TClass*IsA() const
virtual Int_tProcEpics(THaEvData* ev, THaEpicsEvtHandler* han)
virtual Int_tProcess()
static voidSetVerbosity(Int_t level)
virtual voidShowMembers(TMemberInspector&)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual Bool_tTreeDefined() const
protected:
virtual Int_tAttach()
virtual Int_tBuildBlock(const string& blockn)
voidBuildList(const vector<std::string>& vdata)
virtual Int_tChkHistTitle(Int_t key, const string& sline)
stringCleanEpicsName(const string& var) const
virtual voidErrFile(Int_t iden, const string& sline) const
virtual Int_tFindKey(const string& key) const
virtual Int_tLoadFile(const char* filename)
voidPrint() const
vector<std::string>reQuote(const vector<std::string>& input) const
virtual stringStripBracket(const string& var) const
private:
THaOutput(const THaOutput&)
THaOutput&operator=(const THaOutput&)

Data Members

public:
enum EId { kVar
kForm
kCut
kH1f
kH1d
kH2f
kH2d
kBlock
kBegin
kEnd
kRate
kCount
};
protected:
vector<std::string>fArrayNames
vector<THaVar*>fArrays
vector<std::string>fCutdef
vector<std::string>fCutnames
vector<THaVform*>fCuts
vector<THaEpicsKey*>fEpicsKey
TTree*fEpicsTree
Double_t*fEpicsVar
vector<std::string>fFormdef
vector<std::string>fFormnames
vector<THaVform*>fFormulas
vector<THaVhist*>fHistos
boolfInit
Int_tfNvar
vector<THaOdata*>fOdata
TTree*fTree
vector<std::string>fVNames
Double_t*fVar
vector<THaVar*>fVariables
vector<std::string>fVarnames
static const Int_tfgNocut
static Int_tfgVerbose
static const Int_tkNbout
private:
THaEvtTypeHandler*fEpicsHandler
Bool_tfFirstEpics
Bool_tfOpenEpics
Int_tiscut
Int_tnx
Int_tny
stringscut
stringsfvarx
stringsfvary
stringstitle
Float_txhi
Float_txlo
Float_tyhi
Float_tylo

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

THaOutput()
 Constructor
~THaOutput()
 Destructor
Int_t Init(const char* filename = "output.def")
 Initialize output system. Required before anything can happen.

 Only re-attach to variables and re-compile cuts and formulas
 upon re-initialization (eg: continuing analysis with another file)
void BuildList(const vector<std::string>& vdata)
 Build list of EPICS variables and
 SCALER variables to add to output.
Int_t Attach()
 Get the pointers for the global variables
 Also, sets the size of the fVariables and fArrays vectors
 according to the size of the related names array
Int_t ProcEpics(THaEvData* ev, THaEpicsEvtHandler* han)
 Process the EPICS data, this fills the trees.
Int_t Process()
 Process the variables, formulas, and histograms.
 This is called by THaAnalyzer.
Int_t End()
Int_t LoadFile(const char* filename)
 Process the file that defines the output
Int_t FindKey(const string& key) const
 Return integer flag corresponding to
 case-insensitive keyword "key" if it exists
string StripBracket(const string& var) const
 If the string contains "[anything]", we strip
 it away.  In practice this should not be fatal
 because your variable will still show up in the tree.
std::vector<string> reQuote(const vector<std::string>& input) const
 Specialist private function needed by EPICs line parser:
 The problem is that the line was split by white space, so
 a line like "'RF On'=42"  must be repackaged into
 one string, i.e. "'RF" and "On'=42" put back together.
string CleanEpicsName(const string& var) const
 To clean up EPICS variable names that contain
 bad characters like ":" and arithmetic operations
 that confuse TTree::Draw().
 Replace all 'badchar' with 'goodchar'
void ErrFile(Int_t iden, const string& sline) const
 Print error messages about the output definition file.
void Print() const
 Printout the definitions. Amount printed depends on verbosity
 level, set with SetVerbosity().
Int_t ChkHistTitle(Int_t key, const string& sline)
 Parse the string that defines the histogram.
 The title must be enclosed in single quotes (e.g. 'my title').
 Ret value 'result' means:  -1 == error,  1 == everything ok.
Int_t BuildBlock(const string& blockn)
 From the block name, identify and save a specific grouping
 of global variables by adding them to the fVarnames list.

 For efficiency, at the end of building the list we should
 ensure that variables are listed only once.

 Eventually, we can have some specially named blocks,
 but for now we simply will use pattern matching, such that
   block L.*
 would save all variables from the left spectrometer.
void SetVerbosity(Int_t level)
 Set verbosity level for debug messages
THaOdata& operator=(const THaOutput& )
THaOutput()
Bool_t TreeDefined() const
{ return fTree != 0; }
TTree* GetTree() const
{ return fTree; }