]> git.uio.no Git - u/mrichter/AliRoot.git/blob - GRP/UpdateCDBIdealGeom.C
AliTPCcalibPulser added (repalcing AliTPCCalibSignal)
[u/mrichter/AliRoot.git] / GRP / UpdateCDBIdealGeom.C
1 void UpdateCDBIdealGeom(){
2   // produce the ideal geometry with the current AliRoot and store it in the
3   // CDB
4
5   AliCDBManager* man = AliCDBManager::Instance();
6   man->SetDefaultStorage("local://$ALICE_ROOT");
7   man->SetRun(0);
8   AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity());
9   AliCDBMetaData *md= new AliCDBMetaData();
10
11   // Get root version
12   const char* rootv = gROOT->GetVersion();
13
14   // Get AliRoot version from file to set it in the metadata of the entry
15   TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ");
16   Int_t size = fv->GetSize();
17   char *buf = new Char_t[size];
18   memset(buf, '\0', size);
19   fv->Seek(0);
20   char* alirootv;
21   if ( fv->ReadBuffer(buf, size) ) {
22     Printf("Error reading AliRoot version from file to buffer!");
23     alirootv = "";
24   }
25   if(buf=="AliRoot"){
26     alirootv="HEAD";
27   }else{
28     alirootv = buf;
29     md->SetAliRootVersion(alirootv);
30     md->SetComment(Form("Geometry produced with root version %s and AliRoot version %s",rootv,alirootv));
31   }
32   
33   gAlice->Init();
34   
35   if(!gGeoManager){
36     Printf("Unable to produce a valid geometry to be put in the CDB!");
37     return;
38   }
39   
40   Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,alirootv);
41   man->Put(gGeoManager,id,md);
42
43 }