StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFtpcDbReader.hh
1 // $Id: StFtpcDbReader.hh,v 1.30 2010/04/08 16:46:16 jcs Exp $
2 //
3 // $Log: StFtpcDbReader.hh,v $
4 // Revision 1.30 2010/04/08 16:46:16 jcs
5 // swap data for RDO6,RDO7 FTPC East when Calibrations_ftpc/ftpcElectronics->swapRDO6RDO7East=1
6 //
7 // Revision 1.29 2009/08/04 08:37:28 jcs
8 // When the flaser option is included in the bfc, the 'perfect' gain table and
9 // adjustAverageWest = adjustAverageEast = 0.0, will be used for cluster finding
10 //
11 // Revision 1.28 2008/07/30 14:47:32 jcs
12 // if microsecondsPerTimebin calculated from RHIC clock, write the new value for mMicrosecondsPerTimebin back into
13 // Calibrations_ftpc/ftpcElectronics table
14 //
15 // Revision 1.27 2008/05/13 19:12:00 jcs
16 // added laserTZero to Calibrations_ftpc/ftpcElectronics
17 //
18 // Revision 1.26 2006/10/17 19:11:43 fisyak
19 // Add definition of mPadPitch
20 //
21 // Revision 1.25 2006/03/13 19:26:59 jcs
22 // add constructor StFtpcCalibMaker
23 //
24 // Revision 1.24 2005/12/12 13:40:12 jcs
25 // simplify StFtpcDbReader
26 //
27 // Revision 1.23 2005/10/26 14:03:43 jcs
28 // Change setMicrosecondsPerTimebin
29 //
30 // Revision 1.22 2005/10/24 13:43:01 jcs
31 // If microsecondsPerTimebin calculated from RHIC clock frequency, store in
32 // Calibrations_ftpc/ftpcElectronics database table. Otherwise get default
33 // value from Calibrations_ftpc/ftpcElectronics database table.
34 //
35 // Revision 1.21 2005/10/14 07:29:01 jcs
36 // Calculate microsecondsPerTimebin from RHIC ClockFrequency
37 // If RHIC ClockFrequency = 0, use default value from database
38 //
39 // Revision 1.20 2004/07/18 14:10:04 jcs
40 // get adjustAverageWest/East from Calibrations_ftpc/ftpcGas
41 //
42 // Revision 1.19 2003/07/03 13:21:54 fsimon
43 // Added cathode offset information to constructor for SlowSimulator
44 //
45 // Revision 1.18 2003/06/13 12:11:12 jcs
46 // change constructor comment to specify that it is also used for StFtpcMixerMaker
47 //
48 // Revision 1.17 2003/06/12 10:01:26 jcs
49 // renamed ftpcClusterGeometry database table to ftpcClusterGeom
50 // (name was too long)
51 //
52 // Revision 1.16 2003/06/11 12:06:03 jcs
53 // get inner cathode and cluster geometry parameters from database
54 //
55 // Revision 1.15 2003/06/10 13:13:51 jcs
56 // get mix,max gas temperature and pressure limits from database
57 //
58 // Revision 1.14 2003/05/06 20:19:40 mora
59 // Add a new constructor only with FTPC dimensions and geometry for ITTF
60 //
61 // Revision 1.13 2003/02/19 14:50:39 jcs
62 // get default temperatures from database
63 //
64 // Revision 1.12 2003/01/14 12:58:01 jcs
65 // use Geometry_ftpc/ftpcAsicMap to control corrections for error in Y2001-2002
66 // FTPC asic mapping
67 //
68 // Revision 1.11 2002/10/15 09:46:46 fsimon
69 // Constructor used by SlowSimulator changed to include Db access to
70 // ftpcAmpSlope, ftpcAmpOffset and ftpcTimeOffset
71 //
72 // Revision 1.10 2002/01/21 22:12:53 jcs
73 // add gas temperature difference between west and east FTPC to database
74 //
75 // Revision 1.9 2001/11/21 12:36:27 jcs
76 // make ftpcGas database table available to FTPC cluster maker
77 //
78 // Revision 1.8 2001/10/29 12:54:43 jcs
79 // add new constructor for StFtpcDriftMapMaker
80 //
81 // Revision 1.7 2001/10/19 09:40:11 jcs
82 // tZero now in data base in ftpcElectronics
83 //
84 // Revision 1.6 2001/08/16 18:27:54 jcs
85 // add inline get function for driftCathodeVoltage
86 //
87 // Revision 1.5 2001/07/11 21:18:01 jcs
88 // changes for new FTPC database structures
89 //
90 // Revision 1.4 2001/04/04 17:08:42 jcs
91 // remove references to StFtpcParamReader from StFtpcDbReader
92 //
93 // Revision 1.3 2001/04/02 12:10:24 jcs
94 // get FTPC calibrations,geometry from MySQL database and code parameters
95 // from StarDb/ftpc
96 //
97 // Revision 1.2 2001/03/19 15:52:47 jcs
98 // use ftpcDimensions from database
99 //
100 // Revision 1.1 2001/03/06 23:34:06 jcs
101 // use database instead of params
102 //
103 //
104 
105 #ifndef STAR_StFtpcDbReader
106 #define STAR_StFtpcDbReader
107 
108 #include "StMaker.h"
109 
110 #include "TObject.h"
111 
112 #include "tables/St_ftpcDimensions_Table.h"
113 #include "tables/St_ftpcPadrowZ_Table.h"
114 #include "tables/St_ftpcAsicMap_Table.h"
115 #include "tables/St_ftpcEField_Table.h"
116 #include "tables/St_ftpcVDrift_Table.h"
117 #include "tables/St_ftpcDeflection_Table.h"
118 #include "tables/St_ftpcdVDriftdP_Table.h"
119 #include "tables/St_ftpcdDeflectiondP_Table.h"
120 #include "tables/St_ftpcAmpSlope_Table.h"
121 #include "tables/St_ftpcAmpOffset_Table.h"
122 #include "tables/St_ftpcTimeOffset_Table.h"
123 #include "tables/St_ftpcGas_Table.h"
124 #include "tables/St_ftpcDriftField_Table.h"
125 #include "tables/St_ftpcElectronics_Table.h"
126 #include "tables/St_ftpcInnerCathode_Table.h"
127 #include "tables/St_ftpcClusterGeom_Table.h"
128 
129 
130 class StFtpcDbReader : public TObject
131 {
132 
133 protected:
134  //ClusterFinder parameters (also used by other classes)
135  Int_t mNumberOfPadrows;
136  Int_t mNumberOfPadrowsPerSide;
137  Int_t mFirstPadrowToSearch;
138  Int_t mLastPadrowToSearch;
139  Int_t mNumberOfSectors;
140  Int_t mFirstSectorToSearch;
141  Int_t mLastSectorToSearch;
142  Int_t mNumberOfPads;
143  Int_t mNumberOfTimebins;
144  Int_t mMinTimeBin;
145  Int_t mMinTimeBinMed;
146  Int_t mMinTimeBinOut;
147  Int_t mMaxTimeLength;
148  Int_t mMaxTimeLengthMed;
149  Int_t mMaxTimeLengthOut;
150  Int_t mMaxPadLength;
151  Int_t mMaxPadLengthMed;
152  Int_t mMaxPadLengthOut;
153  Int_t mDeltaTime;
154  Int_t mDeltaPad;
155 
156  Bool_t mEastIsInverted;
157  Bool_t mAsic2EastNotInverted;
158 
159  Float_t mPhiOrigin;
160  Float_t mPhiPerSector;
161  Float_t mRadiansPerPad;
162  Float_t mRadiansPerBoundary;
163  Float_t mSensitiveVolumeInnerRadius;
164  Float_t mSensitiveVolumeOuterRadius;
165 
166  Float_t *mPadrowZPosition;
167 
168  Int_t mNumberOfMagboltzBins;
169  Int_t mMaximumNumberOfMagboltzBins;
170  Float_t *mMagboltzEField;
171  Float_t *mMagboltzVDrift;
172  Float_t *mMagboltzDeflection;
173  Float_t *mMagboltzdVDriftdP;
174  Float_t *mMagboltzdDeflectiondP;
175 
176  Float_t mPercentAr;
177  Float_t mPercentCO2;
178  Float_t mPercentNe;
179  Float_t mPercentHe;
180  Float_t mGasGain;
181  Float_t mGasAttenuation;
182  Float_t mGasIonizationPotential;
183  Float_t mBaseTemperature;
184  Float_t mBasePressure;
185  Float_t mPressureOffset;
186  Float_t mTemperatureDifference;
187  Float_t mDefaultTemperatureWest;
188  Float_t mDefaultTemperatureEast;
189  Float_t mMinPressure;
190  Float_t mMaxPressure;
191  Float_t mMinGasTemperature;
192  Float_t mMaxGasTemperature;
193  Float_t mAdjustAverageWest;
194  Float_t mAdjustAverageEast;
195 
196  Float_t mTZero;
197  Float_t mLaserTZero;
198  Float_t mMicrosecondsPerTimebin;
199  Bool_t mSwapRDO6RDO7East;
200 
201  Float_t mOffsetCathodeWest;
202  Float_t mOffsetCathodeEast;
203  Float_t mAngleOffsetWest;
204  Float_t mAngleOffsetEast;
205 
206  Float_t mDriftCathodeVoltage;
207  Float_t mMinimumDriftField;
208  Float_t mStepSizeDriftField;
209  Float_t mRadiusTimesField;
210 
211  Float_t mMinChargeWindow;
212 
213  ftpcAmpSlope_st *ampslopeTable;
214  ftpcAmpOffset_st *ampoffsetTable;
215  ftpcTimeOffset_st *timeoffsetTable;
216  ftpcGas_st* gasTable;
217  ftpcElectronics_st *electronicsTable;
218  //SlowSimulator parameters
219  Float_t mPadLength;
220  Float_t mPadPitch;
221 
222 private:
223 
224 Bool_t mLaserRun; // indicator to know if this is a laser run
225 
226 Int_t FtpcAmpOffset(St_ftpcAmpOffset *ampoffset);
227 Int_t FtpcAmpSlope(St_ftpcAmpSlope *ampslope);
228 Int_t FtpcAsicMap(St_ftpcAsicMap *asicmap);
229 Int_t FtpcClusterGeom(St_ftpcClusterGeom *clustergeo);
230 Int_t FtpcdDeflectiondP(St_ftpcdDeflectiondP *ddeflectiondp);
231 Int_t FtpcDeflection(St_ftpcDeflection *deflection);
232 Int_t FtpcDimensions(St_ftpcDimensions *dimensions);
233 Int_t FtpcDriftField(St_ftpcDriftField *driftfield);
234 Int_t FtpcdVDriftdP(St_ftpcdVDriftdP *dvdriftdp);
235 Int_t FtpcEField(St_ftpcEField *efield);
236 Int_t FtpcElectronics(St_ftpcElectronics *electronics);
237 Int_t FtpcGas(St_ftpcGas *gas);
238 Int_t FtpcInnerCathode(St_ftpcInnerCathode *cathode);
239 Int_t FtpcPadrowZ(St_ftpcPadrowZ *zrow);
240 Int_t FtpcTimeOffset(St_ftpcTimeOffset *timeoffset);
241 Int_t FtpcVDrift(St_ftpcVDrift *vdrift);
242 
243 public:
244  // constructor used by StFtpcClusterMaker:
245  StFtpcDbReader(St_ftpcDimensions *dimensions,
246  St_ftpcPadrowZ *zrow,
247  St_ftpcAsicMap *asicmap,
248  St_ftpcEField *efield,
249  St_ftpcVDrift *vdrift,
250  St_ftpcDeflection *deflection,
251  St_ftpcdVDriftdP *dvdriftdp,
252  St_ftpcdDeflectiondP *ddeflectiondp,
253  St_ftpcAmpSlope *ampslope,
254  St_ftpcAmpOffset *ampoffset,
255  St_ftpcTimeOffset *timeoffset,
256  St_ftpcDriftField *driftfield,
257  St_ftpcGas *gas,
258  St_ftpcElectronics *electronics,
259  St_ftpcInnerCathode *cathode,
260  St_ftpcClusterGeom *clustergeo);
261  // constructor used by StFtpcSlowSimMaker
262  StFtpcDbReader(St_ftpcDimensions *dimensions,
263  St_ftpcAsicMap *asicmap,
264  St_ftpcEField *efield,
265  St_ftpcVDrift *vdrift,
266  St_ftpcDeflection *deflection,
267  St_ftpcdVDriftdP *dvdriftdp,
268  St_ftpcdDeflectiondP *ddeflectiondp,
269  St_ftpcGas *gas,
270  St_ftpcDriftField *driftfield,
271  St_ftpcElectronics *electronics,
272  St_ftpcAmpSlope *ampslope,
273  St_ftpcAmpOffset *ampoffset,
274  St_ftpcTimeOffset *timeoffset,
275  St_ftpcInnerCathode *cathode);
276  // constructor used by StFtpcDriftMapMaker:
277  StFtpcDbReader(St_ftpcDimensions *dimensions,
278  St_ftpcPadrowZ *zrow,
279  St_ftpcEField *efield,
280  St_ftpcVDrift *vdrift,
281  St_ftpcDeflection *deflection,
282  St_ftpcdVDriftdP *dvdriftdp,
283  St_ftpcdDeflectiondP *ddeflectiondp,
284  St_ftpcGas *gas,
285  St_ftpcDriftField *driftfield);
286  // constructor used by StFtpcCalibMaker:
287  StFtpcDbReader(St_ftpcDimensions *dimensions,
288  St_ftpcPadrowZ *zrow,
289  St_ftpcEField *efield,
290  St_ftpcVDrift *vdrift,
291  St_ftpcDeflection *deflection,
292  St_ftpcdVDriftdP *dvdriftdp,
293  St_ftpcdDeflectiondP *ddeflectiondp,
294  St_ftpcElectronics *electronics,
295  St_ftpcGas *gas,
296  St_ftpcDriftField *driftfield);
297  // constructor used by Sti/StFtpcDetectorBuilder and StFtpcMixerMaker:
298  StFtpcDbReader(St_ftpcDimensions *dimensions,
299  St_ftpcPadrowZ *zrow );
300 
301 
302  ~StFtpcDbReader();
303 
304  Int_t returnCode;
305 
306  Float_t padrowZPosition(Int_t i);
307  Float_t magboltzEField(Int_t i);
308  Float_t magboltzVDrift(Int_t i,Int_t padrow);
309  Float_t magboltzDeflection(Int_t i, Int_t padrow);
310  Float_t magboltzdVDriftdP(Int_t i, Int_t padrow);
311  Float_t magboltzdDeflectiondP(Int_t i, Int_t padrow);
312  Float_t amplitudeSlope(Int_t i, Int_t padrow);
313  Float_t amplitudeOffset(Int_t i, Int_t padrow);
314  Float_t timeOffset(Int_t i, Int_t padrow);
315 
316  // parameter set functions
317  Int_t setMagboltzEField(Int_t i, Float_t newvalue);
318  Int_t setMagboltzVDrift(Int_t i, Int_t padrow, Float_t newvalue);
319  Int_t setMagboltzDeflection(Int_t i, Int_t padrow, Float_t newvalue);
320  Int_t setMagboltzdVDriftdP(Int_t i, Int_t padrow, Float_t newvalue);
321  Int_t setMagboltzdDeflectiondP(Int_t i, Int_t padrow, Float_t newvalue);
322  Int_t setMicrosecondsPerTimebin(Float_t newvalue);
323  Bool_t setLaserRun(Bool_t laserRun);
324 
325  // inline get functions
326  Int_t numberOfPadrows() {return mNumberOfPadrows;}
327  Int_t numberOfPadrowsPerSide() {return mNumberOfPadrowsPerSide;}
328  Int_t firstPadrowToSearch() {return mFirstPadrowToSearch;}
329  Int_t lastPadrowToSearch() {return mLastPadrowToSearch;}
330  Int_t numberOfSectors() {return mNumberOfSectors;}
331  Int_t firstSectorToSearch() {return mFirstSectorToSearch;}
332  Int_t lastSectorToSearch() {return mLastSectorToSearch;}
333  Int_t numberOfPads() {return mNumberOfPads;}
334  Int_t numberOfTimebins() {return mNumberOfTimebins;}
335 
336  Bool_t EastIsInverted() {return mEastIsInverted;}
337  Bool_t Asic2EastNotInverted() {return mAsic2EastNotInverted;}
338  Bool_t SwapRDO6RDO7East() {return mSwapRDO6RDO7East;}
339 
340  Int_t numberOfMagboltzBins() {return mNumberOfMagboltzBins;}
341  Int_t maximumNumberOfMagboltzBins() {return mMaximumNumberOfMagboltzBins;}
342 
343  Float_t phiOrigin() {return mPhiOrigin;}
344  Float_t phiPerSector() {return mPhiPerSector;}
345  Float_t phiEnd() {return mPhiOrigin+mPhiPerSector;}
346  Float_t padLength() {return mPadLength;}
347  Float_t padPitch() {return mPadPitch;}
348  Float_t radiansPerPad() {return mRadiansPerPad;}
349  Float_t radiansPerBoundary() {return mRadiansPerBoundary;}
350  Float_t sensitiveVolumeInnerRadius() {return mSensitiveVolumeInnerRadius;}
351  Float_t sensitiveVolumeOuterRadius() {return mSensitiveVolumeOuterRadius;}
352 
353  Float_t percentAr() {return mPercentAr;}
354  Float_t percentCO2() {return mPercentCO2;}
355  Float_t percentNe() {return mPercentNe;}
356  Float_t percentHe() {return mPercentHe;}
357  Float_t gasGain() {return mGasGain;}
358  Float_t gasAttenuation() {return mGasAttenuation;}
359  Float_t gasIonizationPotential() {return mGasIonizationPotential;}
360  Float_t baseTemperature() {return mBaseTemperature;}
361  Float_t basePressure() {return mBasePressure;}
362  Float_t pressureOffset() {return mPressureOffset;}
363  Float_t temperatureDifference(){return mTemperatureDifference;}
364  Float_t defaultTemperatureWest(){return mDefaultTemperatureWest;}
365  Float_t defaultTemperatureEast(){return mDefaultTemperatureEast;}
366  Float_t minPressure() {return mMinPressure;}
367  Float_t maxPressure() {return mMaxPressure;}
368  Float_t minGasTemperature() {return mMinGasTemperature;}
369  Float_t maxGasTemperature() {return mMaxGasTemperature;}
370  Float_t adjustAverageWest() {return mAdjustAverageWest;}
371  Float_t adjustAverageEast() {return mAdjustAverageEast;}
372 
373  Float_t tZero() {return mTZero;}
374  Float_t laserTZero() {return mLaserTZero;}
375  Float_t microsecondsPerTimebin() {return mMicrosecondsPerTimebin;}
376 
377  Float_t driftCathodeVoltage() {return mDriftCathodeVoltage;}
378  Float_t minimumDriftField() {return mMinimumDriftField;}
379  Float_t stepSizeDriftField() {return mStepSizeDriftField;}
380  Float_t radiusTimesField() {return mRadiusTimesField;}
381 
382  Float_t offsetCathodeWest() {return mOffsetCathodeWest;}
383  Float_t offsetCathodeEast() {return mOffsetCathodeEast;}
384  Float_t angleOffsetWest() {return mAngleOffsetWest;}
385  Float_t angleOffsetEast() {return mAngleOffsetEast;}
386 
387  Int_t minTimeBin() {return mMinTimeBin;}
388  Int_t minTimeBinMed() {return mMinTimeBinMed;}
389  Int_t minTimeBinOut() {return mMinTimeBinOut;}
390  Int_t maxTimeLength() {return mMaxTimeLength;}
391  Int_t maxPadLength() {return mMaxPadLength;}
392  Int_t maxTimeLengthMed() {return mMaxTimeLengthMed;}
393  Int_t maxPadLengthMed() {return mMaxPadLengthMed;}
394  Int_t maxTimeLengthOut() {return mMaxTimeLengthOut;}
395  Int_t maxPadLengthOut() {return mMaxPadLengthOut;}
396  Int_t deltaTime() {return mDeltaTime;}
397  Int_t deltaPad() {return mDeltaPad;}
398  Float_t minChargeWindow() {return mMinChargeWindow;}
399 
400 };
401 
402 #endif