From 876c757c0b0dae2823819c7ba5f4ec905a2922a8 Mon Sep 17 00:00:00 2001 From: cvetan Date: Tue, 30 Oct 2007 17:33:46 +0000 Subject: [PATCH] Macro to create the TPC altro mapping from the ascii files and store it in CDB. The corresponding CDB directory is added --- TPC/MakeTPCAltroMapping.C | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 TPC/MakeTPCAltroMapping.C diff --git a/TPC/MakeTPCAltroMapping.C b/TPC/MakeTPCAltroMapping.C new file mode 100644 index 00000000000..464acc8c595 --- /dev/null +++ b/TPC/MakeTPCAltroMapping.C @@ -0,0 +1,60 @@ +void MakeTPCAltroMapping(){ + // Create TObjArray of TPC altro mapping objects and + // store it in the CDB + // + const char* macroname = "MakeTPCAltroMapping.C"; + + TObjArray mappingsArray(6); + + TString path = gSystem->Getenv("ALICE_ROOT"); + path += "/TPC/mapping/Patch"; + TString path2; + for(Int_t i = 0; i < 6; i++) { + path2 = path; + path2 += i; + path2 += ".data"; + AliAltroMapping *mapping = new AliTPCAltroMapping(path2.Data()); + mappingsArray.Add(mapping); + } + + if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ + // save on file + const char* filename = "TPCAltroMapping.root"; + TFile f(filename,"RECREATE"); + if(!f){ + Error(macroname,"cannot open file for output\n"); + return; + } + Info(macroname,"Saving altro mapping objects to the file %s", filename); + f.cd(); + f.WriteObject(&mappingsArray,"TPCAtroMappings","kSingleKey"); + f.Close(); + }else{ + // save in CDB storage + TString Storage = gSystem->Getenv("STORAGE"); + if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { + Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); + return; + } + Info(macroname,"Saving altro mapping objects in CDB storage %s", + Storage.Data()); + AliCDBManager* cdb = AliCDBManager::Instance(); + AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); + if(!storage){ + Error(macroname,"Unable to open storage %s\n",Storage.Data()); + return; + } + AliCDBMetaData* md = new AliCDBMetaData(); + md->SetResponsible("Marian Ivanov"); + md->SetComment("Default ALTRO mapping for TPC"); + md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); + AliCDBId id("TPC/Calib/Mapping",0,AliCDBRunRange::Infinity()); + storage->Put(&mappingsArray,id,md); + + delete md; + } + + mappingsArray.Delete(); + +} + -- 2.43.5