--- yoda/techmodel/physics/CalorimeterReader.cpp 2004/08/19 15:24:58 1.2 +++ yoda/techmodel/physics/CalorimeterReader.cpp 2004/08/20 15:01:50 1.3 @@ -1,6 +1,6 @@ /** @file * $Source: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v $ - * $Id: CalorimeterReader.cpp,v 1.1 2004/07/17 20:03:48 kusanagi Exp $ + * $Id: CalorimeterReader.cpp,v 1.2 2004/08/19 15:24:58 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the CalorimeterReader class. @@ -49,7 +49,7 @@ */ std::string CalorimeterReader::GetVersionInfo(void) const { return - "$Header: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v 1.1 2004/07/17 20:03:48 kusanagi Exp $"; + "$Header: /home/cvsmanager/yoda/techmodel/physics/CalorimeterReader.cpp,v 1.2 2004/08/19 15:24:58 kusanagi Exp $"; } /** @@ -83,49 +83,51 @@ //Call to the routine that unpack calorimeter events calunpack_((short*)convdata, &length, &ERROR); - - /*switch (ERROR){ - case: - }*/ - - calorimeter->IEV2 = evento_.IEV2; - calorimeter->stwerr = evento_.stwerr; - calorimeter->perror = evento_.perror; - -//--------have to invert array because of FORTRAN <-> C different management of the indexes - int tempDexy[96][22][2]; - int tempDexyc[96][22][2]; - int tempBase[96][22][2]; - int tempCalselftrig[7][4]; - memcpy(tempDexy, evento_.dexy, sizeof(tempDexy)); - memcpy(tempDexyc, evento_.dexyc, sizeof(tempDexyc)); - memcpy(tempBase, evento_.base, sizeof(tempBase)); - memcpy(tempCalselftrig, evento_.calselftrig, sizeof(tempCalselftrig)); - - for (int i = 0; i < 4; i++){ - for (int j = 0; j < 7; j++){ - calorimeter->calselftrig[i][j] = tempCalselftrig[j][i]; + + if (ERROR != 0) { + char *errmsg; + switch (ERROR){ + case 1: errmsg = "CALORIMETER NOT FOUND"; + } + cat << log4cpp::Priority::ERROR + << "Fortran77 function calunpack error code = " << ERROR + << errmsg + << "\n " << log4cpp::CategoryStream::ENDLINE; + } else { + calorimeter->IEV2 = evento_.IEV2; + calorimeter->stwerr = evento_.stwerr; + calorimeter->perror = evento_.perror; + + //--------have to invert array because of FORTRAN <-> C different management of the indexes + int tempDexy[96][22][2]; + int tempDexyc[96][22][2]; + int tempBase[96][22][2]; + int tempCalselftrig[7][4]; + memcpy(tempDexy, evento_.dexy, sizeof(tempDexy)); + memcpy(tempDexyc, evento_.dexyc, sizeof(tempDexyc)); + memcpy(tempBase, evento_.base, sizeof(tempBase)); + memcpy(tempCalselftrig, evento_.calselftrig, sizeof(tempCalselftrig)); + + for (int i = 0; i < 4; i++){ + for (int j = 0; j < 7; j++){ + calorimeter->calselftrig[i][j] = tempCalselftrig[j][i]; + } } - } - for (int i = 0; i < 2; i++){ - for (int j = 0; j < 22; j++){ - for (int z = 0; z < 96; z++){ - calorimeter->dexy[i][j][z] = tempDexy[z][j][i]; - calorimeter->dexyc[i][j][z] = tempDexyc[z][j][i]; - calorimeter->base[i][j][z] = tempBase[z][j][i]; + for (int i = 0; i < 2; i++){ + for (int j = 0; j < 22; j++){ + for (int z = 0; z < 96; z++){ + calorimeter->dexy[i][j][z] = tempDexy[z][j][i]; + calorimeter->dexyc[i][j][z] = tempDexyc[z][j][i]; + calorimeter->base[i][j][z] = tempBase[z][j][i]; + } } } - } -//----------------------------------------------------------------------------------------- + //----------------------------------------------------------------------------------------- - - memcpy(calorimeter->calIItrig, evento_.calIItrig, sizeof(calorimeter->calIItrig)); - memcpy(calorimeter->calstripshift, evento_.calstripshift, sizeof(calorimeter->calstripshift)); - memcpy(calorimeter->calDSPtaberr, evento_.calDSPtaberr, sizeof(calorimeter->calDSPtaberr)); - memcpy(calorimeter->calevnum, evento_.calevnum, sizeof(calorimeter->calevnum)); - - cat << log4cpp::Priority::ERROR - << "Fortran77 function calunpack error code = " << ERROR - << "\n " << log4cpp::CategoryStream::ENDLINE; + memcpy(calorimeter->calIItrig, evento_.calIItrig, sizeof(calorimeter->calIItrig)); + memcpy(calorimeter->calstripshift, evento_.calstripshift, sizeof(calorimeter->calstripshift)); + memcpy(calorimeter->calDSPtaberr, evento_.calDSPtaberr, sizeof(calorimeter->calDSPtaberr)); + memcpy(calorimeter->calevnum, evento_.calevnum, sizeof(calorimeter->calevnum)); + } }