1 |
/** @file |
/** @file |
2 |
* $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $ |
* $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $ |
3 |
* $Id: PhysicsReader.cpp,v 1.7 2004/08/24 08:01:44 kusanagi Exp $ |
* $Id: PhysicsReader.cpp,v 2.1 2004/12/03 22:08:01 kusanagi Exp $ |
4 |
* $Author: kusanagi $ |
* $Author: kusanagi $ |
5 |
* |
* |
6 |
* Implementation of the LogReader class. |
* Implementation of the LogReader class. |
11 |
#define UINT unsigned int |
#define UINT unsigned int |
12 |
#define BYTE unsigned char |
#define BYTE unsigned char |
13 |
#include <string> |
#include <string> |
14 |
#include <log4cpp/Category.hh> |
#include <log4cxx/logger.h> |
15 |
extern "C" { |
extern "C" { |
16 |
#include <sys/time.h> |
#include <sys/time.h> |
17 |
#include "CRC.h" |
#include "CRC.h" |
28 |
using namespace pamela::anticounter; |
using namespace pamela::anticounter; |
29 |
using namespace pamela::calorimeter; |
using namespace pamela::calorimeter; |
30 |
using namespace pamela::neutron; |
using namespace pamela::neutron; |
31 |
|
using namespace pamela::S4; |
32 |
|
|
33 |
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.PhysicsReader"); |
static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.PhysicsReader")); |
34 |
|
|
35 |
/** |
/** |
36 |
* Constructor. |
* Constructor. |
37 |
*/ |
*/ |
38 |
PhysicsReader::PhysicsReader(void): |
PhysicsReader::PhysicsReader(void): |
39 |
TechmodelAlgorithm(PacketType::Physics, "TechmodelPhysicsReader") { |
TechmodelAlgorithm(PacketType::Physics, "TechmodelPhysicsReader") { |
40 |
cat << log4cpp::Priority::DEBUG |
logger->debug(_T("Constructor")); |
41 |
<< "Constructor " |
trackerReader = new TrackerReader; |
42 |
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
anticounterReader = new AnticounterReader; |
43 |
trackerReader = new TrackerReader(); |
calorimeterReader = new CalorimeterReader; |
44 |
anticounterReader = new AnticounterReader(); |
neutronReader = new NeutronDetectorReader; |
45 |
calorimeterReader = new CalorimeterReader(); |
s4Reader = new S4Reader; |
|
neutronReader = new NeutronDetectorReader(); |
|
46 |
} |
} |
47 |
|
|
48 |
/** |
/** |
50 |
*/ |
*/ |
51 |
std::string PhysicsReader::GetVersionInfo(void) const { |
std::string PhysicsReader::GetVersionInfo(void) const { |
52 |
return |
return |
53 |
"$Header: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v 1.7 2004/08/24 08:01:44 kusanagi Exp $\n"; |
"$Header: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v 2.1 2004/12/03 22:08:01 kusanagi Exp $\n"; |
54 |
} |
} |
55 |
|
|
56 |
/** |
/** |
64 |
calorimeterReader->Init(run); |
calorimeterReader->Init(run); |
65 |
neutronReader->Init(run); |
neutronReader->Init(run); |
66 |
//run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class()); |
//run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class()); |
67 |
|
logger->debug(_T("Initialize")); |
68 |
} |
} |
69 |
|
|
70 |
/** |
/** |
71 |
* Unpack the Physics event from an input file. |
* Unpack the Physics event from an input file. |
72 |
*/ |
*/ |
73 |
void PhysicsReader::RunEvent(int EventNumber, long int dataLenght) { |
void PhysicsReader::RunEvent(int EventNumber, long int dataLenght) throw (Exception){ |
74 |
char *subData = new char[dataLenght]; |
char *subData = new char[dataLenght]; |
75 |
InputFile->read(subData, sizeof(unsigned char)*dataLenght); |
InputFile->read(subData, sizeof(unsigned char)*dataLenght); |
76 |
|
|
80 |
anticounterReader->RunEvent(EventNumber, subData, dataLenght); |
anticounterReader->RunEvent(EventNumber, subData, dataLenght); |
81 |
calorimeterReader->RunEvent(EventNumber, subData, dataLenght); |
calorimeterReader->RunEvent(EventNumber, subData, dataLenght); |
82 |
neutronReader->RunEvent(EventNumber, subData, dataLenght); |
neutronReader->RunEvent(EventNumber, subData, dataLenght); |
83 |
|
s4Reader->RunEvent(EventNumber, subData, dataLenght); |
84 |
/*-----------------*/ |
/*-----------------*/ |
85 |
|
delete[] subData; |
86 |
} |
} |
87 |
|
|