| 1 |
// Implementation of the CalibCalReader class. |
| 2 |
|
| 3 |
#include "ReaderAlgorithms.h" |
| 4 |
|
| 5 |
using namespace pamela::techmodel; |
| 6 |
|
| 7 |
/** |
| 8 |
* Constructor. |
| 9 |
*/ |
| 10 |
|
| 11 |
CalibCalReader::CalibCalReader(void): |
| 12 |
TechmodelAlgorithm(PacketType::CalibCal, "TechmodelCalibCalReader") { |
| 13 |
calibCal = new CalibCalEvent(); |
| 14 |
} |
| 15 |
|
| 16 |
|
| 17 |
/** |
| 18 |
* Get a string with the version info of the algorithm. |
| 19 |
*/ |
| 20 |
std::string CalibCalReader::GetVersionInfo(void) const { |
| 21 |
return |
| 22 |
"$Trailer: /home/cvsmanager/yoda/techmodel/CalibCalReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 Maurizio Nagni Exp $\n"; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Initialize the algorithm with a special run. This will initialize the |
| 27 |
* event reader routines for all packet types. |
| 28 |
*/ |
| 29 |
void CalibCalReader::Init(PamelaRun *run) { |
| 30 |
run->WriteSubPacket(this, &calibCal, calibCal->Class()); |
| 31 |
//PamOffLineSW::mainLogUtil->logAll("Init CalibCal Done"); |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Unpack the calibCal event |
| 37 |
* The CPU does not add any CRC control at the packet end. |
| 38 |
* @param EventNumber |
| 39 |
* @param dataLength |
| 40 |
*/ |
| 41 |
|
| 42 |
void CalibCalReader::PKT_RunEvent(char* subData, long int dataLength) throw (WrongCRCException){ |
| 43 |
|
| 44 |
if ( dataLength == 6 ){ |
| 45 |
calibCal->CAL_RESET = (((UINT16)(subData[0]<<8))&0xFF00) + (((UINT16)(subData[1]))&0x00FF); |
| 46 |
calibCal->WRITE_DSP_MEM = (((UINT16)(subData[2]<<8))&0xFF00) + (((UINT16)(subData[3]))&0x00FF); |
| 47 |
calibCal->WRITE_FPGA_REG = (((UINT16)(subData[4]<<8))&0xFF00) + (((UINT16)(subData[5]))&0x00FF); |
| 48 |
// calibCal->calibCalData = new TArrayC(dataLength, subData); |
| 49 |
} else { |
| 50 |
calibCal->CAL_RESET = 0; |
| 51 |
calibCal->WRITE_DSP_MEM = 0; |
| 52 |
calibCal->WRITE_FPGA_REG = 0; |
| 53 |
string msg; |
| 54 |
std::stringstream oss; |
| 55 |
oss << "CalibCal: wrong pkt length"; |
| 56 |
msg=oss.str(); |
| 57 |
PamOffLineSW::mainLogUtil->logWarning(msg); |
| 58 |
// PamOffLineSW::mainLogUtil->logAll("PKT_RunEvent: Used CalibCal packet."); |
| 59 |
}; |
| 60 |
} |