class THaVar: public TNamed


 THaVar

 A "global variable".  This is essentially a read-only pointer to the
 actual data, along with support for data types and arrays.  It can
 be used to retrieve data from anywhere in memory, e.g. analysis results
 of some detector object.

 THaVar objects are managed by the THaVarList.

 The standard way to define a variable is via the constructor, e.g.

    Double_t x = 1.5;
    THaVar v("x","variable x",x);

 Constructors and Set() determine the data type automatically.
 Supported types are
    Double_t, Float_t, Long64_t, ULong64_t, Int_t, UInt_t,
    Short_t, UShort_t, Char_t, Byte_t

 Arrays can be defined as follows:

    Double_t* a = new Double_t[10];
    THaVar* va = new THaVar("a[10]","array of doubles",a);

 One-dimensional variable-size arrays are also supported. The actual
 size must be contained in a variable of type Int_t.
 NOTE: This feature may still be buggy. Use with caution.
 Example:

    Double_t* a = new Double_t[20];
    Int_t size;
    GetValues( a, size );  //Fills a and sets size to number of data.
    THaVar* va = new THaVar("a","var size array",a,&size);

 Any array size given in the name string is ignored (e.g. "a[20]"
 would have the same effect as "a"). The data are always interpreted
 as a one-dimensional array.

 Data should normally be retrieved using GetValue(), which always
 returns Double_t.
 If no type conversion is desired, or for maximum
 efficiency, one can use the typed GetValue methods.  However, this
 should be done with extreme care; a type mismatch could return
 just garbage without warning.


Function Members (Methods)

public:
THaVar()
THaVar(const THaVar& rhs)
THaVar(const char* name, const char* descript, const Double_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Float_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Long64_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const ULong64_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Int_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const UInt_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Short_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const UShort_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Char_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Byte_t& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Double_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Float_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Long64_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const ULong64_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Int_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const UInt_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Short_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const UShort_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Char_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* descript, const Byte_t*& var, const Int_t* count = 0)
THaVar(const char* name, const char* desc, const void* obj, VarType type, Int_t offset, TMethodCall* method = 0, const Int_t* count = 0)
virtual~THaVar()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
const Int_t*GetDim() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
Int_tGetLen() const
virtual const char*GetName() const
Byte_tGetNdim() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
VarTypeGetType() const
const char*GetTypeName() const
static const char*GetTypeName(VarType type)
size_tGetTypeSize() const
static size_tGetTypeSize(VarType type)
virtual UInt_tTObject::GetUniqueID() const
Double_tGetValue(Int_t i = 0) const
const void*GetValuePointer() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tHash() const
virtual Bool_tHasSameSize(const THaVar& rhs) const
virtual Bool_tHasSameSize(const THaVar* rhs) const
virtual Int_tIndex(const char*) const
virtual Int_tIndex(const THaArrayString&) const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
Bool_tIsArray() const
Bool_tIsBasic() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
Bool_tIsPointerArray() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
THaVar&operator=(const THaVar&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* opt = "FULL") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetName(const char*)
virtual voidSetNameTitle(const char* name, const char* descript)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetVar(const Double_t& var)
voidSetVar(const Float_t& var)
voidSetVar(const Long64_t& var)
voidSetVar(const ULong64_t& var)
voidSetVar(const Int_t& var)
voidSetVar(const UInt_t& var)
voidSetVar(const Short_t& var)
voidSetVar(const UShort_t& var)
voidSetVar(const Char_t& var)
voidSetVar(const Byte_t& var)
voidSetVar(const Double_t*& var)
voidSetVar(const Float_t*& var)
voidSetVar(const Long64_t*& var)
voidSetVar(const ULong64_t*& var)
voidSetVar(const Int_t*& var)
voidSetVar(const UInt_t*& var)
voidSetVar(const Short_t*& var)
voidSetVar(const UShort_t*& var)
voidSetVar(const Char_t*& var)
voidSetVar(const Byte_t*& var)
voidSetVar(const Double_t**& var)
voidSetVar(const Float_t**& var)
voidSetVar(const Long64_t**& var)
voidSetVar(const ULong64_t**& var)
voidSetVar(const Int_t**& var)
voidSetVar(const UInt_t**& var)
voidSetVar(const Short_t**& var)
voidSetVar(const UShort_t**& var)
voidSetVar(const Char_t**& var)
voidSetVar(const Byte_t**& var)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
const Int_t*GetObjArrayLenPtr() const
Double_tGetValueAsDouble(Int_t i = 0) const
Double_tGetValueFromObject(Int_t i = 0) const
voidTObject::MakeZombie()

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
public:
static const Double_tkInvalid
static const Int_tkInvalidInt
protected:
THaArrayStringfArrayDataVariable name and array dimension(s), if any
const Int_t*fCountPointer to array size for var size array
TMethodCall*fMethodMember function to access data in object
TStringTNamed::fNameobject identifier
const void*fObjectPointer to ROOT object containing data
const void**fObjectPIndirect pointer to ROOT object containing the data
Int_tfOffsetOffset of data w.r.t. object pointer
TStringTNamed::fTitleobject title
VarTypefTypeData type (see VarType.h)
const Byte_t***fValue3B
const Char_t***fValue3C
const Double_t***fValue3DPointers to pointers to array of pointers
const Float_t***fValue3Fto data (non-contiguous arrays)
const Int_t***fValue3I
const Long64_t***fValue3L
const Short_t***fValue3S
const UInt_t***fValue3U
const UShort_t***fValue3W
const ULong64_t***fValue3X
const Byte_t*fValueB
const Byte_t**fValueBB
const Char_t*fValueC
const Char_t**fValueCC
const Double_t*fValueDPointers to data (scalar or stack array)
const Double_t**fValueDDPointers to pointers to array of data
const Float_t*fValueF
const Float_t**fValueFF(fixed or variable heap arrays)
const Int_t*fValueI
const Int_t**fValueII
const Long64_t*fValueL
const Long64_t**fValueLL
const void*fValueP
const Short_t*fValueS
const Short_t**fValueSS
const UInt_t*fValueU
const UInt_t**fValueUU
const UShort_t*fValueW
const UShort_t**fValueWW
const ULong64_t*fValueX
const ULong64_t**fValueXX

Class Charts

Inheritance Chart:
TNamed
THaVar

Function documentation

THaVar(const THaVar& rhs)
 Copy constructor
THaVar& operator=(const THaVar& )
 Assignment operator. Must be explicit due to limitations of CINT.
~THaVar()
 Destructor
Bool_t HasSameSize( const THaVar& rhs )
 Compare the size of this variable to that of 'rhs'.
 Scalars always agree. Arrays agree if either they are of the same fixed
 size, or their count variables are identical, or they belong to the
 same object array.
Bool_t HasSameSize( const THaVar* rhs )
const char* GetTypeName(VarType type)
size_t GetTypeSize(VarType type)
const Int_t* GetObjArrayLenPtr()
 Return pointer to length of object array.
 Result must be copied or used immediately.
Double_t GetValueFromObject(Int_t i = 0) const
 Retrieve variable from a ROOT object, either via a function call
 or from a TSeqCollection
Int_t Index( const THaArrayString& elem )
 Return linear index into this array variable corresponding
 to the array element described by 'elem'.
 Return -1 if subscript(s) out of bound(s) or -2 if incompatible arrays.
Int_t Index( const char* s )
 Return linear index into this array variable corresponding
 to the array element described by the string 's'.
 's' must be either a single integer subscript (for a 1-d array)
 or a comma-separated list of subscripts (for multi-dimensional arrays).

 NOTE: This method is vastly less efficient than
 THaVar::Index( THaArraySring& ) above because the string has
 to be parsed first.

 Return -1 if subscript(s) out of bound(s) or -2 if incompatible arrays.
void Print(Option_t* opt = "FULL") const
Print a description of this variable
void SetName(const char* )
 Set the name of the variable
void SetNameTitle(const char* name, const char* descript)
 Set name and description of the variable
Int_t GetLen()
const Int_t* GetDim()
Double_t GetValueAsDouble(Int_t i = 0) const
  if( ( fValueP == NULL ) ||
    ( fType>=kDoubleP  && *fDoubleDD == NULL ) ||
    ( fType>=kDouble2P && (*fDouble3D)[i] == NULL ))
  return 0.0;
THaVar(const THaVar& rhs)
{}
THaVar(const THaVar& rhs)
THaVar( const char* name, const char* descript, const Double_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Float_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Long64_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const ULong64_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Int_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const UInt_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Short_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const UShort_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Char_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Byte_t& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Double_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Float_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Long64_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const ULong64_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Int_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const UInt_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Short_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const UShort_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Char_t*& var, const Int_t* count = NULL )
{}
THaVar( const char* name, const char* descript, const Byte_t*& var, const Int_t* count = NULL )
{}
const char* GetName()
{ return fArrayData.GetName(); }
Byte_t GetNdim()
{ return ( fCount != NULL || fOffset != -1 ) ? 1 : fArrayData.GetNdim(); }
VarType GetType()
{ return fType; }
size_t GetTypeSize(VarType type)
{ return GetTypeSize( fType ); }
const char* GetTypeName(VarType type)
{ return GetTypeName( fType ); }
Double_t GetValue(Int_t i = 0) const
{ return GetValueAsDouble(i); }
const void* GetValuePointer()
{ return fValueP; }
ULong_t Hash()
{ return fArrayData.Hash(); }
Bool_t IsArray()
{ return ( fCount != NULL || fOffset != -1 ) ? kTRUE : fArrayData.IsArray(); }
Bool_t IsBasic()
{ return ( fOffset == -1 && fMethod == NULL ); }
Bool_t IsPointerArray()
{ return ( IsArray() && fType>=kDouble2P && fType <= kObject2P ); }
void SetVar( const Double_t& var )
 The following are necessary to initialize empty THaVars such as those in arrays,
 where each element was constructed with the default constructor
{ fValueD = &var; fType = kDouble; }
void SetVar( const Float_t& var )
{ fValueF = &var; fType = kFloat; }
void SetVar( const Long64_t& var )
{ fValueL = &var; fType = kLong; }
void SetVar( const ULong64_t& var )
{ fValueX = &var; fType = kULong; }
void SetVar( const Int_t& var )
{ fValueI = &var; fType = kInt; }
void SetVar( const UInt_t& var )
{ fValueU = &var; fType = kUInt; }
void SetVar( const Short_t& var )
{ fValueS = &var; fType = kShort; }
void SetVar( const UShort_t& var )
{ fValueW = &var; fType = kUShort; }
void SetVar( const Char_t& var )
{ fValueC = &var; fType = kChar; }
void SetVar( const Byte_t& var )
{ fValueB = &var; fType = kByte; }
void SetVar( const Double_t*& var )
{ fValueDD = &var; fType = kDoubleP; }
void SetVar( const Float_t*& var )
{ fValueFF = &var; fType = kFloatP; }
void SetVar( const Long64_t*& var )
{ fValueLL = &var; fType = kLongP; }
void SetVar( const ULong64_t*& var )
{ fValueXX = &var; fType = kULongP; }
void SetVar( const Int_t*& var )
{ fValueII = &var; fType = kIntP; }
void SetVar( const UInt_t*& var )
{ fValueUU = &var; fType = kUIntP; }
void SetVar( const Short_t*& var )
{ fValueSS = &var; fType = kShortP; }
void SetVar( const UShort_t*& var )
{ fValueWW = &var; fType = kUShortP; }
void SetVar( const Char_t*& var )
{ fValueCC = &var; fType = kCharP; }
void SetVar( const Byte_t*& var )
{ fValueBB = &var; fType = kByteP; }
void SetVar( const Double_t**& var )
{ fValue3D = &var; fType = kDouble2P; }
void SetVar( const Float_t**& var )
{ fValue3F = &var; fType = kFloat2P; }
void SetVar( const Long64_t**& var )
{ fValue3L = &var; fType = kLong2P; }
void SetVar( const ULong64_t**& var )
{ fValue3X = &var; fType = kULong2P; }
void SetVar( const Int_t**& var )
{ fValue3I = &var; fType = kInt2P; }
void SetVar( const UInt_t**& var )
{ fValue3U = &var; fType = kUInt2P; }
void SetVar( const Short_t**& var )
{ fValue3S = &var; fType = kShort2P; }
void SetVar( const UShort_t**& var )
{ fValue3W = &var; fType = kUShort2P; }
void SetVar( const Char_t**& var )
{ fValue3C = &var; fType = kChar2P; }
void SetVar( const Byte_t**& var )
{ fValue3B = &var; fType = kByte2P; }

Last change: Sat Nov 7 21:26:56 2009
Last generated: 2009-11-07 21:26

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.