StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEMC_Reader.cxx
1 #include "EEMC_Reader.hh"
2 #include "../EVP/emcReader.h" // Has prototypes for emcReader and getEemcTower.
3 #include <assert.h>
4 
5 using namespace OLDEVP;
6 
7 int EEMC_Reader::isEemcBankIn( char type) {
8  switch(type) {
9  case 'T': // tower crates
10  return emc.etow_in;
11  case 'S': // smd/pre/post crates
12  return emc.esmd_in;
13  default:
14  assert(2==3);
15  }
16  return 0;
17 }
18 
19 
20 u_short *EEMC_Reader::getEemcHeadBlock(int fiber, char type) {
21 
22  switch(type) {
23  case 'T': // tower crates
24  assert(fiber>=0 && fiber <ETOW_MAXFEE);
25  return emc.etow_pre[fiber];
26  break;
27  case 'S': // smd/pre/post crates
28  assert(fiber>=0 && fiber <=ESMD_MAXFEE);
29  return emc.esmd_pre[fiber];
30  break;
31  default:
32  assert(2==3);
33  }
34 
35 }
36 
37 
38 u_short *EEMC_Reader::getEemcDataBlock(int fiber, char type) {
39 
40  switch(type) {
41  case 'T': // tower crates
42  assert(fiber>=0 && fiber <ETOW_MAXFEE);
43  return emc.etow[fiber];
44  break;
45  case 'S': // smd/pre/post crates
46  assert(fiber>=0 && fiber <=ESMD_MAXFEE);
47  return emc.esmd[fiber];
48  break;
49  default:
50  assert(2==3);
51  }
52 
53 }
54 
55 
56 
57 
58 u_short EEMC_Reader::getEemcHead(int fiber,int channel, char type) {
59  u_short val=0;
60  switch(type) {
61  case 'T': // tower crates
62  assert(channel>=0 && channel <ETOW_PRESIZE);
63  assert(fiber>=0 && fiber <ETOW_MAXFEE);
64  val=emc.etow_pre[fiber][channel];
65  break;
66  case 'S': // smd/pre/post crates
67  assert(channel>=0 && channel <ESMD_PRESIZE);
68  assert(fiber>=0 && fiber <=ESMD_MAXFEE);
69  val=emc.esmd_pre[fiber][channel];
70  break;
71  default:
72  assert(2==3);
73  }
74  return val;
75 
76 }
77 
78 
79 u_short EEMC_Reader::getEemcData(int fiber,int channel, char type) {
80  u_short val=0;
81  switch(type) {
82  case 'T': // tower crates
83  assert(channel>=0 && channel <ETOW_DATSIZE);
84  assert(fiber>=0 && fiber <ETOW_MAXFEE);
85  val=emc.etow[fiber][channel];
86  break;
87  case 'S': // smd/pre/post crates
88  assert(channel>=0 && channel <ESMD_DATSIZE);
89  assert(fiber>=0 && fiber <=ESMD_MAXFEE);
90  val=emc.esmd[fiber][channel];
91  break;
92  default:
93  assert(2==3);
94  }
95  return val;
96 
97 }
98 
99 
100 
102 {
103  Bank_DATAP *datap = (Bank_DATAP*) er->getDATAP();
104 
105 #ifndef NEW_DAQ_READER_DAQLIB
106  OLDEVP::emcReader((char*)datap); // ::emcReader saves data in a static global, and gives it
107  // out via ::getEemcTower (see above)
108  // LTime = (time->tm_hour*100 + time->tm_min)*100 + time->tm_sec;
109 #else
110  daqReader *rdr=er->getDaqReader(); assert(rdr);
111  ::emcReader((char*)rdr); // call the "event pool" code
112 #endif
113  pBankEEMCP = pEEMCP; //copy into class data member for use by other methods
114  ercpy = er; // squirrel away pointer eventreader for our friends
115 
116  // Protection against NULL pointer
117  if (!pEEMCP) return;
118 
119  if (!pBankEEMCP->test_CRC()) printf("CRC error in EEMCP: %s %d\n",__FILE__,__LINE__) ;
120 
122  // Swapping is done in ::emcReader(). This is not usual StDaqLib practice,
123  // but it does allow maximum re-use of DAQ's Event Pool code
124  // if (pBankEEMCP->swap() < 0) printf("swap error in EEMCP: %s %d\n",__FILE__,__LINE__) ;
126 
127  pBankEEMCP->header.CRC = 0;
128 }
129 
130 
EEMC_Reader(EventReader *er, Bank_EEMCP *pEEMCP)
EEMC_Reader constructor.
u_short * getEemcHeadBlock(int fiber, char type)
EEMC_Reader destructor.
Definition: EEMC_Reader.cxx:20
u_short esmd_pre[ESMD_MAXFEE][ESMD_PRESIZE]
ADC data.
Definition: daq_emc.h:95