--- chewbacca/PamOffLineSW/techmodel/PhysEndRunReader.cpp 2008/10/02 14:37:19 1.4 +++ chewbacca/PamOffLineSW/techmodel/PhysEndRunReader.cpp 2010/02/16 13:38:14 1.5 @@ -53,13 +53,17 @@ int j = 0; // physEndRun->CALO_ENDRUN. while(offset < tbInitPos){ + if ( offset >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_BOARD_ID_HK = (((UINT8)subData[offset])&0xFF); + if ( offset+1 >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_BOARD_STATUS_HK = ((UINT8)subData[offset+1]); // if (!(physEndRun->CALO_ENDRUN[j].CALO_BOARD_STATUS_HK & 0x02)) { - UInt_t kk = 0; + Int_t kk = 0; for(int k = 0; k < 11 ; k++){ + if ( offset+5+kk >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_HK0[k] = (((UINT16)(subData[offset+4+kk]<<8))&0xFF00) + (((UINT16)subData[offset+5+kk])&0x00FF); + if ( offset+27+kk >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_HK1[k] = (((UINT16)(subData[offset+26+kk]<<8))&0xFF00) + (((UINT16)subData[offset+27+kk])&0x00FF); kk += 2; } @@ -70,12 +74,15 @@ // // in CALO_BOARD_ID_REG and CALO_BOARD_STATUS_REG we save only the last id and status register of the 7 and we don't save the CRC for each register. // + if ( offset >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_BOARD_ID_REG[k] = ((UINT8)(subData[offset])&0xFF); offset++; + if ( offset >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_BOARD_STATUS_REG[k] = (UINT8)(subData[offset]); offset++; offset++; offset++; + if ( offset+1 >= length ) return; physEndRun->CALO_ENDRUN[j].CALO_REG[k] = (((UINT16)(subData[offset]<<8))&0xFF00) + (((UINT16)subData[offset+1])&0x00FF); offset++; // CRC @@ -88,21 +95,27 @@ j++; } // + if ( offset+2 >= length ) return; physEndRun->TB_ENDRUN.TB_ALARM_MASK = (((UINT32)(subData[offset]<<16))&0x00FF0000) + (((UINT32)(subData[offset + 1]<<8))&0x0000FF00) + (((UINT32)(subData[offset + 2]))&0x000000FF); offset += 3; // + if ( offset+3 >= length ) return; physEndRun->TB_ENDRUN.TB_PMT_MASK_S3S2S12 = (((UINT32)(subData[offset]<<24))&0xFF000000) + (((UINT32)(subData[offset + 1]<<16))&0x00FF0000) + (((UINT32)(subData[offset + 2]<<8))&0x0000FF00) + (((UINT32)(subData[offset + 3]))&0x000000FF); offset += 4; // + if ( offset+2 >= length ) return; physEndRun->TB_ENDRUN.TB_PMT_MASK_S11CRC = (((UINT32)(subData[offset]<<16))&0x00FF0000) + (((UINT32)(subData[offset + 1]<<8))&0x0000FF00) + (((UINT32)(subData[offset + 2]))&0x000000FF); offset += 3; // + if ( offset+1 >= length ) return; physEndRun->TB_ENDRUN.TB_S4_CAL_MASK = (((UINT16)(subData[offset]<<8))&0xFF00) + (((UINT16)(subData[offset + 1]))&0x00FF); offset += 2; // + if ( offset+3 >= length ) return; physEndRun->TB_ENDRUN.TB_BUSY_MASK = (((UINT32)(subData[offset]<<24))&0xFF000000) + (((UINT32)(subData[offset + 1]<<16))&0x00FF0000) + (((UINT32)(subData[offset + 2]<<8))&0x0000FF00) + (((UINT32)(subData[offset + 3]))&0x000000FF); offset += 4; // + if ( offset+2 >= length ) return; physEndRun->TB_ENDRUN.TB_TRIG_CONF = (((UINT32)(subData[offset]<<16))&0x00FF0000) + (((UINT32)(subData[offset + 1]<<8))&0x0000FF00) + (((UINT32)(subData[offset + 2]))&0x000000FF); offset += 3; // @@ -115,5 +128,5 @@ */ std::string PhysEndRunReader::GetVersionInfo(void) const { return - "$Header: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/PhysEndRunReader.cpp,v 1.3 2008/09/24 15:17:23 mocchiut Exp $\n"; + "$Header: /afs/ba.infn.it/user/pamela/src/CVS/chewbacca/PamOffLineSW/techmodel/PhysEndRunReader.cpp,v 1.4 2008/10/02 14:37:19 mocchiut Exp $\n"; }