]>
Commit | Line | Data |
---|---|---|
1 | #include "ARVersion.h" | |
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 | |
13 | ||
14 | void 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 | // | |
20 | ||
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 | AliCDBStorage* storage = 0; | |
25 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
26 | storage = cdb->GetStorage(cdbUri); | |
27 | if(!storage) | |
28 | { | |
29 | Printf("unable to create valid storage from: %s", cdbUri); | |
30 | return; | |
31 | } | |
32 | cdb->SetRun(0); | |
33 | AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity()); | |
34 | AliCDBMetaData *md= new AliCDBMetaData(); | |
35 | ||
36 | // Get root and AliRoot versions | |
37 | const char* rootv = gROOT->GetVersion(); | |
38 | TString av(ALIROOT_SVN_BRANCH); | |
39 | Int_t revnum = ALIROOT_SVN_REVISION; | |
40 | ||
41 | Printf("root version: %s. AliRoot %s, revision number %d",rootv,av.Data(),revnum); | |
42 | ||
43 | md->SetAliRootVersion(av.Data()); | |
44 | md->SetComment(Form("Geometry produced with root version %s and AliRoot %s, revision number %d",rootv,av.Data(),revnum)); | |
45 | ||
46 | gROOT->LoadMacro(cfgFile); | |
47 | gInterpreter->ProcessLine(gAlice->GetConfigFunction()); | |
48 | gAlice->GetMCApp()->Init(); | |
49 | ||
50 | if(!gGeoManager){ | |
51 | Printf("Unable to produce a valid geometry to be put in the CDB!"); | |
52 | return; | |
53 | } | |
54 | gGeoManager->DefaultColors(); // assign default colors according to Z of material | |
55 | // (many colors turned into dark gray nuances some time ago, when the root palette was changed) | |
56 | ||
57 | Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,av.Data()); | |
58 | storage->Put(gGeoManager,id,md); | |
59 | // This is to allow macros lauched after this one in the same session to find the | |
60 | // newly produced geometry. | |
61 | storage->QueryCDB(cdb->GetRun()); | |
62 | ||
63 | } | |
64 | ||
65 |