14 #include <TClassTable.h>
16 #include <StarMagField.h>
27 #define _CELL_SIZE_ (float(4.0))
33 char fname[FILENAME_MAX];
34 snprintf(fname, FILENAME_MAX-1,
"SolenoidMap%d.dat",
_MAP_ID_);
35 FILE *fout = fopen(fname,
"w");
37 printf(
"Failed to open '%s' for writing!\n", fname);
41 unsigned nodes[3] = {101, 101, 401};
42 float xmin[3] = { 0.0, 0.0, -800.0};
43 float xmax[3] = { 400.0, 400.0, 800.0};
46 fprintf(fout,
"Solenoid\n");
48 for(
unsigned iq=0; iq<3; iq++)
49 fprintf(fout,
"%6.1f %6.1f %3d\n", xmin[iq], xmax[iq], nodes[iq]);
52 for(
unsigned ix=0; ix<nodes[0]; ix++)
53 for(
unsigned iy=0; iy<nodes[1]; iy++)
54 for(
unsigned iz=0; iz<nodes[2]; iz++) {
57 xmin[2] + iz*_CELL_SIZE_},
B[3];
59 StarMagField::Instance()->BField(xx,
B);
62 for(
unsigned iq=0; iq<3; iq++)
65 fprintf(fout,
"%10.3f %10.3f %10.3f\n",
B[0],
B[1],
B[2]);