]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GRP/UpdateCDBIdealGeom.C
f6978220b4f6c9dec8b013a23c9dc525e73ee662
[u/mrichter/AliRoot.git] / GRP / UpdateCDBIdealGeom.C
1 #include "ARVersion.h"
2
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   //
9
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);
16   AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity());
17   AliCDBMetaData *md= new AliCDBMetaData();
18
19   // Get root and AliRoot versions
20   const char* rootv = gROOT->GetVersion();
21   gROOT->ProcessLine(".L $ALICE_ROOT/macros/GetARversion.C");
22   TString av(ALIROOT_SVN_BRANCH);
23   Int_t revnum = ALIROOT_SVN_REVISION;
24
25   Printf("AliRoot %s, revision number %d",av.Data(),revnum);
26
27   md->SetAliRootVersion(av.Data());
28   md->SetComment(Form("Geometry produced with root version %s and AliRoot %s, revision number %d",rootv,av.Data(),revnum));
29   
30   gAlice->Init(cfgFile);
31   
32   if(!gGeoManager){
33     Printf("Unable to produce a valid geometry to be put in the CDB!");
34     return;
35   }
36   
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());
42
43 }
44
45