/** @file * $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $ * $Id: PhysicsReader.cpp,v 1.2 2004/07/06 13:31:18 kusanagi Exp $ * $Author: kusanagi $ * * Implementation of the LogReader class. * ToBeDone: * Control the CRC for the entire data Packet not just for single records */ #define UINT unsigned int #define BYTE unsigned char #include #include extern "C" { #include #include "CRC.h" } #include #include "stdio.h" #include "ReaderAlgorithms.h" using namespace pamela; using namespace pamela::techmodel; using namespace pamela::tracker; using namespace pamela::anticounter; using namespace pamela::calorimeter; static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.PhysicsReader"); /** * Constructor. */ PhysicsReader::PhysicsReader(void): TechmodelAlgorithm(PacketType::Log, "TechmodelPhysicsReader") { cat << log4cpp::Priority::DEBUG << "Constructor " << "\n " << log4cpp::CategoryStream::ENDLINE; trackerReader = new TrackerReader(); anticounterReader = new AnticounterReader(); calorimeterReader = new CalorimeterReader(); } /** * Get a string with the version info of the algorithm. */ std::string PhysicsReader::GetVersionInfo(void) const { return "$Header: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v 1.2 2004/07/06 13:31:18 kusanagi Exp $\n"; } /** * Initialize the algorithm with a special run. This will initialize the * event reader routines for all packet types. */ void PhysicsReader::Init(PamelaRun *run) { SetInputStream(run); trackerReader->Init(run); anticounterReader->Init(run); calorimeterReader->Init(run); //run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class()); } /** * Unpack the Physics event from an input file. */ void PhysicsReader::RunEvent(int EventNumber, long int dataLength) { char *subData = new char[dataLength]; InputFile->read(subData, sizeof(unsigned char)*dataLength); /*-----------------*/ //passo packetData a tutti i reader dei vari rivelatori trackerReader->RunEvent(EventNumber, subData, dataLength); anticounterReader->RunEvent(EventNumber, subData, dataLength); calorimeterReader->RunEvent(EventNumber, subData, dataLength); /*-----------------*/ }