Magnetic Field Maps for Solenoid
Several field maps exists for the GlueX superconducting solenoidal magnet. This page lists them along with some notes for each and how to specify one in the simulation/reconstruction software.
Contents
Location of the Field Maps
The map files themselves are stored as JANA resources, accessible via the web on a JLab server. The exact location is contained in an entry in the CCDB. Generally, retrieval and storage of the appropriate map files to the local computer is done automatically when a simrecon program is run so users don't need to do anything special to get these. A typical situation would have one or more files in the local directory $JANA_RESOURCE_DIR/Magnets/Solenoid.
How simrecon determines the which map to use
When a simrecon program is run (e.g. hd_root) it will look in the CCDB for an entry in the Magnets/Solenoid/solenoid_map item. This will contain a single string specifying the specific map to look for in the CCDB. To see a list of maps by run number, do the following:
> ccdb vers Magnets/Solenoid/solenoid_map (ID) (Created) (Modified) (variation) (run range) (comments) 94913 20180114 151151 20180114 151151 default 4084340848 94909 20180114 020603 20180114 020603 default 40853inf 94884 20180113 051205 20180113 051205 default 40844inf 22955 20170206 081637 20170206 081637 default 30000inf 22954 20170206 081418 20170206 081418 default 30000inf 17522 20161214 215326 20161214 215326 default 21913inf 17451 20161201 175217 20161201 175217 mc_generic 0inf ...
To see the map that would be used for a specific run, (e.g. run 41234) do the following:
> ccdb r 41234 cat Magnets/Solenoid/solenoid_map Working run is 41234 ++  map_name   string  ++  Magnets/Solenoid/solenoid_1350A_poisson_20160222  ++
To see the actual URL where the map file can be obtained, again use the ccdb 'cat' command, but for the specific item obtained from the command above:
> ccdb cat Magnets/Solenoid/solenoid_1350A_poisson_20160222 ++  URL_base  path  md5   string  string  string  ++  https://halldweb.jlab.org/resources  Magnets/Solenoid/solenoid_1350A_poisson_20160222  a96263c5e2f3936241b3eadb85e6559f  ++
The URL is obtained by combining the "URL_base" and "path" strings. In this case:
https://halldweb.jlab.org/resources/Magnets/Solenoid/solenoid_1350A_poisson_20160222
n.b. No run was specified when running ccdb cat Magnets/Solenoid/solenoid_1350A_poisson_20160222 because the specific map file items are only meant to specify a permanent location of the file on the web. They do not change with run number. The solenoid_map item however, does change with run number since the field current may be changed between runs.
Source used to generate a field map
The source for generating the field maps can be found here:
https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles
See the README file there for more info. on specific maps.
Specifying a different field map
Numerous field maps exist for the solenoid and a system is in place where one can specify the map of choice when running the simulation/reconstruction software. To specify a different field map for hdgeant to use, use
Technical details require that a recompile of hdgeant be done when specifying a different map for the simulation, but any existing reconstruction program can be reconfigured to use a different map without recompiling. Here I'm referring only to full maps, not the special field types of "Const" and "Spoiled" described below.
It should be noted that the *easiest* way to switch fields is really just to replace the default file in the calib directory tree with the desired map. Just be careful if you go that route since it will be easy to get confused since the file name will no longer be indicative of the content of the file.
Simulation
To change the map used in the simulation, edit the control.in file to indicate the alternate field map. This is in a section that looks like this:
c The magnetic field map is accessed through the HDGEOMETRY library c so that the same map can be used for both simulation and reconstruction. c There are multiple map types and for each type, more than one map may c exist. The map types consist of the default type of "CalibDB", the c constant type of "Const" and the spoiled field type of "Spoiled". c The type is set using the BFIELDTYPE card. If no BFIELDTYPE card is c present, then no the default type "CalibDB" is used. c The specific parameters used for the field can be specified using the c BFIELDMAP card. If undefined, then the default that is hardcoded into c the HDGEOMETRY library is used. Note that these correspond to the c similarly named configuration parameters used in the econstruction. c The difference being that underscores are not allowed here. To c specify the values to the reconstruction code used here, use the c PBFIELD_TYPE=CalibDB and PBFIELD_MAP=Magents/Solenoid/solenoid_1500 c BFIELDMAP 'Magnets/Solenoid/solenoid_0750_poisson_20091123_03' c BFIELDTYPE 'Const'
The "c" in the first character indicates a comment. The default control.in file has this commented out and so used the default map.
To specify a different map, you will want to uncomment the BFIELDMAP line and set the desired map. For example, to use the standard 1500A map, add this line to control.in
BFIELDMAP 'Magnets/Solenoid/solenoid_1500_poisson_20090814_01'
Note that this will only have access to maps the current CCDB has available. To see a list of available maps do the following:
ccdb ls Magnets/Solenoid
You will see a lot of maps listed. Ignore any with names that include "_parms_". Look to the table below for details on individual maps.
Reconstruction
For reconstruction, one simply needs to specify the BFIELD_MAP configuration parameter either on the command line or through a configuration file. For example, using the command line one passes a "PBFIELD_MAP=Magnets/Solenoid/solenoid_1500_poisson_20090814_01" argument as follows:
hdview2 PBFIELD_MAP=Magnets/Solenoid/solenoid_1500_poisson_20090814_01 hdgeant.hddm
Special Field Types
There are 2 special field types available also. They are the "Const" and "Spoiled" fields.
The "Const" field type is a uniformeverywhereintheuniverse field. The parameters are set in the Magnets/Solenoid/solenoid_const calibration parameters. One can specify the 3 components of the field in cylindrical coordinates so the field is necessarily radially symmetric. The default values are just a 2T field in the z direction. To specify this field in simulation, one needs to set the "BFIELD" parameter in the control.in file to "'Const'". This already exists, but is commented out, in the default control.in file one gets from the repository with the HDGeant package. To specify the "Const" map in a reconstruction program, one just needs to se the BFIELD_TYPE configuration parameter. This can be done by adding the "PBFIELD_TYPE=Const" argument to the command line when the reconstruction program is started.
The "Spoiled" field type uses a full field map, but spoils it by scaling the amplitude with some combination of r, phi, and z dependences. Each of the dependences has both an amplitude and an angular frequency that are set using configuration parameters. The relevant configuration parameters are:
BFIELD:PHI_AMP BFIELD:PHI_OMEGA BFIELD:R_AMP BFIELD:R_OMEGA BFIELD:Z_AMP BFIELD:Z_OMEGA
The underlying unspoiled map that is determined using the BFIELD_MAP configuration parameter as is normally done when using an unspoiled field.
Known field maps
The following are in chronological order. Look to the bottom of the table for the most recent maps.
File  Generator  Date  Notes 

solenoid_1400  TOSCA  9/21/2001  From Paul Brindza's original map "dsolenoid.table". This was very probably generated at 1400A, though there is a small question regarding that. 
solenoid_1500  TOSCA  4/19/2007  From Paul Brindza's original map "smoothsolenoid1500.table". This was the default map used up until 6/22/2009. Comment from Paul's email regarding this:
"I used integral coil and integral mesh fields to compute the grid. There may be places like in the iron or near the coils where the results will be different than before. The region inside the useful volume of the Solenoid where the detectors are should be more accurate and smoother." 
solenoid_1500kinked  TOSCA  ~2006  From Paul Brindza's map "largegridat1500.table". This map had an unintentional kink in it due to a change in the grid size for the inner and outer parts of the solenoid. I beieve it was used for some time before being replaced in spring 2007 when "smoothsolenoid1500.table" was generated after finally noticing the kink. Since the kink appeared outside of the active tracking area, it didn't really affect the tracking at all. 
solenoid_1500spoiledA  TOSCA  3/19/2007  This map was generated by Paul Brindza at Elke's request to study the effect of having a field with distortions at the 10^{3} level from our best guess of what the field is. The nature of the distortions was kept secret so Paul or Elke would need to be contacted for details. 
solenoid_1500_200811121  ANSYS  11/12/2008  One of Floyd Martins original ANSYSgenerated maps. This was never used for anything but to check that the map was roughly consistent with TOSCA. From the email sent by George Biallas regarding this and the following 3 maps:
"David and Elton, The results are in the folder below. 1. Note that because of the FEA calcultion doesn't do well on the sharp corner of a wedge, we don't have a field value on the Magnet Axis 2. We have changed the Z axis to the standard Z axis origin for the experiment, the inner surface of the Upstream Front Yoke. 3. We have solutions at 1500 to 1800 A. So far, the nominal current is 1500A. I don't know how we want to characterize beyond that. 4. ANSYS output is in comma delimited EXCEL files. I didn't want to cram more huge, translated files in our folders, so I will let you do the translations to what you need. 5. We will title the files by date and run on that date. The translation file to what the run consisted of is in the main folder. 6. We don't have the FCAL steel plate in these runs. 7. As more runs accumulate, we will have to maintain configuration control with a designation of what is the OFFICIAL RUN and notify everyone if the run changes. " 
solenoid_1600_200811122  ANSYS  11/12/2008  See notes for solenoid_1500_200811121 above. 
solenoid_1700_200811123  ANSYS  11/12/2008  See notes for solenoid_1500_200811121 above. 
solenoid_1800_200811124  ANSYS  11/12/2008  See notes for solenoid_1500_200811121 above. 
solenoid_1500_200811263  ANSYS  11/26/2008  
solenoid_1800_200811263  ANSYS  11/26/2008  
solenoid_1500_200812091  ANSYS  12/09/2008  
solenoid_1800_200812091  ANSYS  12/09/2008  
solenoid_const  none  11/10/2008  This is not actually a field map, but holds constants that are used when the BFIELD_TYPE configuration parameter is set to "Const". This is useful in simulation studies using a perfectly uniform magnetic field. 
solenoid_1500_200903122  ANSYS  3/12/2009  From Floyd's email describing the differences between the 20090312 maps and the 20081209 maps:
The differences I can see are: On the initial 200812091 tabulation (pg 9): 1) The small upstream yoke bore liner was 1.5" 2) Coil locations and sizes were at room temperature. On the latest 200903122 tabulation (pg 14): 1) The small upstream yoke bore liner is 1.25" 2) Coil locations & sizes are at a liquid Helium state. I think that's the only differences between the two dates. 
solenoid_1600_200903122  ANSYS  3/12/2009  See notes for solenoid_1500_200903122 above. 
solenoid_1500_poisson_20090814_01  POISSON  8/14/2009  Nominal geometry and current as calculated by POISSON 
solenoid_1200_poisson_20091123_01  POISSON  11/23/2009  80% field (uses same geometry as solenoid_1500_poisson_20090814_01) 
solenoid_1050_poisson_20091123_02  POISSON  11/23/2009  70% field (uses same geometry as solenoid_1500_poisson_20090814_01) 
solenoid_0750_poisson_20091123_03  POISSON  11/23/2009  50% field (uses same geometry as solenoid_1500_poisson_20090814_01) 
solenoid_1500_poisson_20100622_01  POISSON  6/22/2010  Simple, single coil configuration using the same crosssectional area and total current as in solenoid_1500_poisson_20090814_01. Baffles have been removed, but iron yoke is the same. 
solenoid_1500_poisson_20100622_02  POISSON  6/22/2010  Similar to solenoid_1500_poisson_20100622_01, but following BaBar model as specified in babar_transv_3_4.am file Eugene sent me on 6/22/2010. Namely, three sections where outer ones are half as long as middle but all 3 carry the same amount of current (outer ones have higher current density). 
solenoid_1500_poisson_20100622_03  POISSON  6/22/2010  Similar to solenoid_1500_poisson_20100622_01, but with additional coils outside of long, inner coil. The outer coils are 30cm long in z. The inner coil thickness in r is reduced such that the total crosssectional area and total current are the same as the solenoid_1500_poisson_20090814_01 configuration. 
solenoid_1500_poisson_20100701_03  POISSON  7/7/2010  This map is a multi coil design, but much simpler than the LASS magnet design. It is symmetric in z about the magnet center. It has a central coil that is ~33cm long, 2 inner coils that are upstream and downstream of that that are 150cm long, and 2 outer coils that are flush with the upstream and downstream ends of the inner coils that are 20cm long. The currents were adjusted by hand to give a flat, uniform field in the central region of the magnet. 
solenoid_1500_poisson_MIT20111104_01  POISSON  11/4/2011  This map implements the 3coil MIT design. 
solenoid_1300_20130508  POISSON  5/8/2013  This map implements the standard LASS design but was generated for a 1300A current. It was generated to use for comparison to the magnet mapping efforts (May,Aug.) in 2013 
solenoid_1350_poisson_20130925  POISSON  9/25/2013  This map implements the standard LASS design but was generated for a 1350A current. It is the first map to have the current produced in the opposite direction from previously generated maps. The current direction of this map is now consistent with how the solenoid has been physically wired (this is currently the default map used by the offline software) 
solenoid_50A_poisson_20140819  POISSON  8/19/2014  Nominal geometry with 50A forward current as calculated by POISSON 
solenoid_100A_poisson_20140819  POISSON  8/19/2014  Nominal geometry with 100A forward current as calculated by POISSON 
solenoid_200A_poisson_20140819  POISSON  8/19/2014  Nominal geometry with 200A forward current as calculated by POISSON 
solenoid_300A_poisson_20140819  POISSON  8/19/2014  Nominal geometry with 300A forward current as calculated by POISSON 
solenoid_1000A_poisson_20141104  POISSON  11/4/2014  Nominal geometry with 1000A forward current as calculated by POISSON 
solenoid_600A_poisson_20141118  POISSON  11/18/2014  Nominal geometry with 600A forward current as calculated by POISSON 
solenoid_1300A_poisson_20150213  POISSON  2/13/2015  Nominal geometry with 1300A forward current as calculated by POISSON 
solenoid_1300A_poisson_20150330  POISSON  3/30/2015  Nominal geometry with 1300A forward current as calculated by POISSON but extended out to z=700cm for DIRC studies 
solenoid_800A_poisson_20150427  POISSON  4/27/2015  Nominal geometry with 800A forward current as calculated by POISSON

solenoid_0050A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 50A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0100A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 100A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01)

solenoid_0150A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 150A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0200A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 200A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0250A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 250A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0300A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 300A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0350A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 350A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0400A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 400A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0450A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 450A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0500A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 500A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0550A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 550A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0600A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 600A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0650A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 650A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0700A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 700A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0750A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 750A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0800A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 800A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0850A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 850A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0900A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 900A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_0950A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 950A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1000A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1000A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1050A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1050A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1100A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1100A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1150A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1150A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1200A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1200A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1250A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1250A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1300A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1300A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1350A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1350A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1400A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1400A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1450A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1450A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1500A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1500A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1550A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1550A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1600A_poisson_20160222  POISSON  6/2/2016  Nominal geometry with 1600A forward current as calculated by POISSON (see https://halldsvn.jlab.org/repos/trunk/home/davidl/PoissonConfigFiles/SOL_07_01) 
solenoid_1350A_DIRC_poisson_20180601  POISSON  6/1/2018  Special map that extends out to R=4m to see field in DIRC PMT region. Zrange is limited so this should not be used for normal simrecon operations (see https://halldsvn.jlab.org/repos/trunk/home/gen/Solenoid/SOL_07_01.DIRC) 
Creating a ROOT file of the magnetic field
The bfield2root program can be used to create a ROOT file of the magnetic field map as is used by the simulation/reconstruction code. The ROOT file will contain a TTree with entries from several points in the map. It is important to note that the values going into the TTree come from interpolating the map whose grid is determined by the ASCII file. The bfield2root program has default settings to match the default grid of the ASCII files. If a map with different grid spacing is generated then the bfield2root program will still work but one should be aware that the resulting ROOT file will contain interpolated values.
Another "gotcha" is that the origin of the lab coordinate system used by the original field maps is not in the same location as is currently used. The TOSCA generated maps have the origin close to the center of the target, 26 inches (=66.04 cm) offset from the modern coordinate system. As of svn revision 5316 on June 22, 2009, the reconstruction code no longer assumes this offset is there and so one must correct for it when using a TOSCA map. In the mean time, the bfield2root program must be told about this offset via a command line parameter (see below).
The following instructions are for doing this on the JLab CUE system (e.g. ifarml3). However, one can of course do this on another system where the HallD software is compiled and the desired map is located in the directory indicated by the JANA_CALIB_URL environment variable (note: this is set in step 1 below for the CUE).
 Make sure bfield2root is in your path. If it's not, then source a setup script for a prebuilt HallD software release.
 e.g. source /group/halld/Software/builds/release20090527/setenv.csh
 Run bfield2root specifying the specific map
 e.g. bfield2root PBFIELD_MAP=Magnets/Solenoid/solenoid_1500_200903122
 Run bfield2root using an older, TOSCA generated map
 e.g. bfield2root PBFIELD_MAP=Magnets/Solenoid/solenoid_1500 Z0 66.04