StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEdsm1Tree.cxx
1 /**************************************************************
2  * $Id: EEdsm1Tree.cxx,v 1.3 2009/11/18 15:50:59 pibero Exp $
3  **************************************************************/
4 
5 #include <iostream>
6 #include <assert.h>
7 
8 
9 #include "EEdsm1Tree.h"
10 #include "EEdsm1.h"
11 
12 
13 //--------------------------------------------------
14 //--------------------------------------------------
15 EEdsm1Tree::EEdsm1Tree(const char *nameX) {
16  mYear=-999;
17  int thr[3]={1000, 2000, 3000};
18  int TPthr=100, HTTPthr=100;
19  ee1=new EEdsm1[Nee1];
20  int i=0;
21  for(i=0; i<Nee1; i++) ee1[i].setYear(-999, thr, TPthr, HTTPthr); // must be defined before use
22  ee1[0].setType(1); //see below
23  ee1[1].setType(2); //see below
24 
25  /* The first board
26  has patches .6 .3 .3 .6 .6 .3
27  Steve's JP# \_3_/ \_4_/ \_5_/
28 
29  The second board
30  has patches .3 .6 .6 .3 .3 .6
31  Steve's JP# \_6_/ \_1_/ \_2_/
32  */
33 
34  clear();
35  strncpy(name,nameX,mxTxt);
36 }
37 
38 //--------------------------------------------------
39 //--------------------------------------------------
40 EEdsm1Tree::~EEdsm1Tree() {
41  //fix it: delete
42  }
43 
44 //--------------------------------------------------
45 //--------------------------------------------------
46 void
47 EEdsm1Tree::setYear(int x, int *JPth, int TPthrSelc, int HTTPthrSelc) {
48  mYear=x;
49  int i;
50  for (i=0;i<Nee1;i++) ee1[i].setYear(mYear, JPth, TPthrSelc, HTTPthrSelc);
51 }
52 
53 //--------------------------------------------------
54 //--------------------------------------------------
55 void EEdsm1Tree :: clear() {
56  int i;
57 
58  for (i=0;i<Nee1;i++) ee1[i].clear();
59 #if 0
60  memset(ee1out3JPadc,0,sizeof(ee1out3JPadc));
61  memset(ee1outJPadc,0,sizeof(ee1outJPadc));
62  memset(ee1outHT,0,sizeof(ee1outHT));
63  memset(ee1outTPthrMax, 0, sizeof(ee1outTPthrMax));
64  memset(ee1outHTTPthrMax, 0, sizeof(ee1outHTTPthrMax));
65 #endif
66  // memset(,0,sizeof());
67 }
68 
69 
70 //--------------------------------------------------
71 //--------------------------------------------------
72 void
73 EEdsm1Tree::setInp16bit(int brd, int ch, unsigned short val){
74  assert(brd>0 && brd<=Nee1);
75  ee1[brd-1].setWord(ch,val);
76  // printf("addX %d %d %d\n",brd,ch,val);
77 }
78 
79 //--------------------------------------------------
80 //--------------------------------------------------
81 void
82 EEdsm1Tree::compute() {
83  int i;
84  for (i=0;i<Nee1;i++) {
85  ee1[i].compute();
86 
87  }
88 /*Note jet patches are numbered
89  in DSM input order. So ijp=0
90  is FEE crate 3. */
91 
92 #if 0
93  //Add some further processing to check jet patch sums for passing thresholds
94  //and form adjacent patch sums.
95  for (i=0;i<EEnJetPatch;i++) {
96  AdjJPsum[i]=ee1outJPadc[i]+ee1outJPadc[(i+1)%EEnJetPatch]; //sum adj patches
97  //printf("patch=%d adc1=%d adc2=%d sum=%d \n",i,ee1outJPadc[i],ee1outJPadc[(i+1)%EEnJetPatch],AdjJPsum[i]);
98  }
99 #endif
100 }
101 
102 //--------------------------------------------------
103 //--------------------------------------------------
104 int
105 EEdsm1Tree:: getInpTPsum(int ch) const {
106  // ch=halfPatches 0...11, for both DSM1 boards
107  return ee1[ch/6].getInpTPsum(ch%6);
108 }
109 
110 
111 //--------------------------------------------------
112 //--------------------------------------------------
113 int
114 EEdsm1Tree::getInpHT2bit(int ch) const {
115  // ch=halfPatches 0...11, for both DSM1 boards
116  return ee1[ch/6].getInpHT2bit(ch%6);
117 }
118 
119 
120 //--------------------------------------------------
121 //--------------------------------------------------
122 int
123 EEdsm1Tree::getInpTP2bit(int ch) const {
124  // ch=halfPatches 0...11, for both DSM1 boards
125  return ee1[ch/6].getInpTP2bit(ch%6);
126 }
127 
128 
129 //--------------------------------------------------
130 //--------------------------------------------------
131 int
132 EEdsm1Tree::getInpHTTP2bit(int ch) const {
133  // ch=halfPatches 0...11, for both DSM1 boards
134  return ee1[ch/6].getInpHTTP2bit(ch%6);
135 }
136 
137 //--------------------------------------------------
138 //--------------------------------------------------
139 int
140 EEdsm1Tree::getInp16bit(int ch) const {
141  // ch=halfPatches 0...11, for both DSM1 boards
142  return ee1[ch/6].getInp16bit(ch%6);
143 }
144 
145 //--------------------------------------------------
146 //--------------------------------------------------
147 int
148 EEdsm1Tree::getOutHT2bit(int ibr) const {
149  return ee1[ibr].getOutHT2bit();
150 }
151 
152 
153 //--------------------------------------------------
154 //--------------------------------------------------
155 int
156 EEdsm1Tree::getOutJP2bit(int ibr) const {
157  return ee1[ibr].getOutJP2bit();
158 }
159 
160 
161 //--------------------------------------------------
162 //--------------------------------------------------
163 int
164 EEdsm1Tree::getOutTP1bit(int ibr) const {
165  return ee1[ibr].getOutTP1bit();
166 }
167 
168 
169 //--------------------------------------------------
170 //--------------------------------------------------
171 int
172 EEdsm1Tree::getOutHTTP1bit(int ibr) const {
173  return ee1[ibr].getOutHTTP1bit();
174 }
175 
176 //--------------------------------------------------
177 //--------------------------------------------------
178 int
179 EEdsm1Tree::getOutEsum5bit(int ibr) const {
180  return ee1[ibr].getOutEsum5bit();
181 }
182 
183 //--------------------------------------------------
184 //--------------------------------------------------
185 int
186 EEdsm1Tree::getOut16bit(int ibr) const {
187  return ee1[ibr].getOut16bit();
188 }
189 
190 
191 //--------------------------------------------------
192 //--------------------------------------------------
193 void
194 EEdsm1Tree::print( int k) const {
195  printf("EEdsm1Tree(%s) , year=%d \n",name,mYear);
196 
197  printf("\n\n----------- level-1 -----------------\n ");
198  int i;
199  for(i=0;i<Nee1;i++) {
200  printf("\n----------- level-1 Board %2d , ",i+1);
201  ee1[i].print();
202  // printf("emul out 3x.9 JP_Falk(%d+%d+%d) energy/dec: 13bit=%d 8bit=%d mxTPthr=%d mxHTTPthr=%d\n",3*i,3*i+1,3*i+2,ee1out3JPadc[i],ee1out3JPadc[i]>>5, ee1outTPthrMax[i], ee1outHTTPthrMax[i]);
203  }
204 #if 0
205  printf("\n----------- level-1 emulated output \n JP_Falk =");
206  int Njp=EEnJetPatch;
207  for(i=Njp-1;i>=0; i--) printf(" %4d ",i);
208  printf("\n JP_Steve=");
209  for(i=Njp-1;i>=0; i--) printf(" %4d ",(i+2)%6+1);
210  printf("\n JPsum =");
211  for(i=Njp-1;i>=0; i--) printf(" %4d ",ee1outJPadc[i]);
212  printf("\n HTthr =");
213  for(i=Njp-1;i>=0; i--) printf(" %4d ",ee1outHT[i]);
214  if(mYear<2006) {
215  printf("\n AdjJPsum=");
216  for(i=Njp-1;i>=0; i--) printf(" %4d ",AdjJPsum[i]);
217  }
218  printf("\n");
219  printf("emul: orTPbit=%d orHTTPbit=%d \n",ee1outTPthrMax[0]||ee1outTPthrMax[1], ee1outHTTPthrMax[0] ||ee1outHTTPthrMax[1]);
220 
221 #endif
222 }
223 
224 
225 
226 
227 /*
228  * $Log: EEdsm1Tree.cxx,v $
229  * Revision 1.3 2009/11/18 15:50:59 pibero
230  * Address several compiler warnings of the type:
231  *
232  * warning: deprecated conversion from string constant 'char*'
233  *
234  * Revision 1.2 2009/10/13 17:00:49 pibero
235  * Changed location of #include file
236  *
237  * Revision 1.1 2009/10/12 18:04:26 pibero
238  * Moved StEEmcUtil/EEdsm to StTriggerUtilities/Eemc
239  *
240  * Revision 1.2 2009/02/24 03:56:18 ogrebeny
241  * Corrected const-ness
242  *
243  * Revision 1.1 2007/08/17 01:15:36 balewski
244  * full blown Endcap trigger simu, by Xin
245  *
246  */
247 
Definition: EEdsm1.h:8