#ifndef VEGA_VFrameMetaDB
#define VEGA_VFrameMetaDB
//*-- Author : Damir Buskulic 20/05/99
#include <math.h>
#include "TString.h"
#include "TTree.h"
#include "TFile.h"
#include "THashList.h"
#include "FrameL.h"
#include "VFrCondition.h"
#include "VMetaString.h"
#include "VConditionNames.h"
#include "VConditionFormula.h"
#include "VConditionSetFMDB.h"
#include "VGroupInfo.h"
#include "VVirtualMetaDBPlayer.h"
#include "VMetaData.h"
#include "VHashTable.h"
class VConditionFormula;
class TObject;
class VFrameMetaDB;
class VHashTable;
//////////////////////////////////////////////////////////////////////////// //// VFrFileIndex //// //// Frame file index used in the VHashTable //// ////////////////////////////////////////////////////////////////////////////
class VFrFileIndex : public TObject
{
private:
Double_t mStartTime; // Start time of the first frame of this file
Double_t mEndTime; // End time of the last frame of this file
Int_t mFirstMetaIndex; // index of the first frame of this file in the metadata tree
Int_t mLastMetaIndex; // index of the last frame of this file in the metadata tree
Int_t mConditionsIndex; // index of the conditions index tree
Int_t mFirstGroup; // first frames group number
Int_t mLastGroup; // last frames group number
public :
VFrFileIndex();
VFrFileIndex(Double_t start, Double_t end, Int_t firstindex, Int_t lastindex,
Int_t condindex, Int_t firstgroup, Int_t lastgroup)
{mStartTime = start; mEndTime = end; mFirstMetaIndex = firstindex;
mLastMetaIndex = lastindex; mConditionsIndex = condindex;
mFirstGroup = firstgroup; mLastGroup = lastgroup;}
Double_t GetStartTime() {return mStartTime;}
// TString GetStartTimeString();Double_t GetEndTime() {return mEndTime;}
Int_t GetFirstMetaIndex() {return mFirstMetaIndex;}
Int_t GetLastMetaIndex() {return mLastMetaIndex;}
Int_t GetConditionsIndex() {return mConditionsIndex;}
Int_t GetFirstGroup() {return mFirstGroup;}
Int_t GetLastGroup() {return mLastGroup;}
void SetStartTime(Double_t start) {mStartTime = start;}
void SetEndTime(Double_t end) {mEndTime = end;}
void SetFirstMetaIndex(Int_tfirst) {mFirstMetaIndex = first;}
void SetLastMetaIndex(Int_tlast) {mLastMetaIndex = last;}
void SetConditionsIndex(Int_t cond) {mConditionsIndex = cond;}
void SetFirstGroup(Int_t group) {mFirstGroup = group;}
void SetLastGroup(Int_t group) {mLastGroup = group;}
ClassDef(VFrFileIndex,2) // Frame file index
};
//////////////////////////////////////////////////////////////////////////// //// VMetaDataFMDB //// //// Meta data for one frame. The filename, detector and status are kept //// inside another object (VMetaString) to allow use of split mode //// for this one. This may change, this is an internal structure //// ////////////////////////////////////////////////////////////////////////////
class VMetaDataFMDB : public TObject
{
private :
UInt_t mRunNumber; // Run number containing this frame
UInt_t mFrameNumber; // Absolute frame number
VGPSTime mStartTime; // Start time of the frame
Double_t mLength; // Length of the frame
Int_t mQuality; // Quality of data flags
Int_t mTrigger; // Trigger bits
Int_t mGroup; // Group number for this frame
public :
VMetaDataFMDB();
VMetaDataFMDB(TString fileName, UInt_t runNumber, UInt_t frameNumber,
VGPSTime startTime, VGPSTime localStartTime, Double_t length,
TString detector="VIRGO", TString state="L", Int_t quality=1,
Int_t trigger=1);
~VMetaDataFMDB();
virtual UInt_t GetRunNumber() {return mRunNumber;}
virtual UInt_t GetFrameNumber() {return mFrameNumber;}
virtual VGPSTime GetStartTime() {return mStartTime;}
virtual Double_t GetLength() {return mLength;}
virtual Int_t GetQuality() {return mQuality;}
virtual Int_t GetTrigger() {return mTrigger;}
virtual Int_t GetGroup() {return mGroup;}
virtual void SetRunNumber(UInt_t run) {mRunNumber = run;}
virtual void SetFrameNumber(UInt_t frame) {mFrameNumber = frame;}
virtual void SetStartTime(VGPSTime start) {mStartTime = start;}
virtual void SetLength(Double_t length) {mLength = length;}
virtual void SetQuality(Int_t qual) {mQuality = qual;}
virtual void SetTrigger(Int_t trig) {mTrigger = trig;}
virtual void SetGroup(Int_t group) {mGroup = group;}
virtual void Print(Option_t * opt="") {}
ClassDef(VMetaDataFMDB,2) // Meta data for one frame
};
//////////////////////////////////////////////////////////////////////////// //// VFrameMetaDB //// //// Local frame data base //// Uses the standard Framelib //// ////////////////////////////////////////////////////////////////////////////
struct CondIndex_t {Int_tfirst, last;}; // helper struct for conditions indices
class VFrameMetaDB : public VVirtualFrameInfoDB
{
private :
TFile* mDBFile; // the database file
TString mPathToDB; // path to db file
TString mOption; // DB opened option "read" or "update"
Bool_t mIsOpened; // DB opened flag
TTree* mMetaTree; // Meta data tree associated to this database
THashList* mConditionTree; // The conditions trees (triggers, sms, user conditions...) in a list
TTree* mConditionsIndex; // The conditions trees index
VMetaDataFMDB* mTmpMeta; // Address of the frame metadata
VMetaString* mTmpMetaString; // Strings of the meta data : filename, detector, state
VFrCondition** mTmpConditions; // Condition objects used for I/O
CondIndex_t* mTmpCondIndex; // Indices (first and last) of a set of conditions in it's condition tree
Int_t mNConditions; // Number of conditions
VHashTable* mHashTable; // Hash table associated to this database
Int_t mCurMetaIndex; // Last accessed meta data index
Int_t* mCurCondTreeIndex; // indices of current conditions in respective condition trees
Double_t mCurFrameStart; // current frame start time;
Double_t mCurFrameEnd; // current frame end time;
TString mCurVectName; // current vector name;
Int_t mCurCondGroup; // current condition group;
UInt_t mLastRunNumber; // Run number of the last frame opened
UInt_t mLastFrNumber; // Frame number of the last frame opened
VConditionNames* mConditionNames; // Names of conditions present in the database
TTree* mGroupList; // Group : group contents tree
VGroupInfo* mTmpGroupInfo; // Group : one group information
VGroupInfo* mLastGroupInfo; // Group : group info for the last group
VVirtualMetaDBPlayer* mPlayer; // Pointer to current metadb player
public :
Int_t FindIndex(Double_t gpstime, Double_t& frbegin, Double_t& frend);
Int_t FindIndex(Int_t approxindex, Double_t gpstime);
Int_t AddFiles(const char* filenames, const char* extrapath, Option_t* option);
TArrayF AnalyzeTriggerString(char* string, TString& outputnames);
Int_t AddCondition(char* name, VGPSTime time, Float_t timebefore, Float_t timeafter,
Bool_t triggerStatus, Float_t amplitude,
Float_t prob, TString varNames, TArrayF tvars, Int_t group);
Bool_t BuildNewCondition(char* name, const char* varnames);
Int_t FindNearestGEIndex(Double_t gpstime, VConditionFormula* condf,
Double_t& frbegin, Double_t& frend, Double_t& cobegin, Double_t& coend, Int_t& cogroup);
Int_t FindNearestGEIndex(Double_t gpstime, Double_t& frbegin, Double_t& frend);
Int_t FindNearestLEIndex(Double_t gpstime, Double_t& frbegin, Double_t& frend);
Int_t FindNearestGECondIndex(const char* condname, Double_t gpstime, Double_t& frbegin, Double_t& frend);
Int_t FindNearestGECondIndex(Int_t conditionnumber, Double_t gpstime, Double_t& frbegin, Double_t& frend);
public :
VFrameMetaDB();
VFrameMetaDB(char* filename, Option_t* mode="READ",char* frfilenames="", Option_t* option="R");
virtual ~VFrameMetaDB();
FrameH* FrameReadHeader(FrFile* iFile, int frnum);
// Opening and building the database
virtual void Build(char* pathtofiles, char* filename, Option_t* option="R");
virtual Bool_t Open(char* pathtoDB, Option_t* openopt = "READ");
virtual Int_t AddFiles(const char* filenames, Option_t* option="R");
virtual void Close();
// Factory part. Creating objects exchanged by the database
virtual VConditionSet* CreateConditionSet(const char* condfs, const char* selfs=0);
// Drawing and getting information about the databaseVVirtualMetaDBPlayer* GetPlayer();
virtual void Draw(const char* selexp, const char* selection="", Option_t* option = "", Double_t start = 0, Double_t length = 0);
virtual TFile* GetDBFile() const {return mDBFile;}
virtual const char* GetOption() {return mOption.Data();}
virtual const char* GetPathToDB() {return mPathToDB.Data();}
virtual Bool_t IsOpened() {return mIsOpened;}
virtual TTree* GetMetaTree() const {return mMetaTree;}
virtual THashList* GetConditionTree() const {return mConditionTree;}
virtual VConditionNames* GetConditionNames() const {return mConditionNames;}
virtual Int_t GetNConditions() {return mNConditions;}
virtual VHashTable* GetDBHash() const {return mHashTable;}
virtual Double_t GetDBStart() {if (mHashTable) return mHashTable->GetGlobalStartTime(); else return 0;}
virtual Double_t GetDBEnd() {if (mHashTable) return mHashTable->GetGlobalEndTime(); else return 0;}
virtual Double_t GetStart();
virtual Double_t GetEnd();
virtual void Print(Option_t* opt="");
// Getting the metadata information
virtual void GetMetaData(VMetaData* meta, Double_t time);
virtual void NextMetaData(VMetaData* meta);
virtual void PreviousMetaData(VMetaData* meta);
virtual void NextMetaData(VMetaData* meta, VConditionSet* condset);
virtual void NextMetaData(VMetaData* meta, Double_t time, VConditionFormula* condf=0);
virtual void NextMetaData(VMetaData* meta, Double_t time, VConditionSet* condset);
virtual void NextMetaData(VMetaData* meta, Double_t time, const char* selection);
// Gets standard conditions for last read entry in the conditions tree
virtual VFrCondition** GetConditionsArray() const {return mTmpConditions;}
// Dealing with conditionsInt_t LoadNearestGECondition(Double_t gpstime, Int_t conditionnumber=-2);
Int_t LoadNearestGECondition(Double_t gpstime, const char* name);
Int_t LoadNextCondition(Int_t conditionnumber);
Int_t LoadNextCondition(char* name);
VFrCondition* GetLoadedCondition(const char* name);
VFrCondition* GetLoadedCondition(Int_t conditionnumber) {return mTmpConditions[conditionnumber];}
ClassDef(VFrameMetaDB,0) // Local frame database
};
#endif
- ROOT page - VEGA page - Class index - Top of the page This page has been automatically generated. If you have any comments or suggestions
about the page layout send a mail to
, or
contact
with any questions or problems regarding ROOT or VEGA.