StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RICH_Reader.hh
1  /***************************************************************************
2  * $id: Rich Event Reader
3  * Author: Jon Gans and M.J. LeVine
4  ***************************************************************************
5  * Description: common definitions for RICH (dummy placeholder)
6  *
7  *
8  * change log
9  * 02-Jul-99 MJL add navigation code to get to RICHP bank
10  * 08-Jul-99 MJL completely change definition - RICH_Reader is independent
11  * class which is handed a pointer at the constructor invocation
12  * 22-Nov-99 MJL fixed bug in array size unsigned short RichMatrix[][]
13  * 12-Mar-00 XZB GetNumOfChannels() returns total number of channels
14  * 21-Apr-00 xzb Add in RichEventReader for standalone data file
15  ***************************************************************************
16  * Opens Event From File, Fills Struct
17  *
18  **************************************************************************/
19 #ifndef RICH_READER_HH
20 #define RICH_READER_HH
21 
22 #include "StDaqLib/GENERIC/EventReader.hh"
23 #include "StDaqLib/GENERIC/RecHeaderFormats.hh"
24 #include "StDaqLib/GENERIC/swaps.hh"
25 #include "StDaqLib/RICH/RichEventReader.hh"
26 
27 #define RICH_CRAM_BANKS 8 /* data banks lowest level */
28 #define RICH_NUM_CRAMS 8
29 #define MAX_NUM_CRAMS 8
30 #define MAX_CHANNEL_NUM 960
31 #define RICH_NUM_ROWS_PER_CRAM 6
32 #define RICH_PAD MAX_CHANNEL_NUM/RICH_NUM_ROWS_PER_CRAM
33 #define RICH_ROW 2*RICH_NUM_CRAMS*RICH_NUM_ROWS_PER_CRAM
34 //#define MAX_CHANNEL_NUM 575
35 
36 namespace RICH_READER {
37 struct offlen {
38  unsigned int off;
39  unsigned int len;
40 } ;
41 }
42 struct Bank_RICP: public Bank
43 {
44  struct RICH_READER::offlen CramPTR[2*MAX_NUM_CRAMS] ; /* number of CRAM blocks */
45  struct RICH_READER::offlen Reserved[2];
46 
47 } ;
48 
49 struct RICCRAMP: public Bank
50 {
51  struct RICH_READER::offlen banks[RICH_CRAM_BANKS];
52 };
53 
54 
55 struct RICDATAD: public Bank{
56 
57  unsigned int chanADC[1]; // This is the first word of the Channel/ADC array
58  // there are many more following it, specified by the
59  // total amount of words, including this first one is
60  // RICDATAD->header.BankLenth - sizeof(RICHDATAD->header)/4
61 };
62 
63 struct RichDATA{
64  char * BankType; // Will be filled with a 9 char array (8 letters + NULL)
65  unsigned int ByteSwapped ; // Should be 0x04030201
66  unsigned int EventNumber; //Token number
67  unsigned int NumOfChannels; //Total number of channels
68  unsigned short RichMatrix[RICH_PAD] [RICH_ROW] ; // Matrix of ADC's in Physical Positions
69 };
70 
71 
72 
73 
75 public:
76  virtual ~StRichReaderInterface(){}
77 
78  virtual unsigned short GetADCFromCoord(int, int) = 0;
79  virtual unsigned short GetADCFromCramChannel(int, int) = 0;
80  virtual unsigned int GetEventNumber() = 0;
81 };
82 
83 
85  void ProcessEvent(const Bank_RICP * RichPTR);
86 
87 public:
88 
89 RICH_Reader(EventReader *er, Bank_RICP *pRICP);
91 
92 ~RICH_Reader(){};
93 
94  unsigned short GetADCFromCoord(int x,int y);
95  unsigned short GetADCFromCramChannel(int cramBlock,int channelNum);
96  unsigned int GetEventNumber(); //Token number actaully
97  unsigned int GetNumOfChannels();
98 
99  const char * GetBankType();
100 
101  int IsByteSwapped();
102 
103 protected:
104 
105  // copy of EventReader pointer
106  EventReader *ercpy;
107 
108  // Bank Pointers
109  struct Bank_RICP *pBankRICP;
110 
111  RichDATA mTheRichArray;
112  // in tic, each row is 96 channels
113  // and it takes 6 rows to fit each cramBank
114 };
115 
116 RICH_Reader *getRICHReader(EventReader *er);
117 
118 #endif
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130