diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.cxx b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.cxx index e0c7dddaa64aad28657eb5bf56dfab2ccfdb48da..66624c9122a78959dc9f1c2e40b7ec130c49eb0f 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.cxx +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.cxx @@ -34,6 +34,7 @@ StatusCode gFexInputByteStreamTool::initialize() { ConversionMode gTowersmode = getConversionMode(m_gTowersReadKey, m_gTowersWriteKey, msg()); ATH_CHECK(gTowersmode!=ConversionMode::Undefined); ATH_CHECK(m_gTowersWriteKey.initialize(gTowersmode==ConversionMode::Decoding)); + ATH_CHECK(m_gTowers50WriteKey.initialize(gTowersmode==ConversionMode::Decoding)); ATH_CHECK(m_gTowersReadKey.initialize(gTowersmode==ConversionMode::Encoding)); ATH_MSG_DEBUG((gTowersmode==ConversionMode::Encoding ? "Encoding" : "Decoding") << " gTowers "); @@ -56,7 +57,11 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> //---gTower EDM SG::WriteHandle<xAOD::gFexTowerContainer> gTowersContainer(m_gTowersWriteKey, ctx); ATH_CHECK(gTowersContainer.record(std::make_unique<xAOD::gFexTowerContainer>(), std::make_unique<xAOD::gFexTowerAuxContainer>())); - ATH_MSG_DEBUG("Recorded gFexTowerContainer with key " << gTowersContainer.key()); + ATH_MSG_DEBUG("Recorded gFexTowerContainer (200 MeV resolution, default) with key " << gTowersContainer.key()); + + SG::WriteHandle<xAOD::gFexTowerContainer> gTowers50Container(m_gTowers50WriteKey, ctx); + ATH_CHECK(gTowers50Container.record(std::make_unique<xAOD::gFexTowerContainer>(), std::make_unique<xAOD::gFexTowerAuxContainer>())); + ATH_MSG_DEBUG("Recorded gFexTower50Container (50 MeV resolution) with key " << gTowers50Container.key()); // Iterate over ROBFragments to decode for (const ROBF* rob : vrobf) { @@ -140,30 +145,35 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> gtFPGA Btwr = {{{0}}}; gtFPGA Ctwr = {{{0}}}; - gtFPGA AtwrS = {{{0}}}; - gtFPGA BtwrS = {{{0}}}; - gtFPGA CtwrS = {{{0}}}; + gtFPGA AtwrF = {{{0}}}; + gtFPGA BtwrF = {{{0}}}; + gtFPGA CtwrF = {{{0}}}; + + gtFPGA Asatur = {{{0}}}; + gtFPGA Bsatur = {{{0}}}; + gtFPGA Csatur = {{{0}}}; a_gtrx_map(Afiber, AMapped); int fpgaA = 0; - // int puCorrA = 0; int fBcidA = -1; int do_lconv = 1; gtReconstructABC(fpgaA, AMapped, // input fibers AB_FIBER = 80 > C fibers gPos::AB_FIBERS, - Atwr, &fBcidA, + AtwrF, + Atwr, + &fBcidA, do_lconv, // flag to indicate multilinear conversion gPos::AMPD_NFI, gPos::ACALO_TYPE, gPos::AMPD_GTRN_ARR, gPos::AMPD_DSTRT_ARR, gPos::AMPD_DTYP_ARR, - gPos::AMSK ); + gPos::AMSK, + Asatur ); - gtRescale(Atwr, AtwrS, 4); b_gtrx_map(Bfiber, BMapped); @@ -172,16 +182,17 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> gtReconstructABC( fpgaB, BMapped, gPos::AB_FIBERS, - Btwr, &fBcidB, + BtwrF, + Btwr, + &fBcidB, do_lconv, gPos::BMPD_NFI, gPos::BCALO_TYPE, gPos::BMPD_GTRN_ARR, gPos::BMPD_DSTRT_ARR, gPos::BMPD_DTYP_ARR, - gPos::BMSK ); - - gtRescale(Btwr, BtwrS, 4); + gPos::BMSK, + Bsatur ); c_gtrx_map(Cfiber, CMapped); @@ -190,16 +201,17 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> gtReconstructABC( fpgaC, CMapped, gPos::C_FIBERS, - Ctwr, &fBcidC, + CtwrF, + Ctwr, + &fBcidC, do_lconv, gPos::CMPD_NFI, gPos::CCALO_TYPE, gPos::CMPD_GTRN_ARR, gPos::CMPD_DSTRT_ARR, gPos::CMPD_DTYP_ARR, - gPos::CMSK ); - - gtRescale(Ctwr, CtwrS, 4); + gPos::CMSK, + Csatur ); // Fill the gTower EDM with the corresponding towers int iEta = 0; @@ -207,6 +219,7 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> float Eta = 0; float Phi = 0; int Et = 0; + int EtF = 0; int Fpga = 0; char IsSaturated = 0; int towerID = 0; @@ -214,8 +227,8 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> // Assign ID based on FPGA (FPGA-A 0->0; FPGA-B 1->10000, FPGA-C 2->20000) and gTower number assigned as per firmware convention - int twr_rows = AtwrS.size(); - int twr_cols = AtwrS[0].size(); + int twr_rows = Atwr.size(); + int twr_cols = Atwr[0].size(); Fpga = 0; @@ -224,10 +237,14 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> for (int icol = 0; icol < twr_cols; icol++){ iEta = icol + 8; iPhi = irow; - Et = AtwrS[irow][icol]; + Et = Atwr[irow][icol]; + EtF = AtwrF[irow][icol]; + IsSaturated = Asatur[irow][icol]; getEtaPhi(Eta, Phi, iEta, iPhi, towerID); gTowersContainer->push_back( std::make_unique<xAOD::gFexTower>() ); - gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowers50Container->push_back( std::make_unique<xAOD::gFexTower>() ); + gTowers50Container->back()->initialize(iEta, iPhi, Eta, Phi, EtF, Fpga, IsSaturated, towerID); towerID += 1; @@ -242,10 +259,14 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> for (int icol = 0; icol < twr_cols; icol++){ iEta = icol + 20; iPhi = irow; - Et = BtwrS[irow][icol]; + Et = Btwr[irow][icol]; + EtF = BtwrF[irow][icol]; + IsSaturated = Bsatur[irow][icol]; getEtaPhi(Eta, Phi, iEta, iPhi, towerID); gTowersContainer->push_back( std::make_unique<xAOD::gFexTower>() ); - gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowers50Container->push_back( std::make_unique<xAOD::gFexTower>() ); + gTowers50Container->back()->initialize(iEta, iPhi, Eta, Phi, EtF, Fpga, IsSaturated, towerID); towerID += 1; } @@ -258,19 +279,27 @@ StatusCode gFexInputByteStreamTool::convertFromBS(const std::vector<const ROBF*> for (int icol = 0; icol < twr_cols/2; icol++){ iEta = icol + 2; iPhi = irow; - Et = CtwrS[irow][icol]; + Et = Ctwr[irow][icol]; + EtF = CtwrF[irow][icol]; + IsSaturated = Csatur[irow][icol]; getEtaPhi(Eta, Phi, iEta, iPhi, towerID); gTowersContainer->push_back( std::make_unique<xAOD::gFexTower>() ); - gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowers50Container->push_back( std::make_unique<xAOD::gFexTower>() ); + gTowers50Container->back()->initialize(iEta, iPhi, Eta, Phi, EtF, Fpga, IsSaturated, towerID); towerID += 1; } for (int icol = twr_cols/2; icol < twr_cols; icol++){ iEta = icol + 26; iPhi = irow; - Et = CtwrS[irow][icol]; + Et = Ctwr[irow][icol]; + EtF = CtwrF[irow][icol]; + IsSaturated = Csatur[irow][icol]; getEtaPhi(Eta, Phi, iEta, iPhi, towerID); gTowersContainer->push_back( std::make_unique<xAOD::gFexTower>() ); - gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowersContainer->back()->initialize(iEta, iPhi, Eta, Phi, Et, Fpga, IsSaturated, towerID); + gTowers50Container->push_back( std::make_unique<xAOD::gFexTower>() ); + gTowers50Container->back()->initialize(iEta, iPhi, Eta, Phi, EtF, Fpga, IsSaturated, towerID); towerID += 1; } @@ -349,22 +378,24 @@ void gFexInputByteStreamTool::c_gtrx_map( const gfiber &inputData, gfiber &outpu void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, - gfiber Xfiber, int Xin, - gtFPGA &Xgt, int *BCIDptr, + gfiber Xfiber, int Xin, + gtFPGA &XgtF, gtFPGA &Xgt, + int *BCIDptr, int do_lconv, std::array<int, gPos::MAX_FIBERS> XMPD_NFI, std::array<int, gPos::MAX_FIBERS> XCALO_TYPE, gCaloTwr XMPD_GTRN_ARR, gType XMPD_DSTRT_ARR, gTypeChar XMPD_DTYP_ARR, - std::array<int, gPos::MAX_FIBERS> XMSK) const{ + std::array<int, gPos::MAX_FIBERS> XMSK, + gtFPGA &Xsaturation) const{ // Output is uncalibrated gTowers with 50MeV LSB // Xfiber -- 80 fibers, each with seven words, 32 bits per word // Xin -- usually 80 -- number of fibers actually used, is 50 for EMEC/HEC FPGAC -// Xgt -- 12*32 = 384 towers -- given as integers, -// limited to 12 signed bits in hardware ( -2048 to 2047, lsb 200 MeV) -// Currently no calibration is implemented +// XgtF -- 12*32 = 384 towers -- 50 MeV LSB +// Xgt -- 12*32 = 384 towers -- given as integers + // XMPD_NFI -- gives the fiber type 0, 1, 2, 3 (A & B only use types 0,1,2) // XMPD_DTYP_ARR -- gives the detector type for the 20 fields on a fiber @@ -373,11 +404,14 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, // In the firmware Xfiber is an array of 32 bit words and on each of seven clocks new data for a BC comes in. + // gtFPGA Xsaturation; //loop over fibers -- for(int irow=0; irow<gPos::ABC_ROWS; irow++){ for(int icolumn=0; icolumn<gPos::AB_COLUMNS; icolumn++){ Xgt[irow][icolumn] = 0; + XgtF[irow][icolumn] = 0; + Xsaturation[irow][icolumn] = 0; } } @@ -394,10 +428,10 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, // -- "1010" - BCID_LOW // -- "1111" - unused field - // eventually need to read this from record - *BCIDptr = 0; + // use fiber 0 for BCID + *BCIDptr = (Xfiber[0][gPos::W280-1]&0x007F0000) >>16; - + //200 MeV towers std::array<int, gPos::AB_TOWERS> etowerData; std::array<int, gPos::AB_TOWERS> htowerData; std::array<int, gPos::ABC_ROWS> xetowerData; @@ -410,7 +444,64 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, xhtowerData.fill(0); ohtowerData.fill(0); + //50 MeV towers + std::array<int, gPos::AB_TOWERS> etowerDataF; + std::array<int, gPos::AB_TOWERS> htowerDataF; + std::array<int, gPos::ABC_ROWS> xetowerDataF; + std::array<int, gPos::ABC_ROWS> xhtowerDataF; + std::array<int, gPos::ABC_ROWS> ohtowerDataF; + + etowerDataF.fill(0); + htowerDataF.fill(0); + xetowerDataF.fill(0); + xhtowerDataF.fill(0); + ohtowerDataF.fill(0); + + + // save values from fiber fields for monitoring (50 MeV towers) + + gFields fiberFields; + gFields fiberFieldsUndecoded; + gSatur fiberSaturation; + + fiberFields = {{0}}; + fiberFieldsUndecoded = {{0}}; + fiberSaturation = {{0}}; + + for(unsigned int i=0; i<100; i++){ + if( ( Xfiber[i][gPos::W280-1] & 0x000000FF ) == 0x000000BC ) { + fiberFields[i][16] = 1; + } + + fiberFields[i][18] = ( Xfiber[i][gPos::W280-1] & 0x007F0000) >>16 ; + fiberFields[i][19] = ( Xfiber[i][gPos::W280-1] & 0xFF800000) >>23 ; + + if (XMPD_DTYP_ARR[ XMPD_NFI[i] ][17] == 8) { + fiberFields[i][17] = ( Xfiber[i][gPos::W280-1] & 0x0000FF00) >>8 ; + // fill in saturation bits + for(unsigned int k=0; k<8; k++){ + if( fiberFields[i][17] & (1<<k) ) { + fiberSaturation[i][k] = 1; + } + } + } + + int kFilled = 0; + for(unsigned int k=0; k<16; k++){ + if( (XMPD_DTYP_ARR[ XMPD_NFI[i] ][k] != 2 ) && ( XMPD_GTRN_ARR[i][k] > -1 ) ) { + int krow = XMPD_GTRN_ARR[i][k]/12; + int kcolumn = XMPD_GTRN_ARR[i][k]%12; + if(kFilled <8 ){ + if( fiberSaturation[i][kFilled] == 1 ) { + Xsaturation[ krow][kcolumn] = 1; + } + } + kFilled = kFilled + 1; + } + } + } + //Loop over fibers for(int iFiber = 0; iFiber < Xin; iFiber++) { // first do CRC check std::array<int, 6> tmp; @@ -478,7 +569,8 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, dataType = 99; } - if( XCALO_TYPE[iFiber] < 3) { + //Different kinds of data type + if( (XCALO_TYPE[iFiber] < 3) && (ntower>-1) && (ntower<384) ) { switch(dataType){ case 0: ilow = ihigh - 11; @@ -490,12 +582,17 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword] & mask) >> ilbit ); // undo multilinear decoding if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = etowerData[ntower]; undoMLE( etowerData[ntower] ); + etowerDataF[ntower] = etowerData[ntower]; + fiberFields[iFiber][iDatum] = etowerData[ntower]; + } else { // sign extend etower data if( etowerData[ntower] & 0x00000800 ){ etowerData[ntower] = (etowerData[ntower] | 0xFFFFF000) ;} - etowerData[ntower] = etowerData[ntower]*4; + etowerData[ntower] = etowerData[ntower]*4; + etowerDataF[ntower] = etowerData[ntower]; } } else { @@ -555,16 +652,24 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, // mulitply by 20 to make 50 MeV LSB if( (Xin > 50) ) { - htowerData[ntower] = 20*htowerData[ntower]; + // include this here before mulitplicaiton by 20 + fiberFieldsUndecoded[iFiber][iDatum] = htowerData[ntower]; + htowerData[ntower] = 20*htowerData[ntower]; + htowerDataF[ntower] = htowerData[ntower]; + fiberFields[iFiber][iDatum] = htowerData[ntower]; } else { if( do_lconv){ - undoMLE( etowerData[ntower] ); + fiberFieldsUndecoded[iFiber][1] = htowerData[ntower]; + undoMLE( htowerData[ntower] ); + htowerDataF[ntower] = htowerData[ntower]; + fiberFields[iFiber][1] = htowerData[ntower]; } else { // sign extend etower data if( htowerData[ntower] & 0x00000800 ){ htowerData[ntower] = (etowerData[ntower] | 0xFFFFF000) ;} htowerData[ntower] = htowerData[ntower]*4; + htowerDataF[ntower] = htowerData[ntower]; } } break; @@ -573,7 +678,7 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, ilow = ihigh - 11; ilword = ilow/32; ilbit = ilow%32; - if( ntower > 32 ){ + if( (ntower > 32) || (ntower < 0) ){ std::stringstream sdetail; sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: bad value of nTower for extended region 2.4 - 2.5 in eta" ; @@ -616,12 +721,17 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, } // undo multilinear decoding if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = xetowerData[ntower]; undoMLE( xetowerData[ntower] ); + xetowerDataF[ntower] = xetowerData[ntower]; + fiberFields[iFiber][iDatum] = xetowerData[ntower]; + } else { // sign extend etower data if( xetowerData[ntower] & 0x00000800 ){ xetowerData[ntower] = (xetowerData[ntower] | 0xFFFFF000) ;} xetowerData[ntower] = xetowerData[ntower]*4; + xetowerDataF[ntower] = xetowerData[ntower]; } break; @@ -672,12 +782,16 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, } // undo multilinear decoding if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = xhtowerData[ntower]; undoMLE( xhtowerData[ntower] ); + xhtowerDataF[ntower] = xhtowerData[ntower]; + fiberFields[iFiber][iDatum] = xhtowerData[ntower]; } else { // sign extend etower data if( xhtowerData[ntower] & 0x00000800 ){ xhtowerData[ntower] = (xhtowerData[ntower] | 0xFFFFF000) ;} - xhtowerData[ntower] = xhtowerData[ntower]*4; + xhtowerData[ntower] = xhtowerData[ntower]*4; + xhtowerDataF[ntower] = xhtowerData[ntower]; } break; @@ -727,12 +841,16 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, } if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = ohtowerData[ntower]; undoMLE( ohtowerData[ntower] ); + ohtowerDataF[ntower] = ohtowerData[ntower]; + fiberFields[iFiber][iDatum] = ohtowerData[ntower]; } else { // sign extend etower data if( ohtowerData[ntower] & 0x00000800 ){ ohtowerData[ntower] = (ohtowerData[ntower] | 0xFFFFF000) ;} ohtowerData[ntower] = ohtowerData[ntower]*4; + ohtowerDataF[ntower] = ohtowerData[ntower]; } break; @@ -774,130 +892,168 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, } if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = htowerData[ntower]; undoMLE( htowerData[ntower] ); + htowerDataF[ntower] = htowerData[ntower]; + fiberFields[iFiber][iDatum] = htowerData[ntower]; } else { // sign extend etower data if( htowerData[ntower] & 0x00000800 ){ htowerData[ntower] = (htowerData[ntower] | 0xFFFFF000) ;} htowerData[ntower] = htowerData[ntower]*4; + htowerDataF[ntower] = htowerData[ntower]; } break; } // FPGA C EMEC/HEC + FCAL // These all have same dataType as extended ECAL and extended HCAL } - else { + else if ( (ntower>-1) && (ntower<384) ){ + // this is FPGA C // only types 2 and 3 exist in FPGA C switch(dataType){ - case 2: - ilow = ihigh - 11; - ilword = ilow/32; - ilbit = ilow%32; - - if(ilword == ihword){ - int mask = 0x00000FFF; - mask = mask << ilbit; - etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword]&mask) >> (ilbit) ); - } - else if ( ihbit == 7 ) { - mask = 0x0000000F; - hmask = 0x000000FF; - etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 4); - lmask = 0xF0000000; - etowerData[ntower] = etowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 28)&mask) ; - } - else if ( ihbit == 3) { - mask = 0x000000FF; - hmask = 0x000000F; - etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 8); - lmask = 0xFF000000; - etowerData[ntower] = etowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 24)&mask) ; - } - else { - - std::stringstream sdetail; - sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: wrongly packed data "<< fiber_type<< ", "<<dataType<< ", "<<ilword<< ", " <<ihword ; - std::stringstream slocation; - slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; - std::stringstream stitle; - stitle << "Wrongly packed data" ; - printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); - - } - // undo multilinear decoding - if( do_lconv){ - undoMLE( etowerData[ntower] ); - } - else { - // sign extend etower data - if( etowerData[ntower] & 0x00000800 ){ etowerData[ntower] = (etowerData[ntower] | 0xFFFFF000) ;} - etowerData[ntower] = etowerData[ntower]*4; - } - break; - - case 3: - ilow = ihigh - 11; - ilword = ilow/32; - ilbit = ilow%32; - - if(ilword == ihword){ - mask = 0x00000FFF; - mask = mask << ilbit; - htowerData[ntower] = htowerData[ntower] | ( (Xfiber[iFiber][ihword]&mask) >> (ilbit) ); - } - else if ( ihbit == 7 ) { - mask = 0x0000000F; - hmask = 0x000000FF; - htowerData[ntower] = htowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 4); - lmask = 0xF0000000; - htowerData[ntower] = htowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 28)&mask) ; - } - else if ( ihbit == 3) { - mask = 0x000000FF; - hmask = 0x0000000F; - htowerData[ntower] = htowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 8); - lmask = 0xFF000000; - htowerData[ntower] = htowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 24)&mask) ; - } - else { - - std::stringstream sdetail; - sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: wrongly packed data "<< fiber_type<< ", "<<dataType<< ", "<<ilword<< ", " <<ihword ; - std::stringstream slocation; - slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; - std::stringstream stitle; - stitle << "Wrongly packed data" ; - printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); + case 2: + ilow = ihigh - 11; + ilword = ilow/32; + ilbit = ilow%32; + + if( etowerData[ntower] != 0 ) { + + std::stringstream sdetail; + sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: etowerData[nTower] is not zero, inconsistent constants! "<< etowerData[ntower] ; + std::stringstream slocation; + slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; + std::stringstream stitle; + stitle << "etowerData not zero" ; + printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); - } - // undo multilinear decoding - if( do_lconv){ - undoMLE( htowerData[ntower] ); - } - else { - // sign extend etower data - if( htowerData[ntower] & 0x00000800 ){ htowerData[ntower] = (htowerData[ntower] | 0xFFFFF000) ;} - htowerData[ntower] = htowerData[ntower]*4; - } - break; - - case 15: - break; - - case 99: - break; - - default: - - std::stringstream sdetail; - sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: wrong detector type "<< dataType ; - std::stringstream slocation; - slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; - std::stringstream stitle; - stitle << "Wrong detector type" ; - printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); + } else { + + if(ilword == ihword){ + int mask = 0x00000FFF; + mask = mask << ilbit; + etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword]&mask) >> (ilbit) ); + } + else if ( ihbit == 7 ) { + mask = 0x0000000F; + hmask = 0x000000FF; + etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 4); + lmask = 0xF0000000; + etowerData[ntower] = etowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 28)&mask) ; + } + else if ( ihbit == 3) { + mask = 0x000000FF; + hmask = 0x000000F; + etowerData[ntower] = etowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 8); + lmask = 0xFF000000; + etowerData[ntower] = etowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 24)&mask) ; + } + else { + + std::stringstream sdetail; + sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: wrongly packed data "<< fiber_type<< ", "<<dataType<< ", "<<ilword<< ", " <<ihword ; + std::stringstream slocation; + slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; + std::stringstream stitle; + stitle << "Wrongly packed data" ; + printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); + + } + // undo multilinear decoding + if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = etowerData[ntower]; + undoMLE( etowerData[ntower] ); + etowerDataF[ntower] = etowerData[ntower]; + fiberFields[iFiber][iDatum] = etowerData[ntower]; + } + else { + // sign extend etower data + if( etowerData[ntower] & 0x00000800 ){ etowerData[ntower] = (etowerData[ntower] | 0xFFFFF000) ;} + etowerData[ntower] = etowerData[ntower]*4; + etowerDataF[ntower] = etowerData[ntower]; + } + } + break; + + case 3: + ilow = ihigh - 11; + ilword = ilow/32; + ilbit = ilow%32; + + if( htowerData[ntower] != 0 ) { + std::stringstream sdetail; + sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: etowerData[nTower] is not zero, inconsistent constants! "<< etowerData[ntower] ; + std::stringstream slocation; + slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; + std::stringstream stitle; + stitle << "etowerData not zero" ; + printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); + + } else { + + if(ilword == ihword){ + mask = 0x00000FFF; + mask = mask << ilbit; + htowerData[ntower] = htowerData[ntower] | ( (Xfiber[iFiber][ihword]&mask) >> (ilbit) ); + } + else if ( ihbit == 7 ) { + mask = 0x0000000F; + hmask = 0x000000FF; + htowerData[ntower] = htowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 4); + lmask = 0xF0000000; + htowerData[ntower] = htowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 28)&mask) ; + } + else if ( ihbit == 3) { + mask = 0x000000FF; + hmask = 0x0000000F; + htowerData[ntower] = htowerData[ntower] | ( (Xfiber[iFiber][ihword]&hmask) << 8); + lmask = 0xFF000000; + htowerData[ntower] = htowerData[ntower] | ( ( (Xfiber[iFiber][ilword]&lmask) >> 24)&mask) ; + } + else { + + std::stringstream sdetail; + sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: wrongly packed data "<< fiber_type<< ", "<<dataType<< ", "<<ilword<< ", " <<ihword ; + std::stringstream slocation; + slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; + std::stringstream stitle; + stitle << "Wrongly packed data" ; + printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); + + } + // undo multilinear decoding + if( do_lconv){ + fiberFieldsUndecoded[iFiber][iDatum] = htowerData[ntower]; + undoMLE( htowerData[ntower] ); + htowerDataF[ntower] = htowerData[ntower]; + fiberFields[iFiber][iDatum] = htowerData[ntower]; + } + else { + // sign extend etower data + if( htowerData[ntower] & 0x00000800 ){ htowerData[ntower] = (htowerData[ntower] | 0xFFFFF000) ;} + htowerData[ntower] = htowerData[ntower]*4; + htowerDataF[ntower] = htowerData[ntower]; + } + } + break; + + case 15: + break; + + case 99: + break; + + default: + std::stringstream sdetail; + sdetail << "[gFexInputByteStreamTool::gtReconstructABC]: wrong detector type "<< dataType ; + std::stringstream slocation; + slocation << "Fiber type "<< fiber_type<< " and data type"<< dataType; + std::stringstream stitle; + stitle << "Wrong detector type" ; + printError(slocation.str(),stitle.str(),MSG::DEBUG,sdetail.str()); + } // end of case statement for FPGAC } // end of | eta | > 2,5 } // end of loop over words @@ -909,12 +1065,25 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, for(int itower=0;itower<384;itower++){ int icolumn = itower%12; int irow = itower/12; - Xgt[irow][icolumn] = etowerData[itower] + htowerData[itower]; + + // 50 MeV towers + int xF = etowerDataF[itower] + htowerDataF[itower]; + // 200 MeV towers + int x = ( (etowerData[itower]>>2) + (htowerData[itower]>>2) ); + + Xgt[irow][icolumn] = x; + XgtF[irow][icolumn] = xF; + + // etra region in FPGA A (eta ~ -2.5) if ( icolumn == 0) { - Xgt[irow][icolumn] = Xgt[irow][icolumn] + xetowerData[irow] + xhtowerData[irow]; + int xx = ( (xetowerData[irow]>>2) + (xhtowerData[irow]>>2) ); + + Xgt[irow][icolumn] = Xgt[irow][icolumn] + xx; } if ( icolumn == 4) { - Xgt[irow][icolumn] = Xgt[irow][icolumn] + ohtowerData[irow]; + // 200 MeV towers + int ox = (ohtowerData[irow] >> 2 ) ; + Xgt[irow][icolumn] = Xgt[irow][icolumn] + ox ; } } } @@ -922,12 +1091,26 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, for(int itower=0;itower<384;itower++){ int icolumn = itower%12; int irow = itower/12; - Xgt[irow][icolumn] = etowerData[itower] + htowerData[itower]; + + // 50 MeV towers + int xF = etowerDataF[itower] + htowerDataF[itower] ; + // 200 MeV towers + int x = ( (etowerData[itower]>>2) + (htowerData[itower] >> 2) ); + + Xgt[irow][icolumn] = x; + XgtF[irow][icolumn] = xF; + + // extra region FPGA B (eta ~ 2.5) if ( icolumn == 11) { - Xgt[irow][icolumn] = Xgt[irow][icolumn] + xetowerData[irow] + xhtowerData[irow]; + // 200 MeV towers + int xx = ( (xetowerData[irow]>>2) + (xhtowerData[irow]>>2) ); + + Xgt[irow][icolumn] = Xgt[irow][icolumn] + xx; } if ( icolumn == 7 ) { - Xgt[irow][icolumn] = Xgt[irow][icolumn] + ohtowerData[irow]; + // 200 MeV towers + int xo = ohtowerData[irow]>>2; + Xgt[irow][icolumn] = Xgt[irow][icolumn] + xo; } } } @@ -935,7 +1118,14 @@ void gFexInputByteStreamTool::gtReconstructABC(int XFPGA, for(int itower=0;itower<384;itower++){ int icolumn = itower%12; int irow = itower/12; - Xgt[irow][icolumn] = etowerData[itower] + htowerData[itower]; + + // 50 MeV towers + int xF = etowerDataF[itower] + htowerDataF[itower] ; + // 200 MeV towers + int x = ( (etowerData[itower]>>2 ) + (htowerData[itower]>>2)); + + Xgt[irow][icolumn] = x; + XgtF[irow][icolumn] = xF; } } else { @@ -1073,6 +1263,13 @@ int gFexInputByteStreamTool::crc9d23(int inword, int in_crc, int reverse ) cons void gFexInputByteStreamTool::undoMLE(int &datumPtr ) const{ // limit input to 12 bits to avoid accidental sign extension int din = (0x00000FFF & datumPtr ); + // map all special cases to zero for now + if( din > 0x0FDE ) din = 0x4EE; + // limit negative values + if( (din > 0) && ( din < 962 ) ) din = 962; + //zeroZero + if( din == 0) din = 0x4EE; + int dout = 0; int FPGA_CONVLIN_TH1 = 5; @@ -1165,22 +1362,22 @@ void gFexInputByteStreamTool::undoMLE(int &datumPtr ) const{ dout = 0; } else if( ( oth0) & (! oth1 ) & (! oth2 ) & (! oth3 ) & (! oth4 ) & (! oth5 ) ) { - dout = r1conv/2; + dout = r1conv >>1; } else if( ( oth0) & ( oth1 ) & (! oth2 ) & (! oth3 ) & (! oth4 ) & (! oth5 ) ) { - dout = r2conv/2; + dout = r2conv >>1; } else if( ( oth0) & ( oth1 ) & ( oth2 ) & (! oth3 ) & (! oth4 ) & (! oth5 ) ) { - dout = r3conv/2; + dout = r3conv >>1; } else if( ( oth0) & ( oth1 ) & ( oth2 ) & ( oth3 ) & (! oth4 ) & (! oth5 ) ) { - dout = r4conv/2; + dout = r4conv >>1; } else if( ( oth0) & ( oth1 ) & ( oth2 ) & ( oth3 ) & ( oth4 ) & (! oth5 ) ) { - dout = r5conv/2; + dout = r5conv >>1; } else if( ( oth0) & ( oth1 ) & ( oth2 ) & ( oth3 ) & ( oth4 ) & ( oth5 ) ) { - dout = r6conv/2; + dout = r6conv >>1; } else { dout = 0; @@ -1189,15 +1386,6 @@ void gFexInputByteStreamTool::undoMLE(int &datumPtr ) const{ datumPtr = dout; } -void gFexInputByteStreamTool::gtRescale(gtFPGA twr, gtFPGA &twrScaled, int scale) const{ - int rows = twr.size(); - int cols = twr[0].size(); - for(int irow=0; irow<rows; irow++){ - for( int icolumn=0; icolumn<cols; icolumn++){ - twrScaled[irow][icolumn] = twr[irow][icolumn]/scale; - } - } -} void gFexInputByteStreamTool::getEtaPhi ( float &Eta, float &Phi, int iEta, int iPhi, int gFEXtowerID) const{ @@ -1287,6 +1475,8 @@ void gFexInputByteStreamTool::getEtaPhi ( float &Eta, float &Phi, int iEta, int } } + + /// xAOD->BS conversion StatusCode gFexInputByteStreamTool::convertToBS(std::vector<WROBF*>& /*vrobf*/, const EventContext& /*eventContext*/) { diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.h index d513deefeea9789463942df34dca629385963917..f5a87533a4df051cc4709f1b9ef7e3a5f04bc13d 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexInputByteStreamTool.h @@ -37,6 +37,8 @@ typedef std::array<std::array<int, 6>, 32> gEngines; typedef std::array<std::array<int, 12>, 32> gtFPGA; typedef std::array<std::array<int, 20>, 100> gFields; typedef std::array<std::array<int, 16>, 100> gCaloTwr; +typedef std::array<std::array<int, 8>, 100> gSatur; + typedef std::array<std::array<char, 20>, 100> gFieldsChar; typedef std::array<std::array<int, 20>, 4> gType; @@ -75,7 +77,8 @@ class gFexInputByteStreamTool : public extends<AthAlgTool, IL1TriggerByteStreamT Gaudi::Property<std::vector<uint32_t>> m_robIds {this, "ROBIDs", {}, "List of ROB IDs required for conversion to/from xAOD RoI"}; //Write handle keys for the L1Calo EDMs for BS->xAOD mode of operation - SG::WriteHandleKey< xAOD::gFexTowerContainer> m_gTowersWriteKey {this,"gTowersWriteKey" ,"L1_gFexDataTowers","Write gFexEDM Trigger Tower container"}; + SG::WriteHandleKey< xAOD::gFexTowerContainer> m_gTowersWriteKey {this,"gTowersWriteKey" ,"L1_gFexDataTowers","Write gFexEDM Trigger Tower container with 200 MeV resolution (default)"}; + SG::WriteHandleKey< xAOD::gFexTowerContainer> m_gTowers50WriteKey {this,"gTowers50WriteKey" ,"L1_gFexDataTowers50","Write gFexEDM Trigger Tower container with 50 MeV resolution"}; // Read handle keys for the L1Calo EDMs for xAOD->BS mode of operation SG::ReadHandleKey < xAOD::gFexTowerContainer> m_gTowersReadKey {this,"gTowersReadKey" ,"L1_gFexDataTowers","Read gFexEDM Trigger Tower container"}; @@ -87,23 +90,25 @@ class gFexInputByteStreamTool : public extends<AthAlgTool, IL1TriggerByteStreamT virtual void c_gtrx_map( const gfiber &inputData, gfiber &outputData) const; virtual void gtReconstructABC( int XFPGA, - gfiber Xfiber, int Xin, - gtFPGA &Xgt, int *BCIDptr, + gfiber Xfiber, + int Xin, + gtFPGA &XgtF, + gtFPGA &Xgt, + int *BCIDptr, int do_lconv, std::array<int, gPos::MAX_FIBERS> XMPD_NFI, std::array<int, gPos::MAX_FIBERS> XCALO_TYPE, gCaloTwr XMPD_GTRN_ARR, gType XMPD_DSTRT_ARR, gTypeChar XMPD_DTYP_ARR, - std::array<int, gPos::MAX_FIBERS> XMSK) const; + std::array<int, gPos::MAX_FIBERS> XMSK, + gtFPGA &Xsatur) const; virtual int crc9d32(std::array<int, 6> inWords,int numWords,int reverse) const; virtual int crc9d23(int inword, int in_crc, int reverse ) const; virtual void undoMLE(int &datumPtr ) const; - - virtual void gtRescale(gtFPGA twr, gtFPGA &twrScaled, int scale) const; virtual void getEtaPhi(float &Eta, float &Phi, int iEta, int iPhi, int gFEXtowerID) const; diff --git a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexPos.h b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexPos.h index 6312fcba1f32099bc7d99f8faa534ae7f1cec54e..1ec5821755ff6b7e163d30cec13e1649537adbb4 100644 --- a/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexPos.h +++ b/Trigger/TrigT1/L1CaloFEX/L1CaloFEXByteStream/src/gFexPos.h @@ -57,6 +57,11 @@ namespace LVL1::gFEXPos { constexpr int ABC_ROWS = 32; //Number of rows in FPGA A, B, C constexpr int AB_COLUMNS = 12; //Number of columns in FPGA A and B constexpr int AB_TOWERS = 384; //Total towers in FPGA => 12*32 = 384 towers + constexpr int W280 = 7; //Number of 32 bit words per clock + + constexpr int FINE_CEILING = 255; //ceiling value used for 50 MeV gTowers + constexpr int FINE_FLOOR = -256; //floor value used for 50 MeV gTowers + constexpr std::array<unsigned int, 80> GTRX_MAP_A_IND = @@ -75,7 +80,6 @@ namespace LVL1::gFEXPos { 75, 72, 74, 73, 52, 53, 55, 54, 56, 57, 58, 59, 63, 60, 62, 61, 39, 47, 38, 45, 46, 44, 42, 43, 36, 41, 37, 40, 34, 33, 35, 32, 22, 21, 23, 20, 19, 18, 16, 17, 12, 15, 13, 14, 10, 9, 11, 8 - }; constexpr std::array<unsigned int, 50> GTRX_MAP_C_IND = @@ -88,7 +92,6 @@ namespace LVL1::gFEXPos { 94, 95, 96, 97, 98, 99, 76, 77, 64, 65, 67, 68, 70, 71, 72, 73, 74, 75, 52, 53 - }; @@ -113,86 +116,86 @@ namespace LVL1::gFEXPos { constexpr std::array<std::array<int, 16>, 100> AMPD_GTRN_ARR = {{ - { 3, 3, 1, 1, 15, 15, 13, 13, 2, 2, 0, 0, 12, 12, 14, 14}, //EMECC_1 - { 27, 27, 25, 25, 39, 39, 37, 37, 26, 26, 24, 24, 36, 36, 38, 38}, //EMECC_2 - { 51, 51, 49, 49, 63, 63, 61, 61, 50, 50, 48, 48, 60, 60, 62, 62}, //EMECC_3 - { 75, 75, 73, 73, 87, 87, 85, 85, 74, 74, 72, 72, 84, 84, 86, 86}, //EMECC_4 - { 99, 99, 97, 97,111,111,109,109, 98, 98, 96, 96,108,108,110,110}, //EMECC_5 - {123,123,121,121,135,135,133,133,122,122,120,120,132,132,134,134}, //EMECC_6 - {147,147,145,145,159,159,157,157,146,146,144,144,156,156,158,158}, //EMECC_7 - {171,171,169,169,183,183,181,181,170,170,168,168,180,180,182,182}, //EMECC_8 - { 7, 7, 5, 5, 19, 19, 17, 17, 6, 6, 4, 4, 16, 16, 18, 18}, //EMBC-EMECC_1 - { 31, 31, 29, 29, 43, 43, 41, 41, 30, 30, 28, 28, 40, 40, 42, 42}, //EMBC-EMECC_2 - { 55, 55, 53, 53, 67, 67, 65, 65, 54, 54, 52, 52, 64, 64, 66, 66}, //EMBC-EMECC_3 - { 79, 79, 77, 77, 91, 91, 89, 89, 78, 78, 76, 76, 88, 88, 90, 90}, //EMBC-EMECC_4 - {103,103,101,101,115,115,113,113,102,102,100,100,112,112,114,114}, //EMBC-EMECC_5 - {127,127,125,125,139,139,137,137,126,126,124,124,136,136,138,138}, //EMBC-EMECC_6 - {151,151,149,149,163,163,161,161,150,150,148,148,160,160,162,162}, //EMBC-EMECC_7 - {175,175,173,173,187,187,185,185,174,174,172,172,184,184,186,186}, //EMBC-EMECC_8 - { 11, 11, 9, 9, 23, 23, 21, 21, 10, 10, 8, 8, 20, 20, 22, 22}, //EMBC_1 - { 35, 35, 33, 33, 47, 47, 45, 45, 34, 34, 32, 32, 44, 44, 46, 46}, //EMBC_2 - { 59, 59, 57, 57, 71, 71, 69, 69, 58, 58, 56, 56, 68, 68, 70, 70}, //EMBC_3 - { 83, 83, 81, 81, 95, 95, 93, 93, 82, 82, 80, 80, 92, 92, 94, 94}, //EMBC_4 - {107,107,105,105,119,119,117,117,106,106,104,104,116,116,118,118}, //EMBC_5 - {131,131,129,129,143,143,141,141,130,130,128,128,140,140,142,142}, //EMBC_6 - {155,155,153,153,167,167,165,165,154,154,152,152,164,164,166,166}, //EMBC_7 - {179,179,177,177,191,191,189,189,178,178,176,176,188,188,190,190}, //EMBC_8 - {195,195,193,193,207,207,205,205,194,194,192,192,204,204,206,206}, //EMECC_9 - {219,219,217,217,231,231,229,229,218,218,216,216,228,228,230,230}, //EMECC_10 - {243,243,241,241,255,255,253,253,242,242,240,240,252,252,254,254}, //EMECC_11 - {267,267,265,265,279,279,277,277,266,266,264,264,276,276,278,278}, //EMECC_12 - {291,291,289,289,303,303,301,301,290,290,288,288,300,300,302,302}, //EMECC_13 - {315,315,313,313,327,327,325,325,314,314,312,312,324,324,326,326}, //EMECC_14 - {339,339,337,337,351,351,349,349,338,338,336,336,348,348,350,350}, //EMECC_15 - {363,363,361,361,375,375,373,373,362,362,360,360,372,372,374,374}, //EMECC_16 - {199,199,197,197,211,211,209,209,198,198,196,196,208,208,210,210}, //EMBC-EMECC_9 - {223,223,221,221,235,235,233,233,222,222,220,220,232,232,234,234}, //EMBC-EMECC_10 - {247,247,245,245,259,259,257,257,246,246,244,244,256,256,258,258}, //EMBC-EMECC_11 - {271,271,269,269,283,283,281,281,270,270,268,268,280,280,282,282}, //EMBC-EMECC_12 - {295,295,293,293,307,307,305,305,294,294,292,292,304,304,306,306}, //EMBC-EMECC_13 - {319,319,317,317,331,331,329,329,318,318,316,316,328,328,330,330}, //EMBC-EMECC_14 - {343,343,341,341,355,355,353,353,342,342,340,340,352,352,354,354}, //EMBC-EMECC_15 - {367,367,365,365,379,379,377,377,366,366,364,364,376,376,378,378}, //EMBC-EMECC_16 - {203,203,201,201,215,215,213,213,202,202,200,200,212,212,214,214}, //EMBC_9 - {227,227,225,225,239,239,237,237,226,226,224,224,236,236,238,238}, //EMBC_10 - {251,251,249,249,263,263,261,261,250,250,248,248,260,260,262,262}, //EMBC_11 - {275,275,273,273,287,287,285,285,274,274,272,272,284,284,286,286}, //EMBC_12 - {299,299,297,297,311,311,309,309,298,298,296,296,308,308,310,310}, //EMBC_13 - {323,323,321,321,335,335,333,333,322,322,320,320,332,332,334,334}, //EMBC_14 - {347,347,345,345,359,359,357,357,346,346,344,344,356,356,358,358}, //EMBC_15 - {371,371,369,369,383,383,381,381,370,370,368,368,380,380,382,382}, //EMBC_16 - { 5, 4, 16, 17, 29, 28, 40, 41, 53, 52, 64, 65, 77, 76, 88, 89}, //TREXC_4_1 - { 7, 6, 18, 19, 31, 30, 42, 43, 55, 54, 66, 67, 79, 78, 90, 91}, //TREXC_5_1 - { 9, 8, 20, 21, 33, 32, 44, 45, 57, 56, 68, 69, 81, 80, 92, 93}, //TREXC_6_1 - { 11, 10, 22, 23, 35, 34, 46, 47, 59, 58, 70, 71, 83, 82, 94, 95}, //TREXC_7_1 - {101,100,112,113,125,124,136,137,149,148,160,161,173,172,184,185}, //TREXC_4_2 - {103,102,114,115,127,126,138,139,151,150,162,163,175,174,186,187}, //TREXC_5_2 - {105,104,116,117,129,128,140,141,153,152,164,165,177,176,188,189}, //TREXC_6_2 - {107,106,118,119,131,130,142,143,155,154,166,167,179,178,190,191}, //TREXC_7_2 - { 0, 0, 3, 2, 1, 0, 0, 1, 1, 15, 14, 13, 12, 1, -1, -1}, //EMECC-HECC_1 - { 2, 2, 27, 26, 25, 24, 2, 3, 3, 39, 38, 37, 36, 3, -1, -1}, //EMECC-HECC_1 - { 4, 4, 51, 50, 49, 48, 4, 5, 5, 63, 62, 61, 60, 5, -1, -1}, //EMECC-HECC_2 - { 6, 6, 75, 74, 73, 72, 6, 7, 7, 87, 86, 85, 84, 7, -1, -1}, //EMECC-HECC_2 - { 8, 8, 99, 98, 97, 96, 8, 9, 9,111,110,109,108, 9, -1, -1}, //EMECC-HECC_3 - { 10, 10,123,122,121,120, 10, 11, 11,135,134,133,132, 11, -1, -1}, //EMECC-HECC_3 - { 12, 12,147,146,145,144, 12, 13, 13,159,158,157,156, 13, -1, -1}, //EMECC-HECC_4 - { 14, 14,171,170,169,168, 14, 15, 15,183,182,181,180, 15, -1, -1}, //EMECC-HECC_4 - {197,196,208,209,221,220,232,233,245,244,256,257,269,268,280,281}, //TREXC_4_3 - {199,198,210,211,223,222,234,235,247,246,258,259,271,270,282,283}, //TREXC_5_3 - {201,200,212,213,225,224,236,237,249,248,260,261,273,272,284,285}, //TREXC_6_3 - {203,202,214,215,227,226,238,239,251,250,262,263,275,274,286,287}, //TREXC_7_3 - {293,292,304,305,317,316,328,329,341,340,352,353,365,364,376,377}, //TREXC_4_4 - {295,294,306,307,319,318,330,331,343,342,354,355,367,366,378,379}, //TREXC_5_4 - {297,296,308,309,321,320,332,333,345,344,356,357,369,368,380,381}, //TREXC_6_4 - {299,298,310,311,323,322,334,335,347,346,358,359,371,370,382,383}, //TREXC_7_4 - { 16, 16,195,194,193,192, 16, 17, 17,207,206,205,204, 17, -1, -1}, //EMECC-HECC_5 - { 18, 18,219,218,217,216, 18, 19, 19,231,230,229,228, 19, -1, -1}, //EMECC-HECC_5 - { 20, 20,243,242,241,240, 20, 21, 21,255,254,253,252, 21, -1, -1}, //EMECC-HECC_6 - { 22, 22,267,266,265,264, 22, 23, 23,279,278,277,276, 23, -1, -1}, //EMECC-HECC_6 - { 24, 24,291,290,289,288, 24, 25, 25,303,302,301,300, 25, -1, -1}, //EMECC-HECC_7 - { 26, 26,315,314,313,312, 26, 27, 27,327,326,325,324, 27, -1, -1}, //EMECC-HECC_7 - { 28, 28,339,338,337,336, 28, 29, 29,351,350,349,348, 29, -1, -1}, //EMECC-HECC_8 - { 30, 30,363,362,361,360, 30, 31, 31,375,374,373,372, 31, -1,-1} // EMECC-HECC_8 + { 3, 3, 1, 1, 15, 15, 13, 13, 2, 2, 0, 0, 12, 12, 14, 14}, // f0 -- EMECC_1 + { 27, 27, 25, 25, 39, 39, 37, 37, 26, 26, 24, 24, 36, 36, 38, 38}, // f1 -- EMECC_2 + { 51, 51, 49, 49, 63, 63, 61, 61, 50, 50, 48, 48, 60, 60, 62, 62}, // f2 -- EMECC_3 + { 75, 75, 73, 73, 87, 87, 85, 85, 74, 74, 72, 72, 84, 84, 86, 86}, // f3 -- EMECC_4 + { 99, 99, 97, 97,111,111,109,109, 98, 98, 96, 96,108,108,110,110}, // f4 -- EMECC_5 + {123,123,121,121,135,135,133,133,122,122,120,120,132,132,134,134}, // f5 -- EMECC_6 + {147,147,145,145,159,159,157,157,146,146,144,144,156,156,158,158}, // f6 -- EMECC_7 + {171,171,169,169,183,183,181,181,170,170,168,168,180,180,182,182}, // f7 -- EMECC_8 + { 7, 7, 5, 5, 19, 19, 17, 17, 6, 6, 4, 4, 16, 16, 18, 18}, // f8 -- EMBC-EMECC_1 + { 31, 31, 29, 29, 43, 43, 41, 41, 30, 30, 28, 28, 40, 40, 42, 42}, // f9 -- EMBC-EMECC_2 + { 55, 55, 53, 53, 67, 67, 65, 65, 54, 54, 52, 52, 64, 64, 66, 66}, // f10 -- EMBC-EMECC_3 + { 79, 79, 77, 77, 91, 91, 89, 89, 78, 78, 76, 76, 88, 88, 90, 90}, // f11 -- EMBC-EMECC_4 + {103,103,101,101,115,115,113,113,102,102,100,100,112,112,114,114}, // f12 -- EMBC-EMECC_5 + {127,127,125,125,139,139,137,137,126,126,124,124,136,136,138,138}, // f13 -- EMBC-EMECC_6 + {151,151,149,149,163,163,161,161,150,150,148,148,160,160,162,162}, // f14 -- EMBC-EMECC_7 + {175,175,173,173,187,187,185,185,174,174,172,172,184,184,186,186}, // f15 -- EMBC-EMECC_8 + { 11, 11, 9, 9, 23, 23, 21, 21, 10, 10, 8, 8, 20, 20, 22, 22}, // f16 -- EMBC_1 + { 35, 35, 33, 33, 47, 47, 45, 45, 34, 34, 32, 32, 44, 44, 46, 46}, // f17 -- EMBC_2 + { 59, 59, 57, 57, 71, 71, 69, 69, 58, 58, 56, 56, 68, 68, 70, 70}, // f18 -- EMBC_3 + { 83, 83, 81, 81, 95, 95, 93, 93, 82, 82, 80, 80, 92, 92, 94, 94}, // f19 -- EMBC_4 + {107,107,105,105,119,119,117,117,106,106,104,104,116,116,118,118}, // f20 -- EMBC_5 + {131,131,129,129,143,143,141,141,130,130,128,128,140,140,142,142}, // f21 -- EMBC_6 + {155,155,153,153,167,167,165,165,154,154,152,152,164,164,166,166}, // f22 -- EMBC_7 + {179,179,177,177,191,191,189,189,178,178,176,176,188,188,190,190}, // f23 -- EMBC_8 + {195,195,193,193,207,207,205,205,194,194,192,192,204,204,206,206}, // f24 -- EMECC_9 + {219,219,217,217,231,231,229,229,218,218,216,216,228,228,230,230}, // f25 -- EMECC_10 + {243,243,241,241,255,255,253,253,242,242,240,240,252,252,254,254}, // f26 -- EMECC_11 + {267,267,265,265,279,279,277,277,266,266,264,264,276,276,278,278}, // f27 -- EMECC_12 + {291,291,289,289,303,303,301,301,290,290,288,288,300,300,302,302}, // f28 -- EMECC_13 + {315,315,313,313,327,327,325,325,314,314,312,312,324,324,326,326}, // f29 -- EMECC_14 + {339,339,337,337,351,351,349,349,338,338,336,336,348,348,350,350}, // f30 -- EMECC_15 + {363,363,361,361,375,375,373,373,362,362,360,360,372,372,374,374}, // f31 -- EMECC_16 + {199,199,197,197,211,211,209,209,198,198,196,196,208,208,210,210}, // f32 -- EMBC-EMECC_9 + {223,223,221,221,235,235,233,233,222,222,220,220,232,232,234,234}, // f33 -- EMBC-EMECC_10 + {247,247,245,245,259,259,257,257,246,246,244,244,256,256,258,258}, // f34 -- EMBC-EMECC_11 + {271,271,269,269,283,283,281,281,270,270,268,268,280,280,282,282}, // f35 -- EMBC-EMECC_12 + {295,295,293,293,307,307,305,305,294,294,292,292,304,304,306,306}, // f36 -- EMBC-EMECC_13 + {319,319,317,317,331,331,329,329,318,318,316,316,328,328,330,330}, // f37 -- EMBC-EMECC_14 + {343,343,341,341,355,355,353,353,342,342,340,340,352,352,354,354}, // f38 -- EMBC-EMECC_15 + {367,367,365,365,379,379,377,377,366,366,364,364,376,376,378,378}, // f39 -- EMBC-EMECC_16 + {203,203,201,201,215,215,213,213,202,202,200,200,212,212,214,214}, // f40 -- EMBC_9 + {227,227,225,225,239,239,237,237,226,226,224,224,236,236,238,238}, // f41 -- EMBC_10 + {251,251,249,249,263,263,261,261,250,250,248,248,260,260,262,262}, // f42 -- EMBC_11 + {275,275,273,273,287,287,285,285,274,274,272,272,284,284,286,286}, // f43 -- EMBC_12 + {299,299,297,297,311,311,309,309,298,298,296,296,308,308,310,310}, // f44 -- EMBC_13 + {323,323,321,321,335,335,333,333,322,322,320,320,332,332,334,334}, // f45 -- EMBC_14 + {347,347,345,345,359,359,357,357,346,346,344,344,356,356,358,358}, // f46 -- EMBC_15 + {371,371,369,369,383,383,381,381,370,370,368,368,380,380,382,382}, // f47 -- EMBC_16 + { 4, 5, 17, 16, 28, 29, 41, 40, 52, 53, 65, 64, 76, 77, 89, 88}, // f48 -- TREXC_4_1 + { 6, 7, 19, 18, 30, 31, 43, 42, 54, 55, 67, 66, 78, 79, 91, 90}, // f49 -- TREXC_5_1 + { 8, 9, 21, 20, 32, 33, 45, 44, 56, 57, 69, 68, 80, 81, 93, 92}, // f50 -- TREXC_6_1 + { 10, 11, 23, 22, 34, 35, 47, 46, 58, 59, 71, 70, 82, 83, 95, 94}, // f51 -- TREXC_7_1 + {100,101,113,112,124,125,137,136,148,149,161,160,172,173,185,184}, // f52 -- TREXC_4_2 + {102,103,115,114,126,127,139,138,150,151,163,162,174,175,187,186}, // f53 -- TREXC_5_2 + {104,105,117,116,128,129,141,140,152,153,165,164,176,177,189,188}, // f54 -- TREXC_6_2 + {106,107,119,118,130,131,143,142,154,155,167,166,178,179,191,190}, // f55 -- TREXC_7_2 + { 0, 0, 3, 2, 1, 0, 0, 1, 1, 15, 14, 13, 12, 1, -1, -1}, // f56 -- EMECC-HECC_1 + { 2, 2, 27, 26, 25, 24, 2, 3, 3, 39, 38, 37, 36, 3, -1, -1}, // f57 -- EMECC-HECC_1 + { 4, 4, 51, 50, 49, 48, 4, 5, 5, 63, 62, 61, 60, 5, -1, -1}, // f58 -- EMECC-HECC_2 + { 6, 6, 75, 74, 73, 72, 6, 7, 7, 87, 86, 85, 84, 7, -1, -1}, // f59 -- EMECC-HECC_2 + { 8, 8, 99, 98, 97, 96, 8, 9, 9,111,110,109,108, 9, -1, -1}, // f60 -- EMECC-HECC_3 + { 10, 10,123,122,121,120, 10, 11, 11,135,134,133,132, 11, -1, -1}, // f61 -- EMECC-HECC_3 + { 12, 12,147,146,145,144, 12, 13, 13,159,158,157,156, 13, -1, -1}, // f62 -- EMECC-HECC_4 + { 14, 14,171,170,169,168, 14, 15, 15,183,182,181,180, 15, -1, -1}, // f63 -- EMECC-HECC_4 + {196,197,209,208,220,221,233,232,244,245,257,256,268,269,281,280}, // f64 -- TREXC_4_3 + {198,199,211,210,222,223,235,234,246,247,259,258,270,271,283,282}, // f65 -- TREXC_5_3 + {200,201,213,212,224,225,237,236,248,249,261,260,272,273,285,284}, // f66 -- TREXC_6_3 + {202,203,215,214,226,227,239,238,250,251,263,262,274,275,287,286}, // f67 -- TREXC_7_3 + {292,293,305,304,316,317,329,328,340,341,353,352,364,365,377,376}, // f68 -- TREXC_4_4 + {294,295,307,306,318,319,331,330,342,343,355,354,366,367,379,378}, // f69 -- TREXC_5_4 + {296,297,309,308,320,321,333,332,344,345,357,356,368,369,381,380}, // f70 -- TREXC_6_4 + {298,299,311,310,322,323,335,334,346,347,359,358,370,371,383,382}, // f71 -- TREXC_7_4 + { 16, 16,195,194,193,192, 16, 17, 17,207,206,205,204, 17, -1, -1}, // f72 -- EMECC-HECC_5 + { 18, 18,219,218,217,216, 18, 19, 19,231,230,229,228, 19, -1, -1}, // f73 -- EMECC-HECC_5 + { 20, 20,243,242,241,240, 20, 21, 21,255,254,253,252, 21, -1, -1}, // f74 -- EMECC-HECC_6 + { 22, 22,267,266,265,264, 22, 23, 23,279,278,277,276, 23, -1, -1}, // f75 -- EMECC-HECC_6 + { 24, 24,291,290,289,288, 24, 25, 25,303,302,301,300, 25, -1, -1}, // f76 -- EMECC-HECC_7 + { 26, 26,315,314,313,312, 26, 27, 27,327,326,325,324, 27, -1, -1}, // f77 -- EMECC-HECC_7 + { 28, 28,339,338,337,336, 28, 29, 29,351,350,349,348, 29, -1, -1}, // f78 -- EMECC-HECC_8 + { 30, 30,363,362,361,360, 30, 31, 31,375,374,373,372, 31, -1, -1}, // f79 -- EMECC-HECC_8 }}; constexpr std::array<std::array<int, 20>, 4> AMPD_DSTRT_ARR = @@ -363,15 +366,17 @@ namespace LVL1::gFEXPos { constexpr std::array<int, 100> CMPD_NFI = - {1,1,2,1,1,0,0,0,0,0,0,0,0,3,3,3, - 3,0,0,0,0,0,0,0,0,1,1,2,1,1,0,0, - 0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,0, - 0,0, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //unsed in C - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //unsed in C - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 //unsed in C - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 //unsed in C - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 //unsed in C + { + 1,1,2,3,3,0,0,0,0,0,0,0,0,1,1,3, + 3,0,0,0,0,0,0,0,0,1,1,2,3,3,0,0, + 0,0,0,0,0,0,1,1,3,3,0,0,0,0,0,0, + 0,0, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //unsed in C + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, //unsed in C + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 //unsed in C + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 //unsed in C + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 //unsed in C + }; constexpr std::array<int, 100> CCALO_TYPE= @@ -384,75 +389,57 @@ namespace LVL1::gFEXPos { constexpr std::array<std::array<int, 16>, 100> CMPD_GTRN_ARR = {{ - // CONNECTOR 5 - //FCAL1 - //neg eta ("C" side) - {12, 36, 60, 84, 1, 25, 49, 73, 13, 37, 61, 85, 0, 0, 0, 0}, - {108, 132, 156, 180, 97, 121, 145, 169, 109, 133, 157, 181, 0, 0, 0, 0}, - {0, 24, 48, 72, 96, 120, 144, 168, 192, 216, 240, 264, 288, 312, 336, 360}, - {204, 228, 252, 276, 193, 217, 241, 265, 205, 229, 253, 277, 0, 0, 0, 0}, - {300, 324, 348, 372, 289, 313, 337, 361, 301, 325, 349, 373, 0, 0, 0, 0}, - //EMEC/HEC - //neg eta ("C" side, first 4) - {2, 14, 3, 15, 4, 16, 5, 17, 2, 14, 3, 15, 4, 16, 5, 17}, - {26, 38, 27, 39, 28, 40, 29, 41, 26, 38, 27, 39, 28, 40, 29, 41}, - {50, 62, 51, 63, 52, 64, 53, 65, 50, 62, 51, 63, 52, 64, 53, 65}, - {74, 86, 75, 87, 76, 88, 77, 89, 74, 86, 75, 87, 76, 88, 77, 89}, - {98, 110, 99, 111, 100, 112, 101, 113, 98, 110, 99, 111, 100, 112, 101, 113}, - {122, 134, 123, 135, 124, 136, 125, 137, 122, 134, 123, 135, 124, 136, 125, 137}, - {146, 158, 147, 159, 148, 160, 149, 161, 146, 158, 147, 159, 148, 160, 149, 161}, - {170, 182, 171, 183, 172, 184, 173, 185, 170, 182, 171, 183, 172, 184, 173, 185}, - //FCAL2 - //neg eta ("C" side) - {0, 24, 48, 72, 12, 36, 60, 84, 1, 25, 49, 73, 13, 37, 61, 85}, - {96, 120, 144, 168, 108, 132, 156, 180, 97, 121, 145, 169, 109, 133, 157, 181}, - {192, 216, 240, 264, 204, 228, 252, 276, 193, 217, 241, 265, 205, 229, 253, 277}, - {288, 312, 336, 360, 300, 324, 348, 372, 289, 313, 337, 361, 301, 325, 349, 373}, - //EMEC/HEC - //neg eta ("C" side, second 4) - {194, 206, 195, 207, 196, 208, 197, 209, 194, 206, 195, 207, 196, 208, 197, 209}, - {218, 230, 219, 231, 220, 232, 221, 233, 218, 230, 219, 231, 220, 232, 221, 233}, - {242, 254, 243, 255, 244, 256, 245, 257, 242, 254, 243, 255, 244, 256, 245, 257}, - {266, 278, 267, 279, 268, 280, 269, 281, 266, 278, 267, 279, 268, 280, 269, 281}, - {290, 302, 291, 303, 292, 304, 293, 305, 290, 302, 291, 303, 292, 304, 293, 305}, - {314, 326, 315, 327, 316, 328, 317, 329, 314, 326, 315, 327, 316, 328, 317, 329}, - {338, 350, 339, 351, 340, 352, 341, 353, 338, 350, 339, 351, 340, 352, 341, 353}, - {362, 374, 363, 375, 364, 376, 365, 377, 362, 374, 363, 375, 364, 376, 365, 377}, + { -1, 12, -1, 60, -1, 36, -1, 84, 1, 0, 49, 48, 25, 24, 73, 72}, // f0 -- FCAL1C + { -1,108, -1,156, -1,132, -1,180, 97, 96,145,144,121,120,169,168}, // f1 -- FCAL1C + { 13, 61,109,157,205,253,301,349, 37, 85,133,181,229,277,325,373}, // f2 -- FCAL1C + { 13, 1, 61, 49, 37, 25, 85, 73, 12, 0, 60, 48, 36, 24, 84, 72}, // f3 -- FCAL2C + {109, 97,157,145,133,121,181,169,108, 96,156,144,132,120,180,168}, // f4 -- FCAL2C + { 5, 4, 5, 4, 3, 2, 3, 2, 17, 16, 17, 16, 15, 14, 15, 14}, // f5 -- EMECC-HECC_1 + { 29, 28, 29, 28, 27, 26, 27, 26, 41, 40, 41, 40, 39, 38, 39, 38}, // f6 -- EMECC-HECC_1 + { 53, 52, 53, 52, 51, 50, 51, 50, 65, 64, 65, 64, 63, 62, 63, 62}, // f7 -- EMECC-HECC_2 + { 77, 76, 77, 76, 75, 74, 75, 74, 89, 88, 89, 88, 87, 86, 87, 86}, // f8 -- EMECC-HECC_2 + {101,100,101,100, 99, 98, 99, 98,113,112,113,112,111,110,111,110}, // f9 -- EMECC-HECC_3 + {125,124,125,124,123,122,123,122,137,136,137,136,135,134,135,134}, // f10 -- EMECC-HECC_3 + {149,148,149,148,147,146,147,146,161,160,161,160,159,158,159,158}, // f11 -- EMECC-HECC_4 + {173,172,173,172,171,170,171,170,185,184,185,184,183,182,183,182}, // f12 -- EMECC-HECC_4 + { -1,204, -1,252, -1,228, -1,276,193,192,241,240,217,216,265,264}, // f13 -- FCAL1C + { -1,300, -1,348, -1,324, -1,372,289,288,337,336,313,312,361,360}, // f14 -- FCAL1C + {205,193,253,241,229,217,277,265,204,192,252,240,228,216,276,264}, // f15 -- FCAL2C + {301,289,349,337,325,313,373,361,300,288,348,336,324,312,372,360}, // f16 -- FCAL2C + {197,196,197,196,195,194,195,194,209,208,209,208,207,206,207,206}, // f17 -- EMECC-HECC_5 + {221,220,221,220,219,218,219,218,233,232,233,232,231,230,231,230}, // f18 -- EMECC-HECC_5 + {245,244,245,244,243,242,243,242,257,256,257,256,255,254,255,254}, // f19 -- EMECC-HECC_6 + {269,268,269,268,267,266,267,266,281,280,281,280,279,278,279,278}, // f20 -- EMECC-HECC_6 + {293,292,293,292,291,290,291,290,305,304,305,304,303,302,303,302}, // f21 -- EMECC-HECC_7 + {317,316,317,316,315,314,315,314,329,328,329,328,327,326,327,326}, // f22 -- EMECC-HECC_7 + {341,340,341,340,339,338,339,338,353,352,353,352,351,350,351,350}, // f23 -- EMECC-HECC_8 + {365,364,365,364,363,362,363,362,377,376,377,376,375,374,375,374}, // f24 -- EMECC-HECC_8 + { -1, 23, -1, 71, -1, 47, -1, 95, 10, 11, 58, 59, 34, 35, 82, 83}, // f25 -- FCAL1A + { -1,119, -1,167, -1,143, -1,191,106,107,154,155,130,131,178,179}, // f26 -- FCAL1A + { 22, 70,118,166,214,262,310,358, 46, 94,142,190,238,286,334,382}, // f27 -- FCAL1A + { 22, 10, 70, 58, 46, 34, 94, 82, 23, 11, 71, 59, 47, 35, 95, 83}, // f28 -- FCAL2A + {118,106,166,154,142,130,190,178,119,107,167,155,143,131,191,179}, // f29 -- FCAL2A + { 6, 7, 6, 7, 8, 9, 8, 9, 18, 19, 18, 19, 20, 21, 20, 21}, // f30 -- EMECA-HECA_1 + { 30, 31, 30, 31, 32, 33, 32, 33, 42, 43, 42, 43, 44, 45, 44, 45}, // f31 -- EMECA-HECA_1 + { 54, 55, 54, 55, 56, 57, 56, 57, 66, 67, 66, 67, 68, 69, 68, 69}, // f32 -- EMECA-HECA_2 + { 78, 79, 78, 79, 80, 81, 80, 81, 90, 91, 90, 91, 92, 93, 92, 93}, // f33 -- EMECA-HECA_2 + {102,103,102,103,104,105,104,105,114,115,114,115,116,117,116,117}, // f34 -- EMECA-HECA_3 + {126,127,126,127,128,129,128,129,138,139,138,139,140,141,140,141}, // f35 -- EMECA-HECA_3 + {150,151,150,151,152,153,152,153,162,163,162,163,164,165,164,165}, // f36 -- EMECA-HECA_4 + {174,175,174,175,176,177,176,177,186,187,186,187,188,189,188,189}, // f37 -- EMECA-HECA_4 + { -1,215, -1,263, -1,239, -1,287,202,203,250,251,226,227,274,275}, // f38 -- FCAL1A + { -1,311, -1,359, -1,335, -1,383,298,299,346,347,322,323,370,371}, // f39 -- FCAL1A + {214,202,262,250,238,226,286,274,215,203,263,251,239,227,287,275}, // f40 -- FCAL2A + {310,298,358,346,334,322,382,370,311,299,359,347,335,323,383,371}, // f41 -- FCAL2A + {198,199,198,199,200,201,200,201,210,211,210,211,212,213,212,213}, // f42 -- EMECA-HECA_5 + {222,223,222,223,224,225,224,225,234,235,234,235,236,237,236,237}, // f43 -- EMECA-HECA_5 + {246,247,246,247,248,249,248,249,258,259,258,259,260,261,260,261}, // f44 -- EMECA-HECA_6 + {270,271,270,271,272,273,272,273,282,283,282,283,284,285,284,285}, // f45 -- EMECA-HECA_6 + {294,295,294,295,296,297,296,297,306,307,306,307,308,309,308,309}, // f46 -- EMECA-HECA_7 + {318,319,318,319,320,321,320,321,330,331,330,331,332,333,332,333}, // f47 -- EMECA-HECA_7 + {342,343,342,343,344,345,344,345,354,355,354,355,356,357,356,357}, // f48 -- EMECA-HECA_8 + {366,367,366,367,368,369,368,369,378,379,378,379,380,381,380,381}, // f49 -- EMECA-HECA_8 - // CONNECTOR 6 - //FCAL1 - //pos eta ("A" side) - {22, 46, 70, 94, 11, 35, 59, 83, 23, 47, 71, 95, 0, 0, 0, 0}, - {118, 142, 166, 190, 107, 131, 155, 179, 119, 143, 167, 191, 0, 0, 0, 0}, - {10, 34, 58, 82, 106, 130, 154, 178, 202, 226, 250, 274, 298, 322, 346, 370}, - {214, 238, 262, 286, 203, 227, 251, 275, 215, 239, 263, 287, 0, 0, 0, 0}, - {310, 334, 358, 382, 299, 323, 347, 371, 311, 335, 359, 383, 0, 0, 0, 0}, - //EMEC/HEC - //pos eta ("A" side, first 4) - {6, 18, 7, 19, 8, 20, 9, 21, 6, 18, 7, 19, 8, 20, 9, 21}, - {30, 42, 31, 43, 32, 44, 33, 45, 30, 42, 31, 43, 32, 44, 33, 45}, - {54, 66, 55, 67, 56, 68, 57, 69, 54, 66, 55, 67, 56, 68, 57, 69}, - {78, 90, 79, 91, 80, 92, 81, 93, 78, 90, 79, 91, 80, 92, 81, 93}, - {102, 114, 103, 115, 104, 116, 105, 117, 102, 114, 103, 115, 104, 116, 105, 117}, - {126, 138, 127, 139, 128, 140, 129, 141, 126, 138, 127, 139, 128, 140, 129, 141}, - {150, 162, 151, 163, 152, 164, 153, 165, 150, 162, 151, 163, 152, 164, 153, 165}, - {174, 186, 175, 187, 176, 188, 177, 189, 174, 186, 175, 187, 176, 188, 177, 189}, - //FCAL2 - //pos eta ("A" side) - {10, 34, 58, 82, 22, 46, 70, 94, 11, 35, 59, 83, 23, 47, 71, 95}, - {106, 130, 154, 178, 118, 142, 166, 190, 107, 131, 155, 179, 119, 143, 167, 191}, - {202, 226, 250, 274, 214, 238, 262, 286, 203, 227, 251, 275, 215, 239, 263, 287}, - {298, 322, 346, 370, 310, 334, 358, 382, 299, 323, 347, 371, 311, 335, 359, 383}, - //EMEC/HEC - //pos eta ("A" side, second 4) - {198, 210, 199, 211, 200, 212, 201, 213, 198, 210, 199, 211, 200, 212, 201, 213}, - {222, 234, 223, 235, 224, 236, 225, 237, 222, 234, 223, 235, 224, 236, 225, 237}, - {246, 258, 247, 259, 248, 260, 249, 261, 246, 258, 247, 259, 248, 260, 249, 261}, - {270, 282, 271, 283, 272, 284, 273, 285, 270, 282, 271, 283, 272, 284, 273, 285}, - {294, 306, 295, 307, 296, 308, 297, 309, 294, 306, 295, 307, 296, 308, 297, 309}, - {318, 330, 319, 331, 320, 332, 321, 333, 318, 330, 319, 331, 320, 332, 321, 333}, - {342, 354, 343, 355, 344, 356, 345, 357, 342, 354, 343, 355, 344, 356, 345, 357}, - {366, 378, 367, 379, 368, 380, 369, 381, 366, 378, 367, 379, 368, 380, 369, 381}, // total to here 32 + 10 + 8 = 50 {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, // unused {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}, // unused @@ -499,14 +486,14 @@ namespace LVL1::gFEXPos { constexpr std::array<std::array<char, 20>, 4> CMPD_DTYP_ARR = {{ - {0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011, - 0b1001,0b1000,0b1010,0b0101}, // EMECHEC - {0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b1111,0b1111,0b1111,0b1111, - 0b1001,0b1000,0b1010,0b0101}, // FCAL1 - {0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010, - 0b1001,0b1000,0b1010,0b0101}, // FCAL1 f1 - {0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011, - 0b1001,0b1000,0b1010,0b0101} // FCAL2 + {0b0010,0b0010,0b0011,0b0011,0b0010,0b0010,0b0011,0b0011,0b0010,0b0010, + 0b0011,0b0011,0b0010,0b0010,0b0011,0b0011,0b1111,0b1000,0b1010,0b0101}, // EMECHEC + {0b1111,0b0010,0b1111,0b0010,0b1111,0b0010,0b1111,0b0010,0b0010,0b0010, + 0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b1111,0b1000,0b1010,0b0101}, // FCAL1 first type + {0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b0010, + 0b0010,0b0010,0b0010,0b0010,0b0010,0b0010,0b1111,0b1000,0b1010,0b0101}, // FCAL1 second type + {0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b0011, + 0b0011,0b0011,0b0011,0b0011,0b0011,0b0011,0b1111,0b1000,0b1010,0b0101} // FCAL2 }}; @@ -519,6 +506,60 @@ namespace LVL1::gFEXPos { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1 }; + constexpr std::array<unsigned int, 385> INV19 = + { + 0x00000,0x45000,0x22800,0x17000,0x11400,0x0DCC8,0x0B800,0x09DB0, + 0x08A00,0x07AA8,0x06E60,0x06458,0x05C00,0x054E8,0x04ED8,0x04998, + 0x04500,0x040F0,0x03D50,0x03A18,0x03730,0x03490,0x03228,0x03000, + 0x02E00,0x02C28,0x02A70,0x028E0,0x02768,0x02610,0x024C8,0x02398, + 0x02280,0x02170,0x02078,0x01F88,0x01EA8,0x01DD0,0x01D08,0x01C48, + 0x01B98,0x01AE8,0x01A48,0x019A8,0x01910,0x01888,0x01800,0x01778, + 0x01700,0x01680,0x01610,0x015A0,0x01538,0x014D0,0x01470,0x01410, + 0x013B0,0x01358,0x01308,0x012B0,0x01260,0x01218,0x011C8,0x01180, + 0x01140,0x010F8,0x010B8,0x01078,0x01038,0x01000,0x00FC0,0x00F88, + 0x00F50,0x00F18,0x00EE8,0x00EB8,0x00E80,0x00E50,0x00E20,0x00DF8, + 0x00DC8,0x00DA0,0x00D70,0x00D48,0x00D20,0x00CF8,0x00CD0,0x00CB0, + 0x00C88,0x00C60,0x00C40,0x00C20,0x00C00,0x00BD8,0x00BB8,0x00B98, + 0x00B80,0x00B60,0x00B40,0x00B20,0x00B08,0x00AE8,0x00AD0,0x00AB0, + 0x00A98,0x00A80,0x00A68,0x00A50,0x00A38,0x00A20,0x00A08,0x009F0, + 0x009D8,0x009C0,0x009A8,0x00998,0x00980,0x00968,0x00958,0x00940, + 0x00930,0x00918,0x00908,0x008F8,0x008E0,0x008D0,0x008C0,0x008B0, + 0x008A0,0x00888,0x00878,0x00868,0x00858,0x00848,0x00838,0x00828, + 0x00818,0x00808,0x00800,0x007F0,0x007E0,0x007D0,0x007C0,0x007B8, + 0x007A8,0x00798,0x00788,0x00780,0x00770,0x00768,0x00758,0x00748, + 0x00740,0x00730,0x00728,0x00718,0x00710,0x00708,0x006F8,0x006F0, + 0x006E0,0x006D8,0x006D0,0x006C0,0x006B8,0x006B0,0x006A0,0x00698, + 0x00690,0x00688,0x00678,0x00670,0x00668,0x00660,0x00658,0x00648, + 0x00640,0x00638,0x00630,0x00628,0x00620,0x00618,0x00610,0x00608, + 0x00600,0x005F0,0x005E8,0x005E0,0x005D8,0x005D0,0x005C8,0x005C0, + 0x005C0,0x005B8,0x005B0,0x005A8,0x005A0,0x00598,0x00590,0x00588, + 0x00580,0x00578,0x00574,0x00570,0x00568,0x00560,0x00558,0x00550, + 0x0054C,0x00548,0x00540,0x00538,0x00530,0x0052C,0x00528,0x00520, + 0x00518,0x00514,0x00510,0x00508,0x00500,0x004FC,0x004F8,0x004F0, + 0x004EC,0x004E8,0x004E0,0x004D8,0x004D4,0x004D0,0x004C8,0x004C4, + 0x004C0,0x004B8,0x004B4,0x004B0,0x004AC,0x004A8,0x004A0,0x0049C, + 0x00498,0x00490,0x0048C,0x00488,0x00484,0x00480,0x0047C,0x00478, + 0x00470,0x0046C,0x00468,0x00464,0x00460,0x0045C,0x00458,0x00454, + 0x00450,0x00448,0x00444,0x00440,0x0043C,0x00438,0x00434,0x00430, + 0x0042C,0x00428,0x00424,0x00420,0x0041C,0x00418,0x00414,0x00410, + 0x0040C,0x00408,0x00405,0x00402,0x00400,0x003FC,0x003F8,0x003F4, + 0x003F0,0x003EC,0x003E8,0x003E4,0x003E0,0x003DD,0x003DA,0x003D8, + 0x003D4,0x003D0,0x003CC,0x003C8,0x003C5,0x003C2,0x003C0,0x003BC, + 0x003B8,0x003B5,0x003B2,0x003B0,0x003AC,0x003A8,0x003A5,0x003A2, + 0x003A0,0x0039D,0x0039A,0x00398,0x00394,0x00390,0x0038D,0x0038A, + 0x00388,0x00385,0x00382,0x00380,0x0037D,0x0037A,0x00378,0x00375, + 0x00372,0x00370,0x0036D,0x0036A,0x00368,0x00365,0x00362,0x00360, + 0x0035D,0x0035A,0x00358,0x00355,0x00352,0x00350,0x0034D,0x0034A, + 0x00348,0x00345,0x00342,0x00340,0x0033D,0x0033A,0x00338,0x00336, + 0x00334,0x00332,0x00330,0x0032D,0x0032A,0x00328,0x00326,0x00324, + 0x00322,0x00320,0x0031D,0x0031A,0x00318,0x00316,0x00314,0x00312, + 0x00310,0x0030E,0x0030C,0x0030A,0x00308,0x00306,0x00304,0x00302, + 0x00300,0x002FD,0x002FA,0x002F8,0x002F6,0x002F4,0x002F2,0x002F0, + 0x002EE,0x002EC,0x002EA,0x002E8,0x002E6,0x002E5,0x002E3,0x002E1, + 0x002E0 + }; + + } // namespace LVL1::gFEXPos