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