//*-- Author : Damir Buskulic 30/04/02//////////////////////////////////////////////////////////////////////////// //// Frame file direct info data base //// //// File Info database for simple files //// Uses the standard Framelib //// the TOC of a set of frame files is considered as an info database //// This allows to treat the same way a small set of frame files //// and a set of frame files managed by a metadb or a BKDB //// ////////////////////////////////////////////////////////////////////////////
#include <iostream.h>
#include "VFileDirectDB.h"
ClassImp(VFileDirectDB)
//______________________________________________________________________________VFileDirectDB::VFileDirectDB() : VVirtualFrameInfoDB()
{
//// direct frame file info data base constructor//mFrameFileName = "";
mFrameFile = 0;
mIsOpened = kFALSE;
mPathToDB = "";
}
//______________________________________________________________________________VFileDirectDB::VFileDirectDB(char* filenames, Option_t* mode,char* frfilenames, Option_t* option)
: VVirtualFrameInfoDB()
{
// Local frame data base constructor// filenames are the names of frame files separated by blanks.// The mode is irrelevant for this type of frame info db//mFrameFileName = "";
mFrameFile = 0;
mIsOpened = kFALSE;
mPathToDB = "";
Open(filenames, mode);
}
//______________________________________________________________________________VFileDirectDB::~VFileDirectDB()
{
//// Local frame data base destructor//Close();
}
//______________________________________________________________________________Bool_tVFileDirectDB::Open(char* filenames, Option_t* openopt)
{
// Open the frame files "filenames" considered as an info databasemFrameFile = FrFileINew(filenames);
if (!mFrameFile) return 0;
mIsOpened = kTRUE;
mFrameFileName = filenames;
mPathToDB = "";
return 1;
}
//______________________________________________________________________________voidVFileDirectDB::Close()
{
// Closes this metadb
FrFileIEnd(mFrameFile);
mIsOpened = kFALSE;
}
//______________________________________________________________________________Double_tVFileDirectDB::GetStart()
{
// Returns the start time of the first frame in the files
return FrFileITStart(mFrameFile);
}
//______________________________________________________________________________Double_tVFileDirectDB::GetEnd()
{
// Returns the end time of the last frame in the metadatabase
return FrFileITEnd(mFrameFile);
}
//______________________________________________________________________________voidVFileDirectDB::Print(Option_t* opt)
{
// Prints information about the files
FrFileIDump(mFrameFile,stdout,3,"");
}
//______________________________________________________________________________voidVFileDirectDB::GetMetaData(VMetaData* meta, Double_t gpstime)
{
// Retrieve the meta data corresponding to timeint index;
if (!mIsOpened) {
Warning("GetMetaData","Data base not opened");
meta->Clear();
return;
}
if (gpstime<GetStart()) gpstime = GetStart();
index = FrTOCFrameFindT(mFrameFile, gpstime);
if (index<0) {
meta->Clear();
return;
}
FrTOC* filetoc = mFrameFile->toc;
// ---- Get the metadata and transfer it to VMetaData object ----
meta->SetRun(filetoc->runs[index]);
meta->SetFrame(filetoc->frame[index]);
VGPSTime gpsti(filetoc->GTimeS[index],filetoc->GTimeN[index]);
meta->SetStartTime(gpsti);
meta->SetLocalStartTime(0);
meta->SetLength(filetoc->dt[index]);
meta->SetQuality(1);
meta->SetTrigger(1);
meta->SetFileName(mFrameFile->current->fileName);
meta->SetDetector("");
meta->SetState("L");
return;
}
//______________________________________________________________________________voidVFileDirectDB::NextMetaData(VMetaData* meta)
{
// Retrieve the next meta data
if (!mIsOpened) {
Warning("NextMetaData","Data base not opened");
meta->Clear();
return;
}
NextMetaData(meta,meta->GetEndTime()+1e-4);
return;
}
//______________________________________________________________________________voidVFileDirectDB::PreviousMetaData(VMetaData* meta)
{
// Retrieve the previous meta data
if (!mIsOpened) {
Warning("PreviousMetaData","Data base not opened");
meta->Clear();
return;
}
// A CORRIGER !NextMetaData(meta,meta->GetStartTime().GetTimeD()-1e-4);
return;
}
//______________________________________________________________________________voidVFileDirectDB::NextMetaData(VMetaData* meta, VConditionSet* condset0)
{
// Retrieve the next meta data with condition setNextMetaData(meta);
return;
}
//______________________________________________________________________________voidVFileDirectDB::NextMetaData(VMetaData* meta, Double_t time, VConditionSet* condset0)
{
// Retrieve the next meta data after time "time" with condition set condsetNextMetaData(meta,time);
return;
}
//______________________________________________________________________________voidVFileDirectDB::NextMetaData(VMetaData* meta, Double_t gpstime, VConditionFormula* condf)
{
// Retrieve the next meta data with time greater or equal to "time"// selection condition is not taken into account in direct frame accessint index;
if (!mIsOpened) {
Warning("GetNextMetaData","Data base not opened");
meta->Clear();
return;
}
if (gpstime<GetStart()) gpstime = GetStart();
index = FrTOCFrameFindT(mFrameFile, gpstime);
if (index<0) {
meta->Clear();
return;
}
FrTOC* filetoc = mFrameFile->toc;
// ---- Get the metadata and transfer it to VMetaData object ----
meta->SetRun(filetoc->runs[index]);
meta->SetFrame(filetoc->frame[index]);
VGPSTime gpsti(filetoc->GTimeS[index],filetoc->GTimeN[index]);
meta->SetStartTime(gpsti);
meta->SetLocalStartTime(0);
meta->SetLength(filetoc->dt[index]);
meta->SetQuality(1);
meta->SetTrigger(1);
meta->SetFileName(mFrameFile->current->fileName);
meta->SetDetector("");
meta->SetState("L");
return;
}
//______________________________________________________________________________voidVFileDirectDB::NextMetaData(VMetaData* meta, Double_t gpstime, const char* selection)
{
// Retrieve the next meta data with time greater or equal to "time"// and selection conditionVConditionFormula* condf;
if (!selection) {
NextMetaData(meta, gpstime, (VConditionFormula*)0);
return;
}
condf = new VConditionFormula("condf",selection,this);
NextMetaData(meta,gpstime,condf);
delete condf;
return;
}
- 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.