]>
Commit | Line | Data |
---|---|---|
a7a1dd76 | 1 | /// \file MakeTPCAltroMapping.C |
2 | /// | |
3 | /// \brief Create TObjArray of TPC altro mapping objects and store it in the CDB | |
4 | ||
5 | void MakeTPCAltroMapping() { | |
6 | ||
876c757c | 7 | const char* macroname = "MakeTPCAltroMapping.C"; |
8 | ||
9 | TObjArray mappingsArray(6); | |
10 | ||
11 | TString path = gSystem->Getenv("ALICE_ROOT"); | |
12 | path += "/TPC/mapping/Patch"; | |
13 | TString path2; | |
14 | for(Int_t i = 0; i < 6; i++) { | |
15 | path2 = path; | |
16 | path2 += i; | |
17 | path2 += ".data"; | |
18 | AliAltroMapping *mapping = new AliTPCAltroMapping(path2.Data()); | |
19 | mappingsArray.Add(mapping); | |
20 | } | |
21 | ||
22 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ | |
23 | // save on file | |
24 | const char* filename = "TPCAltroMapping.root"; | |
25 | TFile f(filename,"RECREATE"); | |
26 | if(!f){ | |
27 | Error(macroname,"cannot open file for output\n"); | |
28 | return; | |
29 | } | |
30 | Info(macroname,"Saving altro mapping objects to the file %s", filename); | |
31 | f.cd(); | |
32 | f.WriteObject(&mappingsArray,"TPCAtroMappings","kSingleKey"); | |
33 | f.Close(); | |
34 | }else{ | |
35 | // save in CDB storage | |
36 | TString Storage = gSystem->Getenv("STORAGE"); | |
37 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
38 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
39 | return; | |
40 | } | |
41 | Info(macroname,"Saving altro mapping objects in CDB storage %s", | |
42 | Storage.Data()); | |
43 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
44 | AliCDBStorage* storage = cdb->GetStorage(Storage.Data()); | |
45 | if(!storage){ | |
46 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
47 | return; | |
48 | } | |
49 | AliCDBMetaData* md = new AliCDBMetaData(); | |
50 | md->SetResponsible("Marian Ivanov"); | |
51 | md->SetComment("Default ALTRO mapping for TPC"); | |
52 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
53 | AliCDBId id("TPC/Calib/Mapping",0,AliCDBRunRange::Infinity()); | |
54 | storage->Put(&mappingsArray,id,md); | |
55 | ||
56 | delete md; | |
57 | } | |
58 | ||
59 | mappingsArray.Delete(); | |
60 | ||
61 | } | |
62 |