StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SVTV1P0.cxx
1 /***************************************************************************
2  *
3  * $Id: SVTV1P0.cxx,v 1.5 2007/12/24 06:04:27 fine Exp $
4  *
5  * Author: Jeff Landgraf, M.J. LeVine, Marcelo Munhoz, J. Schambach
6  *
7  ***************************************************************************
8  *
9  * Description: common SVT implementation stuff
10  *
11  ***************************************************************************
12  *
13  * $Log: SVTV1P0.cxx,v $
14  * Revision 1.5 2007/12/24 06:04:27 fine
15  * introduce OLDEVP namespace to allow ole and new EVP library concurrently
16  *
17  * Revision 1.4 2007/01/04 21:27:50 jml
18  * zero suppressed reader no longer uses adcx, only seqd. Fixes bug from early 2005
19  *
20  * Revision 1.3 2001/05/04 18:05:23 jschamba
21  * Corrected several instances of wrong counting representation for hypersector
22  * and mezzanine (internal counting from 0, physical from 1)
23  *
24  * Revision 1.2 2001/04/18 19:47:25 ward
25  * StDaqLib/SVT stuff from Jo Schambach.
26  *
27  * Revision 1.1 2000/06/06 18:08:31 jml
28  * Initial version of SVT Readers (author: marcello munholz, helen caines, js)
29  *
30  *
31  **************************************************************************/
32 // SVT implementation
33 #include "SVTV1P0.hh"
34 
35 using namespace OLDEVP;
36 
37 SVTV1P0_ANODK_SR::SVTV1P0_ANODK_SR(SVTV1P0_Reader *det)
38 {
39  detector = det;
40 }
41 
42 int SVTV1P0_ANODK_SR::initialize(int maxSector)
43 {
44  // cout << "Initializing ANODK wafer: " << wafer << endl;
45 
46  // zero out lookup array
47  memset((char *)packed_address, 0, sizeof(packed_address));
48 
49  //cout << "Sizeof() = " << sizeof(packed_address) << endl;
50 
51  ANODK_entry ent;
52 
53  for(int hypersector = 1; hypersector <= maxSector; hypersector++)
54  {
55  for(int rcb = 1; rcb <= 6; rcb++)
56  {
57  for(int mz = 1; mz <= 3; mz++)
58  {
59 
60  classname(Bank_SVTANODK) *raw_bank = detector->getBankSVTANODK(hypersector, rcb, mz);
61  if(raw_bank)
62  {
63  //printf("ANODK DATA for hypersector %d, rcb %d, mz %d\n",hypersector,rcb,mz);
64  }
65  else
66  {
67  // missing ANODK bank
68  //printf("No ANODK DATA, hypersector %d, rcb %d, mz %d\n",hypersector,rcb,mz);
69  //printf("ERR: %s\n",detector->errstr0);
70  continue;
71  }
72 
73  for(int i=0; i < SVT_MZHYBRIDS; i++)
74  {
75  int barrel = raw_bank->index[i].barrel;
76  int ladder = raw_bank->index[i].ladder;
77  int wafer = raw_bank->index[i].waferID & 0x0F;
78  int hybrid = (raw_bank->index[i].waferID & 0xF0) >> 4;
79 
80  //if((padrow == 0xFF) && (anode == 0xFF)) continue;
81 
82  ent.offset = i;
83  ent.mz = mz;
84  ent.rb = rcb;
85  ent.hypersector = hypersector;
86 
87  place(barrel, ladder, wafer, hybrid, &ent);
88 
89  //printf("ANODK DATA for barrel %d, ladder %d, wafer %d, hybrid %d\n",barrel,ladder,wafer,hybrid);
90 
91  }
92  }
93  }
94  }
95 
96  return TRUE;
97 }
98 
99 void SVTV1P0_ANODK_SR::place(short barrel, short ladder, short wafer, short hybrid, ANODK_entry *p)
100 {
101  short waferIndex = getWaferIndex(barrel,ladder,wafer);
102  packed_address[waferIndex-1][hybrid-1] = pack(p->hypersector, p->rb, p->mz, p->offset);
103 }
104 
105 void SVTV1P0_ANODK_SR::get(short barrel, short ladder, short wafer, short hybrid, ANODK_entry *p)
106 {
107  short waferIndex = getWaferIndex(barrel,ladder,wafer);
108  unpack(p,packed_address[waferIndex-1][hybrid-1]);
109 }
110 
111 void SVTV1P0_ANODK_SR::get(short waferIndex, short hybrid, ANODK_entry *p)
112 {
113  unpack(p,packed_address[waferIndex-1][hybrid-1]);
114 }
115 
116 short SVTV1P0_ANODK_SR::pack(short hypersector, short rcb, short mz, short offset)
117 {
118  //printf("SVTV1P0_ANODK_SR::pack:hypersector = %d, rcb = %d, mz = %d\n",hypersector,rcb,mz);
119  short p = hypersector; // 5 bits
120  p = p << 5;
121  p += rcb; // 5 bits
122  p = p << 2;
123  p += mz; // 2 bits
124  p = p << 4;
125  p += offset; // 4 bits
126  return p;
127 }
128 
129 void SVTV1P0_ANODK_SR::unpack(ANODK_entry *entry, short anodedress)
130 {
131  entry->offset = anodedress & 0x000F;
132  entry->mz = (anodedress & 0x0030) >> 4;
133  entry->rb = (anodedress & 0x07C0) >> 6;
134  entry->hypersector = anodedress >> 11;
135  //printf("SVTV1P0_ANODK_SR::unpack:hypersector = %d, rcb = %d, mz = %d\n",entry->hypersector,entry->rb,entry->mz);
136 }
137 
138 short SVTV1P0_ANODK_SR::getWaferIndex(short barrel, short ladder, short wafer)
139 {
140  short index;
141  int numberOfLadders[3] = {8,12,16};
142  int numberOfWafers[3] = {4,6,7};
143  // int numberOfHybrids = 2;
144 
145  switch (barrel) {
146 
147  case 1:
148  index = (ladder-1)*numberOfWafers[barrel-1] + wafer;
149  break;
150 
151  case 2:
152  index = numberOfLadders[barrel-2]*numberOfWafers[barrel-2] +
153  (ladder-1)*numberOfWafers[barrel-1] + wafer;
154  break;
155 
156  case 3:
157  index = numberOfLadders[barrel-3]*numberOfWafers[barrel-3] +
158  numberOfLadders[barrel-2]*numberOfWafers[barrel-2] +
159  (ladder-1)*numberOfWafers[barrel-1] + wafer;
160  break;
161 
162  default:
163  cout << "ERROR: There is NO barrel number " << barrel << " !!!" << endl;
164  index = -1;
165  break;
166  }
167 
168  return index;
169 }
170 
171 ZeroSuppressedReader *SVTV1P0_Reader::getZeroSuppressedReader(int wafer)
172 {
173  if (ercpy->verbose) cout << "getSVT_ZS_SR wafer = " << wafer << endl;
174 
175  SVTV1P0_ZS_SR *zsp = new SVTV1P0_ZS_SR(wafer, this);
176  if(!zsp->initialize())
177  {
178  if (ercpy->verbose)
179  cout << "ERROR: getSVT_ZS_SR FAILED wafer = " << wafer << endl;
180  delete zsp;
181  zsp = NULL;
182  }
183 
184  return (ZeroSuppressedReader *)zsp;
185 }
186 
187 ZeroSuppressedReader *SVTV1P0_Reader::getZeroSuppressedReader(int barrel, int ladder, int wafer)
188 {
189  if (ercpy->verbose) cout << "getSVT_ZS_SR wafer = " << wafer << endl;
190 
191  SVTV1P0_ZS_SR *zsp = new SVTV1P0_ZS_SR(barrel, ladder, wafer, this);
192  if(!zsp->initialize())
193  {
194  if (ercpy->verbose)
195  cout << "ERROR: getSVT_ZS_SR FAILED wafer = " << wafer << endl;
196  delete zsp;
197  zsp = NULL;
198  }
199 
200  return (ZeroSuppressedReader *)zsp;
201 }
202 
203 ADCRawReader *SVTV1P0_Reader::getADCRawReader(int wafer)
204 {
205  // cout << "getSVT_ADCR_SR" << endl;
206  SVTV1P0_ADCR_SR *adc = new SVTV1P0_ADCR_SR(wafer, this);
207  if(!adc->initialize())
208  {
209  delete adc;
210  adc = NULL;
211  }
212 
213  return (ADCRawReader *)adc;
214 }
215 
216 ADCRawReader *SVTV1P0_Reader::getADCRawReader(int barrel, int ladder, int wafer)
217 {
218  // cout << "getSVT_ADCR_SR" << endl;
219  SVTV1P0_ADCR_SR *adc = new SVTV1P0_ADCR_SR(barrel, ladder, wafer, this);
220  if(!adc->initialize())
221  {
222  delete adc;
223  adc = NULL;
224  }
225 
226  return (ADCRawReader *)adc;
227 }
228 
229 PedestalReader *SVTV1P0_Reader::getPedestalReader(int wafer)
230 {
231  // cout << "getSVT_P_SR" << endl;
232  SVTV1P0_PEDR_SR *ped = new SVTV1P0_PEDR_SR(wafer, this);
233  if(!ped->initialize())
234  {
235  delete ped;
236  ped = NULL;
237  }
238 
239  return (PedestalReader *)ped;
240 }
241 
242 PedestalReader *SVTV1P0_Reader::getPedestalReader(int barrel, int ladder, int wafer)
243 {
244  // cout << "getSVT_P_SR" << endl;
245  SVTV1P0_PEDR_SR *ped = new SVTV1P0_PEDR_SR(barrel, ladder, wafer, this);
246  if(!ped->initialize())
247  {
248  delete ped;
249  ped = NULL;
250  }
251 
252  return (PedestalReader *)ped;
253 }
254 
255 PedestalRMSReader *SVTV1P0_Reader::getPedestalRMSReader(int wafer)
256 {
257  // cout << "getSVT_PRMS_SR" << endl;
258  SVTV1P0_PRMS_SR *rms = new SVTV1P0_PRMS_SR(wafer, this);
259  if(!rms->initialize())
260  {
261  delete rms;
262  rms = NULL;
263  }
264 
265  return (PedestalRMSReader *)rms;
266 }
267 
268 PedestalRMSReader *SVTV1P0_Reader::getPedestalRMSReader(int barrel, int ladder, int wafer)
269 {
270  // cout << "getSVT_PRMS_SR" << endl;
271  SVTV1P0_PRMS_SR *rms = new SVTV1P0_PRMS_SR(barrel, ladder, wafer, this);
272  if(!rms->initialize())
273  {
274  delete rms;
275  rms = NULL;
276  }
277 
278  return (PedestalRMSReader *)rms;
279 }
280 
281 GainReader *SVTV1P0_Reader::getGainReader(int wafer)
282 {
283  if (ercpy->verbose) cout << "getSVT_G_SR" << endl;
284  return NULL;
285 }
286 
287 GainReader *SVTV1P0_Reader::getGainReader(int barrel, int ladder, int wafer)
288 {
289  if (ercpy->verbose) cout << "getSVT_G_SR" << endl;
290  return NULL;
291 }
292 
293 CPPReader *SVTV1P0_Reader::getCPPReader(int wafer)
294 {
295  // cout << "getSVT_CPP_SR" << endl;
296  SVTV1P0_CPP_SR *cpp = new SVTV1P0_CPP_SR(wafer, this);
297  if(!cpp->initialize())
298  {
299  delete cpp;
300  cpp = NULL;
301  }
302 
303  return (CPPReader *)cpp;}
304 
305 CPPReader *SVTV1P0_Reader::getCPPReader(int barrel, int ladder, int wafer)
306 {
307  // cout << "getSVT_CPP_SR" << endl;
308  SVTV1P0_CPP_SR *cpp = new SVTV1P0_CPP_SR(barrel, ladder, wafer, this);
309  if(!cpp->initialize())
310  {
311  delete cpp;
312  cpp = NULL;
313  }
314 
315  return (CPPReader *)cpp;}
316 
317 BadChannelReader *SVTV1P0_Reader::getBadChannelReader(int wafer)
318 {
319  if (ercpy->verbose) cout << "getSVT_BC_SR" << endl;
320  return NULL;
321 }
322 
323 BadChannelReader *SVTV1P0_Reader::getBadChannelReader(int barrel, int ladder, int wafer)
324 {
325  if (ercpy->verbose) cout << "getSVT_BC_SR" << endl;
326  return NULL;
327 }
328 
329 ConfigReader *SVTV1P0_Reader::getConfigReader(int wafer)
330 {
331  if (ercpy->verbose) cout << "getSVT_CR_SR" << endl;
332  return NULL;
333 }
334 
335 ConfigReader *SVTV1P0_Reader::getConfigReader(int barrel, int ladder, int wafer)
336 {
337  if (ercpy->verbose) cout << "getSVT_CR_SR" << endl;
338  return NULL;
339 }
340 
341 SVTV1P0_ANODK_SR *SVTV1P0_Reader::getANODKReader()
342 {
343  // cout << "GetANODKReader" << endl;
344 
345  //JS: can't do that anymore. The SVTP bank length is now 58, just like TPC
346  // so the length has no relation to the number of sectors anymore.
347  //int maxSector = pBankSVTP->header.BankLength/sizeof(Pointer)*2;
348 
349  int maxSector = 4;
350  SVTV1P0_ANODK_SR *p;
351  p = anodk;
352  if(p == NULL)
353  {
354  p = new SVTV1P0_ANODK_SR(this);
355  if(!p->initialize(maxSector))
356  {
357  // if (ercpy->verbose) cout << "Error Reading ANODK banks"
358  // << ": " << errstr() << endl;
359  delete p;
360  return NULL;
361  }
362  }
363  anodk = p;
364  return p;
365 }
366 
367 SVTV1P0_Reader::SVTV1P0_Reader(EventReader *er, classname(Bank_SVTP) *psvt)
368 {
369  pBankSVTP = psvt; // copy pointer into class variable
370  ercpy = er; // squirrel away pointer eventreader for our friends
371 
372  if (!pBankSVTP->test_CRC()) ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,"SVTP");
373  if (pBankSVTP->swap() < 0) ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,"SVTP");
374  pBankSVTP->header.CRC = 0;
375  anodk = NULL;
376 }
377 
378 SVTV1P0_Reader::~SVTV1P0_Reader()
379 {
380  // cout << "SVT destructor" << endl;
381 
382  // Delete Sector Readers buffers (The actual readers are deleted by client)
383 
384  // Delete ANODK's
385  if(anodk != NULL) delete anodk;
386 }
387 
388 int SVTV1P0_Reader::MemUsed()
389 {
390  return 0;
391 }
392 
393 // -----------------------------------------------------
394 // Here are the bank retrieval functions
395 // ---- These NAVIGATE to the raw banks
396 // -----------------------------------------------------
397 
398 classname(Bank_SVTSECP) *SVTV1P0_Reader::getBankSVTSECP(int hypersector)
399 {
400  //printf("getbankSVTSECP %d\n",hypersector);
401 
402  if((hypersector < 1 ) || (hypersector > 4))
403  {
404  char str0[40];
405  sprintf(str0,"getBankSVTSECP(hs %d)",hypersector);
406  ercpy->fprintError(ERR_BAD_ARG,__FILE__,__LINE__,str0);
407  return NULL;
408  }
409  hypersector--; //convert to internal represenation
410 
411  if((!pBankSVTP->HyperSector[hypersector].offset) ||
412  (!pBankSVTP->HyperSector[hypersector].length))
413  {
414  char str0[40];
415  sprintf(str0,"getBankSVTSECP(hs %d)",hypersector+1);
416  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
417  return NULL;
418  }
419 
420  classname(Bank_SVTSECP) *ptr = (classname(Bank_SVTSECP) *)
421  (((INT32 *)pBankSVTP) +
422  pBankSVTP->HyperSector[hypersector].offset);
423 
424  if(strncmp(ptr->header.BankType,"SVTSECP",7)) {
425  char str0[40];
426  sprintf(str0,"getBankSVTSECP(hs %d)",hypersector+1);
427  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__, str0); return NULL;
428  }
429 
430  if(!ptr->test_CRC()) {
431  char str0[40];
432  sprintf(str0,"getBankSVTSECP(hs %d)",hypersector+1);
433  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
434  }
435  if(ptr->swap() < 0) {
436  char str0[40];
437  sprintf(str0,"getBankSVTSECP(hs %d)",hypersector+1);
438  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
439  }
440  ptr->header.CRC = 0;
441 
442  return ptr;
443 }
444 
445 classname(Bank_SVTRBP) *SVTV1P0_Reader::getBankSVTRBP(int interleaved_rb,
446  classname(Bank_SVTSECP) *secp)
447 {
448  int hypersector = secp->header.BankId;
449  // interleaved_rb counts from 1 to 12
450  if ((interleaved_rb < 1) || (interleaved_rb > 12))
451  {
452  char str0[40];
453  sprintf(str0,"getBankSVTRBP(sec %d rb %d )",hypersector,interleaved_rb);
454  ercpy->fprintError(ERR_BAD_ARG,__FILE__,__LINE__,str0);
455  return NULL;
456  }
457 
458  //convert to internal representation:
459  interleaved_rb--;
460 
461  //printf("getBankSVTRBP RB: %d\n",interleaved_rb);
462  // secp->print();
463 
464  if ((!secp->RcvBoard[interleaved_rb].offset) ||
465  (!secp->RcvBoard[interleaved_rb].length) )
466  {
467  // pERROR(ERR_BANK);
468  return NULL;
469  }
470 
471  classname(Bank_SVTRBP) *ptr = (classname(Bank_SVTRBP) *)
472  (((INT32 *)secp) +
473  secp->RcvBoard[interleaved_rb].offset);
474 
475  if(strncmp(ptr->header.BankType,"SVTRBP",6)) {
476  char str0[40];
477  sprintf(str0,"getBankSVTRBP(sec %d rb %d )",hypersector,interleaved_rb);
478  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
479  }
480  if(!ptr->test_CRC()) {
481  char str0[40];
482  sprintf(str0,"getBankSVTRBP(sec %d rb %d )",hypersector,interleaved_rb);
483  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
484  }
485  if(ptr->swap() < 0) {
486  char str0[40];
487  sprintf(str0,"getBankSVTRBP(sec %d rb %d )",hypersector,interleaved_rb);
488  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
489  }
490  ptr->header.CRC = 0;
491 
492  mSCAZero = (int)ptr->FiberHeader[16];
493  mTimeZero = (int)ptr->FiberHeader[17];
494 
495  return ptr;
496 }
497 
498 classname(Bank_SVTMZP) *SVTV1P0_Reader::getBankSVTMZP(int mz, classname(Bank_SVTRBP) *rbp)
499 {
500  // mezzanine counts from 1 to 3
501  int rb = rbp->header.BankId;
502  if ((mz < 1) || (mz > 3))
503  {
504  char str0[40];
505  sprintf(str0,"getBankSVTMZP(rb %d mz %d )",rb,mz);
506  ercpy->fprintError(ERR_BAD_ARG,__FILE__,__LINE__,str0);
507  return NULL;
508  }
509 
510  // convert to internal representation
511  mz--;
512 
513  if ((!rbp->Mz[mz].offset) || (!rbp->Mz[mz].length))
514  {
515  char str0[40];
516  sprintf(str0,"getBankSVTMZP(rb %d mz %d )",rb,mz+1);
517  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
518  return NULL;
519  }
520 
521  classname(Bank_SVTMZP) *ptr = (classname(Bank_SVTMZP) *)
522  (((INT32 *)rbp) +
523  rbp->Mz[mz].offset);
524 
525  if(strncmp(ptr->header.BankType,"SVTMZP",6)) {
526  char str0[40];
527  sprintf(str0,"getBankSVTMZP(rb %d mz %d )",rb,mz+1);
528  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
529  }
530  if(!ptr->test_CRC()) {
531  char str0[40];
532  sprintf(str0,"getBankSVTMZP(rb %d mz %d )",rb,mz+1);
533  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
534  }
535  if(ptr->swap() < 0) {
536  char str0[40];
537  sprintf(str0,"getBankSVTMZP(rb %d mz %d )",rb,mz+1);
538  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
539  }
540  ptr->header.CRC = 0;
541 
542 // printf("getBankSVTMZP Mezz: %d\n",mz);
543 // ptr->print();
544 
545  return ptr;
546 }
547 
548 classname(Bank_SVTMZP) *SVTV1P0_Reader::getBankSVTMZP(int hypersector, int rb, int mz)
549 {
550  //printf("getBankSVTMZP for hypersector %d, rcb %d, mz %d\n",hypersector,rb,mz);
551 
552  if ((hypersector < 1) || (hypersector > SVT_HYPERSECTORS))
553  {
554  char str0[40];
555  sprintf(str0,"getBankSVTMZP(sec %d, rb %d, mz %d )",hypersector,rb,mz);
556  ercpy->fprintError(ERR_BAD_ARG,__FILE__,__LINE__,str0);
557  return NULL;
558  }
559 
560  if ((rb < 1) || (rb > 6))
561  {
562  char str0[40];
563  sprintf(str0,"getBankSVTMZP(sec %d, rb %d, mz %d )",hypersector,rb,mz);
564  ercpy->fprintError(ERR_BAD_ARG,__FILE__,__LINE__,str0);
565  return NULL;
566  }
567 
568  if ((mz < 1) || (mz > 3))
569  {
570  char str0[40];
571  sprintf(str0,"getBankSVTMZP(sec %d, rb %d, mz %d )",hypersector,rb,mz);
572  ercpy->fprintError(ERR_BAD_ARG,__FILE__,__LINE__,str0);
573  return NULL;
574  }
575 
576  // convert to internal representation:
577  hypersector--;
578 
579  // use odd slots 1 and 3
580  classname(Bank_SVTSECP) *secp = getBankSVTSECP(2*(hypersector/2)+1);
581  if(!secp) return NULL;
582 
583  classname(Bank_SVTRBP) *rbp;
584  if (hypersector%2) // internal hypersector odd -> hypersector even -> rb = 7 to 12
585  {
586  rbp = getBankSVTRBP(rb + 6, secp);
587  }
588  else // internal hypersector even -> hypersector odd -> rb = 1 to 6
589  {
590  rbp = getBankSVTRBP(rb, secp);
591  }
592  if(!rbp) return NULL;
593 
594  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(mz,rbp);
595 
596  return mzp;
597 }
598 
599 classname(Bank_SVTADCD) *SVTV1P0_Reader::getBankSVTADCD(int hypersector, int rb, int mz)
600 {
601  errnum = 0;
602  errstr0[0] = '\0';
603 
604  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
605  if(!mzp) return NULL;
606 
607 // printf(" hypersector: %d RB: %d MZ: %d\n", hypersector, rb, mz);
608 // mzp->print();
609 
610  if((!mzp->SVTADCD.offset) || (!mzp->SVTADCD.length))
611  {
612  char str0[40];
613  sprintf(str0,"getBankSVTADCD(sec %d rb %d mz %d )",hypersector,rb,mz);
614  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
615  return NULL;
616  }
617 
618  classname(Bank_SVTADCD) *ptr = (classname(Bank_SVTADCD) *)
619  (((INT32 *)mzp) +
620  mzp->SVTADCD.offset);
621 
622  if(strncmp(ptr->header.BankType,"SVTADCD",7)) {
623  char str0[40];
624  sprintf(str0,"getBankSVTADCD(sec %d rb %d mz %d )",hypersector,rb,mz);
625  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
626  }
627  if(!ptr->test_CRC()) {
628  char str0[40];
629  sprintf(str0,"getBankSVTADCD(sec %d rb %d mz %d )",hypersector,rb,mz);
630  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
631  }
632  if(ptr->swap() < 0) {
633  char str0[40];
634  sprintf(str0,"getBankSVTADCD(sec %d rb %d mz %d )",hypersector,rb,mz);
635  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
636  }
637  ptr->header.CRC = 0;
638 
639  return ptr;
640 }
641 
642 classname(Bank_SVTSEQD) *SVTV1P0_Reader::getBankSVTSEQD(int hypersector, int rb, int mz)
643 {
644  errnum = 0;
645  errstr0[0] = '\0';
646 
647 
648  //printf("get mzp\n");
649  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
650  if(!mzp) return NULL;
651 
652  //printf("mzp hypersector: %d RB: %d MZ: %d\n", hypersector, rb, mz);
653  //mzp->print();
654 
655 
656  if((!mzp->SVTSEQD.offset) || (!mzp->SVTSEQD.length))
657  {
658  char str0[40];
659  sprintf(str0,"getBankSVTSEQD(sec %d rb %d mz %d )",hypersector,rb,mz);
660  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
661  return NULL;
662  }
663 
664  classname(Bank_SVTSEQD) *ptr = (classname(Bank_SVTSEQD) *)
665  (((INT32 *)mzp) +
666  mzp->SVTSEQD.offset);
667 
668 
669  if(strncmp(ptr->header.BankType,"SVTSEQD",7)) {
670  char str0[40];
671  sprintf(str0,"getBankSVTSEQD(sec %d rb %d mz %d )",hypersector,rb,mz);
672  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
673  }
674  if(!ptr->test_CRC()) {
675  char str0[40];
676  sprintf(str0,"getBankSVTSEQD(sec %d rb %d mz %d )",hypersector,rb,mz);
677  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
678  }
679  if(ptr->swap() < 0) {
680  char str0[40];
681  sprintf(str0,"getBankSVTSEQD(sec %d rb %d mz %d )",hypersector,rb,mz);
682  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
683  }
684  ptr->header.CRC = 0;
685  return ptr;}
686 
687 classname(Bank_SVTADCX) *SVTV1P0_Reader::getBankSVTADCX(int hypersector, int rb, int mz)
688 {
689  errnum = 0;
690  errstr0[0] = '\0';
691 
692  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
693  if(!mzp) return NULL;
694 
695 // printf(" hypersector: %d RB: %d MZ: %d\n", hypersector, rb, mz);
696 // mzp->print();
697 
698  if((!mzp->SVTADCX.offset) || (!mzp->SVTADCX.length))
699  {
700  char str0[40];
701  sprintf(str0,"getBankSVTADCX(sec %d rb %d mz %d )",hypersector,rb,mz);
702  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
703  return NULL;
704  }
705 
706  classname(Bank_SVTADCX) *ptr = (classname(Bank_SVTADCX) *)
707  (((INT32 *)mzp) +
708  mzp->SVTADCX.offset);
709 
710  if(strncmp(ptr->header.BankType,"SVTADCX",7)) {
711  char str0[40];
712  sprintf(str0,"getBankSVTADCX(sec %d rb %d mz %d )",hypersector,rb,mz);
713  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
714  }
715  if(!ptr->test_CRC()) {
716  char str0[40];
717  sprintf(str0,"getBankSVTADCX(sec %d rb %d mz %d )",hypersector,rb,mz);
718  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
719  }
720  if(ptr->swap() < 0) {
721  char str0[40];
722  sprintf(str0,"getBankSVTADCX(sec %d rb %d mz %d )",hypersector,rb,mz);
723  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
724  }
725  ptr->header.CRC = 0;
726 
727  return ptr;}
728 
729 classname(Bank_SVTANODK) *SVTV1P0_Reader::getBankSVTANODK(int hypersector, int rb, int mz)
730 {
731  // cout << "getBankSVTANODK" << endl;
732  errnum = 0;
733  errstr0[0] = '\0';
734 
735  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
736  if(!mzp) return NULL;
737 
738 // printf(" hypersector: %d RB: %d MZ: %d\n", hypersector, rb, mz);
739 // mzp->print();
740 
741  if((!mzp->SVTANODK.offset) || (!mzp->SVTANODK.length))
742  {
743  char str0[40];
744  sprintf(str0,"getBankSVTANODK(sec %d rb %d mz %d )",hypersector,rb,mz);
745  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
746  return NULL;
747  }
748 
749  classname(Bank_SVTANODK) *ptr = (classname(Bank_SVTANODK) *)
750  (((INT32 *)mzp) +
751  mzp->SVTANODK.offset);
752 
753  if(strncmp(ptr->header.BankType,"SVTANODK",7)) {
754  char str0[40];
755  sprintf(str0,"getBankSVTANODK(sec %d rb %d mz %d )",hypersector,rb,mz);
756  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
757  }
758  if(!ptr->test_CRC()) {
759  char str0[40];
760  sprintf(str0,"getBankSVTANODK(sec %d rb %d mz %d )",hypersector,rb,mz);
761  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
762  }
763  if(ptr->swap() < 0) {
764  char str0[40];
765  sprintf(str0,"getBankSVTANODK(sec %d rb %d mz %d )",hypersector,rb,mz);
766  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
767  }
768  ptr->header.CRC = 0;
769 
770  return ptr;
771 };
772 
773 classname(Bank_SVTCPPR) *SVTV1P0_Reader::getBankSVTCPPR(int hypersector, int rb, int mz)
774 {
775  errnum = 0;
776  errstr0[0] = '\0';
777 
778  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
779  if(!mzp) return NULL;
780 
781  if((!mzp->SVTCPPR.offset) || (!mzp->SVTCPPR.length))
782  {
783  char str0[40];
784  sprintf(str0,"getBankSVTCPPR(sec %d rb %d mz %d )",hypersector,rb,mz);
785  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
786  return NULL;
787  }
788 
789  classname(Bank_SVTCPPR) *ptr = (classname(Bank_SVTCPPR) *)
790  (((INT32 *)mzp) +
791  mzp->SVTCPPR.offset);
792 
793  if(strncmp(ptr->header.BankType,"SVTCPPR",7)) {
794  char str0[40];
795  sprintf(str0,"getBankSVTCPPR(sec %d rb %d mz %d )",hypersector,rb,mz);
796  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
797  }
798  if(!ptr->test_CRC()) {
799  char str0[40];
800  sprintf(str0,"getBankSVTCPPR(sec %d rb %d mz %d )",hypersector,rb,mz);
801  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
802  }
803  if(ptr->swap() < 0) {
804  char str0[40];
805  sprintf(str0,"getBankSVTCPPR(sec %d rb %d mz %d )",hypersector,rb,mz);
806  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
807  }
808  ptr->header.CRC = 0;
809 
810  return ptr;
811 }
812 
813 classname(Bank_SVTADCR) *SVTV1P0_Reader::getBankSVTADCR(int hypersector, int rb, int mz)
814 {
815  //printf("getBankSVTADCR for hypersector %d, rcb %d, mz %d\n",hypersector,rb,mz);
816 
817  errnum = 0;
818  errstr0[0] = '\0';
819 
820  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
821  if(!mzp) return NULL;
822 
823  if((!mzp->SVTADCR.offset) || (!mzp->SVTADCR.length))
824  {
825  char str0[40];
826  sprintf(str0,"getBankSVTADCR(sec %d rb %d mz %d )",hypersector,rb,mz);
827  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
828  return NULL;
829  }
830 
831  classname(Bank_SVTADCR) *ptr = (classname(Bank_SVTADCR) *)
832  (((INT32 *)mzp) +
833  mzp->SVTADCR.offset);
834 
835  if(strncmp(ptr->header.BankType,"SVTADCR",7)) {
836  char str0[40];
837  sprintf(str0,"getBankSVTADCR(sec %d rb %d mz %d )",hypersector,rb,mz);
838  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
839  }
840  if(!ptr->test_CRC()) {
841  char str0[40];
842  sprintf(str0,"getBankSVTADCR(sec %d rb %d mz %d )",hypersector,rb,mz);
843  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
844  }
845  if(ptr->swap() < 0) {
846  char str0[40];
847  sprintf(str0,"getBankSVTADCR(sec %d rb %d mz %d )",hypersector,rb,mz);
848  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
849  }
850  ptr->header.CRC = 0;
851 
852  return ptr;
853 }
854 
855 classname(Bank_SVTMZCLD) *SVTV1P0_Reader::getBankSVTMZCLD(int hypersector, int rb, int mz)
856 {
857  errnum = 0;
858  errstr0[0] = '\0';
859 
860  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
861  if(!mzp) return NULL;
862 
863  if((!mzp->SVTMZCLD.offset) || (!mzp->SVTMZCLD.length))
864  {
865  char str0[40];
866  sprintf(str0,"getBankSVTMZCLD(sec %d rb %d mz %d )",hypersector,rb,mz);
867  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
868  return NULL;
869  }
870 
871  classname(Bank_SVTMZCLD) *ptr = (classname(Bank_SVTMZCLD) *)
872  (((INT32 *)mzp) +
873  mzp->SVTMZCLD.offset);
874 
875  if(strncmp(ptr->header.BankType,"SVTMZCLD",8)) {
876  char str0[40];
877  sprintf(str0,"getBankSVTMZCLD(sec %d rb %d mz %d )",hypersector,rb,mz);
878  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
879  }
880  if(!ptr->test_CRC()) {
881  char str0[40];
882  sprintf(str0,"getBankSVTMZCLD(sec %d rb %d mz %d )",hypersector,rb,mz);
883  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
884  }
885  if(ptr->swap() < 0) {
886  char str0[40];
887  sprintf(str0,"getBankSVTMZCLD(sec %d rb %d mz %d )",hypersector,rb,mz);
888  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
889  }
890  ptr->header.CRC = 0;
891 
892  return ptr;
893 }
894 
895 
896 classname(Bank_SVTCFGR) *SVTV1P0_Reader::getBankSVTCFGR(int hypersector, int rb, int mz)
897 {
898  return NULL;
899 }
900 
901 classname(Bank_SVTPEDR) *SVTV1P0_Reader::getBankSVTPEDR(int hypersector, int rb, int mz)
902 {
903  errnum = 0;
904  errstr0[0] = '\0';
905 
906  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
907  if(!mzp) return NULL;
908 
909  if((!mzp->SVTPEDR.offset) || (!mzp->SVTPEDR.length))
910  {
911  char str0[40];
912  sprintf(str0,"getBankSVTPEDR(sec %d rb %d mz %d )",hypersector,rb,mz);
913  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
914  return NULL;
915  }
916 
917  classname(Bank_SVTPEDR) *ptr = (classname(Bank_SVTPEDR) *)
918  (((INT32 *)mzp) +
919  mzp->SVTPEDR.offset);
920 
921  if(strncmp(ptr->header.BankType,"SVTPEDR",7)) {
922  char str0[40];
923  sprintf(str0,"getBankSVTPEDR(sec %d rb %d mz %d )",hypersector,rb,mz);
924  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
925  }
926  if(!ptr->test_CRC()) {
927  char str0[40];
928  sprintf(str0,"getBankSVTPEDR(sec %d rb %d mz %d )",hypersector,rb,mz);
929  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
930  }
931  if(ptr->swap() < 0) {
932  char str0[40];
933  sprintf(str0,"getBankSVTPEDR(sec %d rb %d mz %d )",hypersector,rb,mz);
934  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
935  }
936  ptr->header.CRC = 0;
937 
938  return ptr;
939 }
940 
941 
942 classname(Bank_SVTRMSR) *SVTV1P0_Reader::getBankSVTRMSR(int hypersector, int rb, int mz)
943 {
944  errnum = 0;
945  errstr0[0] = '\0';
946 
947  classname(Bank_SVTMZP) *mzp = getBankSVTMZP(hypersector, rb, mz);
948  if(!mzp) return NULL;
949 
950  if((!mzp->SVTRMSR.offset) || (!mzp->SVTRMSR.length))
951  {
952  char str0[40];
953  sprintf(str0,"getBankSVTRMSR(sec %d rb %d mz %d )",hypersector,rb,mz);
954  ercpy->fprintError(INFO_MISSING_BANK,__FILE__,__LINE__,str0);
955  return NULL;
956  }
957 
958  classname(Bank_SVTRMSR) *ptr = (classname(Bank_SVTRMSR) *)
959  (((INT32 *)mzp) +
960  mzp->SVTRMSR.offset);
961 
962  if(strncmp(ptr->header.BankType,"SVTRMSR",7)) {
963  char str0[40];
964  sprintf(str0,"getBankSVTRMSR(sec %d rb %d mz %d )",hypersector,rb,mz);
965  ercpy->fprintError(ERR_BAD_HEADER,__FILE__,__LINE__,str0); return NULL;
966  }
967  if(!ptr->test_CRC()) {
968  char str0[40];
969  sprintf(str0,"getBankSVTRMSR(sec %d rb %d mz %d )",hypersector,rb,mz);
970  ercpy->fprintError(ERR_CRC,__FILE__,__LINE__,str0); return NULL;
971  }
972  if(ptr->swap() < 0) {
973  char str0[40];
974  sprintf(str0,"getBankSVTRMSR(sec %d rb %d mz %d )",hypersector,rb,mz);
975  ercpy->fprintError(ERR_SWAP,__FILE__,__LINE__,str0); return NULL;
976  }
977  ptr->header.CRC = 0;
978 
979  return ptr;
980 }
981 
982 classname(Bank_SVTGAINR) *SVTV1P0_Reader::getBankSVTGAINR(int hypersector, int rb, int mz)
983 {
984  return NULL;
985 }
986 
987 classname(Bank_SVTBADR) *SVTV1P0_Reader::getBankSVTBADR(int hypersector, int rb, int mz)
988 {
989  return NULL;
990 }
991 
Definition: rb.hh:21
Definition: SVTV1P0.hh:222