5 #define NUMBER_OF_WAFERS 216
6 #include "/afs/rhic/star/packages/DEV/StRoot/StDbLib/StDbDefs.hh"
8 void insertAlignedGeom(
char* unixTime = 0, Bool_t write = kFALSE, Bool_t writeHtml = kTRUE)
10 int numberOfBarrels = 3;
11 int numberOfLadders[3] = {8,12,16};
12 int numberOfWafers[3] = {4,6,7};
13 int barrelRadius[6] = {6.125,7.185,10.185,11.075,13.995,14.935};
14 double theta_xy = 0.0;
15 double theta_xz = 0.0;
16 double theta_yz = 0.0;
17 double delta_x = 0.2332;
22 ofstream file(
"svt_geometry_comp.html");
27 ntuple =
new TNtuple(
"ntuple",
"ntuple",
"x:y:z:xa:ya:za:nx:ny:nz:nxa:nya:nza:dx:dy:dz:dxa:dya:dza:tx:ty:tz:txa:tya:tza:barrel:ladder:wafer");
31 gSystem->Load(
"St_base");
32 gSystem->Load(
"StChain");
33 gSystem->Load(
"StUtilities");
36 gSystem->Load(
"libStDb_Tables.so");
37 gSystem->Load(
"St_Tables.so");
38 gSystem->Load(
"StDbLib");
39 gSystem->Load(
"StDbBroker");
40 gSystem->Load(
"geometry");
41 gSystem->Load(
"St_db_Maker");
42 gSystem->Load(
"StSvtDbMaker");
43 gSystem->Load(
"StSvtClassLibrary");
54 dbMk->SetDateTime(20030102,000000);
62 St_DataSet* dataSet = chain->GetDataSet(
"StSvtGeometry");
66 int* rowIDs=
new int[NUMBER_OF_WAFERS];
67 svtWafersPosition_st *wafersPosition;
72 file <<
"<p>" << endl;
73 file <<
"<b> Time stamp = " <<
"2003-10-31 00:00:00" << endl;
74 file <<
"<p>" << endl;
75 file <<
"<table BORDER=1 WIDTH=\"100%\" >" << endl;
78 file <<
"<td><center><b><font color=\"#FF0000\">barrel</font></b></center></td>"<< endl;
79 file <<
"<td><center><b><font color=\"#FF0000\">ladder</font></b></center></td>"<< endl;
80 file <<
"<td><center><b><font color=\"#FF0000\">wafer</font></b></center></td>"<< endl;
81 file <<
"<td><center><b><font color=\"#FF0000\"> x </font></b></center></td>"<< endl;
82 file <<
"<td><center><b><font color=\"#FF0000\"> y </font></b></center></td>"<< endl;
83 file <<
"<td><center><b><font color=\"#FF0000\"> z </font></b></center></td>"<< endl;
84 file <<
"<td><center><b><font color=\"#FF0000\"> nx </font></b></center></td>"<< endl;
85 file <<
"<td><center><b><font color=\"#FF0000\"> ny </font></b></center></td>"<< endl;
86 file <<
"<td><center><b><font color=\"#FF0000\"> nz </font></b></center></td>"<< endl;
87 file <<
"<td><center><b><font color=\"#FF0000\"> dx </font></b></center></td>"<< endl;
88 file <<
"<td><center><b><font color=\"#FF0000\"> dy </font></b></center></td>"<< endl;
89 file <<
"<td><center><b><font color=\"#FF0000\"> dz </font></b></center></td>"<< endl;
90 file <<
"<td><center><b><font color=\"#FF0000\"> tx </font></b></center></td>"<< endl;
91 file <<
"<td><center><b><font color=\"#FF0000\"> ty </font></b></center></td>"<< endl;
92 file <<
"<td><center><b><font color=\"#FF0000\"> tz </font></b></center></td>"<< endl;
93 file <<
"</tr>" << endl;
97 wafersPosition =
new svtWafersPosition_st[NUMBER_OF_WAFERS];
100 int layer, HardWarePos, index = 0;
103 for (
int barrel =1;barrel <= numberOfBarrels;barrel++) {
104 for (
int ladder =1;ladder <= numberOfLadders[barrel-1];ladder++) {
105 for (
int wafer =1;wafer <= numberOfWafers[barrel-1];wafer++) {
107 index = mSvtGeom->getWaferIndex(barrel,ladder,wafer);
111 cout <<
"No wafer geometry information! Fatal error!!!" << endl;
145 wafersPosition[index].ID = 1000*layer+100*wafer+ladder;
148 float dx, dy, dz, nx, ny, nz, tx, ty, tz;
151 nx = waferGeom->n(0)*cos(theta_xy) - waferGeom->n(1)*sin(theta_xy);
152 ny = waferGeom->n(0)*sin(theta_xy) + waferGeom->n(1)*cos(theta_xy);
153 nz = waferGeom->n(2);
154 dx = waferGeom->d(0)*cos(theta_xy) - waferGeom->d(1)*sin(theta_xy);
155 dy = waferGeom->d(0)*sin(theta_xy) + waferGeom->d(1)*cos(theta_xy);
156 dz = waferGeom->d(2);
157 tx = waferGeom->t(0)*cos(theta_xy) - waferGeom->t(1)*sin(theta_xy);
158 ty = waferGeom->t(0)*sin(theta_xy) + waferGeom->t(1)*cos(theta_xy);
159 tz = waferGeom->t(2);
162 nx = nx*cos(theta_xz) - nz*sin(theta_xz);
164 nz = nx*sin(theta_xz) + nz*cos(theta_xz);
165 dx = dx*cos(theta_xz) - dz*sin(theta_xz);
167 dz = dx*sin(theta_xz) + dz*cos(theta_xz);
168 tx = tx*cos(theta_xz) - tz*sin(theta_xz);
170 tz = tx*sin(theta_xz) + tz*cos(theta_xz);
174 ny = ny*cos(theta_yz) - nz*sin(theta_yz);
175 nz = ny*sin(theta_yz) + nz*cos(theta_yz);
177 dy = dy*cos(theta_yz) - dz*sin(theta_yz);
178 dz = dy*sin(theta_yz) + dz*cos(theta_yz);
180 ty = ty*cos(theta_yz) - tz*sin(theta_yz);
181 tz = ty*sin(theta_yz) + tz*cos(theta_yz);
188 d = 3.1525*(2*(2.5-wafer));
192 d = 3.1525*(2*(3.5-wafer));
196 d = 3.1525*(2*(4-wafer));
201 rx = waferGeom->x(0)*cos(theta_xy) - waferGeom->x(1)*sin(theta_xy);
202 ry = waferGeom->x(0)*sin(theta_xy) + waferGeom->x(1)*cos(theta_xy);
203 rz = waferGeom->x(2);
206 rx = rx + d*sin(theta_xz);
208 rz = rz + d*(1-cos(theta_xz));
212 ry = ry + d*sin(theta_yz);
213 rz = rz + d*(1-cos(theta_yz));
220 wafersPosition[index].driftDirection[0] = dx;
221 wafersPosition[index].driftDirection[1] = dy;
222 wafersPosition[index].driftDirection[2] = dz;
223 wafersPosition[index].normalDirection[0] = nx;
224 wafersPosition[index].normalDirection[1] = ny;
225 wafersPosition[index].normalDirection[2] = nz;
226 wafersPosition[index].transverseDirection[0] = tx;
227 wafersPosition[index].transverseDirection[1] = ty;
228 wafersPosition[index].transverseDirection[2] = tz;
230 wafersPosition[index].centerPosition[0] = rx;
231 wafersPosition[index].centerPosition[1] = ry;
232 wafersPosition[index].centerPosition[2] = rz;
234 nt[0] = waferGeom->x(0);
235 nt[1] = waferGeom->x(1);
236 nt[2] = waferGeom->x(2);
240 nt[6] = waferGeom->n(0);
241 nt[7] = waferGeom->n(1);
242 nt[8] = waferGeom->n(2);
246 nt[12] = waferGeom->d(0);
247 nt[13] = waferGeom->d(1);
248 nt[14] = waferGeom->d(2);
252 nt[18] = waferGeom->t(0);
253 nt[19] = waferGeom->t(1);
254 nt[20] = waferGeom->t(2);
265 <<
"<td><center><b>" << barrel <<
"</b></center></td>"
266 <<
"<td><center><b>" << ladder <<
"</b></center></td>"
267 <<
"<td><center><b>" << wafer <<
"</b></center></td>"
268 <<
"<td><center><b>" << rx <<
"</b></center></td>"
269 <<
"<td><center><b>" << ry <<
"</b></center></td>"
270 <<
"<td><center><b>" << rz <<
"</b></center></td>"
271 <<
"<td><center><b>" << nx <<
"</b></center></td>"
272 <<
"<td><center><b>" << ny <<
"</b></center></td>"
273 <<
"<td><center><b>" << nz <<
"</b></center></td>"
274 <<
"<td><center><b>" << dx <<
"</b></center></td>"
275 <<
"<td><center><b>" << dy <<
"</b></center></td>"
276 <<
"<td><center><b>" << dz <<
"</b></center></td>"
277 <<
"<td><center><b>" << tx <<
"</b></center></td>"
278 <<
"<td><center><b>" << ty <<
"</b></center></td>"
279 <<
"<td><center><b>" << tz <<
"</b></center></td>"
280 <<
"</tr></b>" << endl;
284 <<
"<td><center>" << barrel <<
"</center></td>"
285 <<
"<td><center>" << ladder <<
"</center></td>"
286 <<
"<td><center>" << wafer <<
"</center></td>"
287 <<
"<td><center>" << waferGeom->x(0) <<
"</center></td>"
288 <<
"<td><center>" << waferGeom->x(1) <<
"</center></td>"
289 <<
"<td><center>" << waferGeom->x(2) <<
"</center></td>"
290 <<
"<td><center>" << waferGeom->n(0) <<
"</center></td>"
291 <<
"<td><center>" << waferGeom->n(1) <<
"</center></td>"
292 <<
"<td><center>" << waferGeom->n(2) <<
"</center></td>"
293 <<
"<td><center>" << waferGeom->d(0) <<
"</center></td>"
294 <<
"<td><center>" << waferGeom->d(1) <<
"</center></td>"
295 <<
"<td><center>" << waferGeom->d(2) <<
"</center></td>"
296 <<
"<td><center>" << waferGeom->t(0) <<
"</center></td>"
297 <<
"<td><center>" << waferGeom->t(1) <<
"</center></td>"
298 <<
"<td><center>" << waferGeom->t(2) <<
"</center></td>"
310 cout <<
"index = " << index <<
", ID = " << wafersPosition[index].ID << endl;
316 file <<
"</table>" << endl;
331 StDbTable* svtGeomTable = svtGeomNode->addDbTable(
"svtWafersPosition");
332 svtGeomTable->
SetTable((
char*)wafersPosition,NUMBER_OF_WAFERS,rowIDs);
334 mgr->setStoreTime(unixTime);
335 cout<<
" Will attempt store with timestamp="<<mgr->getDateStoreTime()<<endl;
336 mgr->storeDbTable(svtGeomTable);
338 delete [] wafersPosition;
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc'd version of data for StRoot
virtual TObject * GetObject() const
The depricated method (left here for the sake of the backward compatibility)
static StDbManager * Instance()
strdup(..) is not ANSI