1 |
kusanagi |
1.1 |
/** @file |
2 |
kusanagi |
1.2 |
* $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $ |
3 |
kusanagi |
1.3 |
* $Id: PhysicsReader.cpp,v 1.2 2004/07/06 13:31:18 kusanagi Exp $ |
4 |
kusanagi |
1.2 |
* $Author: kusanagi $ |
5 |
kusanagi |
1.1 |
* |
6 |
|
|
* Implementation of the LogReader class. |
7 |
|
|
* ToBeDone: |
8 |
|
|
* Control the CRC for the entire data Packet not just for single records |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
#define UINT unsigned int |
12 |
|
|
#define BYTE unsigned char |
13 |
|
|
#include <string> |
14 |
|
|
#include <log4cpp/Category.hh> |
15 |
|
|
extern "C" { |
16 |
|
|
#include <sys/time.h> |
17 |
|
|
#include "CRC.h" |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
#include <fstream> |
21 |
|
|
#include "stdio.h" |
22 |
|
|
#include "ReaderAlgorithms.h" |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
using namespace pamela; |
26 |
|
|
using namespace pamela::techmodel; |
27 |
|
|
using namespace pamela::tracker; |
28 |
kusanagi |
1.3 |
using namespace pamela::anticounter; |
29 |
|
|
using namespace pamela::calorimeter; |
30 |
kusanagi |
1.1 |
|
31 |
|
|
static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.PhysicsReader"); |
32 |
|
|
|
33 |
|
|
/** |
34 |
|
|
* Constructor. |
35 |
|
|
*/ |
36 |
|
|
PhysicsReader::PhysicsReader(void): |
37 |
|
|
TechmodelAlgorithm(PacketType::Log, "TechmodelPhysicsReader") { |
38 |
|
|
cat << log4cpp::Priority::DEBUG |
39 |
|
|
<< "Constructor " |
40 |
|
|
<< "\n " << log4cpp::CategoryStream::ENDLINE; |
41 |
kusanagi |
1.3 |
trackerReader = new TrackerReader(); |
42 |
|
|
anticounterReader = new AnticounterReader(); |
43 |
|
|
calorimeterReader = new CalorimeterReader(); |
44 |
kusanagi |
1.1 |
} |
45 |
|
|
|
46 |
|
|
/** |
47 |
|
|
* Get a string with the version info of the algorithm. |
48 |
|
|
*/ |
49 |
|
|
std::string PhysicsReader::GetVersionInfo(void) const { |
50 |
|
|
return |
51 |
kusanagi |
1.3 |
"$Header: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v 1.2 2004/07/06 13:31:18 kusanagi Exp $\n"; |
52 |
kusanagi |
1.1 |
} |
53 |
|
|
|
54 |
|
|
/** |
55 |
|
|
* Initialize the algorithm with a special run. This will initialize the |
56 |
|
|
* event reader routines for all packet types. |
57 |
|
|
*/ |
58 |
|
|
void PhysicsReader::Init(PamelaRun *run) { |
59 |
|
|
SetInputStream(run); |
60 |
|
|
trackerReader->Init(run); |
61 |
kusanagi |
1.3 |
anticounterReader->Init(run); |
62 |
|
|
calorimeterReader->Init(run); |
63 |
kusanagi |
1.1 |
//run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class()); |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
/** |
67 |
|
|
* Unpack the Physics event from an input file. |
68 |
|
|
*/ |
69 |
kusanagi |
1.3 |
void PhysicsReader::RunEvent(int EventNumber, long int dataLength) { |
70 |
|
|
char *subData = new char[dataLength]; |
71 |
|
|
InputFile->read(subData, sizeof(unsigned char)*dataLength); |
72 |
kusanagi |
1.1 |
|
73 |
kusanagi |
1.3 |
/*-----------------*/ |
74 |
kusanagi |
1.1 |
//passo packetData a tutti i reader dei vari rivelatori |
75 |
kusanagi |
1.3 |
trackerReader->RunEvent(EventNumber, subData, dataLength); |
76 |
|
|
anticounterReader->RunEvent(EventNumber, subData, dataLength); |
77 |
|
|
calorimeterReader->RunEvent(EventNumber, subData, dataLength); |
78 |
|
|
/*-----------------*/ |
79 |
kusanagi |
1.1 |
} |
80 |
|
|
|