56 #ifndef ST_NO_EXCEPTIONS
60 #include "SystemOfUnits.h"
61 #ifndef ST_NO_NAMESPACES
62 using namespace units;
65 #ifndef ST_NO_EXCEPTIONS
67 # if !defined(ST_NO_NAMESPACES)
68 using std::invalid_argument;
69 using std::range_error;
73 #include "StTpcDbGeometry.hh"
75 #include "StTpcDb/StTpcDb.h"
91 StTpcDbGeometry::StTpcDbGeometry(
StTpcDb* globalDbPointer)
93 gTpcDbPtr = globalDbPointer;
94 mPadRows = St_tpcPadConfigC::instance()->numberOfRows(20);
95 mInnerPadRows = St_tpcPadConfigC::instance()->numberOfInnerRows(20);
96 mInnerPadRows48 = St_tpcPadConfigC::instance()->numberOfInnerRows48(20);
97 mInnerPadRows52 = St_tpcPadConfigC::instance()->numberOfInnerRows52(20);
98 mOuterPadRows = St_tpcPadConfigC::instance()->numberOfOuterRows(20);
99 mInnerSectorPadWidth = St_tpcPadConfigC::instance()->innerSectorPadWidth(20);
100 mInnerSectorPadLength = St_tpcPadConfigC::instance()->innerSectorPadLength(20);
101 mInnerSectorPadPitch = St_tpcPadConfigC::instance()->innerSectorPadPitch(20);
102 mInnerSectorRowPitch1 = St_tpcPadConfigC::instance()->innerSectorRowPitch1(20);
103 mInnerSectorRowPitch2 = St_tpcPadConfigC::instance()->innerSectorRowPitch2(20);
104 mFirstPadRow = St_tpcPadConfigC::instance()->firstPadRow(20);
105 mFirstOuterSectorPadRow = St_tpcPadConfigC::instance()->firstOuterSectorPadRow(20);
106 mLastOuterSectorPadRow = St_tpcPadConfigC::instance()->lastOuterSectorPadRow(20);
107 mFirstRowWidth = St_tpcPadConfigC::instance()->firstRowWidth(20);
108 mLastRowWidth = St_tpcPadConfigC::instance()->lastRowWidth(20);
109 mOuterSectorPadWidth = St_tpcPadConfigC::instance()->outerSectorPadWidth(20);
110 mOuterSectorPadLength = St_tpcPadConfigC::instance()->outerSectorPadLength(20);
111 mOuterSectorPadPitch = St_tpcPadConfigC::instance()->outerSectorPadPitch(20);
112 mOuterSectorRowPitch = St_tpcPadConfigC::instance()->outerSectorRowPitch(20);
113 mOuterSectorLength = St_tpcPadConfigC::instance()->outerSectorLength(20);
114 mIoSectorSeparation = St_tpcPadConfigC::instance()->ioSectorSeparation(20);
115 mInnerSectorEdge = St_tpcPadConfigC::instance()->innerSectorEdge(20);
116 mOuterSectorEdge = St_tpcPadConfigC::instance()->outerSectorEdge(20);
118 mSectors = gTpcDbPtr->Dimensions()->numberOfSectors();
119 mIfcRadius = gTpcDbPtr->Dimensions()->ifcRadius();
120 mOfcRadius = gTpcDbPtr->Dimensions()->ofcRadius();
122 mAnodeWireRadius = gTpcDbPtr->WirePlaneGeometry()->anodeWireRadius();
123 mFrischGridWireRadius = gTpcDbPtr->WirePlaneGeometry()->frischGridWireRadius();
124 mGateWireRadius = gTpcDbPtr->WirePlaneGeometry()->gateWireRadius();
125 mAnodeWirePitch = gTpcDbPtr->WirePlaneGeometry()->anodeWirePitch();
126 mFrischGridWirePitch = gTpcDbPtr->WirePlaneGeometry()->frischGridPitch();
127 mGateWirePitch = gTpcDbPtr->WirePlaneGeometry()->gatePitch();
129 mInnerSectorAnodeWirePadPlaneSeparation = gTpcDbPtr->WirePlaneGeometry()->innerSectorAnodeWirePadPlaneSeparation();
130 mInnerSectorFrischGridPadPlaneSeparation = gTpcDbPtr->WirePlaneGeometry()->innerSectorFrischGridPadPlaneSeparation();
131 mInnerSectorGatingGridPadPlaneSeparation = gTpcDbPtr->WirePlaneGeometry()->innerSectorGatingGridPadPlaneSeparation();
132 mOuterSectorAnodeWirePadPlaneSeparation = gTpcDbPtr->WirePlaneGeometry()->outerSectorAnodeWirePadPlaneSeparation();
133 mOuterSectorFrischGridPadPlaneSeparation = gTpcDbPtr->WirePlaneGeometry()->outerSectorFrischGridPadPlaneSeparation();
134 mOuterSectorGatingGridPadPlaneSeparation = gTpcDbPtr->WirePlaneGeometry()->outerSectorGatingGridPadPlaneSeparation();
136 mNumberOfInnerSectorAnodeWires = gTpcDbPtr->WirePlaneGeometry()->numberOfInnerSectorAnodeWires();
137 mFirstInnerSectorAnodeWire = gTpcDbPtr->WirePlaneGeometry()->firstInnerSectorAnodeWire();
138 mLastInnerSectorAnodeWire = gTpcDbPtr->WirePlaneGeometry()->lastInnerSectorAnodeWire();
140 mNumberOfOuterSectorAnodeWires = gTpcDbPtr->WirePlaneGeometry()->numberOfOuterSectorAnodeWires();
141 mFirstOuterSectorAnodeWire = gTpcDbPtr->WirePlaneGeometry()->firstOuterSectorAnodeWire();
142 mLastOuterSectorAnodeWire = gTpcDbPtr->WirePlaneGeometry()->lastOuterSectorAnodeWire();
151 mTimeBuckets = gTpcDbPtr->Electronics()->numberOfTimeBins();
153 mFrischGrid = St_tpcPadConfigC::instance()->outerSectorPadPlaneZ(20) -
154 gTpcDbPtr->WirePlaneGeometry()->outerSectorFrischGridPadPlaneSeparation();
155 mInnerSectorzOffSet = gTpcDbPtr->Dimensions()->zInnerOffset();
156 mOuterSectorzOffSet = gTpcDbPtr->Dimensions()->zOuterOffset();
157 mDriftDistance = gTpcDbPtr->Dimensions()->gatingGridZ();
164 mPadsInRow.resize(mPadRows);
165 for(
unsigned int ii=0; ii<mPadsInRow.size(); ii++)
166 mPadsInRow[ii] = St_tpcPadConfigC::instance()->numberOfPadsAtRow(20,ii+1);
168 mRadialDistanceAtRow.resize(mPadRows);
176 for(
unsigned int jj=1; jj<46; jj++)
177 mRadialDistanceAtRow[jj-1] = St_tpcPadConfigC::instance()->radialDistanceAtRow(20,jj);
181 mIfcRadius *= centimeter;
182 mOfcRadius *= centimeter;
183 mEndCapZ *= centimeter;
184 mInnerSectorPadWidth *= centimeter;
185 mInnerSectorPadLength *= centimeter;
186 mInnerSectorPadPitch *= centimeter;
187 mInnerSectorRowPitch1 *= centimeter;
188 mInnerSectorRowPitch2 *= centimeter;
189 mFirstPadRow *= centimeter;
190 mFirstOuterSectorPadRow *= centimeter;
191 mLastOuterSectorPadRow *= centimeter;
192 mFirstRowWidth *= centimeter;
193 mLastRowWidth *= centimeter;
194 mInnerSectorEdge *= centimeter;
196 mOuterSectorPadWidth *= centimeter;
197 mOuterSectorPadLength *= centimeter;
198 mOuterSectorPadPitch *= centimeter;
199 mOuterSectorRowPitch *= centimeter;
200 mOuterSectorLength *= centimeter;
202 mIoSectorSeparation *= centimeter;
203 mOuterSectorEdge *= centimeter;
206 mFrischGrid *= centimeter;
207 mDriftDistance *= centimeter;
208 mInnerSectorzOffSet *= centimeter;
209 mOuterSectorzOffSet *= centimeter;
211 for(
unsigned int k=0; k<mRadialDistanceAtRow.size(); k++)
212 mRadialDistanceAtRow[k] *= centimeter;
215 mAnodeWirePitch *= centimeter;
216 mFrischGridWirePitch *= centimeter;
217 mGateWirePitch *= centimeter;
218 mAnodeWireRadius *= centimeter;
219 mFrischGridWireRadius *= centimeter;
220 mGateWireRadius *= centimeter;
222 mInnerSectorAnodeWirePadPlaneSeparation *= centimeter;
223 mInnerSectorFrischGridPadPlaneSeparation *= centimeter;
224 mInnerSectorGatingGridPadPlaneSeparation *= centimeter;
226 mOuterSectorAnodeWirePadPlaneSeparation *= centimeter;
227 mOuterSectorFrischGridPadPlaneSeparation *= centimeter;
228 mOuterSectorGatingGridPadPlaneSeparation *= centimeter;
230 mFirstInnerSectorAnodeWire *= centimeter;
231 mLastInnerSectorAnodeWire *= centimeter;
233 mFirstOuterSectorAnodeWire *= centimeter;
234 mLastOuterSectorAnodeWire *= centimeter;
236 StTpcDbGeometry::~StTpcDbGeometry()
239 mRadialDistanceAtRow.clear();
242 StTpcDbGeometry::instance()
245 #ifndef ST_NO_EXCEPTIONS
246 throw invalid_argument(
"StTpcDbGeometry::getInstance(): Argument Missing!");
248 std::cerr <<
"StTpcDbGeometry::getInstance(): Argument Missing!" << endl;
249 std::cerr <<
"No arguments for instantiantion" << endl;
250 std::cerr <<
"Aborting..." << endl;
258 StTpcDbGeometry::instance(
StTpcDb* gDbPtr)
264 std::cerr <<
"StTpcDbGeometry::instance()" << endl;
265 std::cerr <<
"\tWARNING:" << endl;
266 std::cerr <<
"\tSingleton class is already instantiated" << endl;
267 std::cerr <<
"\tDataSet Argument ignored!!" << endl;
268 std::cerr <<
"\tContinuing..." << endl;
273 int StTpcDbGeometry::numberOfPadsAtRow(
int r)
const
275 if(r<1 || r>mPadRows) {
276 #ifndef ST_NO_EXCEPTIONS
277 throw invalid_argument(
"Row limits are from 1--45");
279 std::cerr <<
"Error in StTpcDbGeometry::numberOfPadsAtRow() "
280 <<
"Row limits [1--" << mPadRows <<
"]"
281 <<
" (r=" << r <<
")" << endl;
285 return (mPadsInRow[r-1]);
288 double StTpcDbGeometry::radialDistanceAtRow(
int r)
const
290 if(r<0 || r>mPadRows) {
291 #ifndef ST_NO_EXCEPTIONS
292 throw invalid_argument(
"Row limits are from 1--45");
294 std::cerr <<
"Error in StTpcDbGeometry::numberOfPadsAtRow() "
295 <<
"Row limits [1--" << mPadRows <<
"]"
296 <<
" (r=" << r <<
")" << endl;
300 return (mRadialDistanceAtRow[r-1]);
303 double StTpcDbGeometry::outerSectorAnodeWire(
int n)
const
305 if(n>0 && n<numberOfOuterSectorAnodeWires()) {
306 #ifndef ST_NO_EXCEPTIONS
307 throw range_error(
"Invalid wire number");
309 std::cerr <<
"Wire Range must be 0 < n < " << numberOfOuterSectorAnodeWires() << endl;
310 std::cerr <<
"Aborting..." << endl;
314 return (firstOuterSectorAnodeWire() + (n-1)*anodeWirePitch());
317 double StTpcDbGeometry::innerSectorAnodeWire(
int n)
const
319 if(n>0 && n<numberOfInnerSectorAnodeWires()) {
320 #ifndef ST_NO_EXCEPTIONS
321 throw range_error(
"Invalid wire number");
323 std::cerr <<
"Wire Range must be 0 < n < " << numberOfInnerSectorAnodeWires() << endl;
324 std::cerr <<
"Aborting..." << endl;
328 return (firstInnerSectorAnodeWire() + (n-1)*anodeWirePitch());
334 double radial = ::sqrt((tmp.x()*tmp.x())+(tmp.y()*tmp.y()));
336 if((radial > mIfcRadius) &&
337 (radial < mOfcRadius) &&
338 (fabs(tmp.z()) < mEndCapZ))
344 void StTpcDbGeometry::print(ostream& os)
const
347 os <<
"STAR-TPC DataBase" << endl;
348 os <<
"==========================================" << endl;
349 os <<
"padRows = " << mPadRows << endl;
350 os <<
"timeBuckets = " << mTimeBuckets << endl;
351 os <<
"sectors = " << mSectors << endl;
352 os <<
"\nField Cage:" << endl;
353 os <<
"ifcRadius = " << mIfcRadius/millimeter <<
" mm" << endl;
354 os <<
"ofcRadius = " << mOfcRadius/millimeter <<
" mm" << endl;
355 os <<
"endCapZ = " << mEndCapZ/millimeter <<
" mm" << endl;
356 os <<
"DriftDistance = " << mDriftDistance/millimeter <<
" mm" << endl;
357 os <<
"innerSectorzOffSet = " << mInnerSectorzOffSet/millimeter <<
" mm" << endl;
358 os <<
"outerSectorzOffSet = " << mOuterSectorzOffSet/millimeter <<
" mm" << endl;
359 os <<
"\nPads & Rows:" << endl;
360 os <<
"innerSectorPadWidth = " << mInnerSectorPadWidth/millimeter <<
" mm" << endl;
361 os <<
"innerSectorPadLength = " << mInnerSectorPadLength/millimeter <<
" mm" << endl;
362 os <<
"innerSectorPadPitch = " << mInnerSectorPadPitch/millimeter <<
" mm" << endl;
363 os <<
"innerSectorRowPitch1 = " << mInnerSectorRowPitch1/millimeter <<
" mm" << endl;
364 os <<
"innerSectorRowPitch2 = " << mInnerSectorRowPitch2/millimeter <<
" mm" << endl;
365 os <<
"firstPadRow = " << mFirstPadRow/millimeter <<
" mm" << endl;
366 os <<
"firstOuterSectorPadRow = " << mFirstOuterSectorPadRow/millimeter <<
" mm" << endl;
367 os <<
"lastOuterSectorPadRow = " << mLastOuterSectorPadRow/millimeter <<
" mm" << endl;
368 os <<
"firstRowWidth = " << mFirstRowWidth/millimeter <<
" mm" << endl;
369 os <<
"lastRowWidth = " << mLastRowWidth/millimeter <<
" mm" << endl;
370 os <<
"outerSectorPadWidth = " << mOuterSectorPadWidth/millimeter <<
" mm" << endl;
371 os <<
"outerSectorPadLength = " << mOuterSectorPadLength/millimeter <<
" mm" << endl;
372 os <<
"outerSectorPadPitch = " << mOuterSectorPadPitch /millimeter <<
" mm" << endl;
373 os <<
"outerSectorRowPitch = " << mOuterSectorRowPitch/millimeter <<
" mm" << endl;
374 os <<
"outerSectorLength = " << mOuterSectorLength /millimeter <<
" mm" << endl;
375 os <<
"ioSectorSeparation = " << mIoSectorSeparation/millimeter <<
" mm" << endl;
376 os <<
"frischGrid = " << mFrischGrid/millimeter <<
" mm" << endl;
377 os <<
"\nWires:" << endl;
378 os <<
"anodeWirePitch = " << mAnodeWirePitch/millimeter <<
" mm" << endl;
379 os <<
"frischGridWirePitch = " << mFrischGridWirePitch/millimeter <<
" mm" << endl;
380 os <<
"gatingGridWirePitch = " << mGateWirePitch/millimeter <<
" mm" << endl;
381 os <<
"anodeWireRadius = " << mAnodeWireRadius/millimeter <<
" um" << endl;
382 os <<
"frischGridWireRadius = " << mFrischGridWireRadius/millimeter <<
" um" << endl;
383 os <<
"gatingGridWireRadius = " << mGateWireRadius/millimeter <<
" um" << endl;
385 os <<
"Inner Sector:" << endl;
386 os <<
"AnodeWirePadPlane Sep = " << mInnerSectorAnodeWirePadPlaneSeparation/millimeter <<
" mm" << endl;
387 os <<
"FrischGridPadPlane Sep = " << mInnerSectorFrischGridPadPlaneSeparation/millimeter <<
" mm" << endl;
388 os <<
"GatingGridPadPlane Sep = " << mInnerSectorGatingGridPadPlaneSeparation/millimeter <<
" mm" << endl;
390 os <<
"Outer Sector:" << endl;
391 os <<
"AnodeWirePadPlane Sep = " << mOuterSectorAnodeWirePadPlaneSeparation/millimeter <<
" mm" << endl;
392 os <<
"FrischGridPadPlane Sep = " << mOuterSectorFrischGridPadPlaneSeparation/millimeter <<
" mm" << endl;
393 os <<
"GatingGridPadPlane Sep = " << mOuterSectorGatingGridPadPlaneSeparation/millimeter <<
" mm" << endl;
395 os <<
"numberOfInnerSectorAnodeWires = " << mNumberOfInnerSectorAnodeWires << endl;
396 os <<
"firstInnerSectorAnodeWire = " << mFirstInnerSectorAnodeWire/millimeter <<
" mm" << endl;
397 os <<
"lastInnerSectorAnodeWire = " << mLastInnerSectorAnodeWire/millimeter <<
" mm" << endl;
398 os <<
"numberOfOuterSectorAnodeWires = " << mNumberOfOuterSectorAnodeWires << endl;
399 os <<
"firstOuterSectorAnodeWire = " << mFirstOuterSectorAnodeWire/millimeter <<
" mm" << endl;
400 os <<
"lastOuterSectorAnodeWire = " << mLastOuterSectorAnodeWire/millimeter <<
" mm" << endl;
401 os <<
"innerSectorEdge = " << mInnerSectorEdge/millimeter <<
" mm" << endl;
402 os <<
"outerSectorEdge = " << mOuterSectorEdge/millimeter <<
" mm" << endl;
405 os <<
" Row Pads Radial Distance to Row" << endl;
406 os <<
"==========================================" << endl;
407 for(
int i=0; i<mPadRows; i++) {
409 os.setf(std::ios::right,std::ios::adjustfield);
414 os << mRadialDistanceAtRow[i]/millimeter <<
" mm" << endl;