StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FPD_Reader.hh
1 /***************************************************************************
2 * $Id: FPD_Reader.hh,v 1.1 2002/01/17 17:19:59 akio Exp $
3 * Author: Akio Ogawa
4 ***************************************************************************
5 * Description: FPD Event Reader
6 ***************************************************************************
7 * $Log: FPD_Reader.hh,v $
8 * Revision 1.1 2002/01/17 17:19:59 akio
9 * First version of FPD daq reader
10 *
11 **************************************************************************/
12 #ifndef FPD_READER_HH
13 #define FPD_READER_HH
14 
15 #include "StDaqLib/GENERIC/EventReader.hh"
16 #include "StDaqLib/GENERIC/RecHeaderFormats.hh"
17 
18 // Number of channels for each bank
19 #define FPDP_NUM_ADC_CHANNELS 256
20 #define FPDP_NUM_TDC_CHANNELS 8
21 #define FPDP_NUM_REG_CHANNELS 3
22 #define FPDP_NUM_PED_CHANNELS 256
23 #define FPDP_NUM_SCL_CHANNELS 128
24 #define FPDP_BBC_NUM_ADC_CHANNELS 72
25 #define FPDP_BBC_NUM_PED_CHANNELS 128
26 #define FPDP_BBC_NUM_SCL_CHANNELS 32
27 
28 // unsigned typedefs from /RTS/include/daqFormats.h
29 #ifndef _DAQ_FORMATS_H
30 typedef unsigned int UINT32;
31 typedef unsigned short UINT16;
32 typedef unsigned char UINT8 ;
33 #endif
34 
35 
36 // FPDp Raw Data Banks
37 struct Bank_FPDP: public Bank {
38  Pointer AdcPTR;
39  Pointer TdcPTR;
40  Pointer RegPTR;
41  Pointer PedPTR;
42  Pointer SclPTR;
43  Pointer BbcAdcPTR;
44  Pointer BbcPedPTR;
45  Pointer BbcSclPTR;
46 };
47 
48 struct FPDDATA: public Bank {
49  unsigned short data[1];
50 };
51 struct FPDSCLDATA: public Bank {
52  unsigned int data[1];
53 };
54 
55 // FPDp Processed Raw Data structure
56 struct FpdDATA {
57  char * BankType;
58  unsigned int ByteSwapped ; // Should be 0x04030201
59  unsigned int EventNumber; //Token number
60  unsigned short AdcData[FPDP_NUM_ADC_CHANNELS];
61  unsigned short TdcData[FPDP_NUM_TDC_CHANNELS];
62  unsigned short RegData[FPDP_NUM_REG_CHANNELS];
63  unsigned int PedData[FPDP_NUM_PED_CHANNELS];
64  unsigned short SclData[FPDP_NUM_SCL_CHANNELS];
65  unsigned short BbcAdcData[FPDP_BBC_NUM_ADC_CHANNELS];
66  unsigned short BbcPedData[FPDP_BBC_NUM_PED_CHANNELS];
67  unsigned int BbcSclData[FPDP_BBC_NUM_SCL_CHANNELS];
68 };
69 
71 public:
72  virtual ~StFpdReaderInterface(){}
73  virtual unsigned short GetAdc(int)=0;
74  virtual unsigned short GetTdc(int)=0;
75  virtual unsigned short GetReg(int)=0;
76  virtual unsigned short GetPed(int)=0;
77  virtual unsigned int GetScl(int)=0;
78  virtual unsigned short GetBbcAdc(int)=0;
79  virtual unsigned short GetBbcPed(int)=0;
80  virtual unsigned int GetBbcScl(int)=0;
81  virtual unsigned int GetEventNumber()=0;
82  virtual void printRawData()=0;
83 };
84 
86 private:
87  void ProcessEvent(const Bank_FPDP * FpdPTR);
88  FpdDATA mTheFpdArray;
89 protected:
90  EventReader *ercpy; // copy of EventReader pointer
91  struct Bank_FPDP *pBankFPDP; // Bank Pointers
92 public:
93  FPD_Reader(EventReader *er, Bank_FPDP *pFPDP);
94  ~FPD_Reader(){};
95  unsigned short GetAdc(int);
96  unsigned short GetTdc(int);
97  unsigned short GetReg(int);
98  unsigned short GetPed(int);
99  unsigned int GetScl(int);
100  unsigned short GetBbcAdc(int);
101  unsigned short GetBbcPed(int);
102  unsigned int GetBbcScl(int);
103  unsigned int GetEventNumber();
104  void printRawData();
105 };
106 
107 FPD_Reader *getFPDReader(EventReader *er);
108 
109 #endif