StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
L3_Reader.cxx
1 /***************************************************************************
2  *
3  * $Id: L3_Reader.cxx,v 1.13 2007/12/24 06:04:20 fine Exp $
4  *
5  * Author: Christof Struck, struck@star.physics.yale.edu
6  ***************************************************************************
7  *
8  * Description: L3 unpacking code
9  *
10  *
11  *
12  * change log:
13  * 06 Jun 00 CS initial version
14  * 25 Jul 00 CS added i960 cluster reader
15  * 09 Aug 00 CS removed 'cout' statement in i960 reader
16  * 11 Sep 00 CS removed memory leak in L3_Reader
17  *
18  ***************************************************************************
19  *
20  * $Log: L3_Reader.cxx,v $
21  * Revision 1.13 2007/12/24 06:04:20 fine
22  * introduce OLDEVP namespace to allow ole and new EVP library concurrently
23  *
24  * Revision 1.12 2001/09/24 21:42:56 struck
25  * cs: changed vertex info to float (unit [cm]) in Bank_L3_GTD
26  *
27  * Revision 1.11 2001/08/20 05:37:45 struck
28  * removed naming conflicts with 'Stl3Utils/foreign/L3Formats.h'
29  *
30  * Revision 1.10 2001/08/17 17:12:27 struck
31  * cs: getI960ClusterReader() now returns NULL pointer if number of clusters == 0
32  *
33  * Revision 1.9 2001/07/17 19:16:11 struck
34  * update to 2001 data format (backwards compatible)Z
35  *
36  * Revision 1.8 2000/09/30 16:13:46 fisyak
37  * take out derivative and result from Streamer
38  *
39  * Revision 1.7 2000/09/11 16:31:12 struck
40  * removed memory leak in L3_Reader
41  *
42  * Revision 1.6 2000/08/09 15:27:03 struck
43  * removed 'cout' statement in i960ClusterReader
44  *
45  * Revision 1.5 2000/07/26 02:38:06 struck
46  * minor changes
47  *
48  * Revision 1.4 2000/07/26 02:12:28 struck
49  * added i960 cluster reader
50  *
51  * Revision 1.3 2000/07/06 18:16:01 ward
52  * Install L3 code from Christof Struck.
53  *
54  *
55  **************************************************************************/
56 #include "L3_Reader.hh"
57 
58 
59 
60 //##########################################################
61 //- L3_Reader
62 //##########################################################
63 using namespace OLDEVP;
64 L3_Reader::L3_Reader(EventReader *er, Bank_L3_P *pL3P)
65 {
66  mBankL3P = pL3P;
67  mBankL3SUMD = NULL;
68  mBankL3GTD = NULL;
69  mBankL3SECP = NULL;
70  mBankL3SECCD = NULL;
71  mBankL3SECTP = NULL;
72  mBankTPCSECLP = NULL;
73  mBankTPCRBCLP = NULL;
74  mBankTPCMZCLD = NULL;
75  mSVT = NULL;
76  mFTPC = NULL;
77  mEMC = NULL;
78  mAlr = NULL;
79  mGtr = NULL;
80  mScr = NULL;
81  mStr = NULL;
82  mIcr = NULL;
83 
84  // DetectorReader checks if L3_P bank exits
85  // so we can access it here without checking again
86  mTime = mBankL3P->time;
87  mGl3Id = mBankL3P->gl3Id;
88  mL3sum = (L3_Summary *)mBankL3P->L3_Summary;
89 }
90 
91 //----------------------------------------------------------
92 
93 L3_Reader::~L3_Reader()
94 {
95  delete mAlr;
96  delete mGtr;
97  delete mScr;
98  delete mStr;
99  delete mIcr;
100 }
101 
102 //----------------------------------------------------------
103 
104 Bank_L3_SUMD * L3_Reader::getL3_SUMD()
105 {
106  // check format version first
107  if (mBankL3P->header.FormatNumber < 4) {
108  L3ERROR(INFO_MISSING_BANK, "wrong data format, no L3_SUMD bank");
109  return NULL;
110  }
111 
112  // now check for the offset/length
113  if (mBankL3P->summary_data.length==0) {
114  L3ERROR(INFO_MISSING_BANK, "no L3_SUMD bank");
115  return NULL;
116  }
117 
118  mBankL3SUMD = (Bank_L3_SUMD *) ((INT32 *)mBankL3P + mBankL3P->summary_data.offset);
119  if (strncmp(mBankL3SUMD->header.BankType, CHAR_L3_SUMD, 8) != 0) {
120  L3ERROR(ERR_BAD_HEADER, "bad L3_SUMD header");
121  mBankL3SUMD = NULL;
122  return mBankL3SUMD;
123  }
124 
125  if (mBankL3SUMD->swap() < 0) L3ERROR(ERR_SWAP, "swap L3_SUMD");
126 
127  return mBankL3SUMD;
128 }
129 
130 //----------------------------------------------------------
131 
132 Bank_L3_GTD * L3_Reader::getL3_GTD ()
133 {
134  if (mBankL3P->tracks.length==0) {
135  L3ERROR(INFO_MISSING_BANK, "no L3_GTD bank");
136  return NULL;
137  }
138 
139  mBankL3GTD = (Bank_L3_GTD *) ((INT32 *)mBankL3P + mBankL3P->tracks.offset);
140  if (strncmp(mBankL3GTD->header.BankType, CHAR_L3_GTD, 8) != 0) {
141  L3ERROR(ERR_BAD_HEADER, "bad L3_GTD header");
142  mBankL3GTD = NULL;
143  return mBankL3GTD;
144  }
145 
146  if (mBankL3GTD->swap() < 0) L3ERROR(ERR_SWAP, "swap L3_GTD");
147 
148  return mBankL3GTD;
149 }
150 
151 //----------------------------------------------------------
152 
153 Bank_L3_SECP * L3_Reader::getL3_SECP (int sec)
154 {
155  if (mBankL3P->sector[sec-1].length==0) {
156  L3secERROR(INFO_MISSING_BANK, "no L3_SECP bank", sec);
157  mBankL3SECP = NULL;
158  return mBankL3SECP;
159  }
160 
161  mBankL3SECP = (Bank_L3_SECP *) ((INT32 *)mBankL3P + mBankL3P->sector[sec-1].offset);
162  if (strncmp(mBankL3SECP->header.BankType, CHAR_L3_SECP, 8) != 0) {
163  L3secERROR(ERR_BAD_HEADER, "bad L3_SECP header", sec);
164  mBankL3SECP = NULL;
165  return mBankL3SECP;
166  }
167 
168  if (mBankL3SECP->swap() < 0) L3secERROR(ERR_SWAP, "swap L3_SECP", sec);
169 
170  return mBankL3SECP;
171 }
172 
173 //----------------------------------------------------------
174 
175 Bank_L3_SECCD * L3_Reader::getL3_SECCD (int sec)
176 {
177  // get L3_SECP for this sector first
178  mBankL3SECP = getL3_SECP(sec);
179  if (mBankL3SECP==NULL) {
180  mBankL3SECCD = NULL;
181  return mBankL3SECCD;
182  }
183 
184  // now check on L3_SECCD
185  if (mBankL3SECP->sl3clusterp.length==0) {
186  L3secERROR(INFO_MISSING_BANK, "no L3_SECCD bank", sec);
187  mBankL3SECCD = NULL;
188  return mBankL3SECCD;
189  }
190 
191  mBankL3SECCD = (Bank_L3_SECCD *) ((INT32 *)mBankL3SECP + mBankL3SECP->sl3clusterp.offset);
192  if (strncmp(mBankL3SECCD->header.BankType, CHAR_L3_SECCD, 8) != 0) {
193  L3secERROR(ERR_BAD_HEADER, "bad L3_SECCD header", sec);
194  mBankL3SECCD = NULL;
195  return mBankL3SECCD;
196  }
197 
198  if (mBankL3SECCD->swap() < 0) L3secERROR(ERR_SWAP, "swap L3_SECCD", sec);
199 
200  return mBankL3SECCD;
201 }
202 
203 //----------------------------------------------------------
204 
205 Bank_L3_SECTP * L3_Reader::getL3_SECTP (int sec)
206 {
207  // get L3_SECP for this sector first
208  mBankL3SECP = getL3_SECP(sec);
209  if (mBankL3SECP==NULL) {
210  mBankL3SECTP = NULL;
211  return mBankL3SECTP;
212  }
213 
214  // now check on L3_SECTP
215  if (mBankL3SECP->trackp.length==0) {
216  L3secERROR(INFO_MISSING_BANK, "no L3_SECTP bank", sec);
217  mBankL3SECTP = NULL;
218  return mBankL3SECTP;
219  }
220 
221  mBankL3SECTP = (Bank_L3_SECTP *) ((INT32 *)mBankL3SECP + mBankL3SECP->trackp.offset);
222  if (strncmp(mBankL3SECTP->header.BankType, CHAR_L3_SECTP, 8) != 0) {
223  L3secERROR(ERR_BAD_HEADER, "bad L3_SECTP header", sec);
224  mBankL3SECTP = NULL;
225  return mBankL3SECTP;
226  }
227 
228  if (mBankL3SECTP->swap() < 0) L3secERROR(ERR_SWAP, "swap L3_SECTP", sec);
229 
230  return mBankL3SECTP;
231 }
232 
233 //----------------------------------------------------------
234 
235 Bank_TPCSECLP * L3_Reader::getTPCSECLP (int sec)
236 {
237  // get L3_SECP for this sector first
238  mBankL3SECP = getL3_SECP(sec);
239  if (mBankL3SECP==NULL) {
240  mBankTPCSECLP = NULL;
241  return mBankTPCSECLP;
242  }
243 
244  // now check on TPCSECLP
245  if (mBankL3SECP->clusterp.length==0) {
246  L3secERROR(INFO_MISSING_BANK, "no TPCSECLP bank", sec);
247  mBankTPCSECLP = NULL;
248  return mBankTPCSECLP;
249  }
250 
251  mBankTPCSECLP = (Bank_TPCSECLP *) ((INT32 *)mBankL3SECP + mBankL3SECP->clusterp.offset);
252  if (strncmp(mBankTPCSECLP->header.BankType, CHAR_TPCSECLP, 8) != 0) {
253  L3secERROR(ERR_BAD_HEADER, "bad TPCSECLP header", sec);
254  mBankTPCSECLP = NULL;
255  return mBankTPCSECLP;
256  }
257 
258  if (mBankTPCSECLP->swap() < 0) L3secERROR(ERR_SWAP, "swap TPCSECLP", sec);
259 
260  return mBankTPCSECLP;
261 
262 }
263 
264 //----------------------------------------------------------
265 
266 Bank_TPCRBCLP * L3_Reader::getTPCRBCLP (int sec, int rb)
267 {
268  mBankTPCSECLP = getTPCSECLP(sec);
269  if (mBankTPCSECLP==NULL) {
270  mBankTPCRBCLP = NULL;
271  return mBankTPCRBCLP;
272  }
273 
274  // now check on TPCRBCLP
275  if (mBankTPCSECLP->receiverBoard[rb-1].length==0) {
276  L3secERROR(INFO_MISSING_BANK, "no TPCRBCLP bank", sec);
277  mBankTPCRBCLP = NULL;
278  return mBankTPCRBCLP;
279  }
280 
281  mBankTPCRBCLP = (Bank_TPCRBCLP *) ((INT32 *)mBankTPCSECLP + mBankTPCSECLP->receiverBoard[rb-1].offset);
282  if (strncmp(mBankTPCRBCLP->header.BankType, CHAR_TPCRBCLP, 8) != 0) {
283  L3secERROR(ERR_BAD_HEADER, "bad TPCRBCLP header", sec);
284  mBankTPCRBCLP = NULL;
285  return mBankTPCRBCLP;
286  }
287 
288  if (mBankTPCRBCLP->swap() < 0) L3secERROR(ERR_SWAP, "swap TPCRBCLP", sec);
289 
290  return mBankTPCRBCLP;
291 
292 }
293 
294 //----------------------------------------------------------
295 
296 Bank_TPCMZCLD * L3_Reader::getTPCMZCLD (int sec, int rb, int mz)
297 {
298  mBankTPCRBCLP = getTPCRBCLP(sec, rb);
299  if (mBankTPCRBCLP==NULL) {
300  mBankTPCMZCLD = NULL;
301  return mBankTPCMZCLD;
302  }
303 
304  // now check on TPCMZCLD
305  if (mBankTPCRBCLP->mezzBoard[mz-1].length==0) {
306  L3secERROR(INFO_MISSING_BANK, "no TPCMZCLD bank", sec);
307  mBankTPCMZCLD = NULL;
308  return mBankTPCMZCLD;
309  }
310 
311  mBankTPCMZCLD = (Bank_TPCMZCLD *) ((INT32 *)mBankTPCRBCLP + mBankTPCRBCLP->mezzBoard[mz-1].offset);
312  if (strncmp(mBankTPCMZCLD->header.BankType, CHAR_TPCMZCLD, 8) != 0) {
313  L3secERROR(ERR_BAD_HEADER, "bad TPCMZCLD header", sec);
314  mBankTPCMZCLD = NULL;
315  return mBankTPCMZCLD;
316  }
317 
318  if (mBankTPCMZCLD->swap() < 0) L3secERROR(ERR_SWAP, "swap TPCMZCLD", sec);
319 
320  return mBankTPCMZCLD;
321 }
322 
323 //----------------------------------------------------------
324 
325 int * L3_Reader::getSVT_Bank(int sector)
326 {
327  // check format version first
328  if (mBankL3P->header.FormatNumber < 4) {
329  L3ERROR(INFO_MISSING_BANK, "wrong data format, no SVT");
330  return NULL;
331  }
332 
333  // now check for the offset/length
334  if (mBankL3P->svt[sector-1].length==0) {
335  L3ERROR(INFO_MISSING_BANK, "no SVT bank");
336  return NULL;
337  }
338 
339  mSVT = (INT32 *)mBankL3P + mBankL3P->svt[sector-1].offset;
340 
341  return mSVT;
342 }
343 
344 //----------------------------------------------------------
345 
346 int * L3_Reader::getFTPC_Bank(int sector)
347 {
348  // check format version first
349  if (mBankL3P->header.FormatNumber < 4) {
350  L3ERROR(INFO_MISSING_BANK, "wrong data format, no FTPC");
351  return NULL;
352  }
353 
354  // now check for the offset/length
355  if (mBankL3P->ftpc[sector-1].length==0) {
356  L3ERROR(INFO_MISSING_BANK, "no FTPC bank");
357  return NULL;
358  }
359 
360  mFTPC = (INT32 *)mBankL3P + mBankL3P->ftpc[sector-1].offset;
361 
362  return mFTPC;
363 }
364 
365 //----------------------------------------------------------
366 
367 int * L3_Reader::getEMC_Bank()
368 {
369  // check format version first
370  if (mBankL3P->header.FormatNumber < 4) {
371  L3ERROR(INFO_MISSING_BANK, "wrong data format, no EMC");
372  return NULL;
373  }
374 
375  // now check for the offset/length
376  if (mBankL3P->emc.length==0) {
377  L3ERROR(INFO_MISSING_BANK, "no EMC bank");
378  return NULL;
379  }
380 
381  mEMC = (INT32 *)mBankL3P + mBankL3P->emc.offset;
382 
383  return mEMC;
384 }
385 
386 
387 //----------------------------------------------------------
388 
389 Gl3AlgorithmReader * L3_Reader::getGl3AlgorithmReader()
390 {
391  // only one reader per event
392  if (!mAlr) {
393  mAlr = new Gl3AlgorithmReader (this);
394  if (!mAlr->initialize()) {
395  //cout << "ERROR: getGlobalTrackReader FAILED" << endl;
396  return NULL;
397  }
398  }
399  return mAlr;
400 }
401 
402 
403 //----------------------------------------------------------
404 
405 GlobalTrackReader * L3_Reader::getGlobalTrackReader ()
406 {
407  // only one reader per event
408  if (!mGtr) {
409  mGtr = new GlobalTrackReader (this);
410  if (!mGtr->initialize()) {
411  //cout << "ERROR: getGlobalTrackReader FAILED" << endl;
412  return NULL;
413  }
414  }
415  return mGtr;
416 }
417 
418 //----------------------------------------------------------
419 
420 Sl3ClusterReader * L3_Reader::getSl3ClusterReader (int sec)
421 {
422  if (!mScr) mScr = new Sl3ClusterReader (this);
423  if (!mScr->initialize(sec)) {
424  //cout << "ERROR: getSl3ClusterReader FAILED" << endl;
425  return NULL;
426  }
427  return mScr;
428 }
429 
430 //----------------------------------------------------------
431 
432 Sl3TrackReader * L3_Reader::getSl3TrackReader (int sec)
433 {
434  if (!mStr) mStr = new Sl3TrackReader (this);
435  if (!mStr->initialize(sec)) {
436  //cout << "ERROR: getSl3TrackReader FAILED" << endl;
437  return NULL;
438  }
439  return mStr;
440 }
441 
442 //----------------------------------------------------------
443 
444 I960ClusterReader * L3_Reader::getI960ClusterReader (int sec)
445 {
446  if (!mIcr) mIcr = new I960ClusterReader (this);
447  if (!mIcr->initialize(sec)) {
448  //cout << "ERROR: getI960ClusterReader FAILED" << endl;
449  return NULL;
450  }
451  return mIcr;
452 }
453 
454 
455 //##########################################################
456 //--------- Gl3AlgorithmReader ------------------------------
457 //##########################################################
458 
459 Gl3AlgorithmReader::Gl3AlgorithmReader(L3_Reader *l3r)
460 {
461  mL3r = l3r;
462  mL3SUMD = NULL;
463  mAlgData = NULL;
464  mNProcessed = 0;
465  mNReconstructed = 0;
466  mNAlg = 0;
467 }
468 
469 
470 int Gl3AlgorithmReader::initialize()
471 {
472  mL3SUMD = mL3r->getL3_SUMD();
473  if (mL3SUMD == NULL) {
474  //cout << "no L3_SUMD found" << endl;
475  return FALSE;
476  }
477 
478  mNProcessed = mL3SUMD->nProcessed;
479  mNReconstructed = mL3SUMD->nReconstructed;
480  mNAlg = mL3SUMD->nAlg;
481  mAlgData = mL3SUMD->alg;
482 
483  return TRUE;
484 }
485 
486 
487 //##########################################################
488 //--------- GlobalTrackReader ------------------------------
489 //##########################################################
490 
491 GlobalTrackReader::GlobalTrackReader (L3_Reader *l3r)
492 {
493  mL3 = l3r;
494  mL3GTD = NULL;
495  mTracks = NULL;
496  mNTracks = 0;
497  mNHits = 0;
498  mGlobalVertex.x = 0;
499  mGlobalVertex.y = 0;
500  mGlobalVertex.z = 0;
501 }
502 
503 
504 int GlobalTrackReader::initialize ()
505 {
506  mL3GTD = mL3->getL3_GTD();
507  if (mL3GTD == NULL) {
508  //cout << "no L3_GTD found" << endl;
509  return FALSE;
510  }
511 
512  mTracks = mL3GTD->track;
513  mNTracks = mL3GTD->nTracks;
514  mNHits = mL3GTD->nHits;
515 
516  mGlobalVertex.x = mL3GTD->xVert; // now read out as [cm]
517  mGlobalVertex.y = mL3GTD->yVert;
518  mGlobalVertex.z = mL3GTD->zVert;
519 
520  return TRUE;
521 }
522 
523 
524 
525 //##########################################################
526 // ---------- Sl3ClusterReader -----------------------
527 //##########################################################
528 
529 Sl3ClusterReader::Sl3ClusterReader (L3_Reader *l3r)
530 {
531  mL3 = l3r;
532  mSector = -1;
533  mL3SECCD = NULL;
534  mCluster = NULL;
535  mNCluster = 0;
536 }
537 
538 
539 int Sl3ClusterReader::initialize (int sec)
540 {
541  // is this sector already initialized?
542  if (mSector!=sec) {
543  // set sector number
544  mSector = sec;
545  mL3SECCD = mL3->getL3_SECCD(mSector);
546  if (mL3SECCD == NULL) {
547  //cout << "no L3_SECCD found" << endl;
548  return FALSE;
549  }
550  mCluster = mL3SECCD->cluster;
551  mNCluster = mL3SECCD->nrClusters_in_sector;
552  }
553  return TRUE;
554 }
555 
556 
557 
558 //##########################################################
559 // ---------- I960ClusterReader --------------------
560 //##########################################################
561 
562 I960ClusterReader::I960ClusterReader (L3_Reader *l3r)
563 {
564  mL3 = l3r;
565  mSector = -1;
566  mCluster = new L3_Cluster[maxClusterPerSector];
567  mNCluster = 0;
568  for (int rb=0; rb<12; rb++) {
569  for (int mz=0; mz<3; mz++) {
570  mBankTPCMZCLD[rb][mz] = NULL;
571  }
572  }
573 }
574 
575 
576 I960ClusterReader::~I960ClusterReader ()
577 {
578  delete [] mCluster;
579 }
580 
581 
582 int I960ClusterReader::initialize (int sec)
583 {
584  Bank_TPCMZCLD *cld;
585 
586  struct Centroids {
587  unsigned short x;
588  unsigned short t;
589  };
590 
591  struct SpacePt {
592  Centroids centroids;
593  unsigned short flags;
594  unsigned short q;
595  };
596 
597  // is this sector already initialized?
598  if (mSector!=sec) {
599  // set sector number
600  mSector = sec;
601  mNCluster = 0;
602  // get number of clusters
603  int rb;
604  for (rb=1; rb<=12; rb++) {
605  for (int mz=1; mz<=3; mz++) {
606  //pointer to TPCMZCLD bank
607  mBankTPCMZCLD[rb-1][mz-1] = mL3->getTPCMZCLD(mSector, rb, mz);
608  cld = mBankTPCMZCLD[rb-1][mz-1];
609  if (!cld) continue;
610  int *ptr = (int *)&cld->stuff;
611  // count total number of clusters for memory allocation
612  for (int ir=0; ir<cld->numberOfRows; ir++) {
613  //int row = *ptr++;
614  ptr++;
615  int nHitsThisRow = *ptr++; // bump pointer to beginning of space points
616  mNCluster += nHitsThisRow; // add num space pts to running total
617  ptr += 2 * nHitsThisRow;
618  }
619  }
620  }
621  //cout << "sector "<<sector<<": found "
622  // <<nCluster<<" space pts" <<endl;
623 
624  if (mNCluster>maxClusterPerSector) {
625  cout << "ERROR: L3_Reader: reached maxClusterPerSector limit!" << endl;
626  return FALSE;
627  }
628  if (mCluster==NULL) {
629  cout << "failed to allocate cluster structures " << endl;
630  return FALSE;
631  }
632  // check number of clusters
633  // convenient: if mNCluster==0 return FALSE
634  if (mNCluster==0) {
635  cout << "no i960 clusters found" << endl;
636  return FALSE;
637  }
638 
639 
640  // copy i960 cluster into l3 cluster struct
641  L3_Cluster *pcluster;
642  pcluster = mCluster;
643 
644  for ( rb=1; rb<=12; rb++) {
645  for (int mz=1; mz<=3; mz++) {
646  cld = mBankTPCMZCLD[rb-1][mz-1]; // pointer to TPCMZCLD bank
647  if (!cld) continue;
648  int *ptr = &cld->stuff[0];
649  for (int ir=0; ir<cld->numberOfRows; ir++){
650  int row = *ptr++;
651  int nsp = *ptr++; // bump pointer to beginning of space points
652  for (int isp=0; isp<nsp; isp++, ptr+=2) {
653  SpacePt *hit = (SpacePt *)ptr;
654  pcluster->pad = hit->centroids.x;
655  pcluster->time = hit->centroids.t;
656  pcluster->charge = hit->q;
657  pcluster->flags = hit->flags;
658  pcluster->padrow = row;
659  pcluster->RB_MZ = 16 * rb + mz;
660  pcluster->trackId = 0; // no track ass. for i960 cluster
661  pcluster++;
662  }
663  }
664  }
665  }
666  }
667  return TRUE;
668 }
669 
670 
671 
672 //##########################################################
673 // ---------- Sl3TrackReader -----------------------
674 //##########################################################
675 
676 Sl3TrackReader::Sl3TrackReader (L3_Reader *l3r)
677 {
678  mL3 = l3r;
679  mSector = -1;
680  mL3LTD = NULL;
681  mTracks = NULL;
682  mNTracks = 0;
683  mNHits = 0;
684  mCpuTime = 0;
685  mRealTime = 0;
686  mParaSet = 0;
687  mSectorVertex.x = 0;
688  mSectorVertex.y = 0;
689  mSectorVertex.z = 0;
690 }
691 
692 
693 int Sl3TrackReader::initialize (int sec)
694 {
695  // is this sector already initialized?
696  if (mSector!=sec) {
697  // set sector number
698  mSector = sec;
699  mL3SECTP = mL3->getL3_SECTP(mSector);
700  if (mL3SECTP == NULL) {
701  //cout << "no L3_SECTP found" << endl;
702  return FALSE;
703  }
704 
705  // check existence of local track bank
706  if (mL3SECTP->banks[0].length == 0) {
707  pL3secERROR(INFO_MISSING_BANK, "no L3_LTD bank", mSector);
708  return FALSE;
709  }
710 
711  mL3LTD = (Bank_L3_LTD *) ((INT32 *)mL3SECTP + mL3SECTP->banks[0].offset);
712  if (strncmp(mL3LTD->header.BankType, CHAR_L3_LTD, 8) != 0) {
713  pL3secERROR(ERR_BAD_HEADER, "bad L3_LTD header", mSector);
714  return FALSE;
715  }
716 
717  if (mL3LTD->swap() < 0) pL3secERROR(ERR_SWAP, "swap L3_LTD", mSector);
718 
719 
720  //mL3LTD->header.print();
721  //printf("+++++>> L3_LTD: nTracks %i\n",
722  // (int) (mL3LTD->header.BankLength * 4 - sizeof(Bank_Header)) / sizeof(localTrack));
723 
724  mTracks = mL3LTD->track;
725  mNTracks = mL3SECTP->nTracks;
726  mNHits = mL3SECTP->nHits;
727  mCpuTime = mL3SECTP->cpuTime;
728  mRealTime = mL3SECTP->realTime;
729  mParaSet = mL3SECTP->para;
730  mSectorVertex.x = mL3SECTP->xVert;
731  mSectorVertex.y = mL3SECTP->yVert;
732  mSectorVertex.z = mL3SECTP->zVert;
733  }
734  return TRUE;
735 }
Definition: rb.hh:21