00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "StFpdCollection.h"
00030 #include "Stiostream.h"
00031
00032 static const char rcsid[] = "$Id: StFpdCollection.cxx,v 2.5 2003/09/02 17:58:05 perev Exp $";
00033
00034 ClassImp(StFpdCollection)
00035
00036 StFpdCollection::StFpdCollection()
00037 {
00038 int i;
00039 for(i=0; i<mMaxAdc; i++){mAdc[i] = 0;}
00040 for(i=0; i<mMaxTdc; i++){mTdc[i] = 0;}
00041 for(i=0; i<mMaxRegisters; i++){mReg[i] = 0;}
00042 for(i=0; i<mMaxPedestal; i++){mPed[i] = 0;}
00043 for(i=0; i<mMaxScalers; i++){mScl[i] = 0;}
00044 }
00045
00046 StFpdCollection::~StFpdCollection() {}
00047
00048 unsigned short*
00049 StFpdCollection::adc() {return mAdc;}
00050
00051 const unsigned short*
00052 StFpdCollection::adc() const {return mAdc;}
00053
00054 unsigned short*
00055 StFpdCollection::tdc() {return mTdc;}
00056
00057 const unsigned short*
00058 StFpdCollection::tdc() const {return mTdc;}
00059
00060 unsigned short
00061 StFpdCollection::registers(unsigned int n) const
00062 {
00063 if(n < mMaxRegisters) return mReg[n];
00064 return 0;
00065 }
00066
00067 unsigned int
00068 StFpdCollection::scaler(unsigned int n) const
00069 {
00070 if(n < mMaxScalers) return mScl[n];
00071 return 0;
00072 }
00073
00074 unsigned short*
00075 StFpdCollection::pedestal()
00076 {
00077 return mPed;
00078 }
00079
00080 const unsigned short*
00081 StFpdCollection::pedestal() const
00082 {
00083 return mPed;
00084 }
00085
00086 void
00087 StFpdCollection::setAdc(unsigned int n, unsigned short val)
00088 {
00089 if(n < mMaxAdc) mAdc[n] = val;
00090 }
00091
00092 void
00093 StFpdCollection::setTdc(unsigned int n, unsigned short val)
00094 {
00095 if(n < mMaxTdc) mTdc[n] = val;
00096 }
00097
00098 void
00099 StFpdCollection::setRegister(unsigned int n, unsigned short val)
00100 {
00101 if(n < mMaxRegisters) mReg[n] = val;
00102 }
00103
00104 void
00105 StFpdCollection::setPedestal(unsigned int n, unsigned short val)
00106 {
00107 if(n < mMaxPedestal) mPed[n] = val;
00108 }
00109
00110 void
00111 StFpdCollection::setScaler(unsigned int n, unsigned int val)
00112 {
00113 if(n < mMaxScalers) mScl[n] = val;
00114 }
00115
00116 unsigned short
00117 StFpdCollection::north(unsigned int n) const
00118 {
00119 if(n>0 && n<=mMaxPMTpEEMC) return mAdc[n+47];
00120 return 9999;
00121 }
00122
00123 unsigned short
00124 StFpdCollection::south(unsigned int n) const
00125 {
00126 if(n>0 && n<=mMaxPMTPbg) return mAdc[n+31];
00127 return 9999;
00128 }
00129
00130 unsigned short
00131 StFpdCollection::top(unsigned int n) const
00132 {
00133 if(n>0 && n<=mMaxPMTPbg) return mAdc[n-1];
00134 return 9999;
00135 }
00136
00137 unsigned short
00138 StFpdCollection::bottom(unsigned int n) const
00139 {
00140 if(n>0 && n<=mMaxPMTPbg) return mAdc[n+15];
00141 return 9999;
00142 }
00143
00144 unsigned short
00145 StFpdCollection::smdx(unsigned int n) const
00146 {
00147 if(n>0 && n<=mMaxPMTSmdX) return mAdc[n+59];
00148 return 9999;
00149 }
00150
00151 unsigned short
00152 StFpdCollection::smdy(unsigned int n) const
00153 {
00154 if(n>0 && n<=mMaxPMTSmdY) return mAdc[n+119];
00155 return 9999;
00156 }
00157
00158 unsigned short
00159 StFpdCollection::pres1(unsigned int n) const
00160 {
00161 if(n>0 && n<=mMaxPMTpEEMC) return mAdc[n+219];
00162 return 9999;
00163 }
00164
00165 unsigned short
00166 StFpdCollection::pres2(unsigned int n) const
00167 {
00168 if(n>0 && n<=mMaxPMTpEEMC) return mAdc[n+235];
00169 return 9999;
00170 }
00171
00172 unsigned short
00173 StFpdCollection::southVeto() const
00174 {
00175 return mAdc[253];
00176 }
00177
00178 unsigned int
00179 StFpdCollection::sumAdcNorth() const
00180 {
00181 unsigned int sum=0;
00182 for(int i=1; i<=mMaxPMTpEEMC; i++){sum+=(unsigned int)north(i);}
00183 return sum;
00184 }
00185
00186 unsigned int
00187 StFpdCollection::sumAdcSouth() const
00188 {
00189 unsigned int sum=0;
00190 for(int i=1; i<=mMaxPMTPbg; i++){sum+=(unsigned int)south(i);}
00191 return sum;
00192 }
00193
00194 unsigned int
00195 StFpdCollection::sumAdcTop() const
00196 {
00197 unsigned int sum=0;
00198 for(int i=1; i<=mMaxPMTPbg; i++){sum+=(unsigned int)top(i);}
00199 return sum;
00200 }
00201
00202 unsigned int
00203 StFpdCollection::sumAdcBottom() const
00204 {
00205 unsigned int sum=0;
00206 for(int i=1; i<=mMaxPMTPbg; i++){sum+=(unsigned int)bottom(i);}
00207 return sum;
00208 }
00209
00210 unsigned int
00211 StFpdCollection::sumAdcPreShower1() const
00212 {
00213 unsigned int sum=0;
00214 for(int i=1; i<=mMaxPMTpEEMC; i++){sum+=(unsigned int)pres1(i);}
00215 return sum;
00216 }
00217
00218 unsigned int
00219 StFpdCollection::sumAdcPreShower2() const
00220 {
00221 unsigned int sum=0;
00222 for(int i=1; i<=mMaxPMTpEEMC; i++){sum+=(unsigned int)pres2(i);}
00223 return sum;
00224 }
00225
00226 unsigned int
00227 StFpdCollection::sumAdcSmdX() const
00228 {
00229 unsigned int sum=0;
00230 for(int i=1; i<=mMaxPMTSmdX; i++){sum+=(unsigned int)smdx(i);}
00231 return sum;
00232 }
00233
00234 unsigned int
00235 StFpdCollection::sumAdcSmdY() const
00236 {
00237 unsigned int sum=0;
00238 for(int i=1; i<=mMaxPMTSmdY; i++){sum+=(unsigned int)smdy(i);}
00239 return sum;
00240 }
00241
00242 void
00243 StFpdCollection::setToken(unsigned int val)
00244 {
00245 mToken=val;
00246 }
00247
00248 void
00249 StFpdCollection::dump()
00250 {
00251 unsigned int i;
00252 cout << "FPD data dump token " << mToken << endl;
00253 cout << "North ADC "; for(i=1; i<13; i++){cout << north(i) << " ";}; cout << endl;
00254 cout << "South ADC "; for(i=1; i<17; i++){cout << south(i) << " ";}; cout << endl;
00255 cout << "Top ADC "; for(i=1; i<17; i++){cout << top(i) << " ";}; cout << endl;
00256 cout << "Bottom ADC "; for(i=1; i<17; i++){cout << bottom(i) << " ";}; cout << endl;
00257 cout << "PreShower1 "; for(i=1; i<13; i++){cout << pres1(i) << " ";}; cout << endl;
00258 cout << "PreShower2 "; for(i=1; i<13; i++){cout << pres2(i) << " ";}; cout << endl;
00259 cout << "SMD X "; for(i=1; i<61; i++){cout << smdx(i) << " ";}; cout << endl;
00260 cout << "SMD Y "; for(i=1; i<101; i++){cout << smdy(i) << " ";}; cout << endl;
00261 cout << "South Veto " << southVeto() << endl;
00262 cout << "Scalers "; for(i=0; i<128; i++){printf(" %x ",mScl[i]);}; cout << endl;
00263 }