| 1 |
/** @file |
/** @file |
| 2 |
* $Source: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v $ |
| 3 |
* $Id: AnticounterReader.cpp,v 1.1 2004/07/20 13:27:07 kusanagi Exp $ |
* $Id: AnticounterReader.cpp,v 1.2 2004/08/24 08:00:12 kusanagi Exp $ |
| 4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
| 5 |
* |
* |
| 6 |
* Implementation of the AnticounterReader class. |
* Implementation of the AnticounterReader class. |
| 7 |
*/ |
*/ |
| 8 |
|
|
| 9 |
#include <string> |
#include <string> |
| 10 |
#include <log4cpp/Category.hh> |
#include <log4cxx/logger.h> |
| 11 |
#include "AnticounterReader.h" |
#include "AnticounterReader.h" |
| 12 |
|
|
| 13 |
extern "C" { |
extern "C" { |
| 19 |
using namespace pamela; |
using namespace pamela; |
| 20 |
using namespace pamela::anticounter; |
using namespace pamela::anticounter; |
| 21 |
|
|
| 22 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.anticounter.AnticounterReader"); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.anticounter.AnticounterReader")); |
| 23 |
|
|
| 24 |
/** |
/** |
| 25 |
* Constructor. |
* Constructor. |
| 26 |
*/ |
*/ |
| 27 |
AnticounterReader::AnticounterReader(void): |
AnticounterReader::AnticounterReader(void): |
| 28 |
TechmodelAlgorithm(PacketType::Physics, "TechmodelAnticounterReader") { |
TechmodelAlgorithm(PacketType::Physics, "TechmodelAnticounterReader") { |
| 29 |
cat.debug("Constructor"); |
logger->debug(_T("Constructor")); |
| 30 |
anticounter = new AnticounterEvent(); |
anticounter = new AnticounterEvent(); |
| 31 |
} |
} |
| 32 |
|
|
| 35 |
*/ |
*/ |
| 36 |
std::string AnticounterReader::GetVersionInfo(void) const { |
std::string AnticounterReader::GetVersionInfo(void) const { |
| 37 |
return |
return |
| 38 |
"$Header: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v 1.1 2004/07/20 13:27:07 kusanagi Exp $"; |
"$Header: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v 1.2 2004/08/24 08:00:12 kusanagi Exp $"; |
| 39 |
} |
} |
| 40 |
|
|
| 41 |
/** |
/** |
| 43 |
* event reader routines for all packet types. |
* event reader routines for all packet types. |
| 44 |
*/ |
*/ |
| 45 |
void AnticounterReader::Init(PamelaRun *run) { |
void AnticounterReader::Init(PamelaRun *run) { |
| 46 |
|
logger->debug(_T("Initialize")); |
| 47 |
SetInputStream(run); |
SetInputStream(run); |
| 48 |
run->WriteSubPacket(this, &anticounter, anticounter->Class()); |
run->WriteSubPacket(this, &anticounter, anticounter->Class()); |
| 49 |
} |
} |
| 59 |
* Unpack the Anticounter data event from the physical packet. |
* Unpack the Anticounter data event from the physical packet. |
| 60 |
*/ |
*/ |
| 61 |
void AnticounterReader::RunEvent(int EventNumber, const char subData[], long int length) { |
void AnticounterReader::RunEvent(int EventNumber, const char subData[], long int length) { |
| 62 |
char data[length]; |
char *data = new char[length]; |
| 63 |
memcpy(data, subData, length); |
memcpy(data, subData, length); |
| 64 |
int ERROR; |
int ERROR; |
| 65 |
datastruct output; |
datastruct output; |
| 73 |
switch (ERROR){ |
switch (ERROR){ |
| 74 |
case 1: errmsg = "---------------------"; |
case 1: errmsg = "---------------------"; |
| 75 |
} |
} |
|
cat << log4cpp::Priority::ERROR |
|
|
<< "Fortran77 function ACPhysics error code = " << errmsg |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
|
| 76 |
} else {*/ |
} else {*/ |
| 77 |
memcpy(anticounter->header, output.header, sizeof(anticounter->header)); |
memcpy(anticounter->header, output.header, sizeof(anticounter->header)); |
| 78 |
anticounter->status = output.status; |
anticounter->status = output.status; |
| 87 |
memcpy(anticounter->DAC, output.DAC, sizeof(anticounter->DAC)); |
memcpy(anticounter->DAC, output.DAC, sizeof(anticounter->DAC)); |
| 88 |
anticounter->CRC = output.CRC; |
anticounter->CRC = output.CRC; |
| 89 |
//} |
//} |
| 90 |
|
delete[] data; |
| 91 |
} |
} |