+ Int_t parity;
+
+ const Int_t kMaxBus = 51; // BKN
+ Int_t totPatchBus, bPatchBus, ePatchBus;
+ Int_t ibus, totmcm, rows, cols, rowe, cole;
+ Int_t moduleno;
+ Int_t busno = 0;
+ Int_t patchBusNo[kMaxBus], mcmperBus[kMaxBus];
+ Int_t startRowBus[kMaxBus], startColBus[kMaxBus];
+ Int_t endRowBus[kMaxBus], endColBus[kMaxBus];
+
+ Int_t beginPatchBus = -1;
+ Int_t endPatchBus = -1;
+ for(Int_t i = 0; i < kMaxBus; i++)
+ {
+ patchBusNo[i] = -1;
+ mcmperBus[i] = -1;
+ startRowBus[i] = -1;
+ startColBus[i] = -1;
+ endRowBus[i] = -1;
+ endColBus[i] = -1;
+ }
+
+
+ TString fileName(gSystem->Getenv("ALICE_ROOT"));
+
+ if(ddlno == 0)
+ {
+ fileName += "/PMD/PMD_Mapping_ddl0.dat";
+ }
+ else if(ddlno == 1)
+ {
+ fileName += "/PMD/PMD_Mapping_ddl1.dat";
+ }
+ else if(ddlno == 2)
+ {
+ fileName += "/PMD/PMD_Mapping_ddl2.dat";
+ }
+ else if(ddlno == 3)
+ {
+ fileName += "/PMD/PMD_Mapping_ddl3.dat";
+ }
+ else if(ddlno == 4)
+ {
+ fileName += "/PMD/PMD_Mapping_ddl4.dat";
+ }
+ else if(ddlno == 5)
+ {
+ fileName += "/PMD/PMD_Mapping_ddl5.dat";
+ }
+
+ ifstream infile;
+ infile.open(fileName.Data(), ios::in); // ascii file
+ if(!infile)
+ AliError(Form("Could not read the mapping file for DDL No = %d",ddlno));
+
+ for (Int_t im = 0; im < modulePerDDL; im++)
+ {
+ infile >> moduleno;
+ infile >> totPatchBus >> bPatchBus >> ePatchBus;
+
+ if (totPatchBus == 0) continue; // BKN
+
+ if (moduleno == imodule)
+ {
+ beginPatchBus = bPatchBus;
+ endPatchBus = ePatchBus;
+ }
+
+ for(Int_t i=0; i<totPatchBus; i++)
+ {
+ infile >> ibus >> totmcm >> rows >> rowe >> cols >> cole;
+
+ if (moduleno == imodule)
+ {
+ patchBusNo[ibus] = ibus;
+ mcmperBus[ibus] = totmcm;
+ startRowBus[ibus] = rows;
+ startColBus[ibus] = cols;
+ endRowBus[ibus] = rowe;
+ endColBus[ibus] = cole;
+ }
+ }
+
+ }
+
+ infile.close();
+
+ // Read if some chains are off
+ TString rchainName(gSystem->Getenv("ALICE_ROOT"));
+ rchainName += "/PMD/PMD_removed_chains.dat";
+
+ ifstream rchainfile;
+ rchainfile.open(rchainName.Data(), ios::in); // ascii file
+ if(!rchainfile)AliError("Could not read the removed cahins file");
+
+ Int_t srowoff1[2][24], erowoff1[2][24];
+ Int_t scoloff1[2][24], ecoloff1[2][24];
+ Int_t srowoff2[2][24], erowoff2[2][24];
+ Int_t scoloff2[2][24], ecoloff2[2][24];
+
+ Int_t rows1, rowe1, cols1, cole1;
+ Int_t rows2, rowe2, cols2, cole2;
+
+ for (Int_t im = 0; im < 48; im++)
+ {
+ rchainfile >> det >> smn >> rows1 >> rowe1 >> cols1 >> cole1
+ >> rows2 >> rowe2 >> cols2 >> cole2;
+
+ srowoff1[det][smn] = rows1;
+ erowoff1[det][smn] = rowe1;
+ scoloff1[det][smn] = cols1;
+ ecoloff1[det][smn] = cole1;
+ srowoff2[det][smn] = rows2;
+ erowoff2[det][smn] = rowe2;
+ scoloff2[det][smn] = cols2;
+ ecoloff2[det][smn] = cole2;
+ }
+
+ rchainfile.close();