From 9b8b014fd4750a37cd7e9fd9b6a1fb31940f41e4 Mon Sep 17 00:00:00 2001 From: cvetan Date: Thu, 5 Jul 2007 13:22:41 +0000 Subject: [PATCH] Macro to generate the CDB entry with the ideal geometry (Raffaele) --- GRP/UpdateCDBIdealGeom.C | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 GRP/UpdateCDBIdealGeom.C diff --git a/GRP/UpdateCDBIdealGeom.C b/GRP/UpdateCDBIdealGeom.C new file mode 100644 index 00000000000..159cfe1b7b6 --- /dev/null +++ b/GRP/UpdateCDBIdealGeom.C @@ -0,0 +1,43 @@ +void UpdateCDBIdealGeom(){ + // produce the ideal geometry with the current AliRoot and store it in the + // CDB + + AliCDBManager* man = AliCDBManager::Instance(); + man->SetDefaultStorage("local://$ALICE_ROOT"); + man->SetRun(0); + AliCDBId id("GRP/Geometry/Data",0,AliCDBRunRange::Infinity()); + AliCDBMetaData *md= new AliCDBMetaData(); + + // Get root version + const char* rootv = gROOT->GetVersion(); + + // Get AliRoot version from file to set it in the metadata of the entry + TFile *fv= TFile::Open("$ALICE_ROOT/CVS/Repository?filetype=raw","READ"); + Int_t size = fv->GetSize(); + char *buf = new Char_t[size]; + memset(buf, '\0', size); + fv->Seek(0); + char* alirootv; + if ( fv->ReadBuffer(buf, size) ) { + Printf("Error reading AliRoot version from file to buffer!"); + alirootv = ""; + } + if(buf=="AliRoot"){ + alirootv="HEAD"; + }else{ + alirootv = buf; + md->SetAliRootVersion(alirootv); + md->SetComment(Form("Geometry produced with root version %s and AliRoot version %s",rootv,alirootv)); + } + + gAlice->Init(); + + if(!gGeoManager){ + Printf("Unable to produce a valid geometry to be put in the CDB!"); + return; + } + + Printf("Storing in CDB geometry produced with root version %s and AliRoot version %s",rootv,alirootv); + man->Put(gGeoManager,id,md); + +} -- 2.39.3