]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/MakeEMCALAltroMapping.C
Removing comment for "magic" lines to correctly read raw tag files.
[u/mrichter/AliRoot.git] / EMCAL / MakeEMCALAltroMapping.C
CommitLineData
e8b7dc06 1void 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;
21cad85c 12 TString side[] = {"A","C"};//+ and - pseudarapidity supermodules
13 for(Int_t j = 0; j < 2; j++){
14 for(Int_t i = 0; i < 2; i++) {
15 path2 = path;
16 path2 += i;
17 path2 +=side[j];
18 path2 += ".data";
19 printf("File: %s\n",path2.Data());
20 AliAltroMapping *mapping = new AliCaloAltroMapping(path2.Data());
21 mappingsArray.Add(mapping);
22 }
e8b7dc06 23 }
21cad85c 24
e8b7dc06 25 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
26 // save on file
27 const char* filename = "EMCALAltroMapping.root";
28 TFile f(filename,"RECREATE");
29 if(!f){
30 Error(macroname,"cannot open file for output\n");
31 return;
32 }
33 Info(macroname,"Saving altro mapping objects to the file %s", filename);
34 f.cd();
35 f.WriteObject(&mappingsArray,"EMCALAtroMappings","kSingleKey");
36 f.Close();
37 }else{
38 // save in CDB storage
39 TString Storage = gSystem->Getenv("STORAGE");
40 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
41 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
42 return;
43 }
44 Info(macroname,"Saving altro mapping objects in CDB storage %s",
45 Storage.Data());
46 AliCDBManager* cdb = AliCDBManager::Instance();
47 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
48 if(!storage){
49 Error(macroname,"Unable to open storage %s\n",Storage.Data());
50 return;
51 }
52 AliCDBMetaData* md = new AliCDBMetaData();
53 md->SetResponsible("Jennifer Klay");
54 md->SetComment("Default ALTRO mapping for EMCAL");
55 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
56 AliCDBId id("EMCAL/Calib/Mapping",0,AliCDBRunRange::Infinity());
57 storage->Put(&mappingsArray,id,md);
58
59 delete md;
60 }
61
62 mappingsArray.Delete();
63
64}
65