Last Updated: May 14th, 2014 (R.Grosso)
- Important links
- CDB access framework
- AliCDBEntry, AliCDBId, AliCDBMetaData
- Access to the OCDB. AliCDBStorage's Put(), Get() and GetAll() functions
- Storage and retrieval with AliCDBManager
- NEW! - Local caching of remote OCDB files
- OCDB access in Simulation and Reconstruction
- Creating and using OCDB snapshots
- CDB tags - Access to the file catalog with tags
- General guidelines for OCDB objects
- Backward compatibility - Policy for CDB objects
ALICE Detector Calibration Requirement Tables and related documentation
ALICE Calibration and Alignment status table (MS PowerPoint slide)
ALICE Calibration and Alignment status Reports (MS Word document)
The Offline Conditions Database (OCDB) is the place where the calibration and alignment data is stored. It is not a "database" in the literal sense of the word (like Oracle, MySQL, etc): it is a set of entries in the AliEn file catalog that point to the physical entities (ROOT files stored in the various storage elements of the grid) containing the calibration and alignement data.
The organization of the database is handled by the CDB access framework, an AliRoot-based package.The OCDB was designed under the following principles:
- The calibration and alignment database contains ROOT TObjects stored into ROOT files;
- Calibration and alignment objects are RUN DEPENDENT objects;
- The database is READ-ONLY (automatic versioning of the stored objects);
- The objects in the OCDB are univocally identified by:
- a ( logical ) path name (path of the file in the AliEn file catalog);
- a validity expressed as a run range ;
- a main (grid) version number;
- a local subversion number, only for locally stored objects.
The local subversion was introduced to avoid version clashing during tranferral of OCDB object from Grid to local storages and vice versa. In local storage only the local version is increased, while in Grid storage only the Grid version is increased. When the object is transferred from local to Grid the Grid version is increased by one; when the object is transferred from Grid to Local the Grid version is kept fixed and the subVersion is reset to zero. The adopted versioning schema is shown in the following picture.
CDB access framework
The schema of the AliROOT-based CDB access framework is shown in the next picture.
a GRID folder in the file catalog containing logical file names, each one pointing to a Root file. Each calibration or alignment object is contained in a single ROOT file;
a LOCAL folder containing Root files, each one containing one single Root object, with a structure similar to the Grid one;
a local Root file ( DUMP ) containing one or more objects. The objects are stored into Root TDirectories defined by the object's name and run range.
Storage activation: AliCDBManager
grid (the grid host)
user (the user name)
folder (the path of the base folder)
se (the storage element to be used for data storage)
cacheFolder (the local folder used to cache the remote files: for the description of this functionality and of its further parameters see later)
AliCDBStorage *gridStorage = AliCDBManager::Instance()->GetStorage("alien://folder=/alice/data/CDB?user=aliprod");
AliCDBStorage* localStorage = AliCDBManager::Instance()->GetStorage("local://$ALICE_ROOT"); AliCDBStorage* localStorage = AliCDBManager::Instance()->GetStorage("local:///home/colla/CDB");
AliCDBStorage* dumpStorage = AliCDBManager::Instance()->GetStorage("dump://CDBfile.root"); AliCDBStorage* dumpStorage = AliCDBManager::Instance()->GetStorage("dump:///home/colla/CDBfile.root;ReadOnly");
Activation of Default, Specific, Drain storages
AliCDBManager's method SetDefaultStorage("const char* uri") is used to activate the particular storage used by the manager's Get and Put functions (see later). Example:
A pointer to the default storage is returned by the function GetDefaultStorage() , and the default storage is unset by the function UnsetDefaultStorage() . To check activation of the default storage use Bool_t IsDefaultStorageSet() .
AliCDBManager::SetSpecificStorage(const char* calibPath, const char* uri) allows to activate one or more "calibration-specific" storages. Specific storages are useful in case a detector expert wants to test a particular set of conditions data, stored (say) on a local disk, while leaving the reconstruction algorithms use the main OCDB locations for all the other objects.
The implementation of SetSpecificStorage goes through the mapping of the detector name (or calibration type) string with the parameters ( AliCDBParam object) describing the storage. When a conditions object is stored/retrieved using AliCDBManager 's Put/Get functions, the object path name is parsed and if a match in the list of the specific storages is found, then the corresponding storage is returned and used. If not, then the default storage (which should be activated first) is used. For more details, see later.
Examples of specific storage activation:
AliCDBManager::Instance()->SetSpecificStorage("TPC/*","alien://folder="); AliCDBManager::Instance()->SetSpecificStorage("ITS/Calib/DeadPixelMaps","alien://folder="); AliCDBManager::Instance()->SetSpecificStorage("*/Align/*","alien://folder=");
AliCDBManager's SetDrain(const char* uri) activates the drain storage. When activated, the drain storage stores every object retrieved from the OCDB. The drain storage is unset by UnsetDrain() ; to check activation of the default storage use Bool_t IsDrainSet() .
AliCDBEntry, AliCDBId, AliCDBMetaData
The calibration/alignment object container class (anything inheriting from ROOT's TObject class);
The parameters that univoquely identify the conditions data, described by the class AliCDBId ;
The object's metadata , described by the class AliCDBMetaData .
SetObject(TObject*) , TObject* GetObject() ;
SetId(const AliCDBId&) , AliCDBId& GetId( ) ;
SetMetaData(AliCDBMetaData*) , AliCDBMetaData* GetMetaData() ;
PrintId() , PrintMetaData() ;
SetOwner(Bool_t) , Bool_t IsOwner();
during storage it is used to specify the path and run range of the object;
during retrieval it is used as a "query": it contains the path of the object, the required run and (if needed) the version and subversion to be retrieved (if version and/or subversion are not specified the highest ones are looked for).
an object describing the name (path) of the object (AliCDBPath ). The path name must have a fixed, three-level directory structure: " level1/level2/level3" ;
an object describing the run validity range of the object (AliCDBRunRange );
the version and subversion numbers (automatically set during storage).
TString& GetPath(), SetPath(const char* path), Tstring& GetLevel(int lev): return the full object's path or one of its levels;
AliCDBRunRange& GetAliCDBRunRange() + run number setters/getters;
Note: "Infinity" in the OCDB is 999999999 and is returned by static function: AliCDBRunRange::Infinity() ;
version/subVersion getters/setters ( GetVersion( ) , etc.);
The object class name (automatically set during storage);
The name of the person who created the object (related methods: SetResponsible(const char*) , GetResponsible() );
The LHC beam period (related methods: SetBeamPeriod(Int_t*) , GetBeamPeriod() );
The AliROOT version used to create the object (related methods: SetAliRootVersion(const char*) , GetAliRootVersion() );
Any comment (related methods: SetComment(const char*) , GetComment() );