StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TPCV1P0_CPP_SR.cxx
1 /***************************************************************************
2  * $Id: TPCV1P0_CPP_SR.cxx,v 1.6 2007/12/24 06:04:31 fine Exp $
3  * Author: Jeff Landgraf and M.J. LeVine
4  ***************************************************************************
5  * Description:
6  *
7  *
8  * change log
9  * 06-May-99 MJL code cloned from Jeff's ADCR_SR
10  * 03-Jun-99 MJL added return TRUE to TPCV1P0_CPP_SR::initialize()
11  * 29-Aug-99 MJL #include <Stiostream.h> for HP platform
12  *
13  ***************************************************************************
14  * $Log: TPCV1P0_CPP_SR.cxx,v $
15  * Revision 1.6 2007/12/24 06:04:31 fine
16  * introduce OLDEVP namespace to allow ole and new EVP library concurrently
17  *
18  * Revision 1.5 2003/09/02 17:55:33 perev
19  * gcc 3.2 updates + WarnOff
20  *
21  * Revision 1.4 2000/01/04 20:55:04 levine
22  * Implemented memory-mapped file access in EventReader.cxx. Old method
23  * (via seeks) is still possible by setting mmapp=0 in
24  *
25  * getEventReader(fd,offset,(const char *)logfile,mmapp);
26  *
27  *
28  * but memory-mapped access is much more effective.
29  *
30  * Revision 1.3 1999/09/02 21:47:10 fisyak
31  * HP corrections
32  *
33  * Revision 1.2 1999/07/02 04:43:23 levine
34  * Many changes -
35  * navigates to head of TPCP bank independent of position.
36  * move declarations out of loops where they were upsetting some compilers
37  * suppress output from class libraries with run-time switch EventReader.verbose
38  * added TPCV2P0_CPP_SR::getAsicParams()
39  *
40  *
41  **************************************************************************/
42 
43 #include <Stiostream.h>
44 
45 #include "StDaqLib/GENERIC/EventReader.hh"
46 #include "TPCV1P0.hh"
47 // TPC V1.0 Raw Reader
48 
49 using namespace OLDEVP;
50 
51 TPCV1P0_CPP_SR::TPCV1P0_CPP_SR(int s, TPCV1P0_Reader *det)
52 {
53  // cout << "Constructing TPCV1P0_CPP_SR" << endl;
54  sector = s-1; // convert the sector into internal representation
55  detector = det;
56 
57  // NULLS in banks array
58  memset((char *)banks, 0, sizeof(banks));
59 }
60 
61 int TPCV1P0_CPP_SR::initialize()
62 {
63  // get a sector reader for PADK
64  // printf("TPCV1P0_CPP_SR::initialize() sector %d\n",sector);
65  padkr = detector->getPADKReader(sector);
66  if (!padkr) return FALSE;
67  // printf("TPCV1P0_CPP_SR::initialize() SUCCESS sector %d\n",sector);
68 
69  // store pointers to the CPP banks
70  for(int rcb = 0; rcb < 6; rcb++)
71  {
72  for(int mz = 0; mz < 3; mz++)
73  {
74  banks[rcb][mz] = detector->getBankTPCCPPR(sector,rcb,mz);
75  }
76  }
77  return TRUE;
78 }
79 
80 TPCV1P0_CPP_SR::~TPCV1P0_CPP_SR()
81 {
82  // cout << "Deleting TPCV1P0_CPP_SR" << endl;
83 }
84 
85 int TPCV1P0_CPP_SR::getClusters(int PadRow, int Pad,
86  int *nClusters, struct ASIC_Cluster **clusters)
87 {
88  // Return a pointer to the cluster array for this (padrow,pad)
89  int i, mz, rb;
90  PADK_entry ent;
91 
92  // check pad, padrow for validity
93  if (PadRow==0 || PadRow>TPC_PADROWS) {
94  printf(" %s %d padrow not a legal value: %d\n", __FILE__,__LINE__,PadRow);
95  return -1;
96  }
97  padkr->get(PadRow, Pad, &ent);
98  if(((mz=ent.mz) == 0) || ((rb=ent.rb) == 0)) {
99  printf(" %s %d mz: %d rb: %d\n", __FILE__,__LINE__,rb,mz);
100  printf(" PadRow %d, Pad %d\n", PadRow, Pad);
101  return -1;
102  }
103  if (!(void *)banks[rb-1][mz-1]) {
104  printf(" %s %d no CPP bank for rb: %d mz: %d\n", __FILE__,__LINE__,rb,mz);
105  printf(" PadRow %d, Pad %d\n", PadRow, Pad);
106  return -1;
107  //test for CPPR bank for this RB, Mezz
108  }
109 
110  clusters[Pad-1] = (ASIC_Cluster *)(banks[rb-1][mz-1]->entry + 32*ent.offset);
111  for (i=0; i<31; i++) { //loop over ASIC sequences
112  if (clusters[Pad-1][i].start_time_bin < 0) break;
113  }
114 
115  *nClusters = i; //set number of valid clusters in array
116  return 0;
117 }
118 
119 
120 int TPCV1P0_CPP_SR::MemUsed()
121 {
122  return 0;
123 }
124 
125 
126 
Definition: rb.hh:21
Definition: TPCV1P0.hh:217