Usage: This repo contains all the code I use to perform a partial wave analysis using the AmpTools software provided by IU at GlueX. To utilize this software, you must already have access to the halld_sim suite of programs, since this code calls upon FitResults.h
and fit.C
from the AmpTools library and split_mass
. You also need access to the gluex_root_analysis program I no longer advocate the use of tree_to_amptools
.tree_to_amptools
since it seems to not always create the right number of final state particles when running over generated thrown trees.
- Create flat trees from MC Thrown, MC Reconstructed, Data, and (optional) Background ROOT TTrees.
- Use
SetupAmpTools_FlatTree()
andFillAmpTools_FlatTree
in a DSelector (make sure you also tell the DSelector to fill these trees). Asside from runningSetupAmpTools_FlatTree()
, I also had to do a bit of code to get the proper trees filled:
I insert this right at the end of the combo loop. A bit more work is needed to create these kinematic variables in the first place for the Thrown Trees, but the idea is exactly the same. Note that when this is run, you should avoid generating the default flat trees by runningvector<TLorentzVector> locFinalStateP4; locFinalStateP4.push_back(locProtonP4); locFinalStateP4.push_back(locDecayingKShort1P4); locFinalStateP4.push_back(locDecayingKShort2P4); dFlatTreeInterface->Fill_Fundamental<Float_t>("Weight", 1.0); // haven't dealt with accidentals yet Fill_FlatTree();
tree_name->Process("DSelector_name.C+", "DefaultFlatOff")
inROOT
. Additionally, I usehadd_rcdb.py
to divide my files by polarization and generate MC with polarized flux files (no actual polarization dependent physics is included in the MC). - Use
- Run
generate_config.py
to select which waves you want to include in your config file. The interface should be fairly straightforward. If you want to make yours manually, there are a few tags (preceeded by an@
symbol) which you can find by looking in the code fordivide_data_pol.py
orrun_amptools.py
scripts. - Run
divide_data_pol.py
provided by this repo. Running it without arguments will show a help string with the required arguments and a short description of their usage. This program essentially wraps thesplit_mass
program across the AmpTools trees you just generated. - Run
run_amptools.py
to actually perform the fits withfit.C
. Again, running without arguments will display the help message.- The
-p <integer>
option will allow you to specify how many multiprocessing processes to generate. This is limited by the number of cores you have available. Python unfortunately does not support multithreading due to the Python Interpreter Lock, but generally my fits haven't taken very long (31 bins with 20 iterations took about 7 minutes the last time I ran it). Don't worry about not knowing how many cores you have, this option is more to limit the number used if you do know it, otherwise, just don't use this flag and the program will generate up to 60 processes. - Additionally, the
-s <integer>
option allows you to set the seed (default isseed = 1
). The seed is used to randomly generate starting parameter values to be used for the fit. In theory, if you use the same seed and the same number of bins and iterations, all of those generated values should be consistent across each run, as long as you aren't adding new parameters to your fits. run_amptools.py
will also callget_fit_results
. However, if you just downloaded this repo, you need to buildget_fit_results
by going into that directory and running the commandmake
. You might (probably will) get some errors about directories not existing. After creating the directories as suggested, the compilation worked. There is probably a better way to do this, but I just copied the Makefile from Naomi Jarvis, and I don't actually know how it works.- You can also use the
--slurm
option to submit the fits as SLURM jobs (recommended if you are on the CMU cluster). - The
gather.py
program included just re-gathers the fit data after a fit is performed. It is identical to the code run at the end ofrun_amptools.py
, but exists just in case thefit_results.txt
file gets deleted or a format changes or something.
- The
- If you've gotten to this step, you will now have an output directory that contains bin folders as well as a file titled
bin_info.txt
and one titledfit_results.txt
. These are human-readable tab-separated files, so feel free to look inside them and see how they are structured. I wrote a quick script calledplot_results.py
to do some preliminary graphing, but it is very much a work-in-progress.
Need to implement polarization in this analysisNeed a better way of sending the proper waves in pairs toget_fit_results
than just hoping the user writes them in a nice orderplot_results.py
needs to be more robust and versatile. I want to be able to get separate subplots for each wave, but I want it to look nice also. I also want this program to have some command-line options to specify which waves to plot (or other things to plot)get_fit_results
This program needs to be expanded to include more information about the fits, such as phases between waves and the base amplitudes from the fit.Currently none of this code is suited to do any SDMEs, but eventually some separate programs should be added to handle these too.- I should eventually try to implement a way to drop specific waves from the analysis. It might be easier to implement this in
run_amptools.py
.