StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
tpxPed.h
1 #ifndef _TPX_PED_HH_
2 #define _TPX_PED_HH_
3 
4 
5 #include <sys/types.h>
6 
7 #include "tpxCore.h"
8 
9 
10 /*
11  Operates on ONE sector only!
12 */
13 
14 class tpxPed {
15 public:
16  tpxPed() ;
17  ~tpxPed() ;
18 
19 
20  int clock_source ; // 0 TCD, 1 RCC-local, 3 RCC-RHIC, 9-unknown
21 
22  int valid ; // when calced or loaded
23 
24  void init(int sec, int active_rbs) ; // mallocs (if nece) and clears ped_store
25  void clear() ; // zaps storage
26 
27  void accum(char *evbuff, int bytes) ;
28  void calc() ; // calculates mean/rms into ped_store
29 
30  int to_altro(char *buff, int rb, int timebins) ;// to ALTRO format from ped_store
31 
32  int to_evb(char *buff) ; // to EVB format from ped_store
33 
34  int from_cache(char *fname = 0, u_int r_mask = 0x3F) ; // from cached file to ped_store
35  int to_cache(char *fname = 0, u_int run = 0) ; // to cached file from ped_store
36 
37  int special_setup(int run_type, int sub_type) ;
38  int hlt_debug_setup(int param) ;
39 
40  int kill_bad(int r0_logical,int row, int pad) ; // kills this specific pad in ped_store
41 
42  void smooth(int mode=0) ; // from ped_store to ped_store
43 
44  int max_events ; // max events allowed in the calculation
45 
46  void accum(tpx_altro_struct *a) ; // adds values into ped_store
47 
48  u_int evts[6] ; // logical r0: RDOs count from 0 here!
49  u_int valid_evts[6] ; // logical r0
50 
51  int sector ; // logical (1..36)
52  int smoothed ; // boolean
53 private:
54 
55 
56  int rb_mask ; // logical mask
57 
58 
59 
60 
61  struct peds {
62  u_short row ;
63  u_short pad ;
64 
65  double ped[512] ;
66  double rms[512] ;
67  u_short cou[512] ;
68  } ; // *ped_store ;
69 
70  struct peds_rdo_t {
71  int r_real ;
72  int s_real ;
73 
74  struct peds *peds ;
75  short ix[46][183] ;
76  } ped_rdo_store[6] ; // indexed by logical r0
77 
78 
79 
80 
81 
82  struct peds *get(int r0_logical, int row, int pad) { // returns pointer to ped_store
83  if(rb_mask & (1<<r0_logical)) ;
84  else return 0 ; // not enabled!
85 
86  if(ped_rdo_store[r0_logical].peds == 0) {
87  LOG(ERR,"What????") ;
88  return 0 ;
89  }
90 
91 
92  int ix = ped_rdo_store[r0_logical].ix[row][pad] ;
93 
94  if(ix >= 0) {
95  return ped_rdo_store[r0_logical].peds + ix ;
96  }
97 
98 #if 0
99  for(int i=0;i<1152;i++) {
100  if(ped_rdo_store[r0_logical].peds[i].row == row) {
101  //LOG(WARN,"Got row %d",row) ;
102  if(ped_rdo_store[r0_logical].peds[i].pad == pad) {
103  //LOG(WARN," got pad %d",pad) ;
104  return (ped_rdo_store[r0_logical].peds + i) ;
105  }
106  }
107  }
108 #endif
109  //LOG(ERR,"No row pad %d %d???",row,pad) ;
110 
111  return 0 ;
112  }
113 
114 
115 } ;
116 
117 #endif
Definition: tpxPed.h:14
Definition: rb.hh:21