/[PAMELA software]/yoda/techmodel/PhysicsReader.cpp
ViewVC logotype

Contents of /yoda/techmodel/PhysicsReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Tue Aug 24 08:01:44 2004 UTC (20 years, 6 months ago) by kusanagi
Branch: MAIN
Changes since 1.6: +3 -3 lines
*** empty log message ***

1 /** @file
2 * $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $
3 * $Id: PhysicsReader.cpp,v 1.6 2004/08/24 07:59:58 kusanagi Exp $
4 * $Author: kusanagi $
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 #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 using namespace pamela::anticounter;
29 using namespace pamela::calorimeter;
30 using namespace pamela::neutron;
31
32 static log4cpp::Category& cat = log4cpp::Category::getInstance("pamela.techmodel.PhysicsReader");
33
34 /**
35 * Constructor.
36 */
37 PhysicsReader::PhysicsReader(void):
38 TechmodelAlgorithm(PacketType::Physics, "TechmodelPhysicsReader") {
39 cat << log4cpp::Priority::DEBUG
40 << "Constructor "
41 << "\n " << log4cpp::CategoryStream::ENDLINE;
42 trackerReader = new TrackerReader();
43 anticounterReader = new AnticounterReader();
44 calorimeterReader = new CalorimeterReader();
45 neutronReader = new NeutronDetectorReader();
46 }
47
48 /**
49 * Get a string with the version info of the algorithm.
50 */
51 std::string PhysicsReader::GetVersionInfo(void) const {
52 return
53 "$Header: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v 1.6 2004/08/24 07:59:58 kusanagi Exp $\n";
54 }
55
56 /**
57 * Initialize the algorithm with a special run. This will initialize the
58 * event reader routines for all packet types.
59 */
60 void PhysicsReader::Init(PamelaRun *run) {
61 SetInputStream(run);
62 trackerReader->Init(run);
63 anticounterReader->Init(run);
64 calorimeterReader->Init(run);
65 neutronReader->Init(run);
66 //run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class());
67 }
68
69 /**
70 * Unpack the Physics event from an input file.
71 */
72 void PhysicsReader::RunEvent(int EventNumber, long int dataLenght) {
73 char *subData = new char[dataLenght];
74 InputFile->read(subData, sizeof(unsigned char)*dataLenght);
75
76 /*-----------------*/
77 //passo packetData a tutti i reader dei vari rivelatori
78 trackerReader->RunEvent(EventNumber, subData, dataLenght);
79 //anticounterReader->RunEvent(EventNumber, subData, dataLenght);
80 calorimeterReader->RunEvent(EventNumber, subData, dataLenght);
81 neutronReader->RunEvent(EventNumber, subData, dataLenght);
82 /*-----------------*/
83 }
84

  ViewVC Help
Powered by ViewVC 1.1.23