StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FTPV1P0_ADCR_SR.cxx
1 /***************************************************************************
2  * $Id: FTPV1P0_ADCR_SR.cxx,v 1.4 2007/12/24 06:04:13 fine Exp $
3  * Author: Jeff Landgraf, J.Klay, H.Huemmler
4  ***************************************************************************
5  * Description: FTP (v1.0) raw ADC reader
6  *
7  *
8  * change log
9  *
10  ***************************************************************************
11  * $Log: FTPV1P0_ADCR_SR.cxx,v $
12  * Revision 1.4 2007/12/24 06:04:13 fine
13  * introduce OLDEVP namespace to allow ole and new EVP library concurrently
14  *
15  * Revision 1.3 2003/09/02 17:55:31 perev
16  * gcc 3.2 updates + WarnOff
17  *
18  * Revision 1.2 2001/06/19 20:51:21 jeromel
19  * Commited for Janet S.
20  *
21  * Revision 1.1 2000/01/18 18:01:19 levine
22  * Hummler's implementaiton of FTPC reader. Note that method
23  *
24  * FTPV1P0_ZS_SR::getFeeSequences(int Fee, int Pin, int *nSeq,
25  * Sequence **SeqData)
26  *
27  * causes exit() since the required #include file has not yet been
28  * (correctly) implemented.
29  *
30  *
31  **************************************************************************/
32 #include <Stiostream.h>
33 
34 
35 #include "StDaqLib/GENERIC/EventReader.hh"
36 #include "FTPV1P0.hh"
37 
38 // FTP V1.0 ADC Raw Reader
39 using namespace OLDEVP;
40 
41 //==================== ADC Raw Reader =============================
42 
43 FTPV1P0_ADCR_SR::FTPV1P0_ADCR_SR(int s, FTPV1P0_Reader *det)
44 {
45  // cout << "Constructing FTPV1P0_ADCR_SR for sector "<<s << endl;
46  sector = s;
47  detector = det;
48 
49  // NULLS in banks array
50  bank = 0;
51 // memset((char *)bank, 0, sizeof(bank));
52 }
53 
54 int FTPV1P0_ADCR_SR::initialize()
55 {
56  // get a sector reader for PADK
57  padkr = detector->getPADKReader(sector);
58  if (!padkr) return FALSE;
59 
60  // store pointer to the ADCR bank
61  bank = detector->getBankFTPADCR(sector);
62  if(!bank) { return FALSE;
63  } else return TRUE;
64 }
65 
66 FTPV1P0_ADCR_SR::~FTPV1P0_ADCR_SR()
67 {
68  // cout << "Deleting FTPV1P0_ADCR_SR" << endl;
69 }
70 
71 int FTPV1P0_ADCR_SR::getPadList(int PadRow, u_char **padList)
72 {
73  // Construct the padlist array for this PadRow
74  int i;
75  FTPPADK_entry ent;
76 
77  // Fill in padrows
78  int j=0;
79  for(i=1; i<=FTP_MAXPADS; i++)
80  {
81  padkr->get(PadRow, i, &ent);
82  padlist[PadRow-1][j++] = i;
83  }
84  // confusing syntax but correct
85  *padList = &padlist[PadRow-1][0];
86  return j;
87 }
88 
89 int FTPV1P0_ADCR_SR::getSequences(int PadRow, int Pad, int *nArray,
90  u_char **Array)
91 {
92  FTPPADK_entry ent;
93  padkr->get(PadRow, Pad, &ent);
94 
95  int offset = ent.offset * padkr->getADCBytes();
96  *nArray = padkr->getADCBytes();
97 
98  // printf("Offset = %d\n",offset);
99  if (bank != NULL)
100  {
101  *Array = (((u_char *)bank->ADC) + offset);
102  return 1;
103  }
104  return 0;
105 }
106 
107 int FTPV1P0_ADCR_SR::MemUsed()
108 {
109  return 0;
110 }
111 
112 //==================== Pedestal Reader ===========================
113 
114 FTPV1P0_PEDR_SR::FTPV1P0_PEDR_SR(int s, FTPV1P0_Reader *det)
115 {
116  // cout << "Constructing FTPV1P0_PEDR_SR" << endl;
117  sector = s;
118  detector = det;
119 
120  // NULLS in banks array
121 // memset((char *)bank, 0, sizeof(bank));
122  bank = 0;
123  numEvents = 0;
124 }
125 
126 int FTPV1P0_PEDR_SR::initialize()
127 {
128  // get a sector reader for PADK
129  padkr = detector->getPADKReader(sector);
130  if (!padkr) return FALSE;
131 
132  bank = detector->getBankFTPPEDR(sector);
133  if (bank !=NULL)
134  {
135  numEvents = bank->NumEvents;
136  }
137  return TRUE;
138 }
139 
140 FTPV1P0_PEDR_SR::~FTPV1P0_PEDR_SR()
141 {
142  // cout << "Deleting FTPV1P0_PEDR_SR" << endl;
143 }
144 
145 int FTPV1P0_PEDR_SR::getPadList(int PadRow, u_char **padList)
146 {
147  // Construct the padlist array for this PadRow
148  int i;
149  FTPPADK_entry ent;
150 
151  // Fill in padrows
152  int j=0;
153  for(i=1; i<=FTP_MAXPADS; i++)
154  {
155  padkr->get(PadRow, i, &ent);
156  padlist[PadRow-1][j++] = i;
157  }
158  // confusing syntax but correct
159  *padList = &padlist[PadRow-1][0];
160  return j;
161 }
162 
163 int FTPV1P0_PEDR_SR::getSequences(int PadRow, int Pad, int *nArray,
164  u_char **Array)
165 {
166  FTPPADK_entry ent;
167  padkr->get(PadRow, Pad, &ent);
168  int offset = ent.offset * padkr->getPEDBytes();
169  *nArray = padkr->getPEDBytes();
170 
171  if (bank != NULL)
172  {
173  // printf("Offset = %d\n",offset);
174  // printf("array coord: rb=%d, mz=%d\n",ent.rb,ent.mz);
175  *Array = (((u_char *)bank->pedestal) + offset);
176  return 1;
177  }
178  return 0;
179 }
180 
181 int FTPV1P0_PEDR_SR::getNumberOfEvents()
182 {
183  return numEvents;
184 }
185 
186 int FTPV1P0_PEDR_SR::MemUsed()
187 {
188  return 0;
189 }
190 
191 
192 //==================== RMS Reader =============================
193 
194 FTPV1P0_PRMS_SR::FTPV1P0_PRMS_SR(int s, FTPV1P0_Reader *det)
195 {
196  // cout << "Constructing FTPV1P0_PRMS_SR" << endl;
197  sector = s;
198  detector = det;
199 
200  // NULLS in banks array
201 // memset((char *)bank, 0, sizeof(bank));
202  bank = 0;
203  numEvents = 0;
204 
205 }
206 
207 int FTPV1P0_PRMS_SR::initialize()
208 {
209  // get a sector reader for PADK
210  padkr = detector->getPADKReader(sector);
211  if (!padkr) return FALSE;
212 
213  // store pointers to the PRMS banks
214  bank = detector->getBankFTPRMSR(sector);
215  if (bank !=NULL)
216  {
217  numEvents = bank->NumEvents;
218  }
219  return TRUE;
220 }
221 
222 FTPV1P0_PRMS_SR::~FTPV1P0_PRMS_SR()
223 {
224  // cout << "Deleting FTPV1P0_PRMS_SR" << endl;
225 }
226 
227 int FTPV1P0_PRMS_SR::getPadList(int PadRow, u_char **padList)
228 {
229  // Construct the padlist array for this PadRow
230  int i;
231  FTPPADK_entry ent;
232 
233  // Fill in padrows
234  int j=0;
235  for(i=1; i<=FTP_MAXPADS; i++)
236  {
237  padkr->get(PadRow, i, &ent);
238  padlist[PadRow-1][j++] = i;
239  }
240  // confusing syntax but correct
241  *padList = &padlist[PadRow-1][0];
242  return j;
243 }
244 
245 int FTPV1P0_PRMS_SR::getSequences(int PadRow, int Pad, int *nArray,
246  u_char **Array)
247 {
248  FTPPADK_entry ent;
249  padkr->get(PadRow, Pad, &ent);
250  int offset = ent.offset * padkr->getRMSBytes();
251  *nArray = padkr->getRMSBytes();
252 
253  if (bank != NULL)
254  {
255 // printf("Offset = %d\n",offset);
256 // printf("array coord: rb=%d, mz=%d\n",ent.rb,ent.mz);
257  *Array = (((u_char *)bank->pedRMSt16) + offset);
258  return 1;
259  }
260  return 0;
261 }
262 
263 int FTPV1P0_PRMS_SR::getNumberOfEvents()
264 {
265  return numEvents;
266 }
267 
268 int FTPV1P0_PRMS_SR::MemUsed()
269 {
270  return 0;
271 }
272 
273 
Definition: FTPV1P0.hh:198