/** @file * $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $ * $Id: PhysicsReader.cpp,v 1.3 2004/07/17 20:03:38 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; using namespace pamela::neutron; static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.PhysicsReader"); /** * Constructor. */ PhysicsReader::PhysicsReader(void): TechmodelAlgorithm(PacketType::Physics, "TechmodelPhysicsReader") { cat << log4cpp::Priority::DEBUG << "Constructor " << "\n " << log4cpp::CategoryStream::ENDLINE; trackerReader = new TrackerReader(); anticounterReader = new AnticounterReader(); calorimeterReader = new CalorimeterReader(); neutronReader = new NeutronDetectorReader(); } /** * 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.3 2004/07/17 20:03:38 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); neutronReader->Init(run); //run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class()); } /** * Unpack the Physics event from an input file. */ void PhysicsReader::RunEvent(int EventNumber, long int dataLenght) { char *subData = new char[dataLenght]; InputFile->read(subData, sizeof(unsigned char)*dataLenght); /*-----------------*/ //passo packetData a tutti i reader dei vari rivelatori trackerReader->RunEvent(EventNumber, subData, dataLenght); anticounterReader->RunEvent(EventNumber, subData, dataLenght); calorimeterReader->RunEvent(EventNumber, subData, dataLenght); neutronReader->RunEvent(EventNumber, subData, dataLenght); /*-----------------*/ }