3592c27f |
1 | #include "ARVersion.h" |
2 | |
a24be56b |
3 | void UpdateCDBIdealGeom(const char* cdbUri, const char* cfgFile){ |
4 | // Produce the ideal geometry and store it in the specified CDB |
5 | // The second argument allows to specify the config file to be used |
6 | // in particular for giving the choice to generate either a full or |
7 | // a partial geometry. |
8 | // |
9b8b014f |
9 | |
a24be56b |
10 | AliCDBManager* cdb = AliCDBManager::Instance(); |
11 | // we set the default storage to the repository because some dets require |
12 | // already at the time of geometry creation to find calibration objects in the cdb |
13 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); |
14 | AliCDBStorage* storage = cdb->GetStorage(cdbUri); |
15 | cdb->SetRun(0); |
9b8b014f |
16 | AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity()); |
17 | AliCDBMetaData *md= new AliCDBMetaData(); |
18 | |
a24be56b |
19 | // Get root and AliRoot versions |
9b8b014f |
20 | const char* rootv = gROOT->GetVersion(); |
a24be56b |
21 | gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C"); |
3592c27f |
22 | TString av(ALIROOT_SVN_BRANCH); |
23 | Int_t revnum = ALIROOT_SVN_REVISION; |
24 | |
25 | Printf("AliRoot %s, revision number %d",av.Data(),revnum); |
9b8b014f |
26 | |
a24be56b |
27 | md->SetAliRootVersion(av.Data()); |
3592c27f |
28 | md->SetComment(Form("Geometry produced with root version %s and AliRoot %s, revision number %d",rootv,av.Data(),revnum)); |
9b8b014f |
29 | |
a24be56b |
30 | gAlice->Init(cfgFile); |
9b8b014f |
31 | |
32 | if(!gGeoManager){ |
33 | Printf("Unable to produce a valid geometry to be put in the CDB!"); |
34 | return; |
35 | } |
36 | |
a24be56b |
37 | Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,av.Data()); |
38 | storage->Put(gGeoManager,id,md); |
39 | // This is to allow macros lauched after this one in the same session to find the |
40 | // newly produced geometry. |
41 | storage->QueryCDB(cdb->GetRun()); |
9b8b014f |
42 | |
43 | } |
a24be56b |
44 | |
45 | |