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