StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEdsm0Tree.cxx
1 /**************************************************************
2  * $Id: EEdsm0Tree.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 "EEdsm0Tree.h"
10 #include "EEdsm0.h"
11 
12 
13 //--------------------------------------------------
14 //
15 //--------------------------------------------------
16 EEdsm0Tree::EEdsm0Tree(const char *nameX) {
17  ee0=new EEdsm0[Nee0];
18  ee0[2-1].setType(2); // serve 2 x 0.3 JP
19  ee0[5-1].setType(2);
20  ee0[8-1].setType(2);
21  clear();
22  strncpy(name,nameX,mxTxt);
23 }
24 
25 //--------------------------------------------------
26 //--------------------------------------------------
27 EEdsm0Tree::~EEdsm0Tree() {
28  //fix it: delete
29  }
30 
31 //--------------------------------------------------
32 //--------------------------------------------------
33 void EEdsm0Tree :: clear() {
34  int i;
35  for (i=0;i<Nee0;i++) ee0[i].clear();
36  memset(ee0outTPsum,0,sizeof(ee0outTPsum));
37  memset( ee0outHT2bit,0,sizeof( ee0outHT2bit));
38  memset( ee0outTP2bit,0,sizeof( ee0outTP2bit));
39  memset(ee0outHTTP2bit,0,sizeof(ee0outHTTP2bit));
40  memset( ee0out16bit,0,sizeof( ee0out16bit));
41 }
42 
43 
44 //--------------------------------------------------
45 //--------------------------------------------------
46 void
47 EEdsm0Tree::setInp12bit(int HankCh, short val){
48  int ibr=HankCh/10; // board #
49  assert(ibr>=0 && ibr<Nee0);
50  int ch=HankCh%10;
51  ee0[ibr].setInp12bit(ch,val);
52  // printf("add %d %d %d\n",ibr,ch,val);
53 }
54 
55 
56 
57 //--------------------------------------------------
58 //--------------------------------------------------
59 int
60 EEdsm0Tree::getInp12bit(int HankCh) const {
61  int ibr=HankCh/10; // board #
62  assert(ibr>=0 && ibr<Nee0);
63  int ch=HankCh%10;
64  return ee0[ibr].getInp12bit(ch);
65 }
66 
67 //--------------------------------------------------
68 //--------------------------------------------------
69 void
70 EEdsm0Tree::setYear(int y, int*HTth, int*TPth ) {
71  int i;
72  for (i=0;i<Nee0;i++) ee0[i].setYear(y, HTth, TPth);
73 }
74 
75 
76 //--------------------------------------------------
77 //--------------------------------------------------
78 void
79 EEdsm0Tree::compute() {
80  int i,j;
81 
82  for(i=0;i<Nee0; i++){
83  // printf("\nee0[%d].compute()\n",i);
84  ee0[i].compute();
85  // ee0[i].print();
86  }
87 
88  j=0;
89  for(i=0;i<Nee0; i++){ // unpack outpt in arrays
90  ee0outTPsum[j]= ee0[i].getOutTPsum();
91  ee0outTP2bit[j]= ee0[i].getOutTP2bit();
92  ee0outHT2bit[j]= ee0[i].getOutHT2bit();
93  ee0outHTTP2bit[j]= ee0[i].getOutHTTP2bit();
94  ee0out16bit[j]= ee0[i].getOut16bit();
95  j++;
96  if(i==1 || i==4 || i==7) { // double output
97  ee0outTPsum[j]= ee0[i].getOutTPsum(1);
98  ee0outTP2bit[j]= ee0[i].getOutTP2bit(1);
99  ee0outHT2bit[j]= ee0[i].getOutHT2bit(1);
100  ee0outHTTP2bit[j]= ee0[i].getOutHTTP2bit(1);
101  ee0out16bit[j]= ee0[i].getOut16bit(1);
102  j++;
103  }
104  }
105 
106 }
107 
108 //--------------------------------------------------
109 //--------------------------------------------------
110 void
111 EEdsm0Tree::print( int k) const {
112  printf("EEdsm0Tree(%s) \n",name);
113 
114  int i;
115  for(i=0;i<Nee0;i++) {
116  printf("\n----------- level-0 Board %2d ",i+1);
117  ee0[i].print();
118  }
119 
120  printf("\n----------- level-0 emulated output \n ch =");
121  for(i=Nee0out-1;i>=0; i--) printf(" %2d ",i);
122  printf("\n TPsum=");
123  for(i=Nee0out-1;i>=0; i--) printf(" %3d ",ee0outTPsum[i]);
124  printf("\n HT2b=");
125  for(i=Nee0out-1;i>=0; i--) printf(" %3d ",ee0outHT2bit[i]);
126 
127  printf("\nHTTP2b=");
128  for(i=Nee0out-1;i>=0; i--) printf(" %3d ",ee0outHTTP2bit[i]);
129 
130  printf("\n");
131 
132 }
133 
134 /*
135  * $Log: EEdsm0Tree.cxx,v $
136  * Revision 1.3 2009/11/18 15:50:59 pibero
137  * Address several compiler warnings of the type:
138  *
139  * warning: deprecated conversion from string constant 'char*'
140  *
141  * Revision 1.2 2009/10/13 16:57:25 pibero
142  * Changed location of #include file
143  *
144  * Revision 1.1 2009/10/12 18:04:25 pibero
145  * Moved StEEmcUtil/EEdsm to StTriggerUtilities/Eemc
146  *
147  * Revision 1.2 2009/02/24 03:56:18 ogrebeny
148  * Corrected const-ness
149  *
150  * Revision 1.1 2007/08/17 01:15:35 balewski
151  * full blown Endcap trigger simu, by Xin
152  *
153  */
154 
Definition: EEdsm0.h:10