105{
107 if ( map == nullptr ) return;
110
111 TTree*
tree =
new TTree(
"BFieldSolenoid",
"BFieldSolenoid version 4" );
114 double rmin = map->
rmin();
115 double rmax = map->
rmax();
116 double phimin = map->
phimin();
117 double phimax = map->
phimax();
118 int nmeshz = map->
nmesh(0);
119 int nmeshr = map->
nmesh(1);
120 int nmeshphi = map->
nmesh(2);
121 double *meshz;
122
123 double *meshr;
124
125 double *meshphi;
126 int nfield = nmeshz*nmeshr*nmeshphi;
127 double *fieldz;
128
129 double *fieldr;
130
131 double *fieldphi;
132 meshz = new double[nmeshz];
133 meshr = new double[nmeshr];
134 meshphi = new double[nmeshphi];
135 fieldz = new double[nfield];
136 fieldr = new double[nfield];
137 fieldphi = new double[nfield];
138
139 tree->Branch(
"zmin", &zmin,
"zmin/D" );
140 tree->Branch(
"zmax", &zmax,
"zmax/D" );
141 tree->Branch(
"rmin", &rmin,
"rmin/D" );
142 tree->Branch(
"rmax", &rmax,
"rmax/D" );
143 tree->Branch(
"phimin", &phimin,
"phimin/D" );
144 tree->Branch(
"phimax", &phimax,
"phimax/D" );
145 tree->Branch(
"nmeshz", &nmeshz,
"nmeshz/I" );
146 tree->Branch(
"meshz", meshz,
"meshz[nmeshz]/D" );
147 tree->Branch(
"nmeshr", &nmeshr,
"nmeshr/I" );
148 tree->Branch(
"meshr", meshr,
"meshr[nmeshr]/D" );
149 tree->Branch(
"nmeshphi", &nmeshphi,
"nmeshphi/I" );
150 tree->Branch(
"meshphi", meshphi,
"meshphi[nmeshphi]/D" );
151 tree->Branch(
"nfield", &nfield,
"nfield/I" );
152 tree->Branch(
"fieldz", fieldz,
"fieldz[nfield]/D" );
153 tree->Branch(
"fieldr", fieldr,
"fieldr[nfield]/D" );
154 tree->Branch(
"fieldphi", fieldphi,
"fieldphi[nfield]/D" );
155
156 for ( int j = 0; j < nmeshz; j++ ) {
157 meshz[j] = map->
mesh(0,j);
158 }
159 for ( int j = 0; j < nmeshr; j++ ) {
160 meshr[j] = map->
mesh(1,j);
161 }
162 for ( int j = 0; j < nmeshphi; j++ ) {
163 meshphi[j] = map->
mesh(2,j);
164 }
165 for ( int j = 0; j < nfield; j++ ) {
166 const BFieldVector<double>
f = map->
field(j);
169 fieldphi[j] =
f.phi();
170 }
171
174
175 delete[] meshz;
176 delete[] meshr;
177 delete[] meshphi;
178 delete[] fieldz;
179 delete[] fieldr;
180 delete[] fieldphi;
181}
double rmax() const
maximum in r
unsigned nmesh(size_t axis) const
number of cells along each axis = 0 (z), 1 (r), 2 (phi)
double zmax() const
maximum in z
const BFieldVector< T > & field(size_t index) const
field vector at cell corner at index
double phimax() const
maximum in phi
double mesh(size_t axis, size_t index) const
coordinate along axis (0 (z), 1 (r), 2 (phi)) of the cell at index (0 to nmesh-1)
double zmin() const
minimum in z
double rmin() const
minimun in r
double phimin() const
minimun in phi