/[PAMELA software]/yoda/event/PscuHeader.h
ViewVC logotype

Annotation of /yoda/event/PscuHeader.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6.0 - (hide annotations) (download)
Tue Feb 7 17:11:07 2006 UTC (18 years, 9 months ago) by kusanagi
Branch: MAIN
CVS Tags: YODA6_2/01, YODA6_2/00, YODA6_3/10, YODA6_3/06, YODA6_1/00, YODA6_0/00, YODA6_3/04, YODA6_3/05, YODA6_3/07, YODA6_3/00, YODA6_3/01, YODA6_3/02, YODA6_3/03, YODA6_3/08, YODA6_3/09
Changes since 5.1: +2 -2 lines
File MIME type: text/plain
Several new features in this revision:
a) all the packets are conform to the Mass Memory Format specifications (http://people.roma2.infn.it/~cpu/Mass_Memory_Format.html)
b) unpacking either using the old files structure OR the new one file unpacking.
c) parametrized root files compression factor
d) deleting of the following packet: TofTest, TrkTest, TrkEvent.
e) the Tracker routines now work without the use of temp files.

The point a) allow Yoda to unpack in the root file all the packets generated by the CPU. According to the MassMemoryFormat; that is three possible data are available:

1) almost explicit structure of the packet (like for Log, Tracker, Mcmd, etc....);
2) dummy data collection structure (InitHeader, InitTrailer, CalibHeader, CalibTrailer);
3) just the data of the packet (almost all Alarm and Init procedures). The class regarding this packets have only one parameters, a TArrayC class, which contain the data-block included in the packet (tat is the data below the packet Header).

The point b) has been implemented as a consequence of an agreement about a more compact structure of the unpacked data. Up to now the structure of each unpacked data consisted of a folder, named after the packet type, and three files: xxx.Header.root, xxx.NamePacket.root, xxx.Registry.root.
Starting from this release YODA, by default will unpack the data in a unique root file. The structure of this file will consist of:
- several TTree(s) named after the packet type;
- into each TTree are foreseen three TBranche(s):
    - 'Header'  (the old xxx.Header.root file)
    - 'NameOfThePacket' (the old xxx.Event.root file or the xxx.Event.DETECTOR.root)
    - 'Registry' (the old xxx.Registry.root file)

Anyway is still possible, but deprecated, to unpack using the old structure, passing to the "yoda" command the optional parameter "-multifile"

The point c) has been implemented because is well know that writing time in a TTree is as much fast as much lower is the compression factor for the root file; anyway for a PAMELA dat file, a compression equal to 0 will generate a root file which will be more than two times the original size. To modify the compression parameter just add the optional parameter "-c [0-9]" to the yoda command line.

1 kusanagi 1.1 /** @file
2 kusanagi 1.2 * $Source: /home/cvsmanager/yoda/event/PscuHeader.h,v $
3 kusanagi 6.0 * $Id: PscuHeader.h,v 5.1 2006/02/04 12:37:43 kusanagi Exp $
4     * $Author: kusanagi $
5 kusanagi 1.1 *
6     * Header file for the PscuHeader class.
7     */
8     #ifndef PSCU_HEADER_H
9     #define PSCU_HEADER_H
10    
11 kusanagi 2.1 #include "Exception.h"
12 kusanagi 1.1 #include "SubPacket.h"
13    
14     namespace pamela {
15     /**
16     * Class containing the PSCU header and trailer information.
17     */
18     class PscuHeader: public pamela::SubPacket {
19     private:
20 kusanagi 2.1
21     public:
22 kusanagi 1.1 unsigned int Header; /**< Packet type header (must be 0xFAFEDE) */
23     UINT8 PacketId1; /**< Packet type first byte */
24     UINT8 PacketId2; /**< Packet type second byte */
25     UINT32 Counter; /**< PSCU event counter */
26     UINT32 OrbitalTime; /**< Raw Orbital time */
27     UINT32 PacketLenght;
28 kusanagi 2.1 UINT8 CRC; /**< PSCU Header Checksum */ //!
29 kusanagi 1.2
30     /* This parameter represent the offset of the header relative to the begin
31     * of the file it has been extracted. It's purpose is to
32     * check whenever the CPU (for error) store the same packet more than one time.
33     * It's not clear if it will be mantained or not in the definitive release.
34     */
35     UINT32 FileOffset;
36 kusanagi 2.1
37 kusanagi 1.1 PscuHeader();
38     virtual ~PscuHeader();
39 kusanagi 2.1 const pamela::PacketType* GetPacketType(void) const throw(UnidentifiedPacketException);
40 kusanagi 1.1 /** Get the Header. */
41     int GetHeader(void) const { return Header; }
42     /** Get packet id 1. */
43     unsigned char GetPacketId1(void) const { return PacketId1; }
44     /** Get packet id 2. */
45     unsigned char GetPacketId2(void) const { return PacketId2; }
46     /** Get the PSCU event counter. */
47     int GetCounter(void) const { return Counter; }
48     /** Get the orbital time. */
49     int GetOrbitalTime(void) const { return OrbitalTime; }
50     /** Get the header CRC. */
51     unsigned char GetCRC(void) const { return CRC; }
52     /** Get the packet length for this packet. */
53     int GetPacketLenght(void) const { return PacketLenght; }
54 kusanagi 1.2 /** Get the offset of the packet relative to the begin of the raw file. */
55     int GetFileOffset(void) const { return FileOffset; }
56 kusanagi 1.1
57     /** Set the orbital time. Intended to use by the raw reader. */
58     void SetHeader(int var) { Header = var; }
59     /** Set the packet id. Intended to use by the raw reader. */
60     void SetPacketId(short var1, short var2) { PacketId1 = var1; PacketId2 = var2; }
61     /** Set the counter. Intended to use by the raw reader. */
62     void SetCounter(int var) { Counter = var; }
63     /** Set the orbital time. Intended to use by the raw reader. */
64     void SetOrbitalTime(int var) { OrbitalTime = var; }
65     /** Set the packet length. Intended to use by the raw reader. */
66     void SetPacketLenght(int var) { PacketLenght = var; }
67     /** Set the packet length. Intended to use by the raw reader. */
68     void SetCRC(short var) { CRC = var; }
69 kusanagi 1.2 /** Get the offset of the packet relative to the begin of the raw file. */
70     int SetFileOffset(int var) { FileOffset = var; }
71 kusanagi 2.1
72     const char* Print(){
73     oss.str("");
74     oss << "\n Packet Counter : " << hex << Counter
75     << "\n Id1 - Id2 : " << hex << (UINT16)PacketId1 << " - " << hex << (UINT16)PacketId2
76     << "\n Orbital Time : " << hex << OrbitalTime
77     << "\n Lenght : " << hex << PacketLenght
78     << "\n CRC : " << hex << (UINT16)CRC
79     << "\n Header Start Position : " << hex << FileOffset;
80     return oss.str().c_str();
81     }
82    
83 kusanagi 2.2 static const char* Print(char* buff){
84     static stringstream out;
85     out.str("");
86     out << "\n Packet Counter : " << hex << (((UINT32)buff[5]<<16)&0x00FF0000) + (((UINT32)buff[6]<<8)&0x0000FF00) + (((UINT32)buff[7])&0x000000FF)
87     << "\n Id1 - Id2 : " << hex << (UINT16)buff[3] << " - " << hex << (UINT16)buff[4]
88     << "\n Orbital Time : " << hex << (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) + (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF)
89     << "\n Lenght : " << hex << (((UINT32)buff[12]<<16)&0x00FF0000) + (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF)
90     << "\n CRC : " << hex << (UINT16)buff[15];
91     return out.str().c_str();
92     }
93    
94 kusanagi 1.1 ClassDef(PscuHeader, 1)
95     };
96     }
97    
98     #endif /* PSCU_HEADER_H */

  ViewVC Help
Powered by ViewVC 1.1.23