/** @file * $Source: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v $ * $Id: AnticounterReader.cpp,v 2.2 2004/12/03 22:08:12 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the AnticounterReader class. */ #include #include #include "AnticounterReader.h" extern "C" { #include "../forroutines/anticounter/AC.h" extern int ACphysics(int, unsigned char[] , physicsstruct*); } using namespace pamela; using namespace pamela::anticounter; static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.anticounter.AnticounterReader")); /** * Constructor. */ AnticounterReader::AnticounterReader(void): TechmodelAlgorithm(PacketType::Physics, "TechmodelAnticounterReader") { logger->debug(_T("Constructor")); anticounter = new AnticounterEvent(); } /** * Get a string with the version info of the algorithm. */ std::string AnticounterReader::GetVersionInfo(void) const { return "$Header: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v 2.2 2004/12/03 22:08:12 kusanagi Exp $"; } /** * Initialize the algorithm with a special run. This will initialize the * event reader routines for all packet types. */ void AnticounterReader::Init(PamelaRun *run) { logger->debug(_T("Initialize")); SetInputStream(run); run->WriteSubPacket(this, &anticounter, anticounter->Class()); } /** * Unpack the anticounter event from an input file. */ void AnticounterReader::RunEvent(int EventNumber) { } /** * Unpack the Anticounter data event from the physical packet. */ void AnticounterReader::RunEvent(int EventNumber, const char subData[], long int length) { char *data = new char[length]; memcpy(data, subData, length); int ERROR; physicsstruct output = {0}; //Call to the routine that unpack anitocounter events //anticounter->ERROR = ACphysics(length, (unsigned char*) data, &output); //TO BE activated as soon i will know what codes means "error" /*if (ERROR != 0) { char *errmsg; switch (ERROR){ case 1: errmsg = "---------------------"; } } else {*/ /* memcpy(anticounter->header, output.header, sizeof(anticounter->header)); anticounter->status = output.status; anticounter->hitmap = output.hitmap; memcpy(anticounter->regist, output.regist, sizeof(output.regist)); memcpy(anticounter->shift, output.shift, sizeof(output.shift)); memcpy(anticounter->counters, output.counters, sizeof(output.counters)); memcpy(anticounter->coinc, output.coinc, sizeof(output.coinc)); anticounter->trigg = output.trigg; memcpy(anticounter->clock, output.clock, sizeof(output.clock)); memcpy(anticounter->temp, output.temp, sizeof(output.temp)); memcpy(anticounter->DAC, output.DAC, sizeof(output.DAC)); anticounter->CRC = output.CRC; anticounter->ERROR = ERROR; */ //} //delete[] data; }