]>
Commit | Line | Data |
---|---|---|
9bdcc572 | 1 | // $Id$ |
2 | /** | |
3 | * @file makeComponentConfigurationObject.C | |
4 | * @brief Creation of HLT component configuration objects in OCDB | |
5 | * | |
6 | * <pre> | |
7 | * Usage: aliroot -b -q makeComponentConfigurationObject.C'("path", "param", "uri", runmin, runmax)' | |
8 | * </pre> | |
9 | * | |
10 | * Create an OCDB entry with a TObjString containing param. | |
11 | * Many HLT components understand configuration strings containing | |
12 | * arguments and parameters just like the command line arguments. | |
13 | * This macro facilitates the creation of an appropriate object | |
14 | * from a parameter string. | |
15 | * | |
16 | * Parameters: <br> | |
17 | * - path path of the entry within the OCDB | |
18 | * - param (opt) string to be stored in the TObjSting, default empty | |
19 | * - uri (opt) the OCDB URI, default $ALICE_ROOT | |
20 | * - runmin (opt) default 0 | |
21 | * - runmax (opt) default 999999999 | |
22 | * | |
23 | * Note: The configuration procedure of an HLT component is not | |
24 | * restricted to that scheme. The implementation is up to the | |
25 | * developer and more complex objects are possible. | |
26 | * | |
27 | * @author Matthias.Richter@ift.uib.no | |
28 | * @ingroup alihlt_tutorial | |
29 | */ | |
30 | void makeComponentConfigurationObject(const char* path, const char* param="", | |
31 | const char* cdbUri=NULL, | |
32 | int runmin=0, | |
33 | int runmax=999999999) | |
34 | { | |
35 | AliCDBManager* man = AliCDBManager::Instance(); | |
36 | if (!man) { | |
37 | cerr << "can not get AliCDBManager" << end; | |
38 | exit; | |
39 | } | |
40 | TString storage; | |
41 | if (!man->IsDefaultStorageSet()) { | |
42 | if (cdbUri) { | |
43 | storage=cdbUri; | |
84683b66 | 44 | if (storage.Contains("://")==0) { |
9bdcc572 | 45 | storage="local://"; storage+=cdbUri; |
46 | } | |
47 | } else { | |
48 | storage="local://$ALICE_ROOT/OCDB"; | |
49 | } | |
50 | man->SetDefaultStorage(storage); | |
51 | } else { | |
52 | storage = man->GetDefaultStorage()->GetURI(); | |
53 | } | |
54 | ||
55 | // here is the actual content of the configuration object | |
56 | TObjString obj=param; | |
57 | AliCDBPath cdbPath(path); | |
58 | AliCDBId cdbId(cdbPath, runmin, runmax); | |
59 | AliCDBMetaData cdbMetaData; | |
60 | man->Put(&obj, cdbId, &cdbMetaData); | |
61 | cout << "adding TObjString type OCDB object " << path << " (" << (param[0]==0?"<empty>":param) << ") [" << runmin << "," << runmax << "] in " << storage << endl; | |
62 | } | |
63 | ||
64 | void makeComponentConfigurationObject() | |
65 | { | |
66 | cout << "===============================================================" << endl; | |
67 | cout << "usage: aliroot -b -q -l makeComponentConfigurationObject.C'(\"path\", \"param\", \"uri\", rangemin, rangemax)'" << endl << endl; | |
68 | cout << " path path of the entry within the OCDB" << endl; | |
69 | cout << " param (opt) string to be stored in the TObjSting, default empty" << endl; | |
a51a0599 | 70 | cout << " uri (opt) the OCDB URI, default $ALICE_ROOT/OCDB " << endl; |
9bdcc572 | 71 | cout << " rangemin (opt) default 0" << endl; |
72 | cout << " rangemax (opt) default 999999999" << endl; | |
73 | cout << "===============================================================" << endl; | |
74 | } |