StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EEfeeTPTree.cxx
1 /**************************************************************
2  * $Id: EEfeeTPTree.cxx,v 1.6 2020/01/13 20:45:50 zchang Exp $
3  **************************************************************/
4 
5 #include <iostream>
6 #include <assert.h>
7 
8 
9 #include "EEfeeTPTree.h"
10 #include "EEfeeTP.h"
11 
12 #define EEmapFEE_USE // trick instattiates data only in the cxx
13 #include "EEmapTP.h"
14 #undef EEmapFEE_USE
15 
16 
17 //--------------------------------------------------
18 //
19 //--------------------------------------------------
20 EEfeeTPTree::EEfeeTPTree(const char *nameX, int nc) {
21 
22  memset(feeTP,0,sizeof(feeTP)); // clear all pointers
23  memset(TPmap,0,sizeof(TPmap));
24 
25  //.... map all TP to Hank's channels (input to DSM 0)
26 
27  int i;
28  for(i=0;i<90;i++) {
29  EEfeeTPmap *x=eeTPmap+i;
30  feeTP[i]=new EEfeeTP( x->JP,x->name,x->lenCh,x->cha0L,x->cha0H);
31  }
32 
33 
34  mxChan=nc;
35  clear();
36  strncpy(name,nameX,mxTxt);
37 }
38 
39 //--------------------------------------------------
40 //--------------------------------------------------
41 EEfeeTPTree::~EEfeeTPTree() {
42  for (int i = 0; i < 90; ++i) {
43  delete feeTP[i];
44  feeTP[i] = 0;
45  }
46 }
47 
48 //--------------------------------------------------
49 //--------------------------------------------------
50 void
51 EEfeeTPTree::clear() {
52  int i;
53  for(i=0;i<mxTP;i++) {
54  if( feeTP[i]==0) continue; // skip uninitialized TP
55  feeTP[i]->clear();
56  }
57  // memset(ee0outHTTP2bit,0,sizeof(ee0outHTTP2bit));
58 
59 }
60 
61 
62 //--------------------------------------------------
63 //--------------------------------------------------
64 void
65 EEfeeTPTree::compute(int *rawAdc, int *feePed, int *feeMask, int* highTowerMask, int* patchSumMask) {
66  int i;
67 
68  for(i=0;i<mxTP;i++) {
69  if( feeTP[i]==0) continue; // skip uninitialized TP
70  int icr=feeTP[i]->getCrateID()-1;
71  int off=icr*mxChan;
72  feeTP[i]->compute(rawAdc+off, feePed+off, feeMask+off, highTowerMask[i], patchSumMask[i]);
73  }
74 }
75 void
76 EEfeeTPTree::test(int *tp, int *ht)
77 {
78  int i;
79  for(i=0;i<mxTP;i++) {
80  feeTP[i]->test(tp[i], ht[i]);
81  }
82 }
83 #if 0
84 //--------------------------------------------------
85 //--------------------------------------------------
86 void
87 EEfeeTPTree::setInput12bit(int HankCh, short val){
88  int ibr=HankCh/10; // board #
89  assert(ibr>=0 && ibr<Nee0);
90  int ch=HankCh%10;
91  ee0[ibr].setInput12bit(ch,val);
92  // printf("add %d %d %d\n",ibr,ch,val);
93 }
94 
95 
96 
97 //--------------------------------------------------
98 //--------------------------------------------------
99 short
100 EEfeeTPTree::getInput12bit(int HankCh){
101  int ibr=HankCh/10; // board #
102  assert(ibr>=0 && ibr<Nee0);
103  int ch=HankCh%10;
104  return ee0[ibr].getInput12bit(ch);
105 }
106 
107 //--------------------------------------------------
108 //--------------------------------------------------
109 void
110 EEfeeTPTree::setYear(int y, int*HTth, int*TPth ) {
111  int i;
112  for (i=0;i<Nee0;i++) ee0[i].setYear(y,HTth,TPth );
113 }
114 
115 //--------------------------------------------------
116 //--------------------------------------------------
117 void
118 EEfeeTPTree::print( int k) {
119  printf("EEfeeTPTree(%s) \n",name);
120 
121  int i;
122  for(i=0;i<Nee0;i++) {
123  printf("\n----------- level-0 Board %2d ",i+1);
124  ee0[i].print();
125  }
126 
127  printf("\n----------- level-0 emulated output \n ch =");
128  for(i=Nee0out-1;i>=0; i--) printf(" %2d ",i);
129  printf("\n TPsum=");
130  for(i=Nee0out-1;i>=0; i--) printf(" %3d ",ee0outTPsum[i]);
131  printf("\n HT2b=");
132  for(i=Nee0out-1;i>=0; i--) printf(" %3d ",ee0outHT2bit[i]);
133 
134  printf("\nHTTP2b=");
135  for(i=Nee0out-1;i>=0; i--) printf(" %3d ",ee0outHTTP2bit[i]);
136 
137  printf("\n");
138 
139 }
140 #endif
141 /*
142  * $Log: EEfeeTPTree.cxx,v $
143  * Revision 1.6 2020/01/13 20:45:50 zchang
144  * removing old run13 dsm algo files
145  *
146  * Revision 1.5 2011/10/16 17:41:59 pibero
147  * Implement EEMC FEE HT & TP masks
148  *
149  * Revision 1.4 2009/11/18 21:27:15 pibero
150  * Fix memory leak.
151  *
152  * Revision 1.3 2009/11/18 15:50:59 pibero
153  * Address several compiler warnings of the type:
154  *
155  * warning: deprecated conversion from string constant 'char*'
156  *
157  * Revision 1.2 2009/10/13 17:02:49 pibero
158  * Changed location of #include file
159  *
160  * Revision 1.1 2009/10/12 18:04:27 pibero
161  * Moved StEEmcUtil/EEdsm to StTriggerUtilities/Eemc
162  *
163  * Revision 1.1 2007/08/17 01:15:37 balewski
164  * full blown Endcap trigger simu, by Xin
165  *
166  */
167