]>
Commit | Line | Data |
---|---|---|
e8b7dc06 | 1 | void MakeEMCALAltroMapping(){ |
2 | // Create TObjArray of EMCAL altro mapping objects and | |
3 | // store it in the CDB | |
4 | // | |
5 | const char* macroname = "MakeEMCALAltroMapping.C"; | |
6 | ||
7 | TObjArray mappingsArray(6); | |
8 | ||
9 | TString path = gSystem->Getenv("ALICE_ROOT"); | |
10 | path += "/EMCAL/mapping/RCU"; | |
11 | TString path2; | |
12 | for(Int_t i = 0; i < 2; i++) { | |
13 | path2 = path; | |
14 | path2 += i; | |
15 | path2 += ".data"; | |
16 | AliAltroMapping *mapping = new AliCaloAltroMapping(path2.Data()); | |
17 | mappingsArray.Add(mapping); | |
18 | } | |
19 | ||
20 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ | |
21 | // save on file | |
22 | const char* filename = "EMCALAltroMapping.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,"EMCALAtroMappings","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("Jennifer Klay"); | |
49 | md->SetComment("Default ALTRO mapping for EMCAL"); | |
50 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
51 | AliCDBId id("EMCAL/Calib/Mapping",0,AliCDBRunRange::Infinity()); | |
52 | storage->Put(&mappingsArray,id,md); | |
53 | ||
54 | delete md; | |
55 | } | |
56 | ||
57 | mappingsArray.Delete(); | |
58 | ||
59 | } | |
60 |