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

Annotation of /yoda/techmodel/PhysicsReader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2.1 - (hide annotations) (download)
Fri Dec 3 22:08:01 2004 UTC (20 years ago) by kusanagi
Branch: MAIN
Changes since 2.0: +3 -3 lines
Finally added a real group of Exception classes
Re-strucuted all the log systems (for better performances on unpacking)
Minor changes following the packets changes

1 kusanagi 1.9 /** @file
2 kusanagi 1.2 * $Source: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v $
3 kusanagi 2.1 * $Id: PhysicsReader.cpp,v 2.0 2004/09/21 20:50:54 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 kusanagi 1.9 #include <log4cxx/logger.h>
15 kusanagi 1.1 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.4 using namespace pamela::neutron;
31 kusanagi 1.1
32 kusanagi 1.9 static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.PhysicsReader"));
33 kusanagi 1.1
34     /**
35     * Constructor.
36     */
37     PhysicsReader::PhysicsReader(void):
38 kusanagi 1.4 TechmodelAlgorithm(PacketType::Physics, "TechmodelPhysicsReader") {
39 kusanagi 1.9 logger->debug(_T("Constructor"));
40 kusanagi 1.3 trackerReader = new TrackerReader();
41     anticounterReader = new AnticounterReader();
42     calorimeterReader = new CalorimeterReader();
43 kusanagi 1.4 neutronReader = new NeutronDetectorReader();
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 2.1 "$Header: /home/cvsmanager/yoda/techmodel/PhysicsReader.cpp,v 2.0 2004/09/21 20:50:54 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.4 neutronReader->Init(run);
64 kusanagi 1.1 //run->WriteSubPacket(this, &physicsEvent, physicsEvent->Class());
65 kusanagi 1.9 logger->debug(_T("Initialize"));
66 kusanagi 1.1 }
67    
68     /**
69     * Unpack the Physics event from an input file.
70     */
71 kusanagi 2.1 void PhysicsReader::RunEvent(int EventNumber, long int dataLenght) throw (Exception){
72 kusanagi 1.4 char *subData = new char[dataLenght];
73     InputFile->read(subData, sizeof(unsigned char)*dataLenght);
74 kusanagi 1.1
75 kusanagi 1.3 /*-----------------*/
76 kusanagi 1.1 //passo packetData a tutti i reader dei vari rivelatori
77 kusanagi 1.4 trackerReader->RunEvent(EventNumber, subData, dataLenght);
78 kusanagi 1.8 anticounterReader->RunEvent(EventNumber, subData, dataLenght);
79 kusanagi 1.4 calorimeterReader->RunEvent(EventNumber, subData, dataLenght);
80     neutronReader->RunEvent(EventNumber, subData, dataLenght);
81 kusanagi 1.3 /*-----------------*/
82 kusanagi 1.9 delete[] subData;
83 kusanagi 1.1 }
84    

  ViewVC Help
Powered by ViewVC 1.1.23