ROOT logo
Podd » SRC » THaAnalysisObject

class THaAnalysisObject: public TNamed


 THaAnalysisObject

 Abstract base class for a detector or subdetector.

 Derived classes must define all internal variables, a constructor
 that registers any internal variables of interest in the global
 physics variable list, and a Decode() method that fills the variables
 based on the information in the THaEvData structure.


Function Members (Methods)

public:
THaAnalysisObject()
virtual~THaAnalysisObject()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual Int_tBegin(THaRunBase* r = 0)
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidClear(Option_t* = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
static Int_tDefineVarsFromList(const void* list, THaAnalysisObject::EType type, THaAnalysisObject::EMode mode, const char* var_prefix, const TObject* obj, const char* prefix, const char* here)
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 Int_tEnd(THaRunBase* r = 0)
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
static voidGeoToSph(Double_t th_geo, Double_t ph_geo, Double_t& th_sph, Double_t& ph_sph)
const char*GetClassName() const
const char*GetConfig() const
virtual const char*GetDBFileName() const
Int_tGetDebug() const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
TDatimeGetInitDate() const
virtual const char*TNamed::GetName() const
static TString&GetObjArrayString(const TObjArray* params, Int_t pos)
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
const char*GetPrefix() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() 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
THaAnalysisObject::EStatusInit()
virtual THaAnalysisObject::EStatusInit(const TDatime& run_time)
virtual Int_tInitOutput(THaOutput*)
virtual voidTObject::Inspect() constMENU
static Bool_tIntersectPlaneWithRay(const TVector3& xax, const TVector3& yax, const TVector3& org, const TVector3& ray_start, const TVector3& ray_vect, Double_t& length, TVector3& intersect)
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tIsInit() const
Bool_tIsOK() const
Bool_tIsOKOut()
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
static boolIsTag(const char* buf)
Bool_tTObject::IsZombie() const
static Int_tLoadDB(FILE* file, const TDatime& date, const DBRequest* request, const char* prefix, Int_t search = 0, const char* here = "THaAnalysisObject::LoadDB")
static Int_tLoadDBvalue(FILE* file, const TDatime& date, const char* tag, Double_t& value)
static Int_tLoadDBvalue(FILE* file, const TDatime& date, const char* tag, Int_t& value)
static Int_tLoadDBvalue(FILE* file, const TDatime& date, const char* tag, string& text)
static Int_tLoadDBvalue(FILE* file, const TDatime& date, const char* tag, TString& text)
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
static FILE*OpenFile(const char* name, const TDatime& date, const char* here = "OpenFile()", const char* filemode = "r", const int debug_flag = 1)
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)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* opt = "") const
static voidPrintObjects(Option_t* opt = "")
virtual Int_tTObject::Read(const char* name)
static Int_tReadDBline(FILE* fp, char* buf, size_t bufsiz, string& line)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
static Int_tSeekDBconfig(FILE* file, const char* tag, const char* label = "config", Bool_t end_on_tag = false)
static Int_tSeekDBdate(FILE* file, const TDatime& date, Bool_t end_on_tag = false)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetConfig(const char* label)
virtual voidSetDebug(Int_t level)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetName(const char* name)
virtual voidSetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
static voidSphToGeo(Double_t th_sph, Double_t ph_sph, Double_t& th_geo, Double_t& ph_geo)
THaAnalysisObject::EStatusStatus() const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_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()
static vector<std::string>vsplit(const string& s)
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:
THaAnalysisObject(const char* name, const char* description)
virtual const char*ClassNameHere(const char*) const
virtual Int_tDefineVariables(THaAnalysisObject::EMode mode = kDefine)
Int_tDefineVarsFromList(const VarDef* list, THaAnalysisObject::EMode mode = kDefine, const char* var_prefix = "") const
Int_tDefineVarsFromList(const RVarDef* list, THaAnalysisObject::EMode mode = kDefine, const char* var_prefix = "") const
Int_tDefineVarsFromList(const void* list, THaAnalysisObject::EType type, THaAnalysisObject::EMode mode, const char* var_prefix = "") const
virtual voidDoError(int level, const char* location, const char* fmt, va_list va) const
THaAnalysisObject*FindModule(const char* name, const char* classname, bool do_error = true)
static vector<std::string>GetDBFileList(const char* name, const TDatime& date, const char* here = "GetDBFileList()")
virtual const char*Here(const char*) const
Int_tLoadDB(FILE* f, const TDatime& date, const DBRequest* req, Int_t search = 0)
virtual voidMakePrefix()
voidMakePrefix(const char* basename)
voidTObject::MakeZombie()
virtual FILE*OpenFile(const TDatime& date)
virtual FILE*OpenRunDBFile(const TDatime& date)
static char*ReadComment(FILE* fp, char* buf, const int len)
virtual Int_tReadDatabase(const TDatime& date)
virtual Int_tReadRunDatabase(const TDatime& date)
virtual Int_tRemoveVariables()

Data Members

public:
enum EStatus { kOK
kNotinit
kInitError
kFileError
};
enum EType { kVarDef
kRVarDef
};
enum EMode { kDefine
kDelete
};
enum EProperties { kNeedsRunDB
kConfigOverride
};
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_tkBig= 1.e38; // default junk value
protected:
TStringfConfigConfiguration to use from database
Int_tfDebugDebug level
TDatimefInitDateDate passed to Init
Bool_tfIsInitFlag indicating that ReadDatabase done
Bool_tfIsSetupFlag indicating that DefineVariables done.
TStringTNamed::fNameobject identifier
Bool_tfOKOutFlag indicating object-output prepared
char*fPrefixName prefix for global variables
UInt_tfPropertiesProperties of this object (see EProperties)
THaAnalysisObject::EStatusfStatusInitialization status flag
TStringTNamed::fTitleobject title
private:
static TList*fgModulesList of all currently existing Analysis Modules

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

THaAnalysisObject(const char* name, const char* description)
 Constructor
THaAnalysisObject()
 only for ROOT I/O
~THaAnalysisObject()
 Destructor
Int_t Begin(THaRunBase* r = 0)
 Method usually called right before the start of the event loop
 for 'run'. Begin() is similar to Init(), but since there is a default
 Init() implementing standard database and global variable setup,
 Begin() can be used to implement start-of-run setup tasks for each
 module cleanly without interfering with the standard Init() prodecure.

 The default Begin() method does nothing.
Int_t DefineVariables(THaAnalysisObject::EMode mode = kDefine)
 Default method for defining global variables. Currently does nothing.
Int_t DefineVarsFromList(const VarDef* list, THaAnalysisObject::EMode mode = kDefine, const char* var_prefix = "") const
Int_t DefineVarsFromList(const RVarDef* list, THaAnalysisObject::EMode mode = kDefine, const char* var_prefix = "") const
Int_t DefineVarsFromList(const void* list, THaAnalysisObject::EType type, THaAnalysisObject::EMode mode, const char* var_prefix = "") const
 Add/delete variables defined in 'list' to/from the list of global
 variables, using prefix of the current apparatus.
 Internal function that can be called during initialization.
Int_t DefineVarsFromList(const void* list, THaAnalysisObject::EType type, THaAnalysisObject::EMode mode, const char* var_prefix, const TObject* obj, const char* prefix, const char* here)
 Actual implementation of the variable definition utility function.
 Static function that can be used by classes other than THaAnalysisObjects
Int_t End(THaRunBase* r = 0)
 Method usually called right after the end of the event loop for 'run'.
 May be used by modules to clean up, compute averages, write summaries, etc.

 The default End() method does nothing.
THaAnalysisObject* FindModule(const char* name, const char* classname, bool do_error = true)
 Locate the object 'name' in the global list of Analysis Modules
 and check if it inherits from 'classname' (if given), and whether
 it is properly initialized.
 Return pointer to valid object, else return NULL.
 If do_error == true (default), also print error message and set fStatus
 to kInitError.
 If do_error == false, don't print error messages and not test if object is
 initialized.

 This function is intended to be called from physics module initialization
 routines.
vector<string> GetDBFileList(const char* name, const TDatime& date, const char* here = "GetDBFileList()")
 Return the database file searchlist as a vector of strings.
 The file names are relative to the current directory.
const char* GetDBFileName() const
const char* GetClassName() const
void DoError(int level, const char* location, const char* fmt, va_list va) const
 Interface to ErrorHandler. Inserts this object's name after the class name.
 If 'here' = ("prefix")::method -> print <Class("prefix")::method>
 If 'here' = method             -> print <Class::method>
const char* Here(const char* ) const
 Return a string consisting of ("fPrefix")::here
 Used for generating diagnostic messages.
 The return value points to an internal static buffer that
 one should not try to delete ;)
const char* ClassNameHere(const char* ) const
 Return a string consisting of Class("fPrefix")::here
Int_t InitOutput(THaOutput* )
 This method is called from THaAnalyzer::DoInit,
 after THaOutput is initialized.
 The TTree to work with can be retrieved like:
 TTree *tree = output->GetTree()

 tree is the TTree to append the branches to

 construct all branches here. Set kOKOut=true if
 all is okay, and return 0

 anything else will trigger error messages.
void MakePrefix(const char* basename)
 Set up name prefix for global variables.
 Internal function called by constructors of derived classes.
 If basename != NULL,
   fPrefix = basename  + "." + GetName() + ".",
 else
   fPrefix = GetName() + "."
void MakePrefix()
 Make default prefix: GetName() + "."
FILE* OpenFile(const char* name, const TDatime& date, const char* here = "OpenFile()", const char* filemode = "r", const int debug_flag = 1)
 Open database file and return a pointer to the C-style file descriptor.
FILE* OpenFile(const TDatime& date)
 Default method for opening database file
FILE* OpenRunDBFile(const TDatime& date)
 Default method for opening run database file
char* ReadComment(FILE* fp, char* buf, const int len)
 Read database comment lines (those not starting with a space (' ')),
 returning the comment.
 If the line is data, then nothing is done and NULL is returned,
 so one can search for the next data line with:
   while ( ReadComment(fp, buf, len) );
Int_t ReadDatabase(const TDatime& date)
 Default database reader. Currently does nothing.
Int_t ReadRunDatabase(const TDatime& date)
 Default run database reader. Reads one key, <prefix>.config, into
 fConfig. If not found, fConfig is empty. If fConfig was explicitly
 set with SetConfig(), the run database is not parsed and fConfig is
 not touched.
Int_t RemoveVariables()
 Default method for removing global variables of this object
void SetName(const char* name)
 Set/change the name of the object.
void SetNameTitle(const char* name, const char* title)
 Set name and title of the object.
void SetConfig(const char* label)
 Set the "configuration" to select in the database.
 In text-based database files, this will make the database reader
 seek to a section header [ config=label ] if the module supports it.
void SetDebug(Int_t level)
 Set debug level
Bool_t IntersectPlaneWithRay(const TVector3& xax, const TVector3& yax, const TVector3& org, const TVector3& ray_start, const TVector3& ray_vect, Double_t& length, TVector3& intersect)
 Find intersection point of plane (given by 'xax', 'yax', 'org') with
 ray (given by 'ray_start', 'ray_vect').
 Returns true if intersection found, else false (ray parallel to plane).
 Output is in 'length' and 'intersect', where
   intersect = ray_start + length*ray_vect
 'length' and 'intersect' must be provided by the caller.
void GeoToSph(Double_t th_geo, Double_t ph_geo, Double_t& th_sph, Double_t& ph_sph)
 Convert geographical to spherical angles. Units are rad.
 th_geo and ph_geo can be anything.
 th_sph is in [0,pi], ph_sph in [-pi,pi].
void SphToGeo(Double_t th_sph, Double_t ph_sph, Double_t& th_geo, Double_t& ph_geo)
 Convert spherical to geographical angles. Units are rad.
 th_sph and ph_sph can be anything, although th_sph outside
 [0,pi] is not really meaningful.
 th_geo is in [-pi,pi] and ph_sph in [-pi/2,pi/2]
bool IsTag(const char* buf)
 Return true if the string in 'buf' matches regexp ".*\[.+\].*",
 i.e. it is a database tag.  Generic utility function.
Int_t ReadDBline(FILE* fp, char* buf, size_t bufsiz, string& line)
 Get a text line from the database file 'file'. Ignore all comments
 (anything after a #). Trim trailing whitespace. Concatenate continuation
 lines (ending with \).
 Only returns if a non-empty line was found, or on EOF.
Int_t LoadDBvalue(FILE* file, const TDatime& date, const char* tag, string& text)
 Load a data value tagged with 'key' from the database 'file'.
 Lines before the first valid time stamp or starting with "#" are ignored.
 If 'key' is found, then the most recent value seen (based on time stamps
 and position within the file) is returned in 'text'.
 Values with time stamps later than 'date' are ignored.
 This allows incremental organization of the database where
 only changes are recorded with time stamps.
 Return 0 if success, 1 if key not found, <0 if unexpected error.
Int_t LoadDBvalue(FILE* file, const TDatime& date, const char* tag, Double_t& value)
 Locate key in database, convert the text found to double-precision,
 and return result in 'value'.
 This is a convenience function.
Int_t LoadDBvalue(FILE* file, const TDatime& date, const char* tag, Int_t& value)
 Locate key in database, convert the text found to integer
 and return result in 'value'.
 This is a convenience function.
Int_t LoadDBvalue(FILE* file, const TDatime& date, const char* tag, TString& text)
 Locate key in database, convert the text found to TString
 and return result in 'text'.
 This is a convenience function.
Int_t LoadDB(FILE* f, const TDatime& date, const DBRequest* req, Int_t search = 0)
 Member function version of LoadDB, uses current object's fPrefix and
 class name
Int_t LoadDB(FILE* file, const TDatime& date, const DBRequest* request, const char* prefix, Int_t search = 0, const char* here = "THaAnalysisObject::LoadDB")
 Load a list of parameters from the database file 'f' according to
 the contents of the 'req' structure (see VarDef.h).
Int_t SeekDBconfig(FILE* file, const char* tag, const char* label = "config", Bool_t end_on_tag = false)
 Starting from the current position in 'file', look for the
 configuration 'tag'. Position the file on the
 line immediately following the tag. If no tag found, return to
 the original position in the file.
 Return zero if not found, 1 otherwise.

 Configuration tags have the form [ config=tag ].
 If 'label' is given explicitly, it replaces 'config' in the tag string,
 for example label="version" will search for [ version=tag ].
 If 'label' is empty (""), search for just [ tag ].

 If 'end_on_tag' is true, quit if any non-matching tag found,
 i.e. anything matching "*[*]*" except "[config=anything]".

 Useful for segmenting databases (esp. VDC) for different
 experimental configurations.
Int_t SeekDBdate(FILE* file, const TDatime& date, Bool_t end_on_tag = false)
 Starting from the current position in file 'f', look for a
 date tag matching time stamp 'date'. Position the file on the
 line immediately following the tag. If no tag found, return to
 the original position in the file.
 Return zero if not found, 1 otherwise.
 Date tags must be in SQL format: [ yyyy-mm-dd hh:mi:ss ].
 If 'end_on_tag' is true, end the search at the next non-date tag;
 otherwise, search through end of file.
 Useful for sub-segmenting database files.
vector<string> vsplit(const string& s)
 Static utility function to split a string into
 whitespace-separated strings
TString& GetObjArrayString(const TObjArray* params, Int_t pos)
 Get the string at index i in the given TObjArray
void Print(Option_t* opt = "") const
void PrintObjects(Option_t* opt = "")
 Print all defined analysis objects (useful for debugging)
THaAnalysisObject()
void Clear(Option_t* = "")
{}
const char* GetConfig() const
{ return fConfig.Data(); }
Int_t GetDebug() const
{ return fDebug; }
const char* GetPrefix() const
{ return fPrefix; }
EStatus Init()
EStatus Init(const TDatime& run_time)
Bool_t IsInit() const
{ return IsOK(); }
Bool_t IsOK() const
{ return (fStatus == kOK); }
TDatime GetInitDate() const
{ return fInitDate; }
Bool_t IsOKOut()
{ return fOKOut; }
THaAnalysisObject& operator=(const THaAnalysisObject& )