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