LCOV - code coverage report
Current view: top level - RAW/RAWDatabase - AliRawEventHeaderBase.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 13 17 76.5 %
Date: 2016-06-14 17:26:59 Functions: 15 23 65.2 %

          Line data    Source code
       1             : #ifndef ALIRAWEVENTHEADERBASE_H
       2             : #define ALIRAWEVENTHEADERBASE_H
       3             : 
       4             : // Author: Cvetan Cheshkov  10/10/2005
       5             : 
       6             : /* Copyright(c) 1998-2005, ALICE Experiment at CERN, All rights reserved. *
       7             :  * See cxx source for full Copyright notice                               */
       8             : 
       9             : //////////////////////////////////////////////////////////////////////////
      10             : //                                                                      //
      11             : // AliRawEventHeaderBase                                                //
      12             : //                                                                      //
      13             : //////////////////////////////////////////////////////////////////////////
      14             : 
      15             : #include <TObject.h>
      16             : 
      17             : class AliRawEventHeaderBase : public TObject {
      18             : 
      19             : public:
      20             :    AliRawEventHeaderBase();
      21        2178 :    virtual ~AliRawEventHeaderBase() { if (fExtendedData) delete [] fExtendedData; }
      22             : 
      23        1006 :    void         *HeaderBaseBegin() const { return (void *) &fSize; }
      24        2930 :    Int_t         HeaderBaseSize() const { return (Long_t) &fVersion - (Long_t) &fSize + sizeof(fVersion); }
      25             :    void         *HeaderBegin() const;
      26             :    Int_t         HeaderSize() const;
      27        4198 :    Bool_t        DataIsSwapped() const { return fIsSwapped; }
      28      193168 :    Bool_t        IsSwapped() const { return (fMagic == fgkEventMagicNumberSwapped) ? kTRUE : kFALSE; }
      29      386328 :    Bool_t        IsValid() const { return IsSwapped() ? kTRUE : ((fMagic == fgkEventMagicNumber) ? kTRUE : kFALSE); }
      30             :    void          Swap();
      31             :    UInt_t        SwapWord(UInt_t x) const;
      32             :    void          SwapData(const void* data, const void* buf, UInt_t size);
      33             : 
      34         982 :    UInt_t        GetEventSize() const { return fSize; }
      35           0 :    UInt_t        GetMagic() const { return fMagic; }
      36        3844 :    UInt_t        GetHeadSize() const { return fHeadSize; }
      37           4 :    UInt_t        GetVersion() const { return fVersion; }
      38           0 :    UInt_t        GetMajorVersion() const { return ((fVersion>>16)&0x0000ffff); }
      39           0 :    UInt_t        GetMinorVersion() const { return (fVersion&0x0000ffff); }
      40             : 
      41           8 :    UInt_t        GetExtendedDataSize() const { return fExtendedDataSize; }
      42           0 :    char*         GetExtendedData() const { return fExtendedData; }
      43             : 
      44             :    const char *  GetTypeName() const;
      45             :    static const char *  GetTypeName(UInt_t eventType);
      46             :    static AliRawEventHeaderBase* Create(char*& data);
      47             :    void          AllocateExtendedData(Int_t extsize);
      48             :    Int_t         ReadHeader(char*& data);
      49             :    Int_t         ReadExtendedData(char*& data);
      50             :    UInt_t        Get(const char *datamember) const;
      51             :    const UInt_t* GetP(const char *datamember) const;
      52             : 
      53             :    void          Print( const Option_t* opt ="" ) const;
      54             : 
      55     4303732 :    Int_t         GetFirstEqIndex() const { return fFirstEqIndex; }
      56     2151866 :    Int_t         GetLastEqIndex() const { return fLastEqIndex; }
      57             :    void          AddEqIndex(Int_t index);
      58             :    void          Reset();
      59             : 
      60             :    // The following enumeration can be used once the kEventTypeMask has been
      61             :    // applied to the raw event type
      62             :    enum EAliRawEventType {
      63             :      kStartOfRun =       1,    // START_OF_RUN
      64             :      kEndOfRun =         2,    // END_OF_RUN
      65             :      kStartOfRunFiles =  3,    // START_OF_RUN_FILES
      66             :      kEndOfRunFiles =    4,    // END_OF_RUN_FILES
      67             :      kStartOfBurst =     5,    // START_OF_BURST
      68             :      kEndOfBurst =       6,    // END_OF_BURST
      69             :      kPhysicsEvent =     7,    // PHYSICS_EVENT
      70             :      kCalibrationEvent = 8,    // CALIBRATION_EVENT
      71             :      kFormatError =      9,    // EVENT_FORMAT_ERROR
      72             :      kStartOfData =      10,   // START_OF_DATA
      73             :      kEndOfData =        11,   // END_OF_DATA
      74             :      kSystemSoftwareTriggerEvent   = 12, // SYSTEM_SOFTWARE_TRIGGER_EVENT
      75             :      kDetectorSoftwareTriggerEvent = 13, // DETECTOR_SOFTWARE_TRIGGER_EVENT
      76             :      kSyncEvent = 14  // SYNC_EVENT
      77             :    };
      78             : 
      79             : private:
      80             :    AliRawEventHeaderBase(const AliRawEventHeaderBase&);
      81             :    AliRawEventHeaderBase& operator=(const AliRawEventHeaderBase&);
      82             : 
      83             :    UInt_t fSize;          // size of event in bytes
      84             :    UInt_t fMagic;         // magic number used for consistency check
      85             :    UInt_t fHeadSize;      // size of header in bytes
      86             :    UInt_t fVersion;       // unique version identifier
      87             : 
      88             :    UInt_t fExtendedDataSize; // size of header extension data
      89             :    UInt_t fExtendedAllocSize;//! size of allocated memory for header extension data
      90             :    char  *fExtendedData;  //[fExtendedDataSize] pointer to header extension data 
      91             : 
      92             :    Bool_t fIsSwapped;     // is data swapped
      93             :    Int_t  fHeaderSize;    //! cache for the header size estimate
      94             :    void  *fHeaderBegin;   //! cache for the header begin pointer
      95             : 
      96             :    Int_t  fFirstEqIndex;  // index of the first equipment
      97             :    Int_t  fLastEqIndex;   // index of the last equipment
      98             : 
      99             :    static const UInt_t fgkEventMagicNumber        = 0xDA1E5AFE; // magic word
     100             :    static const UInt_t fgkEventMagicNumberSwapped = 0xFE5A1EDA; // swapped magic word
     101             : 
     102         138 :    ClassDef(AliRawEventHeaderBase,4)  // Alice raw event header base class
     103             : };
     104             : 
     105             : #define EVENT_HEADER_VERSION(AA,BB) AliRawEventHeaderV##AA##_##BB
     106             : #define INIT_HEADER_VARS
     107             : 
     108             : #define START_EVENT_HEADER(AA,BB) \
     109             : class AliRawEventHeaderV##AA##_##BB:public AliRawEventHeaderBase { \
     110             : public: \
     111             :  AliRawEventHeaderV##AA##_##BB():AliRawEventHeaderBase(),               \
     112             :    INIT_HEADER_VARS {}; \
     113             :    virtual ~AliRawEventHeaderV##AA##_##BB() {}; \
     114             : private:
     115             : 
     116             : #define END_EVENT_HEADER(AA,BB) \
     117             : ClassDef(AliRawEventHeaderV##AA##_##BB,1) \
     118             : };
     119             : 
     120             : #endif

Generated by: LCOV version 1.11