51 |
*/ |
*/ |
52 |
std::string CalibCalPulse1Reader::GetVersionInfo(void) const { |
std::string CalibCalPulse1Reader::GetVersionInfo(void) const { |
53 |
return |
return |
54 |
"$Header: /home/cvsmanager/yoda/techmodel/CalibCalPulse1Reader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/CalibCalPulse1Reader.cpp,v 1.1 2004/08/19 15:24:46 kusanagi Exp $\n"; |
55 |
} |
} |
56 |
|
|
57 |
/** |
/** |
83 |
readCRC = ((UINT16)(CRCevent[0]<<8)&0xFF00) + ((UINT16)(CRCevent[1])&0x00FF); |
readCRC = ((UINT16)(CRCevent[0]<<8)&0xFF00) + ((UINT16)(CRCevent[1])&0x00FF); |
84 |
|
|
85 |
if (calculatedCRC == readCRC) { |
if (calculatedCRC == readCRC) { |
86 |
calpulse_((short*)packetData, &dataLength, &ERROR); |
calpulse_((short*)packetData, &dataLength, &ERROR); |
87 |
//Store the unpacked data |
if (ERROR != 0) { |
88 |
calibCalPulse1->IEV2 = calib_.IEV2; |
char *errmsg; |
89 |
//--------have to invert array because of FORTRAN <-> C different management of the indexes |
switch (ERROR){ |
90 |
int tempCalped[96][11][4]; |
case 1: errmsg = "CALORIMETER NOT FOUND"; |
91 |
int tempCalgood[96][11][4]; |
} |
92 |
int tempCalthr[6][11][4]; |
cat << log4cpp::Priority::ERROR |
93 |
int tempCalrms[96][11][4]; |
<< "Fortran77 function calpulse error code = " << ERROR |
94 |
int tempCalbase[6][11][4]; |
<< errmsg |
95 |
int tempCalvar[6][11][4]; |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
96 |
int tempCalpuls[96][11][4]; |
} else { |
97 |
|
//Store the unpacked data |
98 |
memcpy(tempCalped, calib_.calped, sizeof(tempCalped)); |
calibCalPulse1->IEV2 = calib_.IEV2; |
99 |
memcpy(tempCalgood, calib_.calgood, sizeof(tempCalgood)); |
//--------have to invert array because of FORTRAN <-> C different management of the indexes |
100 |
memcpy(tempCalthr, calib_.calthr, sizeof(tempCalthr)); |
int tempCalped[96][11][4]; |
101 |
memcpy(tempCalrms, calib_.calrms, sizeof(tempCalrms)); |
int tempCalgood[96][11][4]; |
102 |
memcpy(tempCalbase, calib_.calbase, sizeof(tempCalbase)); |
int tempCalthr[6][11][4]; |
103 |
memcpy(tempCalvar, calib_.calvar, sizeof(tempCalvar)); |
int tempCalrms[96][11][4]; |
104 |
memcpy(tempCalpuls, calib_.calpuls, sizeof(tempCalpuls)); |
int tempCalbase[6][11][4]; |
105 |
|
int tempCalvar[6][11][4]; |
106 |
for (int i = 0; i < 4; i++){ |
int tempCalpuls[96][11][4]; |
107 |
for (int j = 0; j <11; j++){ |
|
108 |
for (int z = 0; z < 96; z++){ |
memcpy(tempCalped, calib_.calped, sizeof(tempCalped)); |
109 |
calibCalPulse1->calped[i][j][z] = tempCalped[z][j][i]; |
memcpy(tempCalgood, calib_.calgood, sizeof(tempCalgood)); |
110 |
calibCalPulse1->calgood[i][j][z] = tempCalgood[z][j][i]; |
memcpy(tempCalthr, calib_.calthr, sizeof(tempCalthr)); |
111 |
calibCalPulse1->calrms[i][j][z] = tempCalrms[z][j][i]; |
memcpy(tempCalrms, calib_.calrms, sizeof(tempCalrms)); |
112 |
calibCalPulse1->calpuls[i][j][z] = tempCalpuls[z][j][i]; |
memcpy(tempCalbase, calib_.calbase, sizeof(tempCalbase)); |
113 |
|
memcpy(tempCalvar, calib_.calvar, sizeof(tempCalvar)); |
114 |
|
memcpy(tempCalpuls, calib_.calpuls, sizeof(tempCalpuls)); |
115 |
|
|
116 |
|
for (int i = 0; i < 4; i++){ |
117 |
|
for (int j = 0; j <11; j++){ |
118 |
|
for (int z = 0; z < 96; z++){ |
119 |
|
calibCalPulse1->calped[i][j][z] = tempCalped[z][j][i]; |
120 |
|
calibCalPulse1->calgood[i][j][z] = tempCalgood[z][j][i]; |
121 |
|
calibCalPulse1->calrms[i][j][z] = tempCalrms[z][j][i]; |
122 |
|
calibCalPulse1->calpuls[i][j][z] = tempCalpuls[z][j][i]; |
123 |
|
} |
124 |
|
} |
125 |
} |
} |
|
} |
|
|
} |
|
126 |
|
|
127 |
for (int i = 0; i < 4; i++){ |
for (int i = 0; i < 4; i++){ |
128 |
for (int j = 0; j <11; j++){ |
for (int j = 0; j <11; j++){ |
129 |
for (int z = 0; z < 6; z++){ |
for (int z = 0; z < 6; z++){ |
130 |
calibCalPulse1->calthr[i][j][z] = tempCalthr[z][j][i]; |
calibCalPulse1->calthr[i][j][z] = tempCalthr[z][j][i]; |
131 |
calibCalPulse1->calbase[i][j][z] = tempCalbase[z][j][i]; |
calibCalPulse1->calbase[i][j][z] = tempCalbase[z][j][i]; |
132 |
calibCalPulse1->calvar[i][j][z] = tempCalvar[z][j][i]; |
calibCalPulse1->calvar[i][j][z] = tempCalvar[z][j][i]; |
133 |
|
} |
134 |
|
} |
135 |
} |
} |
136 |
|
//----------------------------------------------------------------------------------------- |
137 |
} |
} |
|
} |
|
|
//----------------------------------------------------------------------------------------- |
|
|
|
|
|
cat << log4cpp::Priority::ERROR |
|
|
<< "Fortran77 function calpulse error code = " << ERROR |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
138 |
} else { |
} else { |
139 |
cat << log4cpp::Priority::ERROR |
cat << log4cpp::Priority::ERROR |
140 |
<< "The test of calculated CRC with one wrote on file FAILED!!" |
<< "The test of calculated CRC with one wrote on file FAILED!!" |