Difference: CondDBHowToForCOOL (1 vs. 69)

Revision 682017-06-12 - JoelClosier

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 63 to 63
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# SetupProject LHCb
>
>
# lb-run LHCb bash --norc
 # CondDBBrowser LHCBCOND &
  • Select from the menu DataBase the action Create slice.
  • Chose a name for the SQLite file you want to create and write it in the filed SQLite file name: (you can also use the ... button that will open a file selection dialog). I will chose the file myLHCBCOND.db in my home directory.
Line: 75 to 75
 
Using the Python commands
  • Open a python shell in the correct environment (LHCb >= v24r1):

Changed:
<
<
# SetupProject LHCb
>
>
# lb-run LHCb bash --norc
 # CondDBAdmin_MakeSnapshot.py -T DC06 LHCBCOND sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND The database is ready.
Line: 132 to 132
 Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
Changed:
<
<
# SetupProject LHCb
>
>
# lb-run LHCb bash --norc
 # dump_db_to_files.py -c -T -t
Changed:
<
<
# SetupProject LHCb
>
>
# lb-run LHCb bash --norc
 # set tag = "DC06-20080407" # dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB
Line: 247 to 247
 On lxplus, you have to call lhcb-proxy-init end enter your certificate password when prompted. Then
Changed:
<
<
# SetupProject LHCb --use-grid
>
>
# lb-run LHCb bash --norc --use-grid
 # CondDBBrowser.py CondDB/LHCBCOND

where CondDB/LHCBCOND is an example of connection string. All the valid connection strings for Oracle are:

Line: 261 to 261
 
/group/online/condb_viewer/CondDBBrowser.sh CondDBOnline/ONLINE
Changed:
<
<
which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
>
>
which embeds a call to lb-run. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
 

Override the heartbeat and the run-stamp conditions (e.g. when using Oracle in the online farm)

Line: 305 to 305
 
  • Copy the modified files in dedicated directories, for example ~/tmp/DDDB-new and ~/tmp/LHCBCOND-new
  • Create COOL databases to be used as layers

Changed:
<
<
# SetupProject LHCb
>
>
# lb-run LHCb bash --norc
 # copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new # copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
Line: 351 to 351
 From lxplus5, prepare the environment with %CODE{ "sh" }% lhcb-proxy-init -g lhcb_conddb
Changed:
<
<
SetupProject LHCb --use-grid
>
>
lb-run LHCb bash --norc --use-grid
 setenv PATH `echo $LD_LIBRARY_PATH | tr ':' '\n' | grep "CORAL.*lib"`/../bin:$PATH %ENDCODE%
Line: 403 to 403
 From lxplus5 (has not been validated on lxplus6), prepare the environment with %CODE{ "sh" }% lhcb-proxy-init -g lhcb_conddb
Changed:
<
<
SetupProject LHCb --use-grid
>
>
lb-run LHCb bash --norc --use-grid
 %ENDCODE% then call the coolReplicateDB tool on the three partitions DDDB, LHCBCOND and SIMCOND %CODE{ "sh" }%
Line: 428 to 428
  From lxplus5, setup the environment with enabling auto selection of LHCbGrid project:
Changed:
<
<
SetupProject LHCb --dev --use-grid
>
>
lb-run LHCb bash --norc --dev --use-grid
  Next, initialize the proxy:

Revision 672015-11-05 - GiulioDujany

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 263 to 263
  which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
Added:
>
>
 

Override the heartbeat and the run-stamp conditions (e.g. when using Oracle in the online farm)

In order to ensure that replicas of the ONLINE partition of the database are sufficiently up to date two special conditions are inserted in the database at specific times:

Revision 662015-06-19 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 263 to 263
  which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
Changed:
<
<

Override the heartbeat condition when using Oracle in the online farm

>
>

Override the heartbeat and the run-stamp conditions (e.g. when using Oracle in the online farm)

 
Changed:
<
<
In order to ensure that replicas of the ONLINE partition of the database are sufficiently up to date, a "heartbeat condition" is periodically inserted in the database. The framework blocks access to online conditions if the last update is older than the current event time, giving a message like:
>
>
In order to ensure that replicas of the ONLINE partition of the database are sufficiently up to date two special conditions are inserted in the database at specific times:
  • the "heartbeat" condition is inserted periodically during the physics runs and at their end
  • the "run stamp" condition is added for the IOVs of the runs for which alignment/calibration have been produced (before HLT2 processing)
 
Added:
>
>
The framework blocks access to the CondDB if one of the two special conditions is not valid for the current event time with a message like
 
ONLINE              ERROR Database not up-to-date. Latest known update is at 1269840266.0, event time is 1269843690.708544
Added:
>
>
or
RunStampCheck       ERROR Database not up-to-date. No valid data for run at 2015-06-10 12:00:00.0 UTC
 
Changed:
<
<
Obvioulsly this check does not make sense when running in the online farm, where the ONLINE partition is by definition up to date and the event time is, by construction, more recent than the last heartbeat. In th online environment, the above check should be over-ridded by adding the following option:
>
>
Obvioulsly this check does not make sense in some special cases (e.g. when preparing alignments, or when using the Oracle DB in the online farm). In these cases the above checks can be disabled adding the following option:
 
Changed:
<
<
CondDB().IgnoreHeartBeat = True
>
>
CondDB().IgnoreHeartBeat = True CondDB().EnableRunStampCheck = False
 
Changed:
<
<
This implementation of this feature is discussed in Savannah task 13270
>
>
This implementation of this feature is discussed in Savannah task 13270 and in LHCBPS-1421.
 

Production Tasks

Request changes to the content of the official CondDB

Revision 652015-04-01 - LiangSun

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 39 to 45
 The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.

To define a condition in the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space-separated list in case of vectors).

Changed:
<
<
Note: For LHCb < v22r8, if the condition contains more than on parameter, you also have to copy all the values you do not want to override.
>
>
Note: For LHCb < v22r8, if the condition contains more than on parameter, you also have to copy all the values you do not want to override.
 

Create and Use a Local Copy of the CondDB

Problem

Line: 64 to 73
 
  • Now you can click on OK to create the new database. You can also add the selected data to an already existing database using the button Append.
The database is ready.
Using the Python commands
Changed:
<
<
  • Open a python shell in the correct environment (LHCb >= v24r1):
>
>
  • Open a python shell in the correct environment (LHCb >= v24r1):
 
# SetupProject LHCb
# CondDBAdmin_MakeSnapshot.py -T DC06 LHCBCOND sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND
Line: 71 to 80
  The database is ready.
Use the Copy in Your Application
Added:
>
>
 There are two possibilities:
Changed:
<
<
  1. you created a local copy of the whole LHCBCOND database
  2. you only copied a few nodes
>
>
  1. you created a local copy of the whole LHCBCOND database
  2. you only copied a few nodes
 
Complete Copy
Added:
>
>
 To use the local full copy of the database in your application, you have to override the default job options. Add to your options a file like: %CODE{ "python" }%
Line: 105 to 117
 %ENDCODE%

Explanation

Changed:
<
<
TODO
>
>
TODO
 

Generate XML Files from the Content of the CondDB

Problem

Line: 114 to 128
 

Example

-->

Solution

Added:
>
>
 Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
Added:
>
>
 
# SetupProject LHCb
Changed:
<
<
# dump_db_to_files.py -c -T -t
>
>
# dump_db_to_files.py -c -T -t
  A practical example to extract the current version of the detector description is:
Added:
>
>
 
# SetupProject LHCb
# set tag = "DC06-20080407"
Line: 125 to 141
 # SetupProject LHCb # set tag = "DC06-20080407" # dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB
Changed:
<
<
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB
>
>
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB
 (Note: you need to use a tag compatible with the version of the software you are using).
To use these XML files, you need to add to the default options (in Python): %CODE{ "python" }%
Line: 136 to 152
 %ENDCODE%

Because of some implementation details, the ONLINE partition cannot be used outside a database, so you need to use an hybrid configuration where some data is taken from files and others are taken from the DB. To achieve that, you have to modify the file /tmp/myDDDB/Conditions/MainCatalog.xml replacing the line

Added:
>
>
 
Changed:
<
<
>
>
 with
Added:
>
>
 
Changed:
<
<
>
>
  Another practical example, to extract the current version of the particle properties table:
Added:
>
>
 
Changed:
<
<
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -s /param/ParticleTable.txt
>
>
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -s /param/ParticleTable.txt
 

Use a Local Tag of the database

Added:
>
>
 When changes in the XML need to be paired with changes in the C++ code, it is important to be able to get part of the content of the DB from one tag and part from another.

Let's assume we want to use the global tag "head-20080225" as a base and the tag "muon-20080407" (only in DDDB) to test some new Muon code.

Line: 223 to 245
 To use the Oracle database you need some form of authentication. Currently, we use grid proxy certificates.

On lxplus, you have to call lhcb-proxy-init end enter your certificate password when prompted. Then

Added:
>
>
 
# SetupProject LHCb --use-grid
Changed:
<
<
# CondDBBrowser.py CondDB/LHCBCOND
>
>
# CondDBBrowser.py CondDB/LHCBCOND
 where CondDB/LHCBCOND is an example of connection string. All the valid connection strings for Oracle are:
  • CondDB/DDDB
  • CondDB/LHCBCOND
Line: 234 to 257
 
  • CondDBOnline/ONLINE

On plus (PIT), you do not need authentication because it is a trusted environment, so just call the wrapper script:

Added:
>
>
 
Changed:
<
<
/group/online/condb_viewer/CondDBBrowser.sh CondDBOnline/ONLINE
>
>
/group/online/condb_viewer/CondDBBrowser.sh CondDBOnline/ONLINE
 which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.

Override the heartbeat condition when using Oracle in the online farm

Line: 240 to 264
 which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.

Override the heartbeat condition when using Oracle in the online farm

Added:
>
>
 In order to ensure that replicas of the ONLINE partition of the database are sufficiently up to date, a "heartbeat condition" is periodically inserted in the database. The framework blocks access to online conditions if the last update is older than the current event time, giving a message like:
Added:
>
>
 
Changed:
<
<
ONLINE ERROR Database not up-to-date. Latest known update is at 1269840266.0, event time is 1269843690.708544
>
>
ONLINE ERROR Database not up-to-date. Latest known update is at 1269840266.0, event time is 1269843690.708544
  Obvioulsly this check does not make sense when running in the online farm, where the ONLINE partition is by definition up to date and the event time is, by construction, more recent than the last heartbeat. In th online environment, the above check should be over-ridded by adding the following option:
Added:
>
>
 
Changed:
<
<
CondDB().IgnoreHeartBeat = True
>
>
CondDB().IgnoreHeartBeat = True
  This implementation of this feature is discussed in Savannah task 13270

Production Tasks

Request changes to the content of the official CondDB

Changed:
<
<
To request changes to the content of the official CondDB, use the CondDB Savannah tracker. Before submitting new changes please read the following:
  • If you are requesting changes for LHCBCOND partition please check that the IOV(s) for your files are not covering the current closed IOVs (the latter can be checked using CondDB Browser). If you are confident that the current closed IOV scheme should be modified please inform the CondDB manager about that explicitly in the Savannah task.
>
>
To request changes to the content of the official CondDB, use the CondDB JIRA tracker. Before submitting new changes please read the following:
  • If you are requesting changes for LHCBCOND partition please check that the IOV(s) for your files are not covering the current closed IOVs (the latter can be checked using CondDB Browser). If you are confident that the current closed IOV scheme should be modified please inform the CondDB manager about that explicitly in the JIRA task.
 
  • Please check the actual encoding of your xml files matches the one declared in the xml header in the 'encoding' attribute.
  • Please be sure that your changes to the db intended for particular global tag branch are made on the base of the same branch of your interest.
The format in which changes should be provided is described below.
Line: 308 to 334
 >>> MasterLHCBCOND.recursiveTag("/", NewTag)

From SQLite files

Changed:
<
<
TODO
>
>
TODO
 

Update the Oracle Connections string on LFC

Added:
>
>
 From lxplus5, prepare the environment with %CODE{ "sh" }% lhcb-proxy-init -g lhcb_conddb

Revision 642014-06-10 - IllyaShapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 167 to 167
 LHCbApp(DDDBtag = base_tag, CondDBtag = base_tag)

# Get the instance of the CondDB configurable

Changed:
<
<
CondDB(LocalTags["DDDB"] = [ muon_tag ])
>
>
CondDB().LocalTags["DDDB"] = [ muon_tag ]
 %ENDCODE%

Override part of a global tag using another global tag

Line: 190 to 190
 LHCbApp(CondDBtag = base_tag)

# Get the instance of the CondDB configurable

Changed:
<
<
CondDB(LocalTags["LHCBCOND"] = local_tags)
>
>
CondDB().LocalTags["LHCBCOND"] = local_tags
 %ENDCODE%

Use a sub-tree from the old tag

Revision 632012-09-07 - IllyaShapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 361 to 361
  The last thing is to use "export" the new values to validate the content of LFC. Also, don't forget to make the corresponding changes to all the files in the SVN directory DBASE/AppConfig/conddb, and to ask for a new release of AppConfig with these changes.
Changed:
<
<

Synchronize Oracle Databases from SQLITE versions

From lxplus4 (still to be validated on lxplus5), prepare the environment with
>
>

Synchronize Oracle Databases from SQLITE versions (OBSOLETE, see new procedure)

From lxplus5 (has not been validated on lxplus6), prepare the environment with
 %CODE{ "sh" }% lhcb-proxy-init -g lhcb_conddb SetupProject LHCb --use-grid

Revision 622012-08-01 - LucioAnderlini

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 55 to 55
 
  • First you have to start the CondDB Browser:
    # SetupProject LHCb
Changed:
<
<
# CondDBBrowser.py LHCBCOND &
>
>
# CondDBBrowser LHCBCOND &
 
  • Select from the menu DataBase the action Create slice.
  • Chose a name for the SQLite file you want to create and write it in the filed SQLite file name: (you can also use the ... button that will open a file selection dialog). I will chose the file myLHCBCOND.db in my home directory.
  • Chose a string to use as Database name: (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: LHCBCOND.

Revision 612011-04-01 - RoelAaij

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 56 to 56
 
# SetupProject LHCb
# CondDBBrowser.py LHCBCOND &
Changed:
<
<
  • Select from the menu DataBase the action Slice (there is no Slice action anymore.... There is create slice... -- kazu.).
>
>
  • Select from the menu DataBase the action Create slice.
 
  • Chose a name for the SQLite file you want to create and write it in the filed SQLite file name: (you can also use the ... button that will open a file selection dialog). I will chose the file myLHCBCOND.db in my home directory.
  • Chose a string to use as Database name: (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: LHCBCOND.
  • In the group Selection Object Creation, you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely DC06) of the database is achieved by using Node: /, Since: 1970-01-01 01:00:00, Until: +inf and selecting the tag in the Tag Name: list (DC06). If you want, you can select multiple tags.
  • In the group Selection Objects List, click on Add to schedule the selection we prepared for the copy. You can add many selections to the list.
Changed:
<
<
  • Now you can click on Copy (There is no Copy button. there is OK -- kazu) to create the new database. You can also add the selected data to an already existing database using the button Append.
>
>
  • Now you can click on OK to create the new database. You can also add the selected data to an already existing database using the button Append.
 The database is ready.
Using the Python commands
  • Open a python shell in the correct environment (LHCb >= v24r1):

Revision 602011-03-23 - MarcoCattaneo

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 239 to 239
  which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
Changed:
<
<

Override the heartbeat condition

>
>

Override the heartbeat condition when using Oracle in the online farm

 In order to ensure that replicas of the ONLINE partition of the database are sufficiently up to date, a "heartbeat condition" is periodically inserted in the database. The framework blocks access to online conditions if the last update is older than the current event time, giving a message like:
ONLINE              ERROR Database not up-to-date. Latest known update is at 1269840266.0, event time is 1269843690.708544
Line: 387 to 387
 First, decide for what time interval You want to make the snapshot of the ONLINE partition. For this exercise we will create the snapshot for the time interval from 2009-10-01 to 2009-11-01 to renew the ONLINE partition for the Det/SQLDDDB package (located in DEV area) with the last missing snapshot for October of 2009 (For the note: The ONLINE partition in SQLDDDB package consists of monthly snapshots of the Oracle online database).
Changed:
<
<
From lxplus4, or lxplus5, setup the environment with enabling auto selection of LHCbGrid project:
>
>
From lxplus5, setup the environment with enabling auto selection of LHCbGrid project:
  SetupProject LHCb --dev --use-grid

Revision 592011-01-18 - KazuyoshiAkiba

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 56 to 56
 
# SetupProject LHCb
# CondDBBrowser.py LHCBCOND &
Changed:
<
<
  • Select from the menu DataBase the action Slice.
>
>
  • Select from the menu DataBase the action Slice (there is no Slice action anymore.... There is create slice... -- kazu.).
 
  • Chose a name for the SQLite file you want to create and write it in the filed SQLite file name: (you can also use the ... button that will open a file selection dialog). I will chose the file myLHCBCOND.db in my home directory.
  • Chose a string to use as Database name: (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: LHCBCOND.
  • In the group Selection Object Creation, you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely DC06) of the database is achieved by using Node: /, Since: 1970-01-01 01:00:00, Until: +inf and selecting the tag in the Tag Name: list (DC06). If you want, you can select multiple tags.
  • In the group Selection Objects List, click on Add to schedule the selection we prepared for the copy. You can add many selections to the list.
Changed:
<
<
  • Now you can click on Copy to create the new database. You can also add the selected data to an already existing database using the button Append.
>
>
  • Now you can click on Copy (There is no Copy button. there is OK -- kazu) to create the new database. You can also add the selected data to an already existing database using the button Append.
 The database is ready.
Using the Python commands
  • Open a python shell in the correct environment (LHCb >= v24r1):

Revision 582010-10-06 - IllyaShapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 259 to 259
 
  • If you are requesting changes for LHCBCOND partition please check that the IOV(s) for your files are not covering the current closed IOVs (the latter can be checked using CondDB Browser). If you are confident that the current closed IOV scheme should be modified please inform the CondDB manager about that explicitly in the Savannah task.
  • Please check the actual encoding of your xml files matches the one declared in the xml header in the 'encoding' attribute.
Added:
>
>
  • Please be sure that your changes to the db intended for particular global tag branch are made on the base of the same branch of your interest.
 The format in which changes should be provided is described below.
Added:
>
>
 

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:
  • XML files

Revision 572010-07-05 - ChristopherRJones

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 405 to 405
  The snapshot is done.
Changed:
<
<
For our purposes, as fas as we wanted to update the Det/SQLDDDB package, the last additional thing we must do is to edit the file $SQLITEDBPATH/options/SQLDDDB.py to
>
>
For our purposes, as far as we wanted to update the Det/SQLDDDB package, the last additional thing we must do is to edit the file $SQLITEDBPATH/options/SQLDDDB.py to
 declare the last available snapshot for the ONLINE partition. For that purpose, we must specify the year and the month of the last snapshotted ONLINE part in the end of the file in the line:

latest_snapshot = (2010,02)

Revision 562010-06-08 - IllyaShapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 254 to 254
 

Production Tasks

Request changes to the content of the official CondDB

Changed:
<
<
To request changes to the content of the official CondDB, use the CondDB Savannah tracker. The format in which changes should be provided is described below.
>
>
To request changes to the content of the official CondDB, use the CondDB Savannah tracker. Before submitting new changes please read the following:
  • If you are requesting changes for LHCBCOND partition please check that the IOV(s) for your files are not covering the current closed IOVs (the latter can be checked using CondDB Browser). If you are confident that the current closed IOV scheme should be modified please inform the CondDB manager about that explicitly in the Savannah task.
  • Please check the actual encoding of your xml files matches the one declared in the xml header in the 'encoding' attribute.
The format in which changes should be provided is described below.
 

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:
  • XML files

Revision 552010-04-14 - IllyaShapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 394 to 394
 cd $SQLITEDBPATH/

and execute the following script, specifying the option file "SQLDDDB-Oracle.py" (to use the Conditions database) from Det/SQLDDDB package,

Changed:
<
<
start and end point of the time interval, in which You are interested in, the name of the partition and the connection string for the output snapshot file. In our case it will be:
>
>
start and end points of time interval to snapshot (either local, or UTC), the name of the partition and the connection string for the output snapshot file. Note, that currently the snapshotting is done internally using the UTC time, so if you define the range in local time (e.g. ... -s 2010-02-01 -u 2010-03-01 ... ) the snapshot will be done using the time range converted to UTC. For LHCb ONLINE snapshots it is important to have a snapshot exactly from midnight to midnight for every month in UTC and to avoid taking into account 2 (or 1, depending on summer time) hours shifts it is convenient to define the time range always in UTC as it is shown in the example below:
  CondDBAdmin_MakeSnapshot.py --options $SQLDDDBROOT/options/SQLDDDB-Oracle.py -s 2010-02-01UTC -u 2010-03-01UTC ONLINE sqlite_file:ONLINE-201002_new.db/ONLINE
Changed:
<
<
That's it.
>
>
The snapshot is done.
  For our purposes, as fas as we wanted to update the Det/SQLDDDB package, the last additional thing we must do is to edit the file $SQLITEDBPATH/options/SQLDDDB.py to declare the last available snapshot for the ONLINE partition. For that purpose, we must specify the year and the month of the last snapshotted ONLINE part in the end of the file in the line:

Revision 542010-04-13 - IllyaShapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 396 to 396
 and execute the following script, specifying the option file "SQLDDDB-Oracle.py" (to use the Conditions database) from Det/SQLDDDB package, start and end point of the time interval, in which You are interested in, the name of the partition and the connection string for the output snapshot file. In our case it will be:
Changed:
<
<
CondDBAdmin_MakeSnapshot.py --options $SQLDDDBROOT/options/SQLDDDB-Oracle.py -s 2010-02-01 -u 2010-03-01 ONLINE sqlite_file:ONLINE-201002_new.db/ONLINE
>
>
CondDBAdmin_MakeSnapshot.py --options $SQLDDDBROOT/options/SQLDDDB-Oracle.py -s 2010-02-01UTC -u 2010-03-01UTC ONLINE sqlite_file:ONLINE-201002_new.db/ONLINE
  That's it.
Line: 408 to 408
 Now Det/SQLDDDB package contains the most recent version of ONLINE partition.

Deleted:
<
<
-- IllyaShapoval - 02-Nov-2009
 \ No newline at end of file

Revision 532010-04-13 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 304 to 304
 TODO

Update the Oracle Connections string on LFC

Changed:
<
<
From lxplus4 (still to be validated on lxplus5), prepare the environment with
>
>
From lxplus5, prepare the environment with
 
<!-- SyntaxHighlightingPlugin -->
lhcb-proxy-init -g lhcb_conddb
SetupProject LHCb --use-grid
setenv PATH `echo $LD_LIBRARY_PATH | tr ':' '\n' | grep "CORAL.*lib"`/../bin:$PATH
<!-- end SyntaxHighlightingPlugin -->
Changed:
<
<
Go to a temporary directory under $HOME/private (e.g. $HOME/private/tmp) and dump the old version of the connection details for the interested site:
>
>
Go to a temporary directory under $HOME/private (e.g. $HOME/private/tmp) and dump the old version of the connection details for the interested site (replace LCG.NIKHEF.nl with the corerct site name):
 %CODE{ "sh" }% cd $HOME/private/tmp set site = LCG.NIKHEF.nl

Revision 522010-04-08 - MarcoCattaneo

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 352 to 352
 coral_replica_manager -add -l CondDBOnline -c "oracle://$oracle_string/lhcb_online_conddb" -h "$site" -ro -u lhcb_conddb_reader -p "$reader_pwd" %ENDCODE%
Changed:
<
<
The last thing is to use "export" the new values to validate the content of LFC.
>
>
The last thing is to use "export" the new values to validate the content of LFC. Also, don't forget to make the corresponding changes to all the files in the SVN directory DBASE/AppConfig/conddb, and to ask for a new release of AppConfig with these changes.
 

Synchronize Oracle Databases from SQLITE versions

From lxplus4 (still to be validated on lxplus5), prepare the environment with

Revision 512010-03-29 - MarcoCattaneo

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 239 to 239
  which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
Added:
>
>

Override the heartbeat condition

In order to ensure that replicas of the ONLINE partition of the database are sufficiently up to date, a "heartbeat condition" is periodically inserted in the database. The framework blocks access to online conditions if the last update is older than the current event time, giving a message like:
ONLINE              ERROR Database not up-to-date. Latest known update is at 1269840266.0, event time is 1269843690.708544

Obvioulsly this check does not make sense when running in the online farm, where the ONLINE partition is by definition up to date and the event time is, by construction, more recent than the last heartbeat. In th online environment, the above check should be over-ridded by adding the following option:

CondDB().IgnoreHeartBeat = True

This implementation of this feature is discussed in Savannah task 13270

 

Production Tasks

Request changes to the content of the official CondDB

To request changes to the content of the official CondDB, use the CondDB Savannah tracker. The format in which changes should be provided is described below.

Revision 502010-03-02 - Ishapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 383 to 383
 and execute the following script, specifying the option file "SQLDDDB-Oracle.py" (to use the Conditions database) from Det/SQLDDDB package, start and end point of the time interval, in which You are interested in, the name of the partition and the connection string for the output snapshot file. In our case it will be:
Changed:
<
<
CondDBAdmin_MakeSnapshot.py --options $SQLDDDBROOT/options/SQLDDDB-Oracle.py -s 2009-10-01 -u 2009-11-01 ONLINE sqlite_file:ONLINE-200910_new.db/ONLINE
>
>
CondDBAdmin_MakeSnapshot.py --options $SQLDDDBROOT/options/SQLDDDB-Oracle.py -s 2010-02-01 -u 2010-03-01 ONLINE sqlite_file:ONLINE-201002_new.db/ONLINE
 
Changed:
<
<
Wait a few seconds ... and that's it. The snapshot is done!
>
>
That's it.
  For our purposes, as fas as we wanted to update the Det/SQLDDDB package, the last additional thing we must do is to edit the file $SQLITEDBPATH/options/SQLDDDB.py to declare the last available snapshot for the ONLINE partition. For that purpose, we must specify the year and the month of the last snapshotted ONLINE part in the end of the file in the line:
Changed:
<
<
latest_snapshot = (2009,10)
>
>
latest_snapshot = (2010,02)
  Now Det/SQLDDDB package contains the most recent version of ONLINE partition.

Revision 492010-01-22 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 169 to 169
 # Get the instance of the CondDB configurable CondDB(LocalTags["DDDB"] = [ muon_tag ]) %ENDCODE%
Added:
>
>

Override part of a global tag using another global tag

Sometimes it is useful to compare the the effect of the changes in some conditions between two global tags.

If the latest global tag in LHCBCOND is head-20100119 and we want to compare the effect of the changes in the Rich conditions with respect to the tag head-20091211, we have essentially two possibilities.

Reproduce the global tag from the local tags

From the CondDB Release Notes, we can see that (in LHCBCOND) the global tag head-20100119 is based on the global tag head-20091211 plus the local tags rich-20100119, prs-20100117, align-20100115, rich-20100113. To check what would have been the effect if the new global tag was not including the Rich changes, use these options:

<!-- SyntaxHighlightingPlugin -->
from Gaudi.Configuration import *
from Configurables import CondDB, LHCbApp

# Define the tags
base_tag = "head-20091211" # base tag for head-20100119
local_tags = [ "prs-20100117", "align-20100115" ]

# Set the default tags
LHCbApp(CondDBtag = base_tag)

# Get the instance of the CondDB configurable
CondDB(LocalTags["LHCBCOND"] = local_tags)
<!-- end SyntaxHighlightingPlugin -->

Use a sub-tree from the old tag

If removing a local tag from the global tag is not what is needed, may be because it will hide too much, you can use the old local tag for a defined subtree.

Let's say that we want to ignore the changes to Rich2, but not those for Rich1 between the two global tags. To do that, we need a CondDBAccessSvc configured to access LHCBCOND with the old tag and use it only to access the subtree "/Conditions/Rich2":

<!-- SyntaxHighlightingPlugin -->
from Gaudi.Configuration import *
from Configurables import CondDB, LHCbApp, CondDBAccessSvc

# Define the tags
base_tag = "head-20091219"
old_tag = "head-20091211"
LHCBCOND_old = CondDBAccessSvc("LHCBCOND_old")
LHCBCOND_old.ConnectionString = "sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND"
# or "CondDB/LHCBCOND" if using Oracle
LHCBCOND_old.DefaultTAG = "head-20091211"

# Set the default tags
LHCbApp(CondDBtag = base_tag)

# Get the instance of the CondDB configurable
CondDB().addAlternative(LHCBCOND_old, path = "/Conditions/Rich2")
<!-- end SyntaxHighlightingPlugin -->

Note: if this use case is popular, the configuration can be simplified by instrumenting the CondDB configurable.

 

Use the Oracle database

To use the Oracle database you need some form of authentication. Currently, we use grid proxy certificates.

Revision 482009-11-12 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 117 to 117
 Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
# SetupProject LHCb
Changed:
<
<
# dump_db_to_files.py -c -T -d
>
>
# dump_db_to_files.py -c -T -t
 

A practical example to extract the current version of the detector description is:

# SetupProject LHCb
# set tag = "DC06-20080407"
Changed:
<
<
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -T $tag -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND -T $tag -d /tmp/myDDDB
>
>
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND -T $tag -t `date +"%s000000000"` -d /tmp/myDDDB
  (Note: you need to use a tag compatible with the version of the software you are using).
To use these XML files, you need to add to the default options (in Python):

Revision 472009-11-02 - Ishapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 311 to 311
 coolPrivileges "CondDB(owner)/SIMCOND" GRANT READER lhcb_conddb_reader %ENDCODE%
Changed:
<
<

Snapshotting the "ONLINE" partition

You need to have a GRID certificate in order to be authenticated to snapshot the ONLINE partition from Oracle.
>
>

Snapshotting the "ONLINE"

You need to have a GRID certificate in order to be authenticated to snapshot the ONLINE partition from Oracle.
 First, decide for what time interval You want to make the snapshot of the ONLINE partition.
Changed:
<
<
For this exercise we will create the snapshot for the time interval from 2009-10-19 to 2009-11-01 to fulfill continuous monthly ONLINE snapshots for the Det/SQLDDDB package in DEV area, thus creating the last missing part for October of 2009.
>
>
For this exercise we will create the snapshot for the time interval from 2009-10-01 to 2009-11-01 to renew the ONLINE partition for the Det/SQLDDDB package (located in DEV area) with the last missing snapshot for October of 2009 (For the note: The ONLINE partition in SQLDDDB package consists of monthly snapshots of the Oracle online database).
 
Changed:
<
<
From lxplus4 (still to be validated on lxplus5), setup the environment with enabling auto selection of LHCbGrid project:
>
>
From lxplus4, or lxplus5, setup the environment with enabling auto selection of LHCbGrid project:
  SetupProject LHCb --dev --use-grid
Line: 326 to 326
 lhcb-proxy-init

and enter the certificate password.

Added:
>
>
Now, put Yourself to the folder, where You want to place the snapshot:

cd $SQLITEDBPATH/

and execute the following script, specifying the option file "SQLDDDB-Oracle.py" (to use the Conditions database) from Det/SQLDDDB package, start and end point of the time interval, in which You are interested in, the name of the partition and the connection string for the output snapshot file. In our case it will be:

CondDBAdmin_MakeSnapshot.py --options $SQLDDDBROOT/options/SQLDDDB-Oracle.py -s 2009-10-01 -u 2009-11-01 ONLINE sqlite_file:ONLINE-200910_new.db/ONLINE

Wait a few seconds ... and that's it. The snapshot is done!

For our purposes, as fas as we wanted to update the Det/SQLDDDB package, the last additional thing we must do is to edit the file $SQLITEDBPATH/options/SQLDDDB.py to declare the last available snapshot for the ONLINE partition. For that purpose, we must specify the year and the month of the last snapshotted ONLINE part in the end of the file in the line:

latest_snapshot = (2009,10)

 
Added:
>
>
Now Det/SQLDDDB package contains the most recent version of ONLINE partition.
 
Changed:
<
<
-- MarcoClemencic - 29-Oct-2009
>
>
-- IllyaShapoval - 02-Nov-2009

Revision 462009-11-01 - Ishapoval

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 311 to 311
 coolPrivileges "CondDB(owner)/SIMCOND" GRANT READER lhcb_conddb_reader %ENDCODE%
Added:
>
>

Snapshotting the "ONLINE" partition

You need to have a GRID certificate in order to be authenticated to snapshot the ONLINE partition from Oracle. First, decide for what time interval You want to make the snapshot of the ONLINE partition. For this exercise we will create the snapshot for the time interval from 2009-10-19 to 2009-11-01 to fulfill continuous monthly ONLINE snapshots for the Det/SQLDDDB package in DEV area, thus creating the last missing part for October of 2009.

From lxplus4 (still to be validated on lxplus5), setup the environment with enabling auto selection of LHCbGrid project:

SetupProject LHCb --dev --use-grid

Next, initialize the proxy:

lhcb-proxy-init

and enter the certificate password.

 

-- MarcoClemencic - 29-Oct-2009

Revision 452009-10-29 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 290 to 290
 %ENDCODE%

The last thing is to use "export" the new values to validate the content of LFC.

Added:
>
>

Synchronize Oracle Databases from SQLITE versions

From lxplus4 (still to be validated on lxplus5), prepare the environment with
<!-- SyntaxHighlightingPlugin -->
lhcb-proxy-init -g lhcb_conddb
SetupProject LHCb --use-grid
<!-- end SyntaxHighlightingPlugin -->
then call the coolReplicateDB tool on the three partitions DDDB, LHCBCOND and SIMCOND
<!-- SyntaxHighlightingPlugin -->
coolReplicateDB sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB "CondDB(owner)/DDDB"
coolReplicateDB sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND "CondDB(owner)/LHCBCOND"
coolReplicateDB sqlite_file:$SQLITEDBPATH/SIMCOND.db/SIMCOND "CondDB(owner)/SIMCOND"
<!-- end SyntaxHighlightingPlugin -->

If there are new files in the propagated changes, then also the permissions have to be updated:

<!-- SyntaxHighlightingPlugin -->
coolPrivileges "CondDB(owner)/DDDB" GRANT READER lhcb_conddb_reader
coolPrivileges "CondDB(owner)/LHCBCOND" GRANT READER lhcb_conddb_reader
coolPrivileges "CondDB(owner)/SIMCOND" GRANT READER lhcb_conddb_reader
<!-- end SyntaxHighlightingPlugin -->
 
Deleted:
<
<
-- MarcoClemencic - 20-Oct-2009
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 29-Oct-2009

Revision 442009-10-21 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 240 to 240
 

From SQLite files

TODO
Changed:
<
<

Update the Oracle Connections string on LFC

>
>

Update the Oracle Connections string on LFC

 From lxplus4 (still to be validated on lxplus5), prepare the environment with %CODE{ "sh" }% lhcb-proxy-init -g lhcb_conddb

Revision 432009-10-20 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 240 to 240
 

From SQLite files

TODO
Added:
>
>

Update the Oracle Connections string on LFC

From lxplus4 (still to be validated on lxplus5), prepare the environment with
<!-- SyntaxHighlightingPlugin -->
lhcb-proxy-init -g lhcb_conddb
SetupProject LHCb --use-grid
setenv PATH `echo $LD_LIBRARY_PATH | tr ':' '\n' | grep "CORAL.*lib"`/../bin:$PATH
<!-- end SyntaxHighlightingPlugin -->

Go to a temporary directory under $HOME/private (e.g. $HOME/private/tmp) and dump the old version of the connection details for the interested site:

<!-- SyntaxHighlightingPlugin -->
cd $HOME/private/tmp
set site = LCG.NIKHEF.nl
coral_replica_manager -exp -l CondDB -h $site
mv authentication.xml offline_auth.xml
mv dblookup.xml offline_lookup.xml
coral_replica_manager -exp -l CondDBOnline -h $site
mv authentication.xml online_auth.xml
mv dblookup.xml online_lookup.xml
<!-- end SyntaxHighlightingPlugin -->

Extract from the *_auth.xml files the passwords for the accounts

  • lhcb_conddb
  • lhcb_online_conddb
  • lhcb_conddb_reader.

Now you can remove the old entries from LFC

<!-- SyntaxHighlightingPlugin -->
setenv LFC_HOST lfc-lhcb.cern.ch
coral_replica_manager -del -l CondDB -h $site
coral_replica_manager -del -l CondDBOnline -h $site
<!-- end SyntaxHighlightingPlugin -->

With the passwords retrieved before and the Oracle connection details (taken from TNSNAMES), set some variables

<!-- SyntaxHighlightingPlugin -->
set conddb_pwd = "..."
set online_pwd = "..."
set reader_pwd = "... "
set oracle_string = "..."
<!-- end SyntaxHighlightingPlugin -->
then add the new entries to LFC
<!-- SyntaxHighlightingPlugin -->
coral_replica_manager -add -l CondDB -c "oracle://$oracle_string/lhcb_conddb" -h "$site" -r owner -ro -u lhcb_conddb -p "$conddb_pwd"
coral_replica_manager -add -l CondDB -c "oracle://$oracle_string/lhcb_conddb" -h "$site" -r reader -ro -u lhcb_conddb_reader -p "$reader_pwd"
coral_replica_manager -add -l CondDB -c "oracle://$oracle_string/lhcb_conddb" -h "$site" -ro -u lhcb_conddb_reader -p "$reader_pwd"
coral_replica_manager -add -l CondDBOnline -c "oracle://$oracle_string/lhcb_online_conddb" -h "$site" -r owner -ro -u lhcb_online_conddb -p "$online_pwd"
coral_replica_manager -add -l CondDBOnline -c "oracle://$oracle_string/lhcb_online_conddb" -h "$site" -r reader -ro -u lhcb_conddb_reader -p "$reader_pwd"
coral_replica_manager -add -l CondDBOnline -c "oracle://$oracle_string/lhcb_online_conddb" -h "$site" -ro -u lhcb_conddb_reader -p "$reader_pwd"
<!-- end SyntaxHighlightingPlugin -->

The last thing is to use "export" the new values to validate the content of LFC.

 

-- MarcoClemencic - 20-Oct-2009 \ No newline at end of file

Revision 422009-10-20 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 19 to 19
 

Example

The position of the Velo halves are fixed in the "close" position. To reconstruct using the "open Velo" configuration, we need to modify the VeloLeft and VeloRight alignment conditions in order to move the right half of -30mm on X and the left one of 30mm on X.

Solution

Changed:
<
<
We need to add to the option file of our application the following lines .opts:
<!-- SyntaxHighlightingPlugin -->
UpdateManagerSvc.ConditionsOverride += {
  "Conditions/Alignment/Velo/VeloRight :=  double_v dPosXYZ = -30 0 0;",
  "Conditions/Alignment/Velo/VeloLeft  :=  double_v dPosXYZ =  30 0 0;"
};
      
<!-- end SyntaxHighlightingPlugin -->

python options, first load the configurable interface:

>
>
We need to add to the python option file of our application the following lines
  %CODE{ "python" }% from Configurables import UpdateManagerSvc
Deleted:
<
<
%ENDCODE% then after the Program.applyConf() line add condition override: %CODE{ "python" }%
 UpdateManagerSvc().ConditionsOverride += [ "Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"
Line: 254 to 242
 
Deleted:
<
<
-- MarcoClemencic - 13-Oct-2009
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 20-Oct-2009
 \ No newline at end of file

Revision 412009-10-13 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 181 to 181
 # Get the instance of the CondDB configurable CondDB(LocalTags["DDDB"] = [ muon_tag ]) %ENDCODE%
Added:
>
>

Use the Oracle database

To use the Oracle database you need some form of authentication. Currently, we use grid proxy certificates.

On lxplus, you have to call lhcb-proxy-init end enter your certificate password when prompted. Then

# SetupProject LHCb --use-grid
# CondDBBrowser.py CondDB/LHCBCOND
where CondDB/LHCBCOND is an example of connection string. All the valid connection strings for Oracle are:
  • CondDB/DDDB
  • CondDB/LHCBCOND
  • CondDB/SIMCOND
  • CondDBOnline/ONLINE

On plus (PIT), you do not need authentication because it is a trusted environment, so just call the wrapper script:

/group/online/condb_viewer/CondDBBrowser.sh CondDBOnline/ONLINE
which embeds a call to SetupProject. You can use the same connection strings mentioned for lxplus, plus CondDBPrivate/PRIVATE.
 

Production Tasks

Request changes to the content of the official CondDB

Line: 235 to 254
 
Deleted:
<
<
-- MarcoClemencic - 11 Mar 2009
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 13-Oct-2009
 \ No newline at end of file

Revision 402009-07-28 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 197 to 197
 # copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new # copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
Changed:
<
<
  • Modify the option file to be used for testing (e.g. LoadDDDB.opts in DetDescChecks) by appending the following lines:
>
>
  • Create an option file to be used for testing (e.g. after LoadDDDB.py in DetDescChecks) with the following lines:
 
Added:
>
>
from Gaudi.Configuration import * from Configurables import CondDB conddb = CondDB()
 # For DDDB
Changed:
<
<
MainAccessSvc = 'CondDBLayeringSvc/DDDBLayers'; DDDBLayers.Layers = {'CondDBAccessSvc/DDDBNew', 'CondDBAccessSvc/DDDB'}; ConnectionString = "sqlite_file:$HOME/tmp/DDDB-new.db/DDDB";
>
>
conddb.addLayer(dbFile = "$HOME/tmp/DDDB-new.db", dbName = "DDDB")
  # For LHCBCOND
Changed:
<
<
CondDBDispatcherSvc.Alternatives = {'/Conditions=CondDBLayeringSvc/CONDLayers'}; CONDLayers.Layers = {'CondDBAccessSvc/CONDNew', 'CondDBAccessSvc/LHCBCOND'}; ConnectionString = "sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND";
>
>
conddb.addLayer(dbFile = "$HOME/tmp/LHCBCOND-new.db", dbName = "LHCBCOND")
 
  • If the validation is successful, add the XML files to the master database

Revision 392009-03-11 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 21 to 21
 

Solution

We need to add to the option file of our application the following lines .opts:
Changed:
<
<
%CODE{ "c++" }%
>
>
%CODE{ "cpp" }%
 ConditionsOverride += { "Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"

Revision 382009-03-11 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 21 to 21
 

Solution

We need to add to the option file of our application the following lines .opts:
Changed:
<
<
>
>
%CODE{ "c++" }%
 ConditionsOverride += { "Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;" };
Changed:
<
<
>
>
%ENDCODE%
  python options, first load the configurable interface:
Changed:
<
<
>
>
%CODE{ "python" }%
 from Configurables import UpdateManagerSvc
Changed:
<
<
>
>
%ENDCODE%
  then after the Program.applyConf() line add condition override:
Changed:
<
<
>
>
%CODE{ "python" }%
 UpdateManagerSvc().ConditionsOverride += [ "Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;" ]
Changed:
<
<
>
>
%ENDCODE%
 
<!--
and be sure that somebody is registered as a user of that condition to the UpdateManagerSvc, for example adding to the initialize of your algorithm the line
Line: 67 to 67
 
  • First you have to start the CondDB Browser:
    # SetupProject LHCb
Changed:
<
<
# CondDBBrowser.py &
  • From the menu DataBase select the action Open. In the dialog, as DBLookup Alias, type $SQLITEDBPATH/LHCBCOND.db.
  • Write LHCBCOND in the field Database Name, then click on Open DB.
>
>
# CondDBBrowser.py LHCBCOND &
 
  • Select from the menu DataBase the action Slice.
  • Chose a name for the SQLite file you want to create and write it in the filed SQLite file name: (you can also use the ... button that will open a file selection dialog). I will chose the file myLHCBCOND.db in my home directory.
  • Chose a string to use as Database name: (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: LHCBCOND.
Line: 89 to 87
 
  1. you created a local copy of the whole LHCBCOND database
  2. you only copied a few nodes
Complete Copy
Changed:
<
<
To use the local full copy of the database in your application, you have to override the default job options. Add at the end of your options file the line:
LHCBCOND.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
>
>
To use the local full copy of the database in your application, you have to override the default job options. Add to your options a file like:
<!-- SyntaxHighlightingPlugin -->
from Gaudi.Configuration import *
from Configurables import CondDB
cdb = CondDB()
cdb.PartitionConnectionString["LHCBCOND"] = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND"
<!-- end SyntaxHighlightingPlugin -->
 If you need to use a tag different from the one defined in the standard options (e.g. "my_tag"), add also the line:
Changed:
<
<
LHCBCOND.DefaultTAG = "my_tag";
>
>
<!-- SyntaxHighlightingPlugin -->
cdb.Tags["LHCBCOND"] = "my_tag"
<!-- end SyntaxHighlightingPlugin -->
 or
Changed:
<
<
LHCBCOND.DefaultTAG = "";
>
>
<!-- SyntaxHighlightingPlugin -->
cdb.Tags["LHCBCOND"] = ""
<!-- end SyntaxHighlightingPlugin -->
 if you want to use the HEAD version of your local copy.
Added:
>
>
Note that a complete copy can be used as a partial copy with everything inside wink
 
Partial Copy
Changed:
<
<
The job options to use in case of a partial copy are a bit more complex in .opts (essentially the same ones reported below when discussing "Add new XML to the Conditions Database"):
CondDBDispatcherSvc.Alternatives = {'/Conditions=CondDBLayeringSvc/CONDLayers'};
CONDLayers.Layers = {'CondDBAccessSvc/CONDLocal', 'CondDBAccessSvc/LHCBCOND'};
CONDLocal.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
//CONDLocal.DefaultTAG = "my_tag";
In Python options is much simpler:
>
>
This case is much simpler: %CODE{ "python" }%
 from Gaudi.Configuration import * from Configurables import CondDB, CondDBAccessSvc CondDB(). addLayer( CondDBAccessSvc("myCond", ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND", DefaultTAG = "my_tag"))
Changed:
<
<
>
>
%ENDCODE%
 

Explanation

TODO
Line: 145 to 141
  (Note: you need to use a tag compatible with the version of the software you are using).
To use these XML files, you need to add to the default options (in Python):
Changed:
<
<
>
>
%CODE{ "python" }%
 from Gaudi.Configuration import * from Configurables import DDDBConf DDDBConf(DbRoot = "/tmp/myDDDB/lhcb.xml")
Changed:
<
<
>
>
%ENDCODE%
 Because of some implementation details, the ONLINE partition cannot be used outside a database, so you need to use an hybrid configuration where some data is taken from files and others are taken from the DB. To achieve that, you have to modify the file /tmp/myDDDB/Conditions/MainCatalog.xml replacing the line
<catalogref href="Online"/>
Line: 170 to 167
 Let's assume we want to use the global tag "head-20080225" as a base and the tag "muon-20080407" (only in DDDB) to test some new Muon code.

The options to do that are (python options):

Changed:
<
<
>
>
%CODE{ "python" }%
 from Gaudi.Configuration import *
Changed:
<
<
from DetCond.Configuration import *

# Get the default access services DDDB = CondDBAccessSvc("DDDB") LHCBCOND = CondDBAccessSvc("LHCBCOND") # We re-use the same basic configuration of DDDB for the Muon MuonDB = DDDB.clone("MuonDB")

>
>
from Configurables import CondDB, LHCbApp
 
Changed:
<
<
# Set the new tags
>
>
# Define the new tags
 base_tag = "head-20080225" muon_tag = "muon-20080407"
Changed:
<
<
DefaultTAG = base_tag DefaultTAG = base_tag
>
>
# Set the default tags LHCbApp(DDDBtag = base_tag, CondDBtag = base_tag)
 
Changed:
<
<
DefaultTAG = muon_tag

# Use the Muon access service as a layer on top of the default configuration addCondDBLayer(MuonDB)

>
>
# Get the instance of the CondDB configurable CondDB(LocalTags["DDDB"] = [ muon_tag ]) %ENDCODE%
 

Production Tasks

Request changes to the content of the official CondDB

Line: 245 to 234
 TODO

Deleted:
<
<
-- MarcoClemencic - 10 Jul 2008
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 11 Mar 2009
 \ No newline at end of file

Revision 372009-03-06 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 112 to 112
  In Python options is much simpler:
Changed:
<
<
from DetCond.Configuration import * addCondDBLayer(
>
>
from Gaudi.Configuration import * from Configurables import CondDB, CondDBAccessSvc CondDB(). addLayer(
  CondDBAccessSvc("myCond", ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND", DefaultTAG = "my_tag"))

Revision 362009-02-09 - MarcoCattaneo

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 139 to 139
 
# SetupProject LHCb
# set tag = "DC06-20080407"
Changed:
<
<
# dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB -T $tag -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T $tag -d /tmp/myDDDB
>
>
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -T $tag -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/LHCBCOND.db/LHCBCOND -T $tag -d /tmp/myDDDB
  (Note: you need to use a tag compatible with the version of the software you are using).
To use these XML files, you need to add to the default options (in Python):
Line: 158 to 158
 
Added:
>
>
Another practical example, to extract the current version of the particle properties table:
# dump_db_to_files.py -c sqlite_file:$SQLITEDBPATH/DDDB.db/DDDB -s /param/ParticleTable.txt
 

Use a Local Tag of the database

When changes in the XML need to be paired with changes in the C++ code, it is important to be able to get part of the content of the DB from one tag and part from another.

Revision 352009-01-28 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 143 to 143
 # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T $tag -d /tmp/myDDDB (Note: you need to use a tag compatible with the version of the software you are using).
Changed:
<
<
To use these XML files, it is enough to add to the default options:
>
>
To use these XML files, you need to add to the default options (in Python):
 
Changed:
<
<
DetDbLocation = "/tmp/myDDDB/lhcb.xml";
>
>
from Gaudi.Configuration import * from Configurables import DDDBConf DDDBConf(DbRoot = "/tmp/myDDDB/lhcb.xml")
 
Changed:
<
<
or, using gaudirun.py:
>
>
Because of some implementation details, the ONLINE partition cannot be used outside a database, so you need to use an hybrid configuration where some data is taken from files and others are taken from the DB. To achieve that, you have to modify the file /tmp/myDDDB/Conditions/MainCatalog.xml replacing the line
 
Changed:
<
<
# gaudirun.py myOptions.py --option 'DetectorDataSvc().DetDbLocation = "/tmp/myDDDB/lhcb.xml"'
>
>
with
<catalogref href="conddb:/Conditions/Online"/>
 

Use a Local Tag of the database

Revision 342008-11-28 - MarcoCattaneo

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 182 to 182
 

Production Tasks

Added:
>
>

Request changes to the content of the official CondDB

To request changes to the content of the official CondDB, use the CondDB Savannah tracker. The format in which changes should be provided is described below.
 

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:
  • XML files

Revision 332008-07-10 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 60 to 60
 

Example

-->

Solution

Changed:
<
<
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace in the following recipes LHCBCOND with DDDB.
>
>
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace in the following recipes LHCBCOND with DDDB, LHCBCOND or ONLINE.
 
Create the Copy
There are two equivalent ways to create a copy of the database, either via the CondDB Browser or via python commands that can be put in a script.
Using the Graphical User Interface
Line: 78 to 78
 
  • Now you can click on Copy to create the new database. You can also add the selected data to an already existing database using the button Append.
The database is ready.
Using the Python commands
Changed:
<
<
  • Open a python shell in the correct environment:
>
>
  • Open a python shell in the correct environment (LHCb >= v24r1):
 
# SetupProject LHCb
Changed:
<
<
# python
  • Execute the commands:
    >>> from PyCoolCopy import copy
    >>> from os import environ
    >>> db_name = "LHCBCOND"
    >>> source_file = environ["SQLITEDBPATH"] + "/LHCBCOND.db"
    >>> source = "sqlite_file:%s/%s"%(source_file, db_name)
    >>> dest_file = environ["HOME"] + "/myLHCBCOND.db"
    >>> dest = "sqlite_file:%s/%s"%(dest_file, db_name)
    >>> copy(source, dest, tags = ['DC06'])
>
>
# CondDBAdmin_MakeSnapshot.py -T DC06 LHCBCOND sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND
  The database is ready.
Use the Copy in Your Application
Line: 113 to 103
  if you want to use the HEAD version of your local copy.
Partial Copy
Changed:
<
<
The job options to use in case of a partial copy are a bit more complex (essentially the same ones reported below when discussing "Add new XML to the Conditions Database"):
>
>
The job options to use in case of a partial copy are a bit more complex in .opts (essentially the same ones reported below when discussing "Add new XML to the Conditions Database"):
 
CondDBDispatcherSvc.Alternatives = {'/Conditions=CondDBLayeringSvc/CONDLayers'};
CONDLayers.Layers = {'CondDBAccessSvc/CONDLocal', 'CondDBAccessSvc/LHCBCOND'};
CONDLocal.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
Added:
>
>
//CONDLocal.DefaultTAG = "my_tag";
 
Changed:
<
<
The tag in this case has to be defined with the option CONDLocal.DefaultTAG.
>
>
In Python options is much simpler:
from DetCond.Configuration import *
addCondDBLayer(
    CondDBAccessSvc("myCond",
        ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND",
        DefaultTAG = "my_tag"))
 

Explanation

TODO
Line: 132 to 131
 

Solution

Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
Added:
>
>
# SetupProject LHCb
 # dump_db_to_files.py -c -T -d

A practical example to extract the current version of the detector description is:

Added:
>
>
# SetupProject LHCb
 # set tag = "DC06-20080407" # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB -T $tag -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T $tag -d /tmp/myDDDB
Line: 146 to 147
 
DetectorDataSvc.DetDbLocation = "/tmp/myDDDB/lhcb.xml";
Added:
>
>
or, using gaudirun.py:
# gaudirun.py myOptions.py --option 'DetectorDataSvc().DetDbLocation = "/tmp/myDDDB/lhcb.xml"'
 

Use a Local Tag of the database

When changes in the XML need to be paired with changes in the C++ code, it is important to be able to get part of the content of the DB from one tag and part from another.
Line: 185 to 190
 
  • Copy the modified files in dedicated directories, for example ~/tmp/DDDB-new and ~/tmp/LHCBCOND-new
  • Create COOL databases to be used as layers

Added:
>
>
# SetupProject LHCb
 # copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new # copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
Line: 225 to 231
 TODO

Deleted:
<
<
-- MarcoClemencic - 31 Jul 2007
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 10 Jul 2008

Revision 322008-06-02 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 161 to 161
 DDDB = CondDBAccessSvc("DDDB") LHCBCOND = CondDBAccessSvc("LHCBCOND") # We re-use the same basic configuration of DDDB for the Muon
Changed:
<
<
MuonDB = DDDB.Clone("MuonDB")
>
>
MuonDB = DDDB.clone("MuonDB")
  # Set the new tags base_tag = "head-20080225"

Revision 312008-05-13 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 137 to 137
  A practical example to extract the current version of the detector description is:
Changed:
<
<
# dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB -T DC06-repro0710 -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T DC06-repro0710 -d /tmp/myDDDB
>
>
# set tag = "DC06-20080407" # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB -T $tag -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T $tag -d /tmp/myDDDB
 
Added:
>
>
(Note: you need to use a tag compatible with the version of the software you are using).
 To use these XML files, it is enough to add to the default options:
DetectorDataSvc.DetDbLocation = "/tmp/myDDDB/lhcb.xml";

Revision 302008-04-25 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 17 to 17
 

Problem

We need to know how the result of an application would change if we replace one or few conditions in the database with different static (not changing between two events) values.

Example

Changed:
<
<
The position of the Velo halves are fixed in the "close" position. To reconstruct using the "open Velo" configuration, we need to modify the VeloLeft and VeloRight alignment conditions in order to move the right half of -30mm on X and the left one of 30mm on X.
>
>
The position of the Velo halves are fixed in the "close" position. To reconstruct using the "open Velo" configuration, we need to modify the VeloLeft and VeloRight alignment conditions in order to move the right half of -30mm on X and the left one of 30mm on X.
 

Solution

We need to add to the option file of our application the following lines .opts:
Line: 41 to 41
 

<!--
Changed:
<
<
and be sure that somebody is registered as a user of that condition to the UpdateManagerSvc, for example adding to the initialize of your algorithm the line
>
>
and be sure that somebody is registered as a user of that condition to the UpdateManagerSvc, for example adding to the initialize of your algorithm the line
 
  registerCondition<MyAlgorithm>("Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel");
Anyway this should be guarantee by the fact that something in the code is using the condition (e.g. the HLT alley algorithms). -->

Explanation

Changed:
<
<
The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.
>
>
The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.
 
Changed:
<
<
To define a condition in the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space-separated list in case of vectors).
>
>
To define a condition in the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space-separated list in case of vectors).
 Note: For LHCb < v22r8, if the condition contains more than on parameter, you also have to copy all the values you do not want to override.

Create and Use a Local Copy of the CondDB

Line: 60 to 60
 

Example

-->

Solution

Changed:
<
<
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace in the following recipes "LHCBCOND" with "DDDB".
>
>
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace in the following recipes LHCBCOND with DDDB.
 
Create the Copy
There are two equivalent ways to create a copy of the database, either via the CondDB Browser or via python commands that can be put in a script.
Using the Graphical User Interface
Line: 68 to 68
 
# SetupProject LHCb
# CondDBBrowser.py &
Changed:
<
<
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", type "$SQLITEDBPATH/LHCBCOND.db".
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.
  • Chose a string to use as "Database name" (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: "LHCBCOND".
  • In the group "Selection Object Creation", you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely "DC06") of the database is achieved by using Node = "/", Since = "1970-01-01 01:00:00", Until = "+inf" and selecting the tag in the list ("DC06"). If you want, you can select multiple tags.
  • In the group "Selection Objects List", click on "Add" to schedule the selection we prepared for the copy. You can add many selections to the list.
  • Now you can click on "Copy" to create the new database. You can also add the selected data to an already existing database using the button "Append".
>
>
  • From the menu DataBase select the action Open. In the dialog, as DBLookup Alias, type $SQLITEDBPATH/LHCBCOND.db.
  • Write LHCBCOND in the field Database Name, then click on Open DB.
  • Select from the menu DataBase the action Slice.
  • Chose a name for the SQLite file you want to create and write it in the filed SQLite file name: (you can also use the ... button that will open a file selection dialog). I will chose the file myLHCBCOND.db in my home directory.
  • Chose a string to use as Database name: (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: LHCBCOND.
  • In the group Selection Object Creation, you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely DC06) of the database is achieved by using Node: /, Since: 1970-01-01 01:00:00, Until: +inf and selecting the tag in the Tag Name: list (DC06). If you want, you can select multiple tags.
  • In the group Selection Objects List, click on Add to schedule the selection we prepared for the copy. You can add many selections to the list.
  • Now you can click on Copy to create the new database. You can also add the selected data to an already existing database using the button Append.
 The database is ready.
Using the Python commands
  • Open a python shell in the correct environment:
Line: 103 to 103
 
LHCBCOND.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
Changed:
<
<
If you need to use a tag different from the one defined in the standard options (e.g. "my_tag"), add also the line:
>
>
If you need to use a tag different from the one defined in the standard options (e.g. "my_tag"), add also the line:
 
LHCBCOND.DefaultTAG = "my_tag";
Line: 130 to 130
 

Example

-->

Solution

Changed:
<
<
Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
>
>
Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
 
# dump_db_to_files.py -c <connection string> -T <tag> -d <destination directory>
Line: 146 to 146
 

Use a Local Tag of the database

Changed:
<
<
When changes in the XML need to be paired with changes in the C++ code, it is important to be able to get part of the content of the DB from a tag and part from another.
>
>
When changes in the XML need to be paired with changes in the C++ code, it is important to be able to get part of the content of the DB from one tag and part from another.
 
Changed:
<
<
Let's assume we want to use the global tag "head-20080225" as a base and the tag "muon-20080407" (only in DDDB) to test some new Muon code.
>
>
Let's assume we want to use the global tag "head-20080225" as a base and the tag "muon-20080407" (only in DDDB) to test some new Muon code.
  The options to do that are (python options):
Line: 186 to 186
 # copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new # copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
Changed:
<
<
  • Modify the option file to be used for testing (e.g. LoadDDDB.opts in DetDescChecks) by appending the following lines:
>
>
  • Modify the option file to be used for testing (e.g. LoadDDDB.opts in DetDescChecks) by appending the following lines:
 
# For DDDB
CondDBDispatcherSvc.MainAccessSvc = 'CondDBLayeringSvc/DDDBLayers';

Revision 292008-04-22 - DavidHutchcroft

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 20 to 20
 The position of the Velo halves are fixed in the "close" position. To reconstruct using the "open Velo" configuration, we need to modify the VeloLeft and VeloRight alignment conditions in order to move the right half of -30mm on X and the left one of 30mm on X.

Solution

We need to add to the option file of our application the following lines
Changed:
<
<
.opts
>
>
.opts:
 
UpdateManagerSvc.ConditionsOverride += {
Changed:
<
<
"Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"
>
>
"Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"
 };
Changed:
<
<
python options
>
>
python options, first load the configurable interface:
from Configurables import UpdateManagerSvc
then after the Program.applyConf() line add condition override:
 
UpdateManagerSvc().ConditionsOverride += [
Changed:
<
<
"Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"
>
>
"Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"
 ]

Revision 282008-04-21 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 20 to 20
 The position of the Velo halves are fixed in the "close" position. To reconstruct using the "open Velo" configuration, we need to modify the VeloLeft and VeloRight alignment conditions in order to move the right half of -30mm on X and the left one of 30mm on X.

Solution

We need to add to the option file of our application the following lines
Added:
>
>
.opts
 
UpdateManagerSvc.ConditionsOverride += {
"Conditions/Alignment/Velo/VeloRight :=
Line: 28 to 29
  double_v dPosXYZ = 30 0 0;" };
Added:
>
>
python options
UpdateManagerSvc().ConditionsOverride += [
"Conditions/Alignment/Velo/VeloRight :=
   double_v dPosXYZ = -30 0 0;",
"Conditions/Alignment/Velo/VeloLeft :=
   double_v dPosXYZ = 30 0 0;"
]
      
 
<!--
and be sure that somebody is registered as a user of that condition to the UpdateManagerSvc, for example adding to the initialize of your algorithm the line
Line: 133 to 144
 DetDbLocation = "/tmp/myDDDB/lhcb.xml";
Added:
>
>

Use a Local Tag of the database

When changes in the XML need to be paired with changes in the C++ code, it is important to be able to get part of the content of the DB from a tag and part from another.

Let's assume we want to use the global tag "head-20080225" as a base and the tag "muon-20080407" (only in DDDB) to test some new Muon code.

The options to do that are (python options):

from Gaudi.Configuration import *
from DetCond.Configuration import *

# Get the default access services
DDDB = CondDBAccessSvc("DDDB")
LHCBCOND = CondDBAccessSvc("LHCBCOND")
# We re-use the same basic configuration of DDDB for the Muon
MuonDB = DDDB.Clone("MuonDB")

# Set the new tags
base_tag = "head-20080225"
muon_tag = "muon-20080407"

DDDB.DefaultTAG = base_tag
LHCBCOND.DefaultTAG = base_tag

MuonDB.DefaultTAG = muon_tag

# Use the Muon access service as a layer on top of the default configuration
addCondDBLayer(MuonDB)
 

Production Tasks

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:

Revision 272008-01-15 - GloriaCorti

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 76 to 76
 >>> from os import environ
>>> db_name = "LHCBCOND"
>>> source_file = environ["SQLITEDBPATH"] + "/LHCBCOND.db"
Changed:
<
<
>>> source = "sqlite://;schema=%s;dbname=%s"%(source_file, db_name)
>
>
>>> source = "sqlite_file:%s/%s"%(source_file, db_name)
 >>> dest_file = environ["HOME"] + "/myLHCBCOND.db"
Changed:
<
<
>>> dest = "sqlite://;schema=%s;dbname=%s"%(dest_file, db_name)
>
>
>>> dest = "sqlite_file:%s/%s"%(dest_file, db_name)
 >>> copy(source, dest, tags = ['DC06'])
The database is ready.

Revision 262008-01-11 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 126 to 126
 A practical example to extract the current version of the detector description is:
# dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB -T DC06-repro0710 -d /tmp/myDDDB
Changed:
<
<
# dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T DC06-repro0710 -d /tmp/myLHCBCOND
>
>
# dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T DC06-repro0710 -d /tmp/myDDDB
  To use these XML files, it is enough to add to the default options:

Revision 252007-12-18 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 54 to 54
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# setenvLHCb v23r1 # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py & (this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by cmt -pack=CondDBUI -path=Tools run 'echo $SQLITEDBPATH/LHCBCOND.db', which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v3r0/db/LHCBCOND.db), then click "OK".
>
>
# SetupProject LHCb # CondDBBrowser.py &
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", type "$SQLITEDBPATH/LHCBCOND.db".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.
Line: 69 to 68
 
Using the Python commands
  • Open a python shell in the correct environment:

Changed:
<
<
# setenvLHCb v23r1 # cmt -pack=CondDBUI -path=Tools run python (this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
>
>
# SetupProject LHCb # python
 
  • Execute the commands:
    >>> from PyCoolCopy import copy
Line: 122 to 120
 

Solution

Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c -T -d
>
>
# dump_db_to_files.py -c -T -d
 

A practical example to extract the current version of the detector description is:

Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06-repro0710 -d /tmp/myDDDB # cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06-repro0710 -d /tmp/myLHCBCOND
>
>
# dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB -T DC06-repro0710 -d /tmp/myDDDB # dump_db_to_files.py -c sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND -T DC06-repro0710 -d /tmp/myLHCBCOND
  To use these XML files, it is enough to add to the default options:
Line: 144 to 142
 
  • Copy the modified files in dedicated directories, for example ~/tmp/DDDB-new and ~/tmp/LHCBCOND-new
  • Create COOL databases to be used as layers

Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
>
>
# copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new # copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
 
  • Modify the option file to be used for testing (e.g. LoadDDDB.opts in DetDescChecks) by appending the following lines:

Line: 163 to 161
 
# set MasterDDDB = "sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB"
# set MasterLHCBCOND = "sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND"
Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c $MasterDDDB -s ~/tmp/DDDB-new # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c $MasterLHCBCOND -s ~/tmp/LHCBCOND-new
>
>
# copy_files_to_db.py -c $MasterDDDB -s ~/tmp/DDDB-new # copy_files_to_db.py -c $MasterLHCBCOND -s ~/tmp/LHCBCOND-new
 
  • Tag the new data either manually with the CondDB browser (boring but avoids creating duplicated tags) or automatically

Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python
>
>
# python
 Python 2.4.2 (#1, Mar 24 2006, 16:38:17) [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
Changed:
<
<
>>> from conddbui import CondDB
>
>
>>> from CondDBUI import CondDB
 >>> import os
>>> NewTag = "DC06-p1"
>>> MasterDDDB = CondDB("sqlite_file:%s/db/DDDB.db/DDDB"%os.environ["SQLDDDBROOT"],readOnly=False)

Revision 242007-12-05 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 48 to 48
 

Example

-->

Solution

Changed:
<
<
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace LHCBCOND with DDDB.
>
>
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace in the following recipes "LHCBCOND" with "DDDB".
 
Create the Copy
There are two equivalent ways to create a copy of the database, either via the CondDB Browser or via python commands that can be put in a script.
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# setenvLHCb v22r9
>
>
# setenvLHCb v23r1
 # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py & (this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
Changed:
<
<
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by cmt -pack=CondDBUI -path=Tools run 'echo $SQLITEDBPATH/LHCBCOND.db', which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
>
>
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by cmt -pack=CondDBUI -path=Tools run 'echo $SQLITEDBPATH/LHCBCOND.db', which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v3r0/db/LHCBCOND.db), then click "OK".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.
Line: 69 to 69
 
Using the Python commands
  • Open a python shell in the correct environment:

Changed:
<
<
# setenvLHCb v22r9
>
>
# setenvLHCb v23r1
 # cmt -pack=CondDBUI -path=Tools run python (this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
  • Execute the commands:
Line: 125 to 125
 # cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c -T -d
Changed:
<
<
A practical example to extract the current version of the detector descripion is:
>
>
A practical example to extract the current version of the detector description is:
 
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06-repro0710 -d /tmp/myDDDB
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06-repro0710 -d /tmp/myLHCBCOND

Revision 232007-11-30 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 127 to 127
  A practical example to extract the current version of the detector descripion is:
Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06 -d /tmp/myDDDB # cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06 -d /tmp/myLHCBCOND
>
>
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06-repro0710 -d /tmp/myDDDB # cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06-repro0710 -d /tmp/myLHCBCOND
  To use these XML files, it is enough to add to the default options:

Revision 222007-10-18 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 38 to 38
 

Explanation

The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.
Changed:
<
<
To define a condition in the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space-separated list in case of vectors).
>
>
To define a condition in the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space-separated list in case of vectors).
 Note: For LHCb < v22r8, if the condition contains more than on parameter, you also have to copy all the values you do not want to override.

Create and Use a Local Copy of the CondDB

Revision 212007-10-10 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 71 to 71
 
# setenvLHCb v22r9
# cmt -pack=CondDBUI -path=Tools run python
Changed:
<
<
(this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
>
>
(this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
 
  • Execute the commands:
    >>> from PyCoolCopy import copy

Revision 202007-10-08 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 128 to 128
 A practical example to extract the current version of the detector descripion is:
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06 -d /tmp/myDDDB
Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06 -d /tmp/myDDDB
>
>
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06 -d /tmp/myLHCBCOND
  To use these XML files, it is enough to add to the default options:

Revision 192007-10-08 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 57 to 57
 # setenvLHCb v22r9 # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py & (this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
Changed:
<
<
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by # echo $SQLITEDBPATH/LHCBCOND.db, which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
>
>
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by cmt -pack=CondDBUI -path=Tools run 'echo $SQLITEDBPATH/LHCBCOND.db', which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.

Revision 182007-10-08 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 54 to 54
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# SetupProject LHCb
>
>
# setenvLHCb v22r9
 # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py &
Added:
>
>
(this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
 
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by # echo $SQLITEDBPATH/LHCBCOND.db, which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
Line: 68 to 69
 
Using the Python commands
  • Open a python shell in the correct environment:

Changed:
<
<
# SetupProject LHCb
>
>
# setenvLHCb v22r9
 # cmt -pack=CondDBUI -path=Tools run python
Added:
>
>
(this will probably change in the future, the first line is needed to allow the second line to work, more details in InstallAreaWiki)
 
  • Execute the commands:
    >>> from PyCoolCopy import copy

Revision 172007-10-08 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Revision 162007-10-07 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 68 to 68
 
Using the Python commands
  • Open a python shell in the correct environment:

Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python
>
>
# SetupProject LHCb # cmt -pack=CondDBUI -path=Tools run python
 
  • Execute the commands:
    >>> from PyCoolCopy import copy
    >>> from os import environ
    >>> db_name = "LHCBCOND"
Changed:
<
<
>>> source_file = environ["LHCb_release_area"] + "/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db"
>
>
>>> source_file = environ["SQLITEDBPATH"] + "/LHCBCOND.db"
 >>> source = "sqlite://;schema=%s;dbname=%s"%(source_file, db_name)
>>> dest_file = environ["HOME"] + "/myLHCBCOND.db"
>>> dest = "sqlite://;schema=%s;dbname=%s"%(dest_file, db_name)

Revision 152007-10-05 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 54 to 54
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# SetupProject LHCb (And only now, when the previous script has been run, you can redefine:
# setenv User_release_area ...   
if you need. Only in this order.)
# cmt -pack=CondDBUI -path=Tools run python ../python/browser.py &   
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db which is always exactly what # echo $SQLITEDBPATH/LHCBCOND.db gives you), then click "OK".
>
>
# SetupProject LHCb # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py &
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (will be returned by # echo $SQLITEDBPATH/LHCBCOND.db, which currently is: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.

Revision 142007-10-04 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 54 to 54
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# setenvLHCb # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py &
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
>
>
# SetupProject LHCb (And only now, when the previous script has been run, you can redefine:
# setenv User_release_area ...   
if you need. Only in this order.)
# cmt -pack=CondDBUI -path=Tools run python ../python/browser.py &   
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db which is always exactly what # echo $SQLITEDBPATH/LHCBCOND.db gives you), then click "OK".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.

Revision 132007-10-03 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 54 to 54
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run python ../python/browser.py
>
>
# setenvLHCb # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py &
 
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
Line: 85 to 86
 
Use the Copy in Your Application
There are two possibilities:
  1. you created a local copy of the whole LHCBCOND database
Changed:
<
<
  1. you only copied few nodes
>
>
  1. you only copied a few nodes
 
Complete Copy
To use the local full copy of the database in your application, you have to override the default job options. Add at the end of your options file the line:
Line: 107 to 108
 CONDLayers.Layers = {'CondDBAccessSvc/CONDLocal', 'CondDBAccessSvc/LHCBCOND'}; ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
Changed:
<
<
The tag to use from your local has to be defined with the option CONDLocal.DefaultTAG.
>
>
The tag in this case has to be defined with the option CONDLocal.DefaultTAG.
 

Explanation

TODO

Revision 122007-10-03 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 164 to 164
 # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c $MasterDDDB -s ~/tmp/DDDB-new # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c $MasterLHCBCOND -s ~/tmp/LHCBCOND-new
Changed:
<
<
  • Tag the new data either manually with the CondDB browser (boring but avoids to create duplicated tags) or automatically
>
>
  • Tag the new data either manually with the CondDB browser (boring but avoids creating duplicated tags) or automatically
 
# cmt -pack=CondDBUI -path=Tools run python
Python 2.4.2 (#1, Mar 24 2006, 16:38:17)

Revision 112007-10-03 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 61 to 61
 
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.
  • Chose a string to use as "Database name" (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: "LHCBCOND".
Changed:
<
<
  • In the group "Selection Object Creation", you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely "DC06") of the database is achieved using Node = "/", Since = "1970-01-01 01:00:00", Until = "+inf" and selecting the tag in the list ("DC06"). If you want, you can select multiple tags.
  • In the group "Selection Object List", click on "Add" to schedule the selection we prepared for the copy. You can add many selections to the list.
>
>
  • In the group "Selection Object Creation", you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely "DC06") of the database is achieved by using Node = "/", Since = "1970-01-01 01:00:00", Until = "+inf" and selecting the tag in the list ("DC06"). If you want, you can select multiple tags.
  • In the group "Selection Objects List", click on "Add" to schedule the selection we prepared for the copy. You can add many selections to the list.
 
  • Now you can click on "Copy" to create the new database. You can also add the selected data to an already existing database using the button "Append".
The database is ready.
Using the Python commands
Line: 75 to 75
 >>> from PyCoolCopy import copy
>>> from os import environ
>>> db_name = "LHCBCOND"
Changed:
<
<
>>> source_file = environ["LHCb_release_area"] + "/DBASE/Det/SQLDDDB/v2r2/db/LHCBCOND.db"
>
>
>>> source_file = environ["LHCb_release_area"] + "/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db"
 >>> source = "sqlite://;schema=%s;dbname=%s"%(source_file, db_name)
>>> dest_file = environ["HOME"] + "/myLHCBCOND.db"
>>> dest = "sqlite://;schema=%s;dbname=%s"%(dest_file, db_name)
Line: 87 to 87
 
  1. you created a local copy of the whole LHCBCOND database
  2. you only copied few nodes
Complete Copy
Changed:
<
<
To use the local full copy of the database in your application, you have to override on of the default job options. Add at the end of your options file the line:
>
>
To use the local full copy of the database in your application, you have to override the default job options. Add at the end of your options file the line:
 
LHCBCOND.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";

Revision 102007-10-02 - AnatolySolomin

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 38 to 38
 

Explanation

The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.
Changed:
<
<
To define a condition you on the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space separated list in case of vectors).
Note: For LHCb < v22r8, if the condition contains more than on parameter, you have to copy all the values you do not want to override.
>
>
To define a condition in the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space-separated list in case of vectors).
Note: For LHCb < v22r8, if the condition contains more than on parameter, you also have to copy all the values you do not want to override.
 
Changed:
<
<

Create and Use a Local Copy the CondDB

>
>

Create and Use a Local Copy of the CondDB

 

Problem

If we want to test or validate a dynamic set of conditions (that change between events), we need to have a local copy of the conditions database.
<!--
Line: 56 to 56
 
# cmt -pack=CondDBUI -path=Tools run python ../python/browser.py
   
Changed:
<
<
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: $LHCb_release_area/DBASE/Det/SQLDDDB/v2r2/db/LHCBCOND.db), then click "OK".
>
>
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: /afs/cern.ch/lhcb/software/releases/DBASE/Det/SQLDDDB/v2r3/db/LHCBCOND.db), then click "OK".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.

Revision 92007-08-15 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 56 to 56
 
# cmt -pack=CondDBUI -path=Tools run python ../python/browser.py
   
Changed:
<
<
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: $LHCb_release_area/DBASE/Det/SQLDDDB/v1r0/db/LHCBCOND.db), then click "OK".
>
>
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: $LHCb_release_area/DBASE/Det/SQLDDDB/v2r2/db/LHCBCOND.db), then click "OK".
 
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.
Line: 75 to 75
 >>> from PyCoolCopy import copy
>>> from os import environ
>>> db_name = "LHCBCOND"
Changed:
<
<
>>> source_file = environ["LHCb_release_area"] + "/DBASE/Det/SQLDDDB/v1r0/db/LHCBCOND.db"
>
>
>>> source_file = environ["LHCb_release_area"] + "/DBASE/Det/SQLDDDB/v2r2/db/LHCBCOND.db"
 >>> source = "sqlite://;schema=%s;dbname=%s"%(source_file, db_name)
>>> dest_file = environ["HOME"] + "/myLHCBCOND.db"
>>> dest = "sqlite://;schema=%s;dbname=%s"%(dest_file, db_name)

Revision 82007-07-31 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 17 to 17
 

Problem

We need to know how the result of an application would change if we replace one or few conditions in the database with different static (not changing between two events) values.

Example

Changed:
<
<
The parameters used by the HLT alleys are in the conditions database and accessible from the detector transient store below the catalog "Conditions/Trigger".

Currently (CondDB tag "DC06") the condition "Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel" contains two parameters:

We want to see what changes to the data if we use a MaxIP of 3.2.
>
>
The position of the Velo halves are fixed in the "close" position. To reconstruct using the "open Velo" configuration, we need to modify the VeloLeft and VeloRight alignment conditions in order to move the right half of -30mm on X and the left one of 30mm on X.
 

Solution

We need to add to the option file of our application the following lines
UpdateManagerSvc.ConditionsOverride += {
Changed:
<
<
"Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel := double MinIP = 0.15; double MaxIP = 3.2;"
>
>
"Conditions/Alignment/Velo/VeloRight := double_v dPosXYZ = -30 0 0;", "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 30 0 0;"
 };
<!--
Line: 42 to 38
 

Explanation

The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.
Changed:
<
<
To define a condition you on the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space separated list in case of vectors).
Note: If the condition contains more than on parameter, you have to copy all the values you do not want to override.
>
>
To define a condition you on the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Alignment/Velo/VeloRight) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space separated list in case of vectors).
Note: For LHCb < v22r8, if the condition contains more than on parameter, you have to copy all the values you do not want to override.
 

Create and Use a Local Copy the CondDB

Problem

Line: 186 to 182
 TODO

Deleted:
<
<
-- MarcoClemencic - 05 Jul 2007
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 31 Jul 2007
 \ No newline at end of file

Revision 72007-07-12 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 129 to 129
  A practical example to extract the current version of the detector descripion is:
Changed:
<
<
# cmt -pack=CondDBUI -path=Tools run "python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06 -d /tmp/myDDDB" # cmt -pack=CondDBUI -path=Tools run "python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06 -d /tmp/myDDDB"
>
>
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06 -d /tmp/myDDDB # cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06 -d /tmp/myDDDB
  To use these XML files, it is enough to add to the default options:

Revision 62007-07-05 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 112 to 114
 The tag to use from your local has to be defined with the option CONDLocal.DefaultTAG.

Explanation

TODO
Added:
>
>

Generate XML Files from the Content of the CondDB

Problem

The CondDB is not particularly easy to browse and modify. In some cases, it may be useful to edit many XML files at the same time and, possibly, with editors that are validating the XML.
<!--

Example

-->

Solution

Since Tools/CondDBUI v2r4, a tool is available to extract a usable snapshot of the conditions database as XML files: dump_db_to_files.py. The usage is simple:
# cmt -pack=CondDBUI -path=Tools run python ../python/dump_db_to_files.py -c <connection string> -T <tag> -d <destination directory>

A practical example to extract the current version of the detector descripion is:

# cmt -pack=CondDBUI -path=Tools run "python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB' -T DC06 -d /tmp/myDDDB"
# cmt -pack=CondDBUI -path=Tools run "python ../python/dump_db_to_files.py -c 'sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND' -T DC06 -d /tmp/myDDDB"
To use these XML files, it is enough to add to the default options:
DetectorDataSvc.DetDbLocation = "/tmp/myDDDB/lhcb.xml";
 

Production Tasks

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:
Line: 161 to 186
 TODO

Deleted:
<
<
-- MarcoClemencic - 07 Mar 2007
 \ No newline at end of file
Added:
>
>
-- MarcoClemencic - 05 Jul 2007
 \ No newline at end of file

Revision 52007-04-20 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 50 to 50
 

Example

-->

Solution

Changed:
<
<
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Dersciption Database (former XmlDDDB), replace LHCBCOND with DDDB.
>
>
Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Description Database (former XmlDDDB), replace LHCBCOND with DDDB.
 
Create the Copy
Changed:
<
<
There are two equivalent ways to create a copy of the database, either via the CondDB Browser or via python commands tha can be put in a script.
>
>
There are two equivalent ways to create a copy of the database, either via the CondDB Browser or via python commands that can be put in a script.
 
Using the Graphical User Interface
  • First you have to start the CondDB Browser:

Line: 85 to 85
  The database is ready.
Use the Copy in Your Application
Changed:
<
<
To use the local copy of the database in your application, you have to override on of the default job options. Add at the end of your options file the line:
>
>
There are two possibilities:
  1. you created a local copy of the whole LHCBCOND database
  2. you only copied few nodes
Complete Copy
To use the local full copy of the database in your application, you have to override on of the default job options. Add at the end of your options file the line:
 
LHCBCOND.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
Line: 93 to 97
 
LHCBCOND.DefaultTAG = "my_tag";
Added:
>
>
or
LHCBCOND.DefaultTAG = "";
if you want to use the HEAD version of your local copy.
Partial Copy
The job options to use in case of a partial copy are a bit more complex (essentially the same ones reported below when discussing "Add new XML to the Conditions Database"):
CondDBDispatcherSvc.Alternatives = { '/Conditions=CondDBLayeringSvc/CONDLayers' };
CONDLayers.Layers = {'CondDBAccessSvc/CONDLocal', 'CondDBAccessSvc/LHCBCOND'};
CONDLocal.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
The tag to use from your local has to be defined with the option CONDLocal.DefaultTAG.
 

Explanation

TODO

Production Tasks

Revision 42007-04-19 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="LHCbComputing"

LHCb Conditions Database How-To

Line: 109 to 109
 
  • Modify the option file to be used for testing (e.g. LoadDDDB.opts in DetDescChecks) by appending the following lines:

Added:
>
>
# For DDDB
 MainAccessSvc = 'CondDBLayeringSvc/DDDBLayers';
Deleted:
<
<
CondDBDispatcherSvc.Alternatives = { '/Conditions=CondDBLayeringSvc/CONDLayers' };
 DDDBLayers.Layers = {'CondDBAccessSvc/DDDBNew', 'CondDBAccessSvc/DDDB'};
Deleted:
<
<
CONDLayers.Layers = {'CondDBAccessSvc/CONDNew', 'CondDBAccessSvc/LHCBCOND'};
 ConnectionString = "sqlite_file:$HOME/tmp/DDDB-new.db/DDDB";
Added:
>
>
# For LHCBCOND CondDBDispatcherSvc.Alternatives = { '/Conditions=CondDBLayeringSvc/CONDLayers' }; CONDLayers.Layers = {'CondDBAccessSvc/CONDNew', 'CondDBAccessSvc/LHCBCOND'};
 ConnectionString = "sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND";
  • If the validation is successful, add the XML files to the master database

Revision 32007-03-07 - MarcoClemencic

Line: 1 to 1
Changed:
<
<
META TOPICPARENT name="CondDBGettingStarted"
>
>
META TOPICPARENT name="LHCbComputing"
 

LHCb Conditions Database How-To

Table of Contents

Line: 14 to 14
 

Test and Development Tasks

Set the Content of a Condition Bypassing the CondDB

Problem

Changed:
<
<
We need to know how the result of an application would change if we replace of one or few conditions in the database with different static (not changing between two events) values.
>
>
We need to know how the result of an application would change if we replace one or few conditions in the database with different static (not changing between two events) values.
 

Example

The parameters used by the HLT alleys are in the conditions database and accessible from the detector transient store below the catalog "Conditions/Trigger".
Line: 43 to 43
  To define a condition you on the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space separated list in case of vectors).
Note: If the condition contains more than on parameter, you have to copy all the values you do not want to override.
Added:
>
>

Create and Use a Local Copy the CondDB

Problem

If we want to test or validate a dynamic set of conditions (that change between events), we need to have a local copy of the conditions database.
<!--

Example

-->

Solution

Here I shall show how to create a copy of the database containing the conditions (former XmlConditions). To create a copy of the Detector Dersciption Database (former XmlDDDB), replace LHCBCOND with DDDB.
Create the Copy
There are two equivalent ways to create a copy of the database, either via the CondDB Browser or via python commands tha can be put in a script.
Using the Graphical User Interface
  • First you have to start the CondDB Browser:
    # cmt -pack=CondDBUI -path=Tools run python ../python/browser.py
       
  • From the menu "DataBase" select the action "Open". In the dialog, as "DBLookup Alias", select "SQLite File" and in the file selection dialog select the SQLite file containing the official database (currently: $LHCb_release_area/DBASE/Det/SQLDDDB/v1r0/db/LHCBCOND.db), then click "OK".
  • Write "LHCBCOND" in the field "Database Name", then click on "Open DB".
  • Select from the menu "DataBase" the action "Slice".
  • Chose a name for the SQLite file you want to create and write it in the filed "SQLite file name" (you can also use the "..." button that will open a file selection dialog). I will chose the file "myLHCBCOND.db" in my home directory.
  • Chose a string to use as "Database name" (it can contain up to 8 upper case characters or "_", it is needed because one SQLite file may contain more independent databases). I suggest to keep the original one: "LHCBCOND".
  • In the group "Selection Object Creation", you can chose which nodes (foldersets or folders), for which period (since, until) and for which tag to copy. A copy of a whole version (namely "DC06") of the database is achieved using Node = "/", Since = "1970-01-01 01:00:00", Until = "+inf" and selecting the tag in the list ("DC06"). If you want, you can select multiple tags.
  • In the group "Selection Object List", click on "Add" to schedule the selection we prepared for the copy. You can add many selections to the list.
  • Now you can click on "Copy" to create the new database. You can also add the selected data to an already existing database using the button "Append".
The database is ready.
Using the Python commands
  • Open a python shell in the correct environment:
    # cmt -pack=CondDBUI -path=Tools run python
       
  • Execute the commands:
    >>> from PyCoolCopy import copy
    >>> from os import environ
    >>> db_name = "LHCBCOND"
    >>> source_file = environ["LHCb_release_area"] + "/DBASE/Det/SQLDDDB/v1r0/db/LHCBCOND.db"
    >>> source = "sqlite://;schema=%s;dbname=%s"%(source_file, db_name)
    >>> dest_file = environ["HOME"] + "/myLHCBCOND.db"
    >>> dest = "sqlite://;schema=%s;dbname=%s"%(dest_file, db_name)
    >>> copy(source, dest, tags = ['DC06'])
       
The database is ready.
Use the Copy in Your Application
To use the local copy of the database in your application, you have to override on of the default job options. Add at the end of your options file the line:
LHCBCOND.ConnectionString = "sqlite_file:$HOME/myLHCBCOND.db/LHCBCOND";
If you need to use a tag different from the one defined in the standard options (e.g. "my_tag"), add also the line:
LHCBCOND.DefaultTAG = "my_tag";

Explanation

TODO
 

Production Tasks

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:
Line: 91 to 143
 TODO

Changed:
<
<
-- MarcoClemencic - 27 Feb 2007
>
>
-- MarcoClemencic - 07 Mar 2007

Revision 22007-02-27 - MarcoClemencic

Line: 1 to 1
 
META TOPICPARENT name="CondDBGettingStarted"

LHCb Conditions Database How-To

Line: 44 to 44
 To define a condition you on the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space separated list in case of vectors).
Note: If the condition contains more than on parameter, you have to copy all the values you do not want to override.

Production Tasks

Added:
>
>

Add new XML to the Conditions Database

Users can provide new XML to be included in the CondDB in 2 formats:
  • XML files
  • an SQLite file

From XML files

  • Copy the modified files in dedicated directories, for example ~/tmp/DDDB-new and ~/tmp/LHCBCOND-new
  • Create COOL databases to be used as layers
    # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c sqlite_file:$HOME/tmp/DDDB-new.db/DDDB -s ~/tmp/DDDB-new
    # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND -s ~/tmp/LHCBCOND-new
       
  • Modify the option file to be used for testing (e.g. LoadDDDB.opts in DetDescChecks) by appending the following lines:
    CondDBDispatcherSvc.MainAccessSvc = 'CondDBLayeringSvc/DDDBLayers';
    CondDBDispatcherSvc.Alternatives = { '/Conditions=CondDBLayeringSvc/CONDLayers' };
    
    DDDBLayers.Layers = {'CondDBAccessSvc/DDDBNew', 'CondDBAccessSvc/DDDB'};
    CONDLayers.Layers = {'CondDBAccessSvc/CONDNew', 'CondDBAccessSvc/LHCBCOND'};
    
    DDDBNew.ConnectionString = "sqlite_file:$HOME/tmp/DDDB-new.db/DDDB";
    CONDNew.ConnectionString = "sqlite_file:$HOME/tmp/LHCBCOND-new.db/LHCBCOND";
       
  • If the validation is successful, add the XML files to the master database
    # set MasterDDDB = "sqlite_file:$SQLDDDBROOT/db/DDDB.db/DDDB"
    # set MasterLHCBCOND = "sqlite_file:$SQLDDDBROOT/db/LHCBCOND.db/LHCBCOND"
    # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c $MasterDDDB -s ~/tmp/DDDB-new
    # cmt -pack=CondDBUI -path=Tools run python ../python/copy_files_to_db.py -c $MasterLHCBCOND -s ~/tmp/LHCBCOND-new
       
  • Tag the new data either manually with the CondDB browser (boring but avoids to create duplicated tags) or automatically
    # cmt -pack=CondDBUI -path=Tools run python
    Python 2.4.2 (#1, Mar 24 2006, 16:38:17)
    [GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from conddbui import CondDB
    >>> import os
    >>> NewTag = "DC06-p1"
    >>> MasterDDDB = CondDB("sqlite_file:%s/db/DDDB.db/DDDB"%os.environ["SQLDDDBROOT"],readOnly=False)
    >>> MasterDDDB.recursiveTag("/",NewTag)
    >>> MasterLHCBCOND = CondDB("sqlite_file:%s/db/LHCBCOND.db/LHCBCOND"%os.environ["SQLDDDBROOT"],readOnly=False)
    >>> MasterLHCBCOND.recursiveTag("/",NewTag)
       

From SQLite files

TODO
 
Changed:
<
<
-- MarcoClemencic - 22 Feb 2007
>
>
-- MarcoClemencic - 27 Feb 2007

Revision 12007-02-22 - MarcoClemencic

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="CondDBGettingStarted"

LHCb Conditions Database How-To

Table of Contents

Overview

The aim of this page is to collect examples and instructions to allow the users of the LHCb Conditions Database (CondDB) to accomplish common CondDB related tasks.

The tasks are grouped in two areas:

  • test and development
  • production

Test and Development Tasks

Set the Content of a Condition Bypassing the CondDB

Problem

We need to know how the result of an application would change if we replace of one or few conditions in the database with different static (not changing between two events) values.

Example

The parameters used by the HLT alleys are in the conditions database and accessible from the detector transient store below the catalog "Conditions/Trigger".

Currently (CondDB tag "DC06") the condition "Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel" contains two parameters:

  • MinIP = 0.15
  • MaxIP = 3.0
We want to see what changes to the data if we use a MaxIP of 3.2.

Solution

We need to add to the option file of our application the following lines
UpdateManagerSvc.ConditionsOverride += {
"Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel :=
   double MinIP = 0.15;
   double MaxIP = 3.2;"
};
<!--
and be sure that somebody is registered as a user of that condition to the UpdateManagerSvc, for example adding to the initialize of your algorithm the line
  registerCondition<MyAlgorithm>("Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel");
Anyway this should be guarantee by the fact that something in the code is using the condition (e.g. the HLT alley algorithms). -->

Explanation

The UpdateManagerSvc is the manager of the used conditions. When somebody needs the overridden condition, the UpdateManagerSvc will replace it with the one provided via job options.

To define a condition you on the job options file, you have to add to the option UpdateManagerSvc.ConditionsOverride (array of strings) a string containing the path to the condition in the transient store (e.g. Conditions/Trigger/HltMuonAlley/HltMuonPreTriggerIPSel) followed by ':=' and by a ';' separated list of parameters. Each parameter in the form of type = value where type is any of int, double, string, int_v, double_v or string_v (the '_v' means vector of) and where value is the value you want to use (a space separated list in case of vectors).
Note: If the condition contains more than on parameter, you have to copy all the values you do not want to override.

Production Tasks

-- MarcoClemencic - 22 Feb 2007

 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback