77 #include "SystemOfUnits.h"
78 #ifndef ST_NO_NAMESPACES
79 using namespace units;
81 #ifndef ST_NO_EXCEPTIONS
83 # if !defined(ST_NO_NAMESPACES)
84 using std::invalid_argument;
85 using std::range_error;
89 #include "StTpcSimpleGeometry.hh"
90 #include "StGetConfigValue.hh"
94 StTpcSimpleGeometry::StTpcSimpleGeometry() { }
96 StTpcSimpleGeometry::StTpcSimpleGeometry(
const char* file)
98 StGetConfigValue(file,
"padRows",mPadRows);
99 StGetConfigValue(file,
"innerPadRows",mInnerPadRows);
100 StGetConfigValue(file,
"innerPadRows48",mInnerPadRows48);
101 StGetConfigValue(file,
"innerPadRows52",mInnerPadRows52);
102 StGetConfigValue(file,
"outerPadRows",mOuterPadRows);
103 StGetConfigValue(file,
"timeBuckets",mTimeBuckets);
104 StGetConfigValue(file,
"sectors",mSectors);
105 StGetConfigValue(file,
"ifcRadius",mIfcRadius);
106 StGetConfigValue(file,
"ofcRadius",mOfcRadius);
107 StGetConfigValue(file,
"endCapZ",mEndCapZ);
108 StGetConfigValue(file,
"innerSectorPadWidth",mInnerSectorPadWidth);
109 StGetConfigValue(file,
"innerSectorPadLength",mInnerSectorPadLength);
110 StGetConfigValue(file,
"innerSectorPadPitch",mInnerSectorPadPitch);
111 StGetConfigValue(file,
"innerSectorRowPitch1",mInnerSectorRowPitch1);
112 StGetConfigValue(file,
"innerSectorRowPitch2",mInnerSectorRowPitch2);
113 StGetConfigValue(file,
"firstPadRow",mFirstPadRow);
114 StGetConfigValue(file,
"firstOuterSectorPadRow",mFirstOuterSectorPadRow);
115 StGetConfigValue(file,
"lastOuterSectorPadRow",mLastOuterSectorPadRow);
116 StGetConfigValue(file,
"firstRowWidth",mFirstRowWidth);
117 StGetConfigValue(file,
"lastRowWidth",mLastRowWidth);
118 StGetConfigValue(file,
"outerSectorPadWidth",mOuterSectorPadWidth);
119 StGetConfigValue(file,
"outerSectorPadLength",mOuterSectorPadLength);
120 StGetConfigValue(file,
"outerSectorPadPitch",mOuterSectorPadPitch);
121 StGetConfigValue(file,
"outerSectorRowPitch",mOuterSectorRowPitch);
122 StGetConfigValue(file,
"outerSectorLength",mOuterSectorLength);
123 StGetConfigValue(file,
"ioSectorSeparation",mIoSectorSeparation);
124 StGetConfigValue(file,
"frischGrid",mFrischGrid);
125 StGetConfigValue(file,
"innerSectorzOffSet",mInnerSectorzOffSet);
126 StGetConfigValue(file,
"outerSectorzOffSet",mOuterSectorzOffSet);
127 StGetConfigValue(file,
"maximumDriftDistance",mDriftDistance);
129 StGetConfigValue(file,
"anodeWirePitch",mAnodeWirePitch);
130 StGetConfigValue(file,
"frischGridWirePitch",mFrischGridWirePitch);
131 StGetConfigValue(file,
"gateWirePitch",mGateWirePitch);
132 StGetConfigValue(file,
"anodeWireRadius",mAnodeWireRadius);
133 StGetConfigValue(file,
"frischGridWireRadius",mFrischGridWireRadius);
134 StGetConfigValue(file,
"gateWireRadius",mGateWireRadius);
136 StGetConfigValue(file,
"iSAnodeWirePadPlaneSeparation",mInnerSectorAnodeWirePadPlaneSeparation);
137 StGetConfigValue(file,
"iSFrischGridPadPlaneSeparation",mInnerSectorFrischGridPadPlaneSeparation);
138 StGetConfigValue(file,
"iSGatingGridPadPlaneSeparation",mInnerSectorGatingGridPadPlaneSeparation);
139 StGetConfigValue(file,
"oSAnodeWirePadPlaneSeparation",mOuterSectorAnodeWirePadPlaneSeparation);
140 StGetConfigValue(file,
"oSFrischGridPadPlaneSeparation",mOuterSectorFrischGridPadPlaneSeparation);
141 StGetConfigValue(file,
"oSGatingGridPadPlaneSeparation",mOuterSectorGatingGridPadPlaneSeparation);
143 StGetConfigValue(file,
"firstInnerSectorAnodeWire",mFirstInnerSectorAnodeWire);
144 StGetConfigValue(file,
"lastInnerSectorAnodeWire",mLastInnerSectorAnodeWire);
145 StGetConfigValue(file,
"numberOfInnerSectorAnodeWires",mNumberOfInnerSectorAnodeWires);
146 StGetConfigValue(file,
"firstOuterSectorAnodeWire",mFirstOuterSectorAnodeWire);
147 StGetConfigValue(file,
"lastOuterSectorAnodeWire",mLastOuterSectorAnodeWire);
148 StGetConfigValue(file,
"numberOfOuterSectorAnodeWires",mNumberOfOuterSectorAnodeWires);
149 StGetConfigValue(file,
"innerSectorEdge",mInnerSectorEdge);
150 StGetConfigValue(file,
"outerSectorEdge",mOuterSectorEdge);
155 mPadsInRow.resize(mPadRows);
156 StGetConfigValue(file,
"padsInRow",mPadsInRow,mPadRows);
158 mRadialDistanceAtRow.resize(mPadRows);
164 for(
int ii=1; ii<9; ii++)
165 mRadialDistanceAtRow[ii-1] =
166 mFirstPadRow+(ii-1)*mInnerSectorRowPitch1;
170 mFirstPadRow + 7*mInnerSectorRowPitch1;
171 for(
int i=9; i<14; i++)
172 mRadialDistanceAtRow[i-1] =
173 base+(i-8)*mInnerSectorRowPitch2;
176 mRadialDistanceAtRow[13] =
177 mFirstPadRow + 7*mInnerSectorRowPitch1 + 5*mInnerSectorRowPitch2 + mIoSectorSeparation;
180 for(
int jj=15; jj<46; jj++)
181 mRadialDistanceAtRow[jj-1] =
182 mFirstOuterSectorPadRow + (jj-14)*mOuterSectorRowPitch;
186 mIfcRadius *= millimeter;
187 mOfcRadius *= millimeter;
188 mEndCapZ *= millimeter;
189 mInnerSectorPadWidth *= millimeter;
190 mInnerSectorPadLength *= millimeter;
191 mInnerSectorPadPitch *= millimeter;
192 mInnerSectorRowPitch1 *= millimeter;
193 mInnerSectorRowPitch2 *= millimeter;
194 mFirstPadRow *= millimeter;
195 mFirstOuterSectorPadRow *= millimeter;
196 mLastOuterSectorPadRow *= millimeter;
197 mFirstRowWidth *= millimeter;
198 mLastRowWidth *= millimeter;
199 mInnerSectorEdge *= millimeter;
201 mOuterSectorPadWidth *= millimeter;
202 mOuterSectorPadLength *= millimeter;
203 mOuterSectorPadPitch *= millimeter;
204 mOuterSectorRowPitch *= millimeter;
205 mOuterSectorLength *= millimeter;
207 mIoSectorSeparation *= millimeter;
208 mOuterSectorEdge *= millimeter;
211 mFrischGrid *= millimeter;
212 mDriftDistance *= millimeter;
213 mInnerSectorzOffSet *= millimeter;
214 mOuterSectorzOffSet *= millimeter;
216 for(
unsigned int j=0; j<mRadialDistanceAtRow.size(); j++)
217 mRadialDistanceAtRow[j] *= millimeter;
220 mAnodeWirePitch *= millimeter;
221 mFrischGridWirePitch *= millimeter;
222 mGateWirePitch *= millimeter;
223 mAnodeWireRadius *= micrometer;
224 mFrischGridWireRadius *= micrometer;
225 mGateWireRadius *= micrometer;
227 mInnerSectorAnodeWirePadPlaneSeparation *= millimeter;
228 mInnerSectorFrischGridPadPlaneSeparation *= millimeter;
229 mInnerSectorGatingGridPadPlaneSeparation *= millimeter;
231 mOuterSectorAnodeWirePadPlaneSeparation *= millimeter;
232 mOuterSectorFrischGridPadPlaneSeparation *= millimeter;
233 mOuterSectorGatingGridPadPlaneSeparation *= millimeter;
235 mFirstInnerSectorAnodeWire *= millimeter;
236 mLastInnerSectorAnodeWire *= millimeter;
238 mFirstOuterSectorAnodeWire *= millimeter;
239 mLastOuterSectorAnodeWire *= millimeter;
242 StTpcSimpleGeometry::~StTpcSimpleGeometry()
245 mRadialDistanceAtRow.clear();
249 StTpcSimpleGeometry::instance()
252 #ifndef ST_NO_EXCEPTIONS
253 throw invalid_argument(
"StTpcSimpleGeometry::getInstance(): Argument Missing!");
255 cerr <<
"StTpcSimpleGeometry::getInstance(): Argument Missing!" << endl;
256 cerr <<
"No arguments for instantiantion" << endl;
257 cerr <<
"Aborting..." << endl;
265 StTpcSimpleGeometry::instance(
const char* file)
271 cerr <<
"StTpcSimpleGeometry::instance()" << endl;
272 cerr <<
"\tWARNING:" << endl;
273 cerr <<
"\tSingleton class is already instantiated" << endl;
274 cerr <<
"\tArgument \"" << file <<
"\" ignored!!" << endl;
275 cerr <<
"\tContinuing..." << endl;
280 int StTpcSimpleGeometry::numberOfPadsAtRow(
int r)
const
282 if(r<1 || r>mPadRows) {
283 #ifndef ST_NO_EXCEPTIONS
284 throw invalid_argument(
"Row limits are from 1--45");
286 cerr <<
"Error in StTpcSimpleGeometry::numberOfPadsAtRow() "
287 <<
"Row limits [1--" << mPadRows <<
"]"
288 <<
" (r=" << r <<
")" << endl;
292 return (mPadsInRow[r-1]);
295 double StTpcSimpleGeometry::radialDistanceAtRow(
int r)
const
297 if(r<0 || r>mPadRows) {
298 #ifndef ST_NO_EXCEPTIONS
299 throw invalid_argument(
"Row limits are from 1--45");
301 cerr <<
"Error in StTpcSimpleGeometry::numberOfPadsAtRow() "
302 <<
"Row limits [1--" << mPadRows <<
"]"
303 <<
" (r=" << r <<
")" << endl;
307 return (mRadialDistanceAtRow[r-1]);
310 double StTpcSimpleGeometry::outerSectorAnodeWire(
int n)
const
312 if(n>0 && n<numberOfOuterSectorAnodeWires()) {
313 #ifndef ST_NO_EXCEPTIONS
314 throw range_error(
"Invalid wire number");
316 cerr <<
"Wire Range must be 0 < n < " << numberOfOuterSectorAnodeWires() << endl;
317 cerr <<
"Aborting..." << endl;
321 return (firstOuterSectorAnodeWire() + (n-1)*anodeWirePitch());
324 double StTpcSimpleGeometry::innerSectorAnodeWire(
int n)
const
326 if(n>0 && n<numberOfInnerSectorAnodeWires()) {
327 #ifndef ST_NO_EXCEPTIONS
328 throw range_error(
"Invalid wire number");
330 cerr <<
"Wire Range must be 0 < n < " << numberOfInnerSectorAnodeWires() << endl;
331 cerr <<
"Aborting..." << endl;
335 return (firstInnerSectorAnodeWire() + (n-1)*anodeWirePitch());
341 double radial = ::sqrt((tmp.x()*tmp.x())+(tmp.y()*tmp.y()));
343 if((radial > mIfcRadius) &&
344 (radial < mOfcRadius) &&
345 (fabs(tmp.z()) < mEndCapZ))
351 void StTpcSimpleGeometry::print(ostream& os)
const
354 os <<
"STAR-TPC DataBase" << endl;
355 os <<
"==========================================" << endl;
356 os <<
"padRows = " << mPadRows << endl;
357 os <<
"timeBuckets = " << mTimeBuckets << endl;
358 os <<
"sectors = " << mSectors << endl;
359 os <<
"\nField Cage:" << endl;
360 os <<
"ifcRadius = " << mIfcRadius/millimeter <<
" mm" << endl;
361 os <<
"ofcRadius = " << mOfcRadius/millimeter <<
" mm" << endl;
362 os <<
"endCapZ = " << mEndCapZ/millimeter <<
" mm" << endl;
363 os <<
"DriftDistance = " << mDriftDistance/millimeter <<
" mm" << endl;
364 os <<
"innerSectorzOffSet = " << mInnerSectorzOffSet/millimeter <<
" mm" << endl;
365 os <<
"outerSectorzOffSet = " << mOuterSectorzOffSet/millimeter <<
" mm" << endl;
366 os <<
"\nPads & Rows:" << endl;
367 os <<
"innerSectorPadWidth = " << mInnerSectorPadWidth/millimeter <<
" mm" << endl;
368 os <<
"innerSectorPadLength = " << mInnerSectorPadLength/millimeter <<
" mm" << endl;
369 os <<
"innerSectorPadPitch = " << mInnerSectorPadPitch/millimeter <<
" mm" << endl;
370 os <<
"innerSectorRowPitch1 = " << mInnerSectorRowPitch1/millimeter <<
" mm" << endl;
371 os <<
"innerSectorRowPitch2 = " << mInnerSectorRowPitch2/millimeter <<
" mm" << endl;
372 os <<
"firstPadRow = " << mFirstPadRow/millimeter <<
" mm" << endl;
373 os <<
"firstOuterSectorPadRow = " << mFirstOuterSectorPadRow/millimeter <<
" mm" << endl;
374 os <<
"lastOuterSectorPadRow = " << mLastOuterSectorPadRow/millimeter <<
" mm" << endl;
375 os <<
"firstRowWidth = " << mFirstRowWidth/millimeter <<
" mm" << endl;
376 os <<
"lastRowWidth = " << mLastRowWidth/millimeter <<
" mm" << endl;
377 os <<
"outerSectorPadWidth = " << mOuterSectorPadWidth/millimeter <<
" mm" << endl;
378 os <<
"outerSectorPadLength = " << mOuterSectorPadLength/millimeter <<
" mm" << endl;
379 os <<
"outerSectorPadPitch = " << mOuterSectorPadPitch /millimeter <<
" mm" << endl;
380 os <<
"outerSectorRowPitch = " << mOuterSectorRowPitch/millimeter <<
" mm" << endl;
381 os <<
"outerSectorLength = " << mOuterSectorLength /millimeter <<
" mm" << endl;
382 os <<
"ioSectorSeparation = " << mIoSectorSeparation/millimeter <<
" mm" << endl;
383 os <<
"frishGrid = " << mFrischGrid/millimeter <<
" mm" << endl;
384 os <<
"\nWires:" << endl;
385 os <<
"anodeWirePitch = " << mAnodeWirePitch/millimeter <<
" mm" << endl;
386 os <<
"frischGridWirePitch = " << mFrischGridWirePitch/millimeter <<
" mm" << endl;
387 os <<
"gatingGridWirePitch = " << mGateWirePitch/millimeter <<
" mm" << endl;
388 os <<
"anodeWireRadius = " << mAnodeWireRadius/millimeter <<
" um" << endl;
389 os <<
"frischGridWireRadius = " << mFrischGridWireRadius/millimeter <<
" um" << endl;
390 os <<
"gatingGridWireRadius = " << mGateWireRadius/millimeter <<
" um" << endl;
392 os <<
"Inner Sector:" << endl;
393 os <<
"AnodeWirePadPlane Sep = " << mInnerSectorAnodeWirePadPlaneSeparation/millimeter <<
" mm" << endl;
394 os <<
"FrischGridPadPlane Sep = " << mInnerSectorFrischGridPadPlaneSeparation/millimeter <<
" mm" << endl;
395 os <<
"GatingGridPadPlane Sep = " << mInnerSectorGatingGridPadPlaneSeparation/millimeter <<
" mm" << endl;
397 os <<
"Outer Sector:" << endl;
398 os <<
"AnodeWirePadPlane Sep = " << mOuterSectorAnodeWirePadPlaneSeparation/millimeter <<
" mm" << endl;
399 os <<
"FrischGridPadPlane Sep = " << mOuterSectorFrischGridPadPlaneSeparation/millimeter <<
" mm" << endl;
400 os <<
"GatingGridPadPlane Sep = " << mOuterSectorGatingGridPadPlaneSeparation/millimeter <<
" mm" << endl;
402 os <<
"numberOfInnerSectorAnodeWires = " << mNumberOfInnerSectorAnodeWires << endl;
403 os <<
"firstInnerSectorAnodeWire = " << mFirstInnerSectorAnodeWire/millimeter <<
" mm" << endl;
404 os <<
"lastInnerSectorAnodeWire = " << mLastInnerSectorAnodeWire/millimeter <<
" mm" << endl;
405 os <<
"numberOfOuterSectorAnodeWires = " << mNumberOfOuterSectorAnodeWires << endl;
406 os <<
"firstOuterSectorAnodeWire = " << mFirstOuterSectorAnodeWire/millimeter <<
" mm" << endl;
407 os <<
"lastOuterSectorAnodeWire = " << mLastOuterSectorAnodeWire/millimeter <<
" mm" << endl;
408 os <<
"innerSectorEdge = " << mInnerSectorEdge/millimeter <<
" mm" << endl;
409 os <<
"outerSectorEdge = " << mOuterSectorEdge/millimeter <<
" mm" << endl;
412 os <<
" Row Pads Radial Distance to Row" << endl;
413 os <<
"==========================================" << endl;
414 for(
int i=0; i<mPadRows; i++) {
416 os.setf(ios::right,ios::adjustfield);
421 os << mRadialDistanceAtRow[i]/millimeter <<
" mm" << endl;