1 |
mocchiut |
1.1 |
/** @file |
2 |
|
|
* $Source: /repository/PamOffLineSW/techmodel/PhysicsReader.cpp,v $ |
3 |
|
|
* $Id: PhysicsReader.cpp,v 1.9 2008-03-04 18:09:31 messineo Exp $ |
4 |
|
|
* $Author: messineo $ |
5 |
|
|
* |
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 |
|
|
|
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 |
|
|
using namespace pamela; |
25 |
|
|
using namespace pamela::techmodel; |
26 |
|
|
using namespace pamela::tracker; |
27 |
|
|
using namespace pamela::anticounter; |
28 |
|
|
using namespace pamela::calorimeter; |
29 |
|
|
using namespace pamela::neutron; |
30 |
|
|
using namespace pamela::S4; |
31 |
|
|
using namespace pamela::tof; |
32 |
|
|
using namespace pamela::trigger; |
33 |
|
|
|
34 |
|
|
/** |
35 |
|
|
* Constructor. |
36 |
|
|
*/ |
37 |
|
|
PhysicsReader::PhysicsReader(void): |
38 |
|
|
TechmodelAlgorithm(PacketType::Physics, "TechmodelPhysicsReader") { |
39 |
|
|
trackerReader = new TrackerReader; |
40 |
|
|
anticounterReader = new AnticounterReader; |
41 |
|
|
calorimeterReader = new CalorimeterReader; |
42 |
|
|
neutronReader = new NeutronDetectorReader; |
43 |
|
|
s4Reader = new S4Reader; |
44 |
|
|
tofReader = new TofReader; |
45 |
|
|
triggerReader = new TriggerReader; |
46 |
|
|
} |
47 |
|
|
|
48 |
|
|
/** |
49 |
|
|
* Initialize the algorithm with a special run. This will initialize the |
50 |
|
|
* event reader routines for all packet types. |
51 |
|
|
*/ |
52 |
|
|
void PhysicsReader::Init(PamelaRun *run) |
53 |
|
|
{ |
54 |
|
|
trackerReader->Init(run); |
55 |
|
|
anticounterReader->Init(run); |
56 |
|
|
calorimeterReader->Init(run); |
57 |
|
|
neutronReader->Init(run); |
58 |
|
|
s4Reader->Init(run); |
59 |
|
|
tofReader->Init(run); |
60 |
|
|
triggerReader->Init(run); |
61 |
|
|
////run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class()); |
62 |
|
|
} |
63 |
|
|
|
64 |
|
|
/** |
65 |
|
|
* Unpack the Physics event from an input file. |
66 |
|
|
*/ |
67 |
|
|
void PhysicsReader::PKT_RunEvent(char* subData, long int dataLenght) throw (Exception) |
68 |
|
|
{ |
69 |
|
|
int EventNumber = 0; |
70 |
|
|
/*-----------------*/ |
71 |
|
|
//passo packetData a tutti i reader dei vari rivelatori |
72 |
|
|
triggerReader->RunEvent(EventNumber, subData, dataLenght); |
73 |
|
|
tofReader->RunEvent(EventNumber, subData, dataLenght); |
74 |
|
|
trackerReader->RunEvent(EventNumber, subData, dataLenght); |
75 |
|
|
anticounterReader->RunEvent(EventNumber, subData, dataLenght); |
76 |
|
|
calorimeterReader->RunEvent(EventNumber, subData, dataLenght); |
77 |
|
|
s4Reader->RunEvent(EventNumber, subData, dataLenght); |
78 |
|
|
// if(...) |
79 |
|
|
// throw WrongCRCException_PKTUsed("asdsadas"); |
80 |
|
|
|
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
/** |
84 |
|
|
* Get a string with the version info of the algorithm. |
85 |
|
|
*/ |
86 |
|
|
std::string PhysicsReader::GetVersionInfo(void) const { |
87 |
|
|
return |
88 |
|
|
"$Header: /repository/PamOffLineSW/techmodel/PhysicsReader.cpp,v 1.9 2008-03-04 18:09:31 messineo Exp $\n"; |
89 |
|
|
} |
90 |
|
|
|