15 #include <TGeoVolume.h>
20 static char XYZ[3] = {
'X',
'Y',
'Z'};
37 FILE *fin = fopen(fileName.Data(),
"r");
39 printf(
"-E- EicBeamLineElementMap::Initialize() -> fail to open '%s' file!\n", fileName.Data());
46 fgets(buffer, 1024-1, fin);
54 if (fscanf(fin,
"%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n",
55 A+0, A+1, A+2, A+3, A+4, A+5, A+6, A+7, A+8, b+0, b+1, b+2) != 12) {
56 printf(
"-E- EicBeamLineElementMap::Initialize() -> file '%s': wrong input format!\n", fileName.Data());
60 printf(
"%15.10f %15.10f %15.10f %15.10f %15.10f %15.10f %15.10f %15.10f %15.10f ... %15.10f %15.10f %15.10f\n",
61 A[0], A[1], A[2], A[3], A[4], A[5], A[6], A[7], A[8], b[0], b[1], b[2]);
64 TGeoRotation *
rw =
new TGeoRotation();
67 mTransformation =
new TGeoCombiTrans(100.0 * b[0], 100.0 * b[1], 100.0 * b[2], rw);
71 fgets(buffer, 1024-1, fin);
77 double x0, x1,
dx, y0, y1,
dy, z0,
z1,
dz;
79 if (fscanf(fin,
"%lf,%lf,%d,%lf,%lf,%lf,%d,%lf,%lf,%lf,%d,%lf\n",
80 &x0, &x1, &Nx, &dx, &y0, &y1, &Ny, &dy, &z0, &z1, &Nz, &dz) != 12) {
81 printf(
"-E- EicBeamLineElementMap::Initialize() -> file '%s': wrong input format!\n", fileName.Data());
91 double origin[3] = {100.0 * (x0+x1)/2, 100.0 * (y0+y1)/2, 100.0 * (z0+
z1)/2};
92 mShape =
dynamic_cast<TGeoShape*
>(TGeoBBox(100.0 * (x1-x0)/2, 100.0 * (y1-y0)/2,
93 100.0 * (z1-z0)/2, origin).Clone());
101 int dim[3] = {Nx, Ny, Nz};
103 double min[3] = {x0 - dx/2, y0 - dy/2, z0 - dz/2},
max[3] = {x1 + dx/2, y1 + dy/2, z1 + dz/2};
108 assert(csystem && fsystem);
111 for(
int ik=0; ik<3; ik++) {
123 printf(
"-E- EicBeamLineElementMap::Initialize(): !!! most likely you ran out of memory !!!\n\n");
133 fgets(buffer, 1024-1, fin);
137 unsigned dim3D = Nx*Ny*Nz;
143 for(
unsigned lc=0; lc<dim3D; lc++) {
147 if (fscanf(fin,
"%lf,%lf,%lf,%lf,%lf,%lf\n",
148 xx+0, xx+1, xx+2, BB+0, BB+1, BB+2) != 6) {
149 printf(
"-E- EicBeamLineElementMap::Initialize() -> file '%s': wrong input format!\n", fileName.Data());
154 for(
unsigned iq=0; iq<3; iq++)
158 for(
unsigned iq=0; iq<3; iq++)
160 cell->
B[iq] = 10.0 * BB[iq] *
mScale;
173 if (fscanf(fin,
"Length,%lf\n", &
mLength) != 1 ||
174 fscanf(fin,
"Angle,%lf\n", &
mAngle) != 1 ||
175 fscanf(fin,
"Bore,%lf\n", &
mBore) != 1) {
176 printf(
"-E- EicBeamLineElementMap::Initialize() -> file '%s': bore information missing!\n", fileName.Data());
203 double global[3] = {-4.9, -4.6, 950}, local[3];
208 printf(
"local[]: %f %f %f -> B[] = %f %f %f -> (%d)\n", local[0], local[1], local[2], B[0], B[1], B[2],
Contains(global));
exit(0);
229 TVector3 xlv(xl[0], xl[1], xl[2]), BLV;
232 for(
unsigned iq=0; iq<3; iq++)
238 double BL[3] = {BLV[0], BLV[1], BLV[2]};
250 #define _EXTRA_BORE_WIDTH_ (100.0)
252 #define _IRON_ ("iron")
253 #define _VACUUM_ ("vacuum")
254 #define _ALUMINUM_ ("aluminum")
256 #include <TGeoManager.h>
267 char yokeIronName[128], yokeVacuumName[128];
270 snprintf(yokeVacuumName, 128-1,
"%s-Vacuum",
GetDetectorName().Data());
274 TGeoBBox *yoke =
new TGeoBBox(yokeIronName,
282 mYoke->RegisterYourself();
287 TGeoTube *vacuum =
new TGeoTube(yokeVacuumName,
291 TGeoVolume *vvacuum =
new TGeoVolume(yokeVacuumName, vacuum, mediaHub->
GetMedium(
_VACUUM_));
292 vvacuum->RegisterYourself();
294 mYoke->AddNode(vvacuum, 0,
new TGeoTranslation(origin[0], origin[1], origin[2]));