#ifndef ROOT_THaAnalysisObject
#define ROOT_THaAnalysisObject
#include "TNamed.h"
#include "THaGlobals.h"
#include "TDatime.h"
#include "VarDef.h"
#include <vector>
#include <string>
#include <cstdio>
class THaEvData;
class TList;
class TVector3;
class THaRunBase;
class THaOutput;
const char* Here( const char* here, const char* prefix = NULL );
class THaAnalysisObject : public TNamed {
public:
enum EStatus { kOK, kNotinit, kInitError, kFileError };
enum EType { kVarDef, kRVarDef };
enum EMode { kDefine, kDelete };
static const Double_t kBig;
THaAnalysisObject();
virtual ~THaAnalysisObject();
virtual Int_t Begin( THaRunBase* r=0 );
virtual void Clear( Option_t* ) {}
virtual Int_t End( THaRunBase* r=0 );
virtual const char* GetDBFileName() const;
const char* GetConfig() const { return fConfig.Data(); }
Int_t GetDebug() const { return fDebug; }
const char* GetPrefix() const { return fPrefix; }
EStatus Init();
virtual EStatus Init( const TDatime& run_time );
Bool_t IsInit() const { return IsOK(); }
Bool_t IsOK() const { return (fStatus == kOK); }
TDatime GetInitDate() const { return fInitDate; }
void SetConfig( const char* label );
virtual void SetDebug( Int_t level );
virtual void SetName( const char* name );
virtual void SetNameTitle( const char* name, const char* title );
EStatus Status() const { return fStatus; }
virtual Int_t InitOutput( THaOutput * );
Bool_t IsOKOut() { return fOKOut; }
static FILE* OpenFile( const char* name, const TDatime& date,
const char* here = "OpenFile()",
const char* filemode = "r",
const int debug_flag = 1);
static Int_t LoadDBvalue( FILE* file, const TDatime& date,
const char* tag, Double_t& value );
static Int_t LoadDBvalue( FILE* file, const TDatime& date,
const char* tag, Int_t& value );
static Int_t LoadDBvalue( FILE* file, const TDatime& date,
const char* tag, std::string& text );
static Int_t LoadDBvalue( FILE* file, const TDatime& date,
const char* tag, TString& text );
template <class T>
static Int_t LoadDBarray( FILE* file, const TDatime& date,
const char* tag, std::vector<T>& values );
template <class T>
static Int_t LoadDBmatrix( FILE* file, const TDatime& date,
const char* tag,
std::vector<std::vector<T> >& values,
UInt_t ncols );
static Int_t LoadDB( FILE* file, const TDatime& date,
const DBRequest* request, const char* prefix="",
Int_t search = 0 );
static Int_t LoadDB( FILE* file, const TDatime& date,
const TagDef* tags, const char* prefix="",
Int_t search = 0 );
static Int_t SeekDBdate( FILE* file, const TDatime& date,
Bool_t end_on_tag = false );
static Int_t SeekDBconfig( FILE* file, const char* tag,
const char* label = "config",
Bool_t end_on_tag = false );
static std::vector<std::string> vsplit( const std::string& s );
static void GeoToSph( Double_t th_geo, Double_t ph_geo,
Double_t& th_sph, Double_t& ph_sph );
static void SphToGeo( Double_t th_sph, Double_t ph_sph,
Double_t& th_geo, Double_t& ph_geo );
static 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 );
static Int_t DefineVarsFromList( const void* list,
EType type, EMode mode,
const char* var_prefix,
const TObject* obj,
const char* prefix,
const char* here );
protected:
enum EProperties { kNeedsRunDB = BIT(0) };
char* fPrefix;
EStatus fStatus;
Int_t fDebug;
Bool_t fIsInit;
Bool_t fIsSetup;
TString fConfig;
UInt_t fProperties;
Bool_t fOKOut;
TDatime fInitDate;
virtual Int_t DefineVariables( EMode mode = kDefine );
Int_t DefineVarsFromList( const VarDef* list,
EMode mode = kDefine,
const char* var_prefix="" ) const;
Int_t DefineVarsFromList( const RVarDef* list,
EMode mode = kDefine,
const char* var_prefix="" ) const;
Int_t DefineVarsFromList( const void* list,
EType type, EMode mode,
const char* var_prefix="" ) const;
THaAnalysisObject* FindModule( const char* name, const char* classname,
bool do_error = true );
virtual const char* Here( const char* ) const;
void MakePrefix( const char* basename );
virtual void MakePrefix() = 0;
virtual FILE* OpenFile( const TDatime& date );
virtual FILE* OpenRunDBFile( const TDatime& date );
virtual Int_t ReadDatabase( const TDatime& date );
virtual Int_t ReadRunDatabase( const TDatime& date );
virtual Int_t RemoveVariables();
static std::vector<std::string>
GetDBFileList( const char* name, const TDatime& date,
const char* here = "GetDBFileList()" );
static char* ReadComment( FILE* fp, char* buf, const int len );
THaAnalysisObject( const char* name, const char* description );
private:
THaAnalysisObject( const THaAnalysisObject& );
THaAnalysisObject& operator=( const THaAnalysisObject& );
static TList* fgModules;
ClassDef(THaAnalysisObject,1)
};
#endif
Last change: Sat Nov 7 21:26:41 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.