]>
Commit | Line | Data |
---|---|---|
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" | |
b0e25852 | 8 | #include "AliMC.h" |
a63b8f02 | 9 | #include <TROOT.h> |
10 | #include "AliRun.h" | |
11 | #include <TGeoManager.h> | |
12 | #include <TString.h> | |
b0e25852 | 13 | #include <TInterpreter.h> |
a63b8f02 | 14 | #endif |
3592c27f | 15 | |
a24be56b | 16 | void UpdateCDBIdealGeom(const char* cdbUri, const char* cfgFile){ |
17 | // Produce the ideal geometry and store it in the specified CDB | |
18 | // The second argument allows to specify the config file to be used | |
19 | // in particular for giving the choice to generate either a full or | |
20 | // a partial geometry. | |
21 | // | |
9b8b014f | 22 | |
a24be56b | 23 | AliCDBManager* cdb = AliCDBManager::Instance(); |
24 | // we set the default storage to the repository because some dets require | |
25 | // already at the time of geometry creation to find calibration objects in the cdb | |
860aa382 | 26 | AliCDBStorage* storage = 0; |
162637e4 | 27 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); |
860aa382 | 28 | storage = cdb->GetStorage(cdbUri); |
29 | if(!storage) | |
30 | { | |
31 | Printf("unable to create valid storage from: %s", cdbUri); | |
32 | return; | |
33 | } | |
a24be56b | 34 | cdb->SetRun(0); |
9b8b014f | 35 | AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity()); |
36 | AliCDBMetaData *md= new AliCDBMetaData(); | |
37 | ||
a24be56b | 38 | // Get root and AliRoot versions |
9b8b014f | 39 | const char* rootv = gROOT->GetVersion(); |
3592c27f | 40 | TString av(ALIROOT_SVN_BRANCH); |
41 | Int_t revnum = ALIROOT_SVN_REVISION; | |
42 | ||
a63b8f02 | 43 | Printf("root version: %s. AliRoot %s, revision number %d",rootv,av.Data(),revnum); |
9b8b014f | 44 | |
a24be56b | 45 | md->SetAliRootVersion(av.Data()); |
3592c27f | 46 | md->SetComment(Form("Geometry produced with root version %s and AliRoot %s, revision number %d",rootv,av.Data(),revnum)); |
9b8b014f | 47 | |
99a8afe3 | 48 | gROOT->LoadMacro(cfgFile); |
49 | gInterpreter->ProcessLine(gAlice->GetConfigFunction()); | |
50 | gAlice->GetMCApp()->Init(); | |
9b8b014f | 51 | |
52 | if(!gGeoManager){ | |
53 | Printf("Unable to produce a valid geometry to be put in the CDB!"); | |
54 | return; | |
55 | } | |
6f009629 | 56 | gGeoManager->DefaultColors(); // assign default colors according to Z of material |
57 | // (many colors turned into dark gray nuances some time ago, when the root palette was changed) | |
9b8b014f | 58 | |
a24be56b | 59 | Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,av.Data()); |
60 | storage->Put(gGeoManager,id,md); | |
61 | // This is to allow macros lauched after this one in the same session to find the | |
62 | // newly produced geometry. | |
63 | storage->QueryCDB(cdb->GetRun()); | |
9b8b014f | 64 | |
65 | } | |
a24be56b | 66 | |
67 |