]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PMD/ocdbmacro/MakePMDDDLinfoCDB.C
Cleanup of ocdb macros:sjena
[u/mrichter/AliRoot.git] / PMD / ocdbmacro / MakePMDDDLinfoCDB.C
1 /**************************************************************************
2  * To Convert Ascii DDL file into DDL-CDB object
3  * sjena@cern.ch
4  * Mon Nov 22 19:54:27 CET 2010
5  *                     
6  **************************************************************************/
7 void MakePMDDDLinfoCDB()
8 {
9
10   AliCDBManager* man = AliCDBManager::Instance();
11   man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");   
12   //  man->SetDefaultStorage("local:///Users/basanta/ALISOFT/PMD/VarInit/OCDB");        
13   AliPMDddlinfoData *mapda = new AliPMDddlinfoData();
14
15   Int_t ddlno;
16   Int_t modno, totmod;
17   Int_t serialmodno[12];
18   //  Int_t moduleDDL[6] = {12,12,0,0,12,12};
19
20   ifstream infile;
21   infile.open("PMD_ddl_info.dat"); // ascii file
22   if(!infile) AliError("Could not open the DDL info file");
23
24
25   for(Int_t iddl = 0; iddl < 6; iddl++)
26     {
27       infile >> ddlno >> totmod;
28
29       mapda->SetNoOfModulePerDdl(iddl,totmod);
30
31       //printf("%d %d\n", ddlno, totmod);
32       if(totmod == 0) continue;
33
34       for(Int_t imod = 0; imod < 12; imod++)
35         {
36           infile >> modno;
37           serialmodno[imod] = modno;
38           //printf("%d \n", modno);
39         }
40
41       mapda->SetModuleNoPerDdl(iddl,serialmodno);
42     }
43
44   infile.close();
45   
46   infile.open("PMD_removed_chains.dat"); // ascii file
47   if(!infile) AliError("Could not open the DDL info file");
48
49   Int_t det, smn;
50   Int_t rows1, rowe1, cols1, cole1;
51   Int_t rows2, rowe2, cols2, cole2;
52
53   Int_t srowa[2][24];
54   Int_t erowa[2][24];
55   Int_t scola[2][24];
56   Int_t ecola[2][24];
57   Int_t srowb[2][24];
58   Int_t erowb[2][24];
59   Int_t scolb[2][24];
60   Int_t ecolb[2][24];
61
62
63   for(Int_t idet = 0; idet < 2; idet++)
64     {
65       for(Int_t ismn = 0; ismn < 24; ismn++)
66         {
67           infile >> det >> smn >> rows1 >> rowe1 >> cols1 >> cole1
68                      >> rows2 >> rowe2 >> cols2 >> cole2;
69       
70           srowa[idet][ismn] = rows1;
71           erowa[idet][ismn] = rowe1;
72           scola[idet][ismn] = cols1;
73           ecola[idet][ismn] = cole1;
74           srowb[idet][ismn] = rows2;
75           erowb[idet][ismn] = rowe2;
76           scolb[idet][ismn] = cols2;
77           ecolb[idet][ismn] = cole2;
78
79         }
80     }
81
82   mapda->SetStartRowA(srowa);
83   mapda->SetStartRowB(srowb);
84   mapda->SetStartColA(scola);
85   mapda->SetStartColB(scolb);
86   mapda->SetEndRowA(erowa);
87   mapda->SetEndRowB(erowb);
88   mapda->SetEndColA(ecola);
89   mapda->SetEndColB(ecolb);
90
91
92   AliCDBMetaData *md= new AliCDBMetaData();
93   md->SetResponsible("Basanta Nandi");
94   md->SetComment("DDL info for PMD");
95   
96   AliCDBId id("PMD/Calib/Ddlinfo",0,AliCDBRunRange::Infinity());
97
98   man->GetDefaultStorage()->Put(mapda,id, md);
99
100 }