ROOT logo
///////////////////////////////////////////////////////////
// File: $RCSfile: $
//
// Author : J.Wuestenfeld
// Version: $Revision: $
///////////////////////////////////////////////////////////
#ifndef HMDCDATAWORD__H
#define HMDCDATAWORD__H

#include "TObject.h"

class HMdcDataword : public TObject
{
protected:
    enum {m1=0x1, m3=0x7, m4=0xf, m5 = 0x1f, m11=0x7ff, m16 = 0xffff, m24 = 0xffffff, m26 = 0x3ffffff, m29=0xFFFFFFF, m32 = 0xffffffff};

    // Event header information
    Int_t decodeType;			// Type of decoding
    Int_t eventNumber;	 // Number of event
    Int_t triggerType;	 // Type of trigger (1 = normal, 9 = calibration)
    Int_t errorFlag;	 // Status information from subevent
    Int_t subEventSize;	 // Number of datawords in subevent
    
    Int_t statusCode;			// Code of Statusword, see doc.
    Int_t statusData;			// See doc.

    // MDC - data - word
    Int_t mboAddress;	 // Adress information of motherboard
    Int_t tdcNumber;	 // Number of TDC chip on MBO
    Int_t channel;	 // Number of channel in TDC
    Int_t hit;		 // Number of hit in TDC (0 or 1)
    Int_t time;		 // Measured time in channels (~500ps)

    // Address
    Int_t sector;	 // MdcRaw container coordinate: sector
    Int_t module;	 // MdcRaw container coordinate: module
    Int_t mbo;		 // MdcRaw container coordinate: mbo
    Int_t tdc;		 // MdcRaw container coordinate: tdc (tdc * 8 + channel)

    Int_t entry;	 // Number of entry
    Bool_t noComment;	 //! Switches of all comments

    Int_t time1;	 // second hit of channel
    Bool_t debug;        // Enable debugging of dataword

public:
    HMdcDataword(Bool_t comment);
    HMdcDataword(void);
    ~HMdcDataword(void){;};

    Bool_t checkConsistency(UInt_t version = 0, UInt_t data = 0);

    void   clearData   (void);
    void   clearAll    (void){clearData();clearHeader();clearAddress();};
    void   clearAddress(void){sector = module = mbo = tdc = 0;};
    void   clearHeader (void){decodeType=eventNumber=triggerType=errorFlag=subEventSize=-1;};

    Bool_t decode(const UInt_t data, Bool_t consistencyCheck = kFALSE);
    void   dump(void);

    // Get functions for member variables
    Int_t  getDecodeType  (void){return decodeType;};
    Int_t  getEventNumber (void){return eventNumber;};
    Int_t  getTriggerType (void){return triggerType;};
    Int_t  getErrorFlag   (void){return errorFlag;};
    Int_t  getModule      (void){return module;}
    Int_t  getSector      (void){return sector;};
    Int_t  getSubEventSize(void){return subEventSize;};

    Int_t  getAddress   (void);
    Int_t  getMboAddress(void){return mboAddress;};
    Int_t  getTdcNumber (void){return tdcNumber;};
    Int_t  getChannel   (void){return channel;};
    Int_t  getHit       (void){return hit;};
    Int_t  getTime      (void){return time;};
		Int_t  getTime1     (void){return time1;};

    Int_t getStatusCode(void){return statusCode;};
    Int_t getStatusData(void){return statusData;};
    
    UInt_t getCodedDataword(UInt_t version = 0);

    void   print(UInt_t version);

    // Set functions for member variables
    void   setAddress(Int_t s, Int_t m, Int_t mb, Int_t t, Int_t e){sector=s;module=m;mbo=mb,tdc=t;entry=e;};

    void   setEventNumber (Int_t val){eventNumber = val;};
    void   setTriggerType (Int_t val){triggerType = val;};
    void   setErrorFlag   (Int_t val){errorFlag = val;};
    void   setSubEventSize(Int_t val){subEventSize = val;};

    void   setAddress   (Int_t addr);
    void   setMboAddress(Int_t val){mboAddress = val;};
    void   setTdcNumber (Int_t val){tdcNumber = val;};
    void   setChannel   (Int_t val){channel = val;};
    void   setHit       (Int_t val){hit = val;};
    void   setTime      (Int_t val){time = val;};
		void   setTime1     (Int_t val){time1 = val;};

    void   setQuietMode(Bool_t b=kTRUE){noComment = b;};

    Bool_t subHeader(const UInt_t *data, UInt_t version, Bool_t consistencyCheck = kFALSE);

    ClassDef(HMdcDataword,1)				// MDC dataford for OEP (Optical End Point)
};

#endif
 hmdcdataword.h:1
 hmdcdataword.h:2
 hmdcdataword.h:3
 hmdcdataword.h:4
 hmdcdataword.h:5
 hmdcdataword.h:6
 hmdcdataword.h:7
 hmdcdataword.h:8
 hmdcdataword.h:9
 hmdcdataword.h:10
 hmdcdataword.h:11
 hmdcdataword.h:12
 hmdcdataword.h:13
 hmdcdataword.h:14
 hmdcdataword.h:15
 hmdcdataword.h:16
 hmdcdataword.h:17
 hmdcdataword.h:18
 hmdcdataword.h:19
 hmdcdataword.h:20
 hmdcdataword.h:21
 hmdcdataword.h:22
 hmdcdataword.h:23
 hmdcdataword.h:24
 hmdcdataword.h:25
 hmdcdataword.h:26
 hmdcdataword.h:27
 hmdcdataword.h:28
 hmdcdataword.h:29
 hmdcdataword.h:30
 hmdcdataword.h:31
 hmdcdataword.h:32
 hmdcdataword.h:33
 hmdcdataword.h:34
 hmdcdataword.h:35
 hmdcdataword.h:36
 hmdcdataword.h:37
 hmdcdataword.h:38
 hmdcdataword.h:39
 hmdcdataword.h:40
 hmdcdataword.h:41
 hmdcdataword.h:42
 hmdcdataword.h:43
 hmdcdataword.h:44
 hmdcdataword.h:45
 hmdcdataword.h:46
 hmdcdataword.h:47
 hmdcdataword.h:48
 hmdcdataword.h:49
 hmdcdataword.h:50
 hmdcdataword.h:51
 hmdcdataword.h:52
 hmdcdataword.h:53
 hmdcdataword.h:54
 hmdcdataword.h:55
 hmdcdataword.h:56
 hmdcdataword.h:57
 hmdcdataword.h:58
 hmdcdataword.h:59
 hmdcdataword.h:60
 hmdcdataword.h:61
 hmdcdataword.h:62
 hmdcdataword.h:63
 hmdcdataword.h:64
 hmdcdataword.h:65
 hmdcdataword.h:66
 hmdcdataword.h:67
 hmdcdataword.h:68
 hmdcdataword.h:69
 hmdcdataword.h:70
 hmdcdataword.h:71
 hmdcdataword.h:72
 hmdcdataword.h:73
 hmdcdataword.h:74
 hmdcdataword.h:75
 hmdcdataword.h:76
 hmdcdataword.h:77
 hmdcdataword.h:78
 hmdcdataword.h:79
 hmdcdataword.h:80
 hmdcdataword.h:81
 hmdcdataword.h:82
 hmdcdataword.h:83
 hmdcdataword.h:84
 hmdcdataword.h:85
 hmdcdataword.h:86
 hmdcdataword.h:87
 hmdcdataword.h:88
 hmdcdataword.h:89
 hmdcdataword.h:90
 hmdcdataword.h:91
 hmdcdataword.h:92
 hmdcdataword.h:93
 hmdcdataword.h:94
 hmdcdataword.h:95
 hmdcdataword.h:96
 hmdcdataword.h:97
 hmdcdataword.h:98
 hmdcdataword.h:99
 hmdcdataword.h:100
 hmdcdataword.h:101
 hmdcdataword.h:102
 hmdcdataword.h:103
 hmdcdataword.h:104
 hmdcdataword.h:105
 hmdcdataword.h:106
 hmdcdataword.h:107
 hmdcdataword.h:108