/** @file * $Source: /home/cvsmanager/yoda/techmodel/physics/AnticounterReader.cpp,v $ * $Id: TrackerReader.cpp,v 1.1.1.1 2004/07/06 12:20:23 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the AnticounterReader class. */ #include #include #include "AnticounterReader.h" extern "C" { #include "../forroutines/anticounter/ACphysics.h" extern int ACphysics(int length,unsigned short* datapointer,struct datastruct* physicspointer); //Struct per il passaggio di dati da e verso la chiamata fortran } using namespace pamela; using namespace pamela::anticounter; static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.anticounter.AnticounterReader"); /** * Constructor. */ AnticounterReader::AnticounterReader(void): TechmodelAlgorithm(PacketType::Physics, "TechmodelAnticounterReader") { cat.debug("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 1.1.1.1 2004/07/06 12:20:23 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) { 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[length]; memcpy(data, subData, length); int ERROR; datastruct output; //Call to the routine that unpack anitocounter events ERROR = ACphysics(length, (unsigned short*) data, &output); memcpy(anticounter->header, output.header, sizeof(anticounter->header)); anticounter->status = output.status; anticounter->hitmap = output.hitmap; memcpy(anticounter->regist, output.regist, sizeof(anticounter->regist)); memcpy(anticounter->shift, output.shift, sizeof(anticounter->shift)); memcpy(anticounter->counters, output.counters, sizeof(anticounter->counters)); memcpy(anticounter->coinc, output.coinc, sizeof(anticounter->coinc)); anticounter->trigg = output.trigg; memcpy(anticounter->clock, output.clock, sizeof(anticounter->clock)); memcpy(anticounter->temp, output.temp, sizeof(anticounter->temp)); memcpy(anticounter->DAC, output.DAC, sizeof(anticounter->DAC)); anticounter->CRC = output.CRC; cat << log4cpp::Priority::ERROR << "Fortran77 function ACPhysics error code = " << ERROR << "\n " << log4cpp::CategoryStream::ENDLINE; }