Mapping file put in the CDB
[u/mrichter/AliRoot.git] / PMD / CreateMappingCDB.C
CommitLineData
c3217637 1void CreateMappingCDB()
2{
3
4 AliCDBManager* man = AliCDBManager::Instance();
5 man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
6 AliPMDMappingData *mapda = new AliPMDMappingData();
7
8
9 Int_t moduleno, totPatchBus, bPatchBus, ePatchBus;
10 Int_t ibus, totmcm, rows, rowe, cols, cole;
11 Int_t moduleDDL[6] = {12,12,0,0,12,12};
12
13 ifstream infile;
14
15
16
17 for(Int_t iddl = 0; iddl < 6; iddl++)
18 {
19 if(iddl == 0) infile.open("PMD_Mapping_ddl0.dat"); // ascii file
20 if(iddl == 1) infile.open("PMD_Mapping_ddl1.dat"); // ascii file
21 if(iddl == 2) infile.open("PMD_Mapping_ddl2.dat"); // ascii file
22 if(iddl == 3) infile.open("PMD_Mapping_ddl3.dat"); // ascii file
23 if(iddl == 4) infile.open("PMD_Mapping_ddl4.dat"); // ascii file
24 if(iddl == 5) infile.open("PMD_Mapping_ddl5.dat"); // ascii file
25
26 if(!infile)
27 AliError("Could not read the mapping file for DDL No = 0");
28
29 Int_t modulePerDDL = moduleDDL[iddl];
30
31 for (Int_t im = 0; im < modulePerDDL; im++)
32 {
33 infile >> moduleno;
34 infile >> totPatchBus >> bPatchBus >> ePatchBus;
35
36 if (totPatchBus == 0) continue;
37
38 for(Int_t i=0; i<totPatchBus; i++)
39 {
40 infile >> ibus >> totmcm >> rows >> rowe >> cols >> cole;
41
42 printf("%d %d %d %d %d %d %d %d \n",moduleno,totPatchBus,
43 ibus,totmcm,rows,rowe,cols,cole);
44
45 mapda->SetModuleNo(iddl,ibus,moduleno);
46 mapda->SetMcmperBus(iddl,ibus,totmcm);
47 mapda->SetRowBus(iddl,ibus,rows,rowe);
48 mapda->SetColBus(iddl,ibus,cols,cole);
49
50
51 }
52
53 }
54
55 infile.close();
56
57 }
58
59 AliCDBMetaData *md= new AliCDBMetaData();
60 md->SetResponsible("Basanta Nandi");
61 md->SetComment("Patchbus Mapping info for PMD");
62
63 AliCDBId id("PMD/Calib/Mapping",0,AliCDBRunRange::Infinity());
64
65 man->GetDefaultStorage()->Put(mapda,id, md);
66
67}