1 // some global var/constants
2 const Int_t kNRCU = 2; // per SM
3 AliCaloAltroMapping *fMapping[4]; // 1 for each side (A/C) and each RCU (0/1), i.e. 2*2 total
5 const Bool_t kDebug = kFALSE;
6 const char *branchStr[] = {"A", "B"};
9 Int_t GetHWAddress(Int_t iside, Int_t icol, Int_t irow, Int_t igain);
10 void DecodeHWAddress(Int_t hwAddr, Int_t & branch, Int_t & FEC, Int_t & chip, Int_t & chan);
15 TowerToFEE(Int_t iSM=0, Int_t icol=0, Int_t irow=0, Int_t igain=0)
17 // Get mapping file info, and clear arrays
20 Int_t isect = iSM / 2; //
21 Int_t iside = iSM % 2; // A or C side
30 hwAddress = GetHWAddress(iside, icol, irow, igain, iRCU);
31 DecodeHWAddress(hwAddress, branch, FEC, chip, chan);
33 Int_t iDDL = iRCU + iSM * kNRCU;
35 // report channel info
36 printf(" iSM %d icol %d irow %d caloflag (igain) %d \n corresponds to \n iSM %d iRCU %d (iDDL %d EqId %d) : branch %d (%s) FEC %d chip %d chan %d\n",
37 iSM, icol, irow, igain,
38 iSM, iRCU, iDDL, iDDL + 0x1200,
39 branch, branchStr[branch], FEC, chip, chan);
45 DecodeHWAddress(Int_t hwAddr, Int_t & branch, Int_t & FEC, Int_t & chip, Int_t & chan)
48 chip = (hwAddr >> 4) & 0x7;
49 FEC = (hwAddr >> 7) & 0xf;
50 branch = (hwAddr >> 11) & 0x1;
55 GetHWAddress(Int_t iside, Int_t icol, Int_t irow, Int_t igain, Int_t & iRCU)
60 if (0<=irow&&irow<8) iRCU=0; // first cable row
61 else if (8<=irow&&irow<16 && 0<=icol&&icol<24) iRCU=0; // first half;
64 else if(8<=irow&&irow<16 && 24<=icol&&icol<48) iRCU=1; // second half;
66 else if(16<=irow&&irow<24) iRCU=1; // third cable row
68 // swap for odd=C side, to allow us to cable both sides the same
69 Int_t iRCUSide = iRCU;
72 iRCUSide = iRCU + 2; // to make it map file index
74 Int_t hwAddress = fMapping[iRCUSide]->GetHWAddress(irow, icol, igain);
82 TString sides[]={"A","C"};
83 // Read mapping files from $ALICE_ROOT/CALO/mapping/*.data
84 TString path = gSystem->Getenv("ALICE_ROOT");
85 path += "/EMCAL/mapping/RCU";
87 for(Int_t j = 0; j < 2; j++){ // sides
88 for(Int_t i = 0; i < 2; i++) { // RCU
93 if (kDebug) { printf("Mapping file: %s\n",path2.Data()); }
94 fMapping[j*2 + i] = new AliCaloAltroMapping(path2.Data());