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

Diff of /yoda/event/PscuHeader.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2.0 by kusanagi, Tue Sep 21 20:49:57 2004 UTC revision 6.1 by mocchiut, Fri Sep 29 10:19:13 2006 UTC
# Line 1  Line 1 
1  /** @file  /** @file
2   * $Source: /home/cvsmanager/yoda/event/PscuHeader.h,v $   * $Source: /afs/ba.infn.it/user/pamela/src/CVS/yoda/event/PscuHeader.h,v $
3   * $Id: PscuHeader.h,v 1.2 2004/08/25 10:14:22 kusanagi Exp $   * $Id: PscuHeader.h,v 6.0 2006/02/07 17:11:07 kusanagi Exp $
4   * $Author: kusanagi $   * $Author: kusanagi $
5   *   *
6   * Header file for the PscuHeader class.   * Header file for the PscuHeader class.
7   */   */
8  #ifndef PSCU_HEADER_H  #ifndef PSCU_HEADER_H
9  #define PSCU_HEADER_H  #define PSCU_HEADER_H
 #define UINT32 unsigned int  
 #define UINT16 unsigned short  
 #define UINT8  unsigned char  
 #include <exception>  
10    
11  #include "PacketType.h"  #include "Exception.h"
12  #include "SubPacket.h"  #include "SubPacket.h"
13    
14  namespace pamela {  namespace pamela {
# Line 20  namespace pamela { Line 16  namespace pamela {
16     * Class containing the PSCU header and trailer information.     * Class containing the PSCU header and trailer information.
17     */     */
18    class PscuHeader: public pamela::SubPacket {    class PscuHeader: public pamela::SubPacket {
19    
20    private:    private:
21    
22      public:
23      unsigned int Header;  /**< Packet type header (must be 0xFAFEDE) */      unsigned int Header;  /**< Packet type header (must be 0xFAFEDE) */
24      UINT8  PacketId1; /**< Packet type first  byte */      UINT8  PacketId1; /**< Packet type first  byte */
25      UINT8  PacketId2; /**< Packet type second byte */      UINT8  PacketId2; /**< Packet type second byte */
26      UINT32 Counter; /**< PSCU event counter */      UINT32 Counter; /**< PSCU event counter */
27      UINT32 OrbitalTime; /**< Raw Orbital time */      UINT32 OrbitalTime; /**< Raw Orbital time */
28      UINT32 PacketLenght;      UINT32 PacketLenght;
29      UINT8  CRC; /**< PSCU Header Checksum  */      UINT8  CRC; /**< PSCU Header Checksum  */ //!
30    
31      /* This parameter represent the offset of the header relative to the begin      /* This parameter represent the offset of the header relative to the begin
32       * of the file it has been extracted. It's purpose is to       * of the file it has been extracted. It's purpose is to
# Line 35  namespace pamela { Line 34  namespace pamela {
34       * It's not clear if it will be mantained or not in the definitive release.       * It's not clear if it will be mantained or not in the definitive release.
35      */      */
36      UINT32 FileOffset;      UINT32 FileOffset;
37    public:      
38      PscuHeader();      PscuHeader();
39      virtual ~PscuHeader();      virtual ~PscuHeader(){};
40      const pamela::PacketType* GetPacketType(void) const throw (std::exception);      const pamela::PacketType* GetPacketType(void) const throw(UnidentifiedPacketException);
41      /** Get the Header. */      /** Get the Header. */
42      int GetHeader(void) const { return Header; }      int GetHeader(void) const { return Header; }
43      /** Get packet id 1. */      /** Get packet id 1. */
# Line 69  namespace pamela { Line 68  namespace pamela {
68      /** Set the packet length. Intended to use by the raw reader. */      /** Set the packet length. Intended to use by the raw reader. */
69      void SetCRC(short var) { CRC = var; }      void SetCRC(short var) { CRC = var; }
70      /** Get the offset of the packet relative to the begin of the raw file. */      /** Get the offset of the packet relative to the begin of the raw file. */
71      int SetFileOffset(int var) { FileOffset = var; }      int SetFileOffset(int var) { FileOffset = var; return(0); }
72      ClassDef(PscuHeader, 1)  
73        const char* Print(){
74            oss.str("");
75            oss <<  "\n Packet Counter          : "  <<  hex << Counter
76                <<  "\n Id1 - Id2               : "  <<  hex << (UINT16)PacketId1 <<  " - " << hex << (UINT16)PacketId2
77                <<  "\n Orbital Time            : "  <<  hex << OrbitalTime
78                <<  "\n Lenght                  : "  <<  hex << PacketLenght
79                <<  "\n CRC                     : "  <<  hex << (UINT16)CRC
80                <<  "\n Header Start Position   : "  <<  hex << FileOffset;
81            return oss.str().c_str();
82        }
83    
84      static const char* Print(char* buff){
85      static stringstream out;
86        out.str("");
87        out <<  "\n Packet Counter          : "  <<  hex << (((UINT32)buff[5]<<16)&0x00FF0000) + (((UINT32)buff[6]<<8)&0x0000FF00) + (((UINT32)buff[7])&0x000000FF)
88            <<  "\n Id1 - Id2               : "  <<  hex << (UINT16)buff[3] <<  " - " << hex << (UINT16)buff[4]
89            <<  "\n Orbital Time            : "  <<  hex << (((UINT32)buff[8]<<24)&0xFF000000) + (((UINT32)buff[9]<<16)&0x00FF0000) +  (((UINT32)buff[10]<<8)&0x0000FF00) + (((UINT32)buff[11])&0x000000FF)
90            <<  "\n Lenght                  : "  <<  hex << (((UINT32)buff[12]<<16)&0x00FF0000) +  (((UINT32)buff[13]<<8)&0x0000FF00) + (((UINT32)buff[14])&0x000000FF)
91            <<  "\n CRC                     : "  <<  hex << (UINT16)buff[15];
92        return out.str().c_str();
93      }
94        
95        ClassDef(PscuHeader, 1)
96    };    };
97  }  }
98    

Legend:
Removed from v.2.0  
changed lines
  Added in v.6.1

  ViewVC Help
Powered by ViewVC 1.1.23