StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StPeCL0.cxx
1 //
3 // $Id: StPeCL0.cxx,v 1.6 2003/09/02 17:58:46 perev Exp $
4 // $Log: StPeCL0.cxx,v $
5 // Revision 1.6 2003/09/02 17:58:46 perev
6 // gcc 3.2 updates + WarnOff
7 //
8 // Revision 1.5 2003/04/30 20:37:54 perev
9 // Warnings cleanup. Modified lines marked VP
10 //
11 // Revision 1.4 2002/12/16 23:04:01 yepes
12 // Field comes in KGauss and should be passed to routines in Teslas
13 // problem pointed out by Vladimir
14 //
15 // Revision 1.3 2001/04/25 18:11:25 perev
16 // HPcorrs
17 //
18 // Revision 1.2 2001/02/21 20:54:24 yepes
19 // *** empty log message ***
20 //
21 // Revision 1.0 2000/12/11
22 //
24 #include <Stiostream.h>
25 #include <math.h>
26 #include "StPeCL0.h"
27 #include "StCtbTriggerDetector.h"
28 #include "StMuDSTMaker/COMMON/StMuEvent.h"
29 
30 
31 
32 ClassImp(StPeCL0)
33 
34 StPeCL0::StPeCL0() {
35  infoLevel = 0 ;
36  minAdc = 3 ;
37  maxAdc = 16 ;
38 }
39 
40 StPeCL0::~StPeCL0() {
41 
42 }
43 
44 Int_t StPeCL0::dsm1Sum ( ) {
45 //
46 // Run sums at first dsm level
47  int i, j;
48  for(i=0; i<nL0Phi; i++){for(j=0; j<nL0Eta; j++){array2[i][j] = 0;}}
49  for(i=0; i<15; i++){for(j=0; j<nL0Slats; j++){array2[0][2+j]+=weighted1[i][j];}}
50  for(i=15; i<30; i++){for(j=0; j<nL0Slats; j++){array2[3][2+j]+=weighted1[i][j];}}
51  for(i=30; i<45; i++){for(j=0; j<nL0Slats; j++){array2[2][2+j]+=weighted1[i][j];}}
52  for(i=45; i<60; i++){for(j=0; j<nL0Slats; j++){array2[1][2+j]+=weighted1[i][j];}}
53  for(i=60; i<75; i++){for(j=0; j<nL0Slats; j++){array2[1][1-j]+=weighted1[i][j];}}
54  for(i=75; i<90; i++){for(j=0; j<nL0Slats; j++){array2[2][1-j]+=weighted1[i][j];}}
55  for(i=90; i<105; i++){for(j=0; j<nL0Slats; j++){array2[3][1-j]+=weighted1[i][j];}}
56  for(i=105; i<120; i++){for(j=0; j<nL0Slats; j++){array2[0][1-j]+=weighted1[i][j];}}
57 //
58 // Look at lookup tables
59 //
60  int sum ;
61  for ( i = 0 ; i < nL0Phi ; i++ ) {
62  for ( j = 0 ; j < nL0Eta ; j++ ) {
63  sum = array2[i][j] ;
64  if ( sum > 255 ) weighted2[i][j] = 255 ;
65  else if ( sum < 0 ) weighted2[i][j] = 0 ;
66  else weighted2[i][j] = lut2[i][j][sum] ;
67  }
68  }
69  return 0 ;
70 }
71 
72 Int_t StPeCL0::dsm2Sum ( ){
73  array3[0]=0; array3[1]=0;
74  {for(int i=0; i<nL0Phi; i++){for(int j=0; j<2; j++){array3[0]+=weighted2[i][j];}}}
75  {for(int i=0; i<nL0Phi; i++){for(int j=2; j<4; j++){array3[1]+=weighted2[i][j];}}}
76 //
77 // Look at lookup tables
78 //
79  int sum ;
80  {for ( int i = 0 ; i < 2 ; i++ ) {
81  sum = array3[i] ;
82  if ( sum > 255 ) weighted3[i] = 255 ;
83  else if ( sum < 0 ) weighted3[i] = 0 ;
84  else weighted3[i] = lut3[i][sum] ;
85  }}
86  return 0 ;
87 }
88 
89 
90 void StPeCL0::printWeightedSlats ( ){
91  int i, j;
92 
93  char parray[nL0Trays][nL0Slats] ;
94  for ( i = 0 ; i < nL0Trays ; i++ ) {
95  for ( j = 0 ; j < nL0Slats ; j++ ) {
96  parray[i][j] = weighted1[i][j] ;
97  if ( parray[i][j] > 14 ) parray[i][j] = 14 ;
98  }
99  }
100 
101  cout << " ++++++++++ Weighted Slat Information ++++++++++ " <<endl ;
102  cout << " : south -> top -> north -> bottom" << endl;
103  cout << " : 13-1 60-59 | 58-44 | 43-29 | 28-14" << endl;
104  for(j=1; j>-1; j--){
105  cout << "west / eta= " << j << " : ";
106  for(i=12; i>-1; i--) printf ( "%x", parray[i][j] );
107  for(i=59; i>57; i--) printf ( "%x", parray[i][j] );
108  printf ( " | " ) ;
109  for(i=57; i>42; i--) printf ( "%x", parray[i][j] );
110  printf ( " | " ) ;
111  for(i=42; i>27; i--) printf ( "%x", parray[i][j] );
112  printf ( " | " ) ;
113  for(i=27; i>12; i--) printf ( "%x", parray[i][j] );
114  printf ( "\n" ) ;
115  }
116  for(j=0; j<2; j++){
117  cout << "east / eta= " << j << " : ";
118  for(i=102; i<117; i++) printf ( "%x", parray[i][j] );
119  printf ( " | " ) ;
120  for(i=117; i<120; i++) printf ( "%x", parray[i][j] );
121  for(i=60; i< 72; i++) printf ( "%x", parray[i][j] );
122  printf ( " | " ) ;
123  for(i=72; i< 87; i++) printf ( "%x", parray[i][j] );
124  printf ( " | " ) ;
125  for(i=87; i<102; i++) printf ( "%x", parray[i][j] );
126  cout << endl;
127  }
128  cout << " : 103-117 | 118-120 61-72 | 73-87 | 88-102" << endl;
129 }
130 
131 void StPeCL0::printSlats ( ){
132  int i, j;
133 
134  char parray[nL0Trays][nL0Slats] ;
135  for ( i = 0 ; i < nL0Trays ; i++ ) {
136  for ( j = 0 ; j < nL0Slats ; j++ ) {
137  parray[i][j] = array1[i][j] ;
138  if ( parray[i][j] > 14 ) parray[i][j] = 14 ;
139  }
140  }
141  cout << " ++++++++++ Slat Information ++++++++++ " <<endl ;
142  cout << " : south -> top -> north -> bottom" << endl;
143  cout << " : 13-1 60-59 | 58-44 | 43-29 | 28-14" << endl;
144  for(j=1; j>-1; j--){
145  cout << "west / eta= " << j << " : ";
146  for(i=12; i>-1; i--) printf ( "%x", parray[i][j] );
147  for(i=59; i>57; i--) printf ( "%x", parray[i][j] );
148  printf ( " | " ) ;
149  for(i=57; i>42; i--) printf ( "%x", parray[i][j] );
150  printf ( " | " ) ;
151  for(i=42; i>27; i--) printf ( "%x", parray[i][j] );
152  printf ( " | " ) ;
153  for(i=27; i>12; i--) printf ( "%x", parray[i][j] );
154  printf ( "\n" ) ;
155  }
156  for(j=0; j<2; j++){
157  cout << "east / eta= " << j << " : ";
158  for(i=102; i<117; i++) printf ( "%x", parray[i][j] );
159  printf ( " | " ) ;
160  for(i=117; i<120; i++) printf ( "%x", parray[i][j] );
161  for(i=60; i< 72; i++) printf ( "%x", parray[i][j] );
162  printf ( " | " ) ;
163  for(i=72; i< 87; i++) printf ( "%x", parray[i][j] );
164  printf ( " | " ) ;
165  for(i=87; i<102; i++) printf ( "%x", parray[i][j] );
166  cout << endl;
167  }
168  cout << " : 103-117 | 118-120 61-72 | 73-87 | 88-102" << endl;
169 }
170 
171 void StPeCL0::printPatches ( ) {
172  cout << " ------- Patches --------- " << endl;
173  cout << " : south top/north bottom/south bottom" << endl;
174  for(int j=0; j<nL0Eta; j++){
175  cout << "eta= " << j << " : ";
176  for(int i=0; i<nL0Phi; i++){
177  cout << " " << (int)array2[i][j]<<" "<<i<<j<<" "<<(int)(lut2[i][j][array2[i][j]]);
178  }
179  cout << endl;
180  }
181 }
182 
183 void StPeCL0::printWeightedPatches ( ) {
184  cout << " ------- Weighted Patches --------- " << endl;
185  cout << " : south top/north bottom/south bottom" << endl;
186  for(int j=0; j<nL0Eta; j++){
187  cout << "eta= " << j << " : ";
188  for(int i=0; i<nL0Phi; i++){
189  cout << " " << (int)weighted2[i][j];
190  }
191  cout << endl;
192  }
193 }
194 
195 
196 #ifndef __CINT__
197 Int_t StPeCL0::process ( StEvent* event ) {
198 
199  StTriggerDetectorCollection* trg = event->triggerDetectorCollection();
200  StCtbTriggerDetector& ctb = trg->ctb();
201 
202  if ( !&ctb ){
203  printf ( "StPeCL0::process: Didn't find CTB" ) ;
204  return 1;
205 
206  }
207  int i, j, slot ;
208  for ( i=0 ; i<nL0Trays; i++ ){
209  slot = cabling[i] ;
210  if ( slot < 0 || slot >= nL0Trays ) {
211  printf ( "StPeCL0:process: wrong cabling tray %d slot %d \n", i, slot ) ;
212  continue ;
213  }
214  for ( j = 0 ; j < nL0Slats ; j++ ){
215  int adc = (int)ctb.mips(i,j,0) ;
216  if ( adc < 0 ) {
217 // printf ( "StPeCL0:process: adc %d out of range \n", adc ) ;
218  adc = 0 ;
219  }
220  if ( adc > 255 ) {
221  printf ( "StPeCL0:process: adc %d out of range \n", adc ) ;
222  adc = 255 ;
223  }
224  array1[i][j] = adc ;
225  weighted1[slot][j] = lut1[slot][j][adc] ;
226  // if ( infoLevel && adc > 0 && weighted1[slot][j] > 0 )
227  if ( infoLevel && adc > 0 )
228  printf ( " Event %d tray %d slot %d slat %d adc %d matched %d \n",
229  event->id(), i+1, slot, j+1, adc, weighted1[slot][j] ) ;
230  }
231  }
232 
233 
234  if ( infoLevel ) {
235  printSlats();
236  printWeightedSlats();
237  }
238 
239  dsm1Sum() ;
240 
241  if ( infoLevel ) {
242  printPatches() ;
243  printWeightedPatches();
244  }
245 
246  dsm2Sum() ;
247 
248  int output = weighted3[0] + weighted3[1] ;
249  if ( infoLevel )
250  printf ( "StPeCL0::process: trigger output %d \n", output ) ;
251 
252  return output ;
253 }
254 
255 Int_t StPeCL0::process(StMuDst* mudst)
256 {
257  StMuEvent* event = 0;
258  event = mudst->event();
259 
260 
261  StCtbTriggerDetector& ctb = event->ctbTriggerDetector();
262  if (!&ctb)
263  {
264  printf("StPeCL0::process: Didn't find CTB");
265  return 1;
266  }
267 
268 
269  int i, j, slot;
270 
271  for (i=0 ; i<nL0Trays; i++)
272  {
273  slot = cabling[i];
274  if (slot < 0 || slot >= nL0Trays)
275  {
276  printf ("StPeCL0:process: wrong cabling tray %d slot %d \n", i, slot ) ;
277  continue;
278  }
279 
280  for (j = 0; j < nL0Slats; j++)
281  {
282  int adc = (int)ctb.mips(i, j, 0);
283  if (adc < 0)
284  adc = 0;
285 
286  if (adc > 255)
287  {
288  printf ("StPeCL0:process: adc %d out of range \n", adc);
289  adc = 255;
290  }
291 
292  array1[i][j] = adc;
293  weighted1[slot][j] = lut1[slot][j][adc];
294  if (infoLevel && adc > 0)
295  printf (" Event %d tray %d slot %d slat %d adc %d matched %d \n", mudst->event()->eventInfo().id(), i+1, slot, j+1, adc, weighted1[slot][j]);
296  }
297  }
298 
299 
300  if (infoLevel)
301  {
302  printSlats();
303  printWeightedSlats();
304  }
305 
306  dsm1Sum();
307 
308  if (infoLevel)
309  {
310  printPatches();
311  printWeightedPatches();
312  }
313 
314  dsm2Sum();
315 
316  int output = weighted3[0] + weighted3[1];
317  if (infoLevel)
318  printf ("StPeCL0::process: trigger output %d \n", output);
319 
320 
321  return output;
322 }
323 #endif
324 
325 void StPeCL0::setLinearLuts() {
326 
327  int i, j, k ;
328  for ( i = 0 ; i < nL0Trays ; i++ ) {
329  for ( j = 0 ; j < nL0Range ; j++ ) {
330  lut1[i][0][j] = j ;
331  lut1[i][1][j] = j ;
332  }
333  }
334  for ( i = 0 ; i < nL0Phi ; i++ ) {
335  for ( j = 0 ; j < nL0Eta ; j++ ) {
336  for ( k = 0 ; k < nL0Range ; k++ ) {
337  lut2[i][j][k] = k ;
338  lut2[i][j][k] = k ;
339  }
340  }
341  }
342 
343  for ( k = 0 ; k < nL0Range ; k++ ) {
344  lut3[0][k] = k ;
345  lut3[1][k] = k ;
346  }
347 }
348 
349 void StPeCL0::setP4Luts() {
350 
351  int i, j, k ;
352 //
353 //
354 // 1. map "top" and "bottom" slats to >16 for 3<adc<16 to effectively veto
355 // any events having hits on the top or bottom. The matching from east to
356 // west top and bottom is not exact, but I took the easiest path here just
357 // to get us going.
358 // top West: 50-60,1-8 bot West: 20-34
359 // top east: 110-120,61-68 bot East: 80-94
360 //
361 // Top West
362 //
363  for ( i = 0 ; i < 8 ; i++ ) {
364  for ( j = 0 ; j < nL0Slats ; j++ ) {
365  for ( k = 0 ; k < nL0Range ; k++ ) {
366  if ( k < minAdc ) lut1[i][j][k] = 0 ;
367  else lut1[i][j][k] = maxAdc ;
368  }
369  }
370  }
371 
372  for ( i = 49 ; i < 60 ; i++ ) {
373  for ( j = 0 ; j < nL0Slats ; j++ ) {
374  for ( k = 0 ; k < nL0Range ; k++ ) {
375  if ( k < minAdc ) lut1[i][j][k] = 0 ;
376  else lut1[i][j][k] = maxAdc ;
377  }
378  }
379  }
380 //
381 // Bottom West
382 //
383  for ( i = 19 ; i < 34 ; i++ ) {
384  for ( j = 0 ; j < nL0Slats ; j++ ) {
385  for ( k = 0 ; k < nL0Range ; k++ ) {
386  if ( k < minAdc ) lut1[i][j][k] = 0 ;
387  else lut1[i][j][k] = maxAdc ;
388  }
389  }
390  }
391 //
392 // Top East
393 //
394  for ( i = 109 ; i < 120 ; i++ ) {
395  for ( j = 0 ; j < nL0Slats ; j++ ) {
396  for ( k = 0 ; k < nL0Range ; k++ ) {
397  if ( k < minAdc ) lut1[i][j][k] = 0 ;
398  else lut1[i][j][k] = maxAdc ;
399  }
400  }
401  }
402 //
403  for ( i = 60 ; i < 68 ; i++ ) {
404  for ( j = 0 ; j < nL0Slats ; j++ ) {
405  for ( k = 0 ; k < nL0Range ; k++ ) {
406  if ( k < minAdc ) lut1[i][j][k] = 0 ;
407  else lut1[i][j][k] = maxAdc ;
408  }
409  }
410  }
411 //
412 // Bottom East
413 //
414  for ( i = 79 ; i < 94 ; i++ ) {
415  for ( j = 0 ; j < nL0Slats ; j++ ) {
416  for ( k = 0 ; k < nL0Range ; k++ ) {
417  if ( k < minAdc ) lut1[i][j][k] = 0 ;
418  else lut1[i][j][k] = maxAdc ;
419  }
420  }
421  }
422 //
423 // 2.map 3<adc<9 -> 1 for "north" side slats
424 // map 3<adc<9 -> 4 for "South" side slats
425 //
426 // NorthWest
427 //
428  for ( i = 34 ; i < 50 ; i++ ) {
429  for ( j = 0 ; j < nL0Slats ; j++ ) {
430  for ( k = 0 ; k < nL0Range ; k++ ) {
431  if ( k < minAdc ) lut1[i][j][k] = 0 ;
432  else if ( k < maxAdc ) lut1[i][j][k] = 1 ;
433  else lut1[i][j][k] = 17 ;
434  }
435  }
436  }
437 //
438 // SouthWest
439 //
440  for ( i = 8 ; i < 19 ; i++ ) {
441  for ( j = 0 ; j < nL0Slats ; j++ ) {
442  for ( k = 0 ; k < nL0Range ; k++ ) {
443  if ( k < minAdc ) lut1[i][j][k] = 0 ;
444  else if ( k < maxAdc ) lut1[i][j][k] = 4 ;
445  else lut1[i][j][k] = 17 ;
446  }
447  }
448  }
449 //
450 // NorthEast
451 //
452  for ( i = 68 ; i < 79 ; i++ ) {
453  for ( j = 0 ; j < nL0Slats ; j++ ) {
454  for ( k = 0 ; k < nL0Range ; k++ ) {
455  if ( k < minAdc ) lut1[i][j][k] = 0 ;
456  else if ( k < maxAdc ) lut1[i][j][k] = 1 ;
457  else lut1[i][j][k] = 17 ;
458  }
459  }
460  }
461 //
462 // SouthEast
463 //
464  for ( i = 94 ; i < 109 ; i++ ) {
465  for ( j = 0 ; j < nL0Slats ; j++ ) {
466  for ( k = 0 ; k < nL0Range ; k++ ) {
467  if ( k < minAdc ) lut1[i][j][k] = 0 ;
468  else if ( k < maxAdc ) lut1[i][j][k] = 4 ;
469  else lut1[i][j][k] = 17 ;
470  }
471  }
472  }
473 //
474 // Depth 2 LUT
475 //
476  for ( i = 0 ; i < nL0Phi ; i++ ) {
477  for ( j = 0 ; j < nL0Eta ; j++ ) {
478  for ( k = 0 ; k < nL0Range ; k++ ) {
479  if ( k == 1 ) lut2[i][j][k] = 1 ;
480  else if ( k == 4 ) lut2[i][j][k] = 4 ;
481  else if ( k == 5 ) lut2[i][j][k] = 5 ;
482  else if ( k == 8 ) lut2[i][j][k] = 8 ;
483  else lut2[i][j][k] = 0 ;
484  }
485  }
486  }
487 //
488 // Depth 3 LUT
489 //
490  for ( i = 0 ; i < 2 ; i++ ) {
491  for ( k = 0 ; k < nL0Range ; k++ ) {
492  lut3[i][k] = k ;
493  }
494  }
495 }
496 void StPeCL0::setCountingLuts() {
497 
498  int i, j, k ;
499  for ( i = 0 ; i < nL0Trays ; i++ ) {
500  for ( j = 0 ; j < nL0Range ; j++ ) {
501  if ( j < minAdc ) {
502  lut1[i][0][j] = 0 ;
503  lut1[i][1][j] = 0 ;
504  }
505  else {
506  lut1[i][0][j] = 1 ;
507  lut1[i][1][j] = 1 ;
508  }
509  }
510  }
511  for ( i = 0 ; i < nL0Phi ; i++ ) {
512  for ( j = 0 ; j < nL0Eta ; j++ ) {
513  for ( k = 0 ; k < nL0Range ; k++ ) {
514  if ( i == 0 || i == 2 ) { // bottom or top
515  if ( k > 0 ) lut2[i][j][k] = 20 ;
516  }
517  else if ( i == 1 ) {
518  if ( k < 10 ) lut2[i][j][k] = 10 * k ;
519  else lut2[i][j][k] = 255 ;
520  }
521  else lut2[i][j][k] = k ;
522  }
523  }
524  }
525 
526  for ( k = 0 ; k < nL0Range ; k++ ) {
527  lut3[0][k] = k ;
528  lut3[1][k] = k ;
529  }
530 }
531 
532 void StPeCL0::setP4PLuts() {
533 
534  int i, j, k ;
535 //
536 //
537 // 1. map "top" and "bottom" slats to >16 for 3<adc<16 to effectively veto
538 // any events having hits on the top or bottom. The matching from east to
539 // west top and bottom is not exact, but I took the easiest path here just
540 // to get us going.
541 // top West: 50-60,1-8 bot West: 20-34
542 // top east: 110-120,61-68 bot East: 80-94
543 //
544 // Top West
545 //
546  for ( i = 0 ; i < 3 ; i++ ) {
547  for ( j = 0 ; j < nL0Slats ; j++ ) {
548  for ( k = 0 ; k < nL0Range ; k++ ) {
549  if ( k < minAdc ) lut1[i][j][k] = 0 ;
550  else lut1[i][j][k] = maxAdc ;
551  }
552  }
553  }
554 
555  for ( i = 52 ; i < 60 ; i++ ) {
556  for ( j = 0 ; j < nL0Slats ; j++ ) {
557  for ( k = 0 ; k < nL0Range ; k++ ) {
558  if ( k < minAdc ) lut1[i][j][k] = 0 ;
559  else lut1[i][j][k] = maxAdc ;
560  }
561  }
562  }
563 //
564 // Bottom West
565 //
566  for ( i = 22 ; i < 33 ; i++ ) {
567  for ( j = 0 ; j < nL0Slats ; j++ ) {
568  for ( k = 0 ; k < nL0Range ; k++ ) {
569  if ( k < minAdc ) lut1[i][j][k] = 0 ;
570  else lut1[i][j][k] = maxAdc ;
571  }
572  }
573  }
574 //
575 // Top East
576 //
577  for ( i = 112 ; i < 120 ; i++ ) {
578  for ( j = 0 ; j < nL0Slats ; j++ ) {
579  for ( k = 0 ; k < nL0Range ; k++ ) {
580  if ( k < minAdc ) lut1[i][j][k] = 0 ;
581  else lut1[i][j][k] = maxAdc ;
582  }
583  }
584  }
585 //
586  for ( i = 60 ; i < 63 ; i++ ) {
587  for ( j = 0 ; j < nL0Slats ; j++ ) {
588  for ( k = 0 ; k < nL0Range ; k++ ) {
589  if ( k < minAdc ) lut1[i][j][k] = 0 ;
590  else lut1[i][j][k] = maxAdc ;
591  }
592  }
593  }
594 //
595 // Bottom East
596 //
597  for ( i = 82 ; i < 93 ; i++ ) {
598  for ( j = 0 ; j < nL0Slats ; j++ ) {
599  for ( k = 0 ; k < nL0Range ; k++ ) {
600  if ( k < minAdc ) lut1[i][j][k] = 0 ;
601  else lut1[i][j][k] = maxAdc ;
602  }
603  }
604  }
605 //
606 // 2.map 3<adc<9 -> 1 for "north" side slats
607 // map 3<adc<9 -> 4 for "South" side slats
608 //
609 // NorthWest
610 //
611  for ( i = 33 ; i < 52 ; i++ ) {
612  for ( j = 0 ; j < nL0Slats ; j++ ) {
613  for ( k = 0 ; k < nL0Range ; k++ ) {
614  if ( k < minAdc ) lut1[i][j][k] = 0 ;
615  else if ( k < maxAdc ) lut1[i][j][k] = 4 ;
616  else lut1[i][j][k] = 17 ;
617  }
618  }
619  }
620 //
621 // SouthWest
622 //
623  for ( i = 3 ; i < 22 ; i++ ) {
624  for ( j = 0 ; j < nL0Slats ; j++ ) {
625  for ( k = 0 ; k < nL0Range ; k++ ) {
626  if ( k < minAdc ) lut1[i][j][k] = 0 ;
627  else if ( k < maxAdc ) lut1[i][j][k] = 1 ;
628  else lut1[i][j][k] = 17 ;
629  }
630  }
631  }
632 //
633 // NorthEast
634 //
635  for ( i = 63 ; i < 82 ; i++ ) {
636  for ( j = 0 ; j < nL0Slats ; j++ ) {
637  for ( k = 0 ; k < nL0Range ; k++ ) {
638  if ( k < minAdc ) lut1[i][j][k] = 0 ;
639  else if ( k < maxAdc ) lut1[i][j][k] = 1 ;
640  else lut1[i][j][k] = 17 ;
641  }
642  }
643  }
644 //
645 // SouthEast
646 //
647  for ( i = 93 ; i < 112 ; i++ ) {
648  for ( j = 0 ; j < nL0Slats ; j++ ) {
649  for ( k = 0 ; k < nL0Range ; k++ ) {
650  if ( k < minAdc ) lut1[i][j][k] = 0 ;
651  else if ( k < maxAdc ) lut1[i][j][k] = 4 ;
652  else lut1[i][j][k] = 17 ;
653  }
654  }
655  }
656 //
657 // Depth 2 LUT
658 //
659  for ( i = 0 ; i < nL0Phi ; i++ ) {
660  for ( j = 0 ; j < nL0Eta ; j++ ) {
661  for ( k = 0 ; k < nL0Range ; k++ ) {
662  if ( k == 1 ) lut2[i][j][k] = 1 ;
663  else if ( k == 4 ) lut2[i][j][k] = 4 ;
664  else if ( k == 5 ) lut2[i][j][k] = 5 ;
665  else if ( k == 8 ) lut2[i][j][k] = 8 ;
666  else lut2[i][j][k] = 0 ;
667  }
668  }
669  }
670 //
671 // Depth 3 LUT
672 //
673  for ( i = 0 ; i < 2 ; i++ ) {
674  for ( k = 0 ; k < nL0Range ; k++ ) {
675  lut3[i][k] = k ;
676  }
677  }
678 }
679 //
680 // P4 luts with switched weigths
681 // Configuration actually used in 2000
682 //
683 void StPeCL0::setP4SLuts() {
684 
685  int i, j, k ;
686 //
687 //
688 // 1. map "top" and "bottom" slats to >16 for 3<adc<16 to effectively veto
689 // any events having hits on the top or bottom. The matching from east to
690 // west top and bottom is not exact, but I took the easiest path here just
691 // to get us going.
692 // top West: 50-60,1-8 bot West: 20-34
693 // top east: 110-120,61-68 bot East: 80-94
694 //
695 // Top West
696 //
697  for ( i = 0 ; i < 3 ; i++ ) {
698  for ( j = 0 ; j < nL0Slats ; j++ ) {
699  for ( k = 0 ; k < nL0Range ; k++ ) {
700  if ( k < minAdc ) lut1[i][j][k] = 0 ;
701  else lut1[i][j][k] = maxAdc ;
702  }
703  }
704  }
705 
706  for ( i = 52 ; i < 60 ; i++ ) {
707  for ( j = 0 ; j < nL0Slats ; j++ ) {
708  for ( k = 0 ; k < nL0Range ; k++ ) {
709  if ( k < minAdc ) lut1[i][j][k] = 0 ;
710  else lut1[i][j][k] = maxAdc ;
711  }
712  }
713  }
714 //
715 // Bottom West
716 //
717  for ( i = 22 ; i < 33 ; i++ ) {
718  for ( j = 0 ; j < nL0Slats ; j++ ) {
719  for ( k = 0 ; k < nL0Range ; k++ ) {
720  if ( k < minAdc ) lut1[i][j][k] = 0 ;
721  else lut1[i][j][k] = maxAdc ;
722  }
723  }
724  }
725 //
726 // Top East
727 //
728  for ( i = 112 ; i < 120 ; i++ ) {
729  for ( j = 0 ; j < nL0Slats ; j++ ) {
730  for ( k = 0 ; k < nL0Range ; k++ ) {
731  if ( k < minAdc ) lut1[i][j][k] = 0 ;
732  else lut1[i][j][k] = maxAdc ;
733  }
734  }
735  }
736 //
737  for ( i = 60 ; i < 63 ; i++ ) {
738  for ( j = 0 ; j < nL0Slats ; j++ ) {
739  for ( k = 0 ; k < nL0Range ; k++ ) {
740  if ( k < minAdc ) lut1[i][j][k] = 0 ;
741  else lut1[i][j][k] = maxAdc ;
742  }
743  }
744  }
745 //
746 // Bottom East
747 //
748  for ( i = 82 ; i < 93 ; i++ ) {
749  for ( j = 0 ; j < nL0Slats ; j++ ) {
750  for ( k = 0 ; k < nL0Range ; k++ ) {
751  if ( k < minAdc ) lut1[i][j][k] = 0 ;
752  else lut1[i][j][k] = maxAdc ;
753  }
754  }
755  }
756 //
757 // 2.map 3<adc<9 -> 1 for "north" side slats
758 // map 3<adc<9 -> 4 for "South" side slats
759 //
760 // NorthWest
761 //
762  for ( i = 33 ; i < 52 ; i++ ) {
763  for ( j = 0 ; j < nL0Slats ; j++ ) {
764  for ( k = 0 ; k < nL0Range ; k++ ) {
765  lut1[i][j][k] = k ;
766  }
767  }
768  }
769 //
770 // SouthWest
771 //
772  for ( i = 3 ; i < 22 ; i++ ) {
773  for ( j = 0 ; j < nL0Slats ; j++ ) {
774  for ( k = 0 ; k < nL0Range ; k++ ) {
775  lut1[i][j][k] = k ;
776  }
777  }
778  }
779 //
780 // NorthEast
781 //
782  for ( i = 63 ; i < 82 ; i++ ) {
783  for ( j = 0 ; j < nL0Slats ; j++ ) {
784  for ( k = 0 ; k < nL0Range ; k++ ) {
785  lut1[i][j][k] = k ;
786  }
787  }
788  }
789 //
790 // SouthEast
791 //
792  for ( i = 93 ; i < 112 ; i++ ) {
793  for ( j = 0 ; j < nL0Slats ; j++ ) {
794  for ( k = 0 ; k < nL0Range ; k++ ) {
795  lut1[i][j][k] = k ;
796  }
797  }
798  }
799 //
800 // Depth 2 LUT
801 //
802  int ns[4][4] = {{4,4,1,1},{1,1,4,4},{1,1,4,4},{4,4,1,1}};
803  int adc_sum_min=2, adc_sum_max=9;
804 
805  for ( i = 0 ; i < nL0Phi ; i++ ) {
806  for ( j = 0 ; j < nL0Eta ; j++ ) {
807  for ( k = 0 ; k < nL0Range ; k++ ) {
808  if ( k <= adc_sum_min ) lut2[i][j][k] = 0 ;
809  else if ( k <= adc_sum_max ) lut2[i][j][k] = ns[i][j] ;
810  else if ( k <= 16 ) lut2[i][j][k] = 0 ;
811  else lut2[i][j][k] = k ;
812  }
813  }
814  }
815 //
816 // Depth 3 LUT
817 //
818  for ( i = 0 ; i < 2 ; i++ ) {
819  for ( k = 0 ; k < nL0Range ; k++ ) {
820  if ( k == 1 || k == 4 || k == 5 ) lut3[i][k] = k ;
821  else lut3[i][k] = 0 ;
822  }
823  }
824 }
825 //
826 void StPeCL0::setYear1Input() {
827  for ( int i = 0 ; i < nL0Trays ; i++ ) {
828  cabling[i] = i ;
829  }
830 }
831 //
832 void StPeCL0::setYear2Input() {
833 //
834 // West side
835 //
836  {for ( int i = 0 ; i < 50 ; i++ ) {
837  cabling[i] = i + 10 ;
838  }}
839  {for ( int i = 50 ; i < 60 ; i++ ) {
840  cabling[i] = i - 50 ;
841  }}
842 //
843 // East side
844 //
845  {for ( int i = 65 ; i < 120 ; i++ ) {
846  cabling[i] = i - 5 ;
847  }}
848  {for ( int i = 60 ; i < 65 ; i++ ) {
849  cabling[i] = 55 + i ;
850  }}
851 }
static StMuEvent * event()
returns pointer to current StMuEvent (class holding the event wise information, e.g. event number, run number)
Definition: StMuDst.h:320