Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members

lccd::DBInterface Class Reference

Provides a simple interface to the conditions data base for lccd. More...

#include <DBInterface.hh>

List of all members.

Public Member Functions

 DBInterface (const std::string &folder, bool update=false)
 Default c'tor, uses lccd::getDBInitString() to determine the db initialization, i.e.

 DBInterface (const std::string &dbInit, const std::string &folder, bool update=false)
 Open the database specified in dbInit.

virtual ~DBInterface ()
 D'tor.

ICondDBMgr * condDBMgr ()
 The db manager object - use for direct access to the conditions database.

ICondDBDataAccess * condDataAccess ()
 The db access object - use for direct access to the conditions database..

ICondDBFolderMgr * condFolderMgr ()
 The folder manager - use for direct access to the conditions database..

ICondDBTagMgr * condTagMgr ()
 The tag manager - use for direct access to the conditions database.

const std::string & folderName ()
 The folder used for this DB access.

void storeCollection (LCCDTimeStamp since, LCCDTimeStamp till, lcio::LCCollection *col, const std::string &description)
 Stores the given collection in the database.

lcio::LCCollection * findCollection (LCCDTimeStamp timeStamp, LCCDTimeStamp &since, LCCDTimeStamp &till, const std::string &tag="")
 Retrieves the collection for the given point in time - returns NULL if no data is found.
This expects the LCIO collection type to be decoded in the object description:
"LCIO_COL_TYPE: some description" - storeCollection() does this automatically.
Some parameters are added to the collection:
.

lcio::LCCollection * findCollection (LCCDTimeStamp timeStamp, const std::string &tag="")
 Retrieves the collection for the given point in time - returns NULL if it no data is found.
Same as above, except that no information on the validity interval is returned.

void findCollections (ColVec &colVec, const std::string &tag="")
 Creates collections for all conditions data for the given tag and adds them to the colvec.

void findCollections (ColVec &colVec, LCCDTimeStamp timeStamp)
 Creates collections for all conditions data for the given timestamp.

void tagFolder (const std::string &tagName, const std::string &description="", std::string usingTagName="")
 Tag the current HEAD of the database folder as tagName.

void createDBFile (const std::string &tag="")
 Creates an LCIO file with the all conditions data in the folder for the given tag.

void createSimpleFile (LCCDTimeStamp timeStamp, const std::string &tag, bool allLayers=false)
 Creates an LCIO file with one event that has a collection with the conditions data for the given time stamp and tag (use "" for the current HEAD).
If allLayers==true then in addition to the specified collection, all collections in the database for this timestamp are added to the event with name COLNAME_layer_LAYERNUM.


Protected Member Functions

void init ()
 Initializes the database access.

lcio::LCCollection * collectionFromCondDBObject (ICondDBObject *object, const std::string &tag)
 Creates an LCColleciton from the data in the ICondDBObject.


Protected Attributes

ICondDBMgr * _condDBmgr
ICondDBDataAccess * _condDataAccess
ICondDBFolderMgr * _condFolderMgr
ICondDBTagMgr * _condTagMgr


Detailed Description

Provides a simple interface to the conditions data base for lccd.

The functionality corresponds to a subset of the ConditionsDB API for user's ( and lccd developer's) convenience. Most of the usual tasks can be handled through this interface.
If needed access to the relevant manager objects of ConditionsDB is provided.
Every DBInterface object is attached to one particular folder in a particular database.
The methods createDBFile() and createSimpleFile() can be used to produce LCIO files with conditions data as input for the corresponding conditions handlers in a reconstrcution program.
They also provide an easy way to browse the database horizontally (by tag) or vertically (by time stamp).

Author:
F.Gaede, DESY
Version:
Id
DBInterface.hh,v 1.8 2005/02/18 16:51:55 gaede Exp


Constructor & Destructor Documentation

lccd::DBInterface::DBInterface const std::string &  folder,
bool  update = false
 

Default c'tor, uses lccd::getDBInitString() to determine the db initialization, i.e.

as defined by the environment variable $LCCD_DB_INIT. In update mode the folder is created if it doesn't exist - provided the database user has the proper privileges.

Parameters:
folder: the folder used for this db access
update: open db in update mode, default: false

lccd::DBInterface::DBInterface const std::string &  dbInit,
const std::string &  folder,
bool  update = false
 

Open the database specified in dbInit.

In update mode the folder is created if it doesn't exist - provided the database user has the proper privileges.

Parameters:
folder: the folder used for this db access
update: open db in update mode, default: false


Member Function Documentation

lcio::LCCollection* lccd::DBInterface::collectionFromCondDBObject ICondDBObject *  object,
const std::string &  tag
[protected]
 

Creates an LCColleciton from the data in the ICondDBObject.

Adds the db parameters as described in findCollection() to the collection.

void lccd::DBInterface::createDBFile const std::string &  tag = ""  ) 
 

Creates an LCIO file with the all conditions data in the folder for the given tag.

The collections are sorted w.r.t. their validity time intervall and attached to consecutive events. The run header holds a map of validity time intervalls to events. in the parameters DBSince and DBTill.
The name of the file will be of the form "conddb_COLNAME_TAG_YYYYMMDD_HHMMSS.slcio" where the specified time is the creation time. This file can be used by the DBFileHandler.

void lccd::DBInterface::createSimpleFile LCCDTimeStamp  timeStamp,
const std::string &  tag,
bool  allLayers = false
 

Creates an LCIO file with one event that has a collection with the conditions data for the given time stamp and tag (use "" for the current HEAD).
If allLayers==true then in addition to the specified collection, all collections in the database for this timestamp are added to the event with name COLNAME_layer_LAYERNUM.

The name of the file will be of the form "conddb_COLNAME_TAG_TIMESTAMP.slcio" This file can be used by the SimpleFileHandler.

lcio::LCCollection* lccd::DBInterface::findCollection LCCDTimeStamp  timeStamp,
LCCDTimeStamp since,
LCCDTimeStamp till,
const std::string &  tag = ""
 

Retrieves the collection for the given point in time - returns NULL if no data is found.
This expects the LCIO collection type to be decoded in the object description:
"LCIO_COL_TYPE: some description" - storeCollection() does this automatically.
Some parameters are added to the collection:
.

  • DBName: name of the (MySQL) database
  • DBFolder: data base folder
  • DBTag: the tag used for the query - possibly HEAD at that time.
  • DBQueryTime: the time the conditions data was extracted from the data base.
  • DBInsertionTime: the time the conditions data was inserted into the data base.
  • DBSince: the start of the vaidity intervall
  • DBTill: the end of the validity intervall
  • DBLayer: the layer number of this data set
DBQueryTime, DBInsertionTime, DBSince and DBTill are string vectors with two elements: the 64bit time stamp and the date in human readable format.

Parameters:
timeStamp: the point in time for which the conditions data is valid
since: return the begin of the validity interval
end: return the end of the validity interval
tag: the tag to be used for the query, if omitted HEAD is used

void lccd::DBInterface::findCollections ColVec colVec,
LCCDTimeStamp  timeStamp
 

Creates collections for all conditions data for the given timestamp.

The collections are ordered w.r.t. to the layer number in the database.
Description parameters are added to the collections as in findCollection() plus DBLayer.

void lccd::DBInterface::findCollections ColVec colVec,
const std::string &  tag = ""
 

Creates collections for all conditions data for the given tag and adds them to the colvec.

The collections are ordered w.r.t. to their validity time.
Description parameters are added to the collections as in findCollection().

void lccd::DBInterface::tagFolder const std::string &  tagName,
const std::string &  description = "",
std::string  usingTagName = ""
 

Tag the current HEAD of the database folder as tagName.

If the argument usingTagName is provided and refers to an existing tag this tag will be duplicated as tagName.
This can be used to provide a common tag with the same name for several folders of conditions data that have been tagged before with different names.


The documentation for this class was generated from the following file:
Generated on Fri Sep 9 12:30:32 2005 for LCCD by doxygen 1.3.5