StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFpdCollection.cxx
1 /***************************************************************************
2  *
3  * $Id: StFpdCollection.cxx,v 2.5 2003/09/02 17:58:05 perev Exp $
4  *
5  * Author: Akio Ogawa, Jan 2002
6  ***************************************************************************
7  *
8  * Description:
9  *
10  ***************************************************************************
11  *
12  * $Log: StFpdCollection.cxx,v $
13  * Revision 2.5 2003/09/02 17:58:05 perev
14  * gcc 3.2 updates + WarnOff
15  *
16  * Revision 2.4 2002/09/25 14:04:17 akio
17  * Bug fix in the service functions, no change in data
18  *
19  * Revision 2.3 2002/01/17 18:38:10 ullrich
20  * Several new methods added. Bug fixed.
21  *
22  * Revision 2.2 2002/01/09 15:37:55 ullrich
23  * AdcSum functions and scaler infos added.
24  *
25  * Revision 2.1 2002/01/03 20:57:36 ullrich
26  * Initial Revision.
27  *
28  **************************************************************************/
29 #include "StFpdCollection.h"
30 #include "Stiostream.h"
31 
32 static const char rcsid[] = "$Id: StFpdCollection.cxx,v 2.5 2003/09/02 17:58:05 perev Exp $";
33 
34 ClassImp(StFpdCollection)
35 
37 {
38  int i;
39  for(i=0; i<mMaxAdc; i++){mAdc[i] = 0;}
40  for(i=0; i<mMaxTdc; i++){mTdc[i] = 0;}
41  for(i=0; i<mMaxRegisters; i++){mReg[i] = 0;}
42  for(i=0; i<mMaxPedestal; i++){mPed[i] = 0;}
43  for(i=0; i<mMaxScalers; i++){mScl[i] = 0;}
44 }
45 
46 StFpdCollection::~StFpdCollection() {/* noop */}
47 
48 unsigned short*
49 StFpdCollection::adc() {return mAdc;}
50 
51 const unsigned short*
52 StFpdCollection::adc() const {return mAdc;}
53 
54 unsigned short*
55 StFpdCollection::tdc() {return mTdc;}
56 
57 const unsigned short*
58 StFpdCollection::tdc() const {return mTdc;}
59 
60 unsigned short
61 StFpdCollection::registers(unsigned int n) const
62 {
63  if(n < mMaxRegisters) return mReg[n];
64  return 0;
65 }
66 
67 unsigned int
68 StFpdCollection::scaler(unsigned int n) const
69 {
70  if(n < mMaxScalers) return mScl[n];
71  return 0;
72 }
73 
74 unsigned short*
75 StFpdCollection::pedestal()
76 {
77  return mPed;
78 }
79 
80 const unsigned short*
81 StFpdCollection::pedestal() const
82 {
83  return mPed;
84 }
85 
86 void
87 StFpdCollection::setAdc(unsigned int n, unsigned short val)
88 {
89  if(n < mMaxAdc) mAdc[n] = val;
90 }
91 
92 void
93 StFpdCollection::setTdc(unsigned int n, unsigned short val)
94 {
95  if(n < mMaxTdc) mTdc[n] = val;
96 }
97 
98 void
99 StFpdCollection::setRegister(unsigned int n, unsigned short val)
100 {
101  if(n < mMaxRegisters) mReg[n] = val;
102 }
103 
104 void
105 StFpdCollection::setPedestal(unsigned int n, unsigned short val)
106 {
107  if(n < mMaxPedestal) mPed[n] = val;
108 }
109 
110 void
111 StFpdCollection::setScaler(unsigned int n, unsigned int val)
112 {
113  if(n < mMaxScalers) mScl[n] = val;
114 }
115 
116 unsigned short
117 StFpdCollection::north(unsigned int n) const
118 {
119  if(n>0 && n<=mMaxPMTpEEMC) return mAdc[n+47];
120  return 9999;
121 }
122 
123 unsigned short
124 StFpdCollection::south(unsigned int n) const
125 {
126  if(n>0 && n<=mMaxPMTPbg) return mAdc[n+31];
127  return 9999;
128 }
129 
130 unsigned short
131 StFpdCollection::top(unsigned int n) const
132 {
133  if(n>0 && n<=mMaxPMTPbg) return mAdc[n-1];
134  return 9999;
135 }
136 
137 unsigned short
138 StFpdCollection::bottom(unsigned int n) const
139 {
140  if(n>0 && n<=mMaxPMTPbg) return mAdc[n+15];
141  return 9999;
142 }
143 
144 unsigned short
145 StFpdCollection::smdx(unsigned int n) const
146 {
147  if(n>0 && n<=mMaxPMTSmdX) return mAdc[n+59];
148  return 9999;
149 }
150 
151 unsigned short
152 StFpdCollection::smdy(unsigned int n) const
153 {
154  if(n>0 && n<=mMaxPMTSmdY) return mAdc[n+119];
155  return 9999;
156 }
157 
158 unsigned short
159 StFpdCollection::pres1(unsigned int n) const
160 {
161  if(n>0 && n<=mMaxPMTpEEMC) return mAdc[n+219];
162  return 9999;
163 }
164 
165 unsigned short
166 StFpdCollection::pres2(unsigned int n) const
167 {
168  if(n>0 && n<=mMaxPMTpEEMC) return mAdc[n+235];
169  return 9999;
170 }
171 
172 unsigned short
173 StFpdCollection::southVeto() const
174 {
175  return mAdc[253];
176 }
177 
178 unsigned int
179 StFpdCollection::sumAdcNorth() const
180 {
181  unsigned int sum=0;
182  for(int i=1; i<=mMaxPMTpEEMC; i++){sum+=(unsigned int)north(i);}
183  return sum;
184 }
185 
186 unsigned int
187 StFpdCollection::sumAdcSouth() const
188 {
189  unsigned int sum=0;
190  for(int i=1; i<=mMaxPMTPbg; i++){sum+=(unsigned int)south(i);}
191  return sum;
192 }
193 
194 unsigned int
195 StFpdCollection::sumAdcTop() const
196 {
197  unsigned int sum=0;
198  for(int i=1; i<=mMaxPMTPbg; i++){sum+=(unsigned int)top(i);}
199  return sum;
200 }
201 
202 unsigned int
203 StFpdCollection::sumAdcBottom() const
204 {
205  unsigned int sum=0;
206  for(int i=1; i<=mMaxPMTPbg; i++){sum+=(unsigned int)bottom(i);}
207  return sum;
208 }
209 
210 unsigned int
211 StFpdCollection::sumAdcPreShower1() const
212 {
213  unsigned int sum=0;
214  for(int i=1; i<=mMaxPMTpEEMC; i++){sum+=(unsigned int)pres1(i);}
215  return sum;
216 }
217 
218 unsigned int
219 StFpdCollection::sumAdcPreShower2() const
220 {
221  unsigned int sum=0;
222  for(int i=1; i<=mMaxPMTpEEMC; i++){sum+=(unsigned int)pres2(i);}
223  return sum;
224 }
225 
226 unsigned int
227 StFpdCollection::sumAdcSmdX() const
228 {
229  unsigned int sum=0;
230  for(int i=1; i<=mMaxPMTSmdX; i++){sum+=(unsigned int)smdx(i);}
231  return sum;
232 }
233 
234 unsigned int
235 StFpdCollection::sumAdcSmdY() const
236 {
237  unsigned int sum=0;
238  for(int i=1; i<=mMaxPMTSmdY; i++){sum+=(unsigned int)smdy(i);}
239  return sum;
240 }
241 
242 void
243 StFpdCollection::setToken(unsigned int val)
244 {
245  mToken=val;
246 }
247 
248 void
249 StFpdCollection::dump()
250 {
251  unsigned int i;
252  cout << "FPD data dump token " << mToken << endl;
253  cout << "North ADC "; for(i=1; i<13; i++){cout << north(i) << " ";}; cout << endl;
254  cout << "South ADC "; for(i=1; i<17; i++){cout << south(i) << " ";}; cout << endl;
255  cout << "Top ADC "; for(i=1; i<17; i++){cout << top(i) << " ";}; cout << endl;
256  cout << "Bottom ADC "; for(i=1; i<17; i++){cout << bottom(i) << " ";}; cout << endl;
257  cout << "PreShower1 "; for(i=1; i<13; i++){cout << pres1(i) << " ";}; cout << endl;
258  cout << "PreShower2 "; for(i=1; i<13; i++){cout << pres2(i) << " ";}; cout << endl;
259  cout << "SMD X "; for(i=1; i<61; i++){cout << smdx(i) << " ";}; cout << endl;
260  cout << "SMD Y "; for(i=1; i<101; i++){cout << smdy(i) << " ";}; cout << endl;
261  cout << "South Veto " << southVeto() << endl;
262  cout << "Scalers "; for(i=0; i<128; i++){printf(" %x ",mScl[i]);}; cout << endl;
263 }