/[PAMELA software]/yoda/techmodel/physics/S4Reader.cpp
ViewVC logotype

Annotation of /yoda/techmodel/physics/S4Reader.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2.3 - (hide annotations) (download)
Thu Dec 16 17:33:03 2004 UTC (19 years, 11 months ago) by kusanagi
Branch: MAIN
Changes since 2.2: +5 -5 lines
*** empty log message ***

1 kusanagi 2.1 /** @file
2     * $Source: /home/cvsmanager/yoda/techmodel/physics/S4Reader.cpp,v $
3 kusanagi 2.3 * $Id: S4Reader.cpp,v 2.2 2004/12/09 08:48:54 kusanagi Exp $
4 kusanagi 2.1 * $Author: kusanagi $
5     *
6     * Implementation of the S4Reader class.
7     */
8    
9     #include <string>
10     #include <log4cxx/logger.h>
11     #include "S4Reader.h"
12    
13     using namespace pamela;
14     using namespace pamela::S4;
15    
16     static log4cxx::LoggerPtr logger = log4cxx::Logger::getLogger(_T("pamela.techmodel.S4.S4Reader"));
17    
18     /**
19     * Constructor.
20     */
21     S4Reader::S4Reader(void):
22     TechmodelAlgorithm(PacketType::Physics, "TechmodelS4Reader") {
23     logger->debug(_T("Constructor"));
24     s4 = new S4Event();
25     }
26    
27     /**
28     * Get a string with the version info of the algorithm.
29     */
30     std::string S4Reader::GetVersionInfo(void) const {
31     return
32 kusanagi 2.3 "$Header: /home/cvsmanager/yoda/techmodel/physics/S4Reader.cpp,v 2.2 2004/12/09 08:48:54 kusanagi Exp $";
33 kusanagi 2.1 }
34    
35     /**
36     * Initialize the algorithm with a special run. This will initialize the
37     * event reader routines for all packet types.
38     */
39     void S4Reader::Init(PamelaRun *run) {
40     logger->debug(_T("Initialize"));
41     SetInputStream(run);
42     run->WriteSubPacket(this, &s4, s4->Class());
43     }
44    
45     /**
46     * Unpack the S4 event from an input file.
47     */
48     void S4Reader::RunEvent(int EventNumber) {
49    
50     }
51    
52     /**
53     * Unpack the S4 data event from the physical packet.
54 kusanagi 2.2 * Unfortunately the only definition available for S4 is "Rigth before the Neutron detector data"
55     * consequently supposing the Neutron data (12 Bytes) always present S4 start 18 Bytes before the end of the packet
56 kusanagi 2.1 */
57     void S4Reader::RunEvent(int EventNumber, const char subData[], long int length) {
58 kusanagi 2.2 //char *data = new char[lenght];
59     //memcpy(data, subData, lenght);
60     int offset = length - 18;
61     s4->S4_REG_STATUS = (((UINT8)subData[offset])&0xF0);
62     s4->S4_DATA = ((((UINT16)subData[offset]<<8)&0x0FFF) + (((UINT16)subData[offset+1])&0x00FF));
63 kusanagi 2.3 s4->S4_CMD_NUM = (((UINT8)subData[offset+2])&0xFF);
64     s4->S4_RESP_LENGHT = ((((UINT16)subData[offset+3]<<8)&0xFF00) + (((UINT16)subData[offset+4])&0x00FF));
65     s4->S4_OVERALL_CHKCODE = (((UINT8)subData[offset+5])&0xFF);
66 kusanagi 2.2 }
67 kusanagi 2.1

  ViewVC Help
Powered by ViewVC 1.1.23