/* ROOT Macro to generate all numbering believed to be relevant for EMCAL - at least as far as electronics is concerned. Includes FEE, TRU and LED information. Sorry if this macro does not quite adher to ALICE coding conventions (but on the other hand it is not used in AliRoot) Some further documentation is available at: http://cern.ch/dsilverm/mapping/emcal_mapping.html Author: David Silvermyr, ORNL; silvermy@mail.phy.ornl.gov */ /* First we define a number of constants; the main method EMCALNumbering starts below */ const int kDDLEqIdOffsetEMCAL = 0x1200; /* From AliDAQ; first equipment Id # for EMCAL*/ // global arrays for chip, channel and CSP numbering // - in the area covered by a single FEC (32 CSPs covering a 4x8 tower area) const int kNROWS = 8; const int kNCOLS = 4; const int kNCSP = 32; // the way CSPs are populated, as seen from the back where we // plug in the T-cards const int kCspMap[kNROWS][kNCOLS] = { 0, 16, 8, 24, // 7 1, 17, 9, 25, // | 2, 18, 10, 26, // | 3, 19, 11, 27, // row 4, 20, 12, 28, // | 5, 21, 13, 29, // | 6, 22, 14, 30, // | 7, 23, 15, 31 // 0 // 0 <-col-> 3 }; // i.e. the highest row comes first, and this map should thus be indexed as [NROWS-1-irow][icol] // - Csp help array is constructed below. /* The rest of the global Chan/Chip arrays are either fixed from the Altro mapping, or a function of the CspMap above */ // Altro mapping for chips and channels, high and low gain const int kChip[kNCSP] = { 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 0, 0, 4, 4, 4, 4, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 0, 0, 4, 4, 4, 4 }; const int kChanHigh[kNCSP] = { 10, 14, 5, 1, 1, 5, 14, 10, 10, 14, 5, 1, 1, 5, 14, 10, 8, 12, 7, 3, 3, 7, 12, 8, 8, 12, 7, 3, 3, 7, 12, 8 }; const int kChanLow[kNCSP] = { 11, 15, 4, 0, 0, 4, 15, 11, 11, 15, 4, 0, 0, 4, 15, 11, 9, 13, 6, 2, 2, 6, 13, 9, 9, 13, 6, 2, 2, 6, 13, 9 }; // Order that CSPs appear in the data const int kCspOrder[kNCSP] = { // just from ALTRO mapping of chips/channels to CSP 11, 27, 10, 26, 24, 8, 25, 9, 3, 19, 2, 18, 16, 0, 17, 1, 4, 20, 5, 21, 23, 7, 22, 6, 12, 28, 13, 29, 31, 15, 30, 14 }; // LED reference info: const int kNLED = 24; // per SuperModule; equals number of StripModules per SuperModule const int kNLEDPerTCard = kNLED / 2; // CSPs and LED are connected on a special T-card with only 12 connectors // Half of the StripModules in a SuperModule will be connected to the Top // (and half to the Bottom) T-card // First Top const int kCspMapLEDTop[kNLEDPerTCard] = { 1, 17, // Strips 0, 1 2, 18, // Strips 2, 3 3, 19, // Strips 4, 5 4, 20, // Strips 6, 7 5, 21, // Strips 8, 9 6, 22 // Strips 10,11 }; const int kStripModuleMapLEDTop[kNLEDPerTCard] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11 }; // Then Bottom const int kCspMapLEDBottom[kNLEDPerTCard] = { 9, 25, // Strips 12,13 10, 26, // Strips 14,15 11, 27, // Strips 16,17 12, 28, // Strips 18,19 13, 29, // Strips 20,21 14, 30 // Strips 22,23 }; const int kStripModuleMapLEDBottom[kNLEDPerTCard] = { 12,13, 14,15, 16,17, 18,19, 20,21, 22,23 }; // let's make some simpler/normal help index arrays too, that we'll use later on int ROW[kNCSP]; int COL[kNCSP]; int Csp[kNROWS][kNCOLS]; // Order that Towers, appear in the data int towerOrder[kNCSP]; void initTowers() { for(int icol=0; icolBranch("iside",&iside,"iside/I"); t->Branch("isect",&isect,"isect/I"); t->Branch("iSM",&iSM,"iSM/I"); t->Branch("iDDLEqId",&iDDLEqId,"iDDLEqId/I"); t->Branch("iFEC",&iFEC,"iFEC/I"); t->Branch("iTRU",&iTRU,"iTRU/I"); t->Branch("iTRUADC",&iTRUADC,"iTRUADC/I"); t->Branch("iRCU",&iRCU,"iRCU/I"); t->Branch("iBranch",&iBranch,"iBranch/I"); t->Branch("iGTL",&iGTL,"iGTL/I"); t->Branch("nTow",&nTow,"nTow/I"); t->Branch("CSP",CSP,"CSP[nTow]/I"); t->Branch("chip",chip,"chip[nTow]/I"); t->Branch("lowGainChan",lowGainChan,"lowGainChan[nTow]/I"); t->Branch("highGainChan",highGainChan,"highGainChan[nTow]/I"); t->Branch("towerCol",towerCol,"towerCol[nTow]/I"); t->Branch("towerRow",towerRow,"towerRow[nTow]/I"); t->Branch("towerOrder",towerOrder,"towerOrder[nTow]/I"); t->Branch("iTRUADCChan",iTRUADCChan,"iTRUADCChan[nTow]/I"); // LED TTree TTree *tLED = new TTree("tLED","ALICE EMCal LED reference map"); tLED->Branch("iside",&iside,"iside/I"); tLED->Branch("isect",&isect,"isect/I"); tLED->Branch("iSM",&iSM,"iSM/I"); tLED->Branch("iDDLEqId",&iDDLEqId,"iDDLEqId/I"); tLED->Branch("iRCU",&iRCU,"iRCU/I"); tLED->Branch("iBranch",&iBranch,"iBranch/I"); tLED->Branch("iGTL",&iGTL,"iGTL/I"); int nLED = kNLED; tLED->Branch("nLED",&nLED,"nLED/I"); int iLEDCSP[kNLED] = {0}; int iLEDchip[kNLED] = {0}; int iLEDhighGainChan[kNLED] = {0}; int iLEDlowGainChan[kNLED] = {0}; int iLEDStrip[kNLED] = {0}; tLED->Branch("iLEDCSP",iLEDCSP,"iLEDCSP[nLED]/I"); tLED->Branch("iLEDchip",iLEDchip,"iLEDchip[nLED]/I"); tLED->Branch("iLEDlowGainChan",iLEDlowGainChan,"iLEDlowGainChan[nLED]/I"); tLED->Branch("iLEDhighGainChan",iLEDhighGainChan,"iLEDhighGainChan[nLED]/I"); tLED->Branch("iLEDStrip",iLEDStrip,"iLEDStrip[nLED]/I"); // TRU TTree TTree *tTRU = new TTree("tTRU","ALICE EMCal TRU fake-altro map"); tTRU->Branch("iside",&iside,"iside/I"); tTRU->Branch("isect",&isect,"isect/I"); tTRU->Branch("iSM",&iSM,"iSM/I"); tTRU->Branch("iDDLEqId",&iDDLEqId,"iDDLEqId/I"); tTRU->Branch("iRCU",&iRCU,"iRCU/I"); tTRU->Branch("iBranch",&iBranch,"iBranch/I"); tTRU->Branch("iGTL",&iGTL,"iGTL/I"); // TRU is identified by (GTL==0 && !(Branch==0 && RCU==0)) int iTRUFirstChan = 0; int iTRULastChan = 127; // maximum allowed number of fake ALTRO channels=128 from TRU tTRU->Branch("iTRUFirstChan",&iTRUFirstChan,"iTRUFirstChan/I"); tTRU->Branch("iTRULastChan",&iTRULastChan,"iTRULastChan/I"); for (isect = 0; isect<(kNFullSect+kNThirdSect); isect++) { for (iside=0; isideFill(); } // iFEC // also handle special LED and TRU mapping iGTL = 0; // they are all in GTL/FEC slot 0 // start with LED.. iRCU = 0; iBranch = 0; iDDLEqId = kDDLEqIdOffsetEMCAL + iSM*kNRCU + iRCU; /* for the special 'half'/third sector, side C, there is no RCU=0.. So we put the LED in RCU=1 instead then. There is only 1 TRU in this sector (RCU=1, branch=1), so no problem.. */ if (MINTRU == 2) { // key for this special sector iRCU++; iDDLEqId++; } // loop over attached CSPs // First Top for (int iled = 0; iledFill(); // then we also have the TRUs (fake ALTRO) for (iTRU=MINTRU; iTRUFill(); } } // isect / iSM } // iside f->Write(); }