Requirements: This example requires that version 0.6 or later of AmpTools (amptools.sourceforge.net). Compile the main AmpTools library and set the environment variable AMPTOOLS to point this directory (the directory that contains (GPUManager, GPUUtils, IUAmpTools, ...) *before* compiling the GlueX source tree. This example also requires version 0.6 or later of the AmpPlotter package that is distributed with AmpTools. Compile the AmpPlotter library and set the environment variable AMPPLOTTER to point to the top-level directory of AmpPlotter (that contains the Makefile). The goals of this example are: A. (i) Generate gamma p -> pi+ pi- pi+ n events, both with physics amplitudes and without (ii) Pass generated events through mock toy_detector or the simulated GlueX detector B. Perform a fit to extract the production amplitudes for several resonances C. Use the AmpPlotter library to view projections of the fit <><><><><><><> Quick recipe for doing example <><><><><><><><> cd $HALLD_HOME/src/programs/AmplitudeAnalysis/Examples/threepi_all cp ../../../Simulation/gen_3pi/gen_3pi.cfg . gen_3pi -c gen_3pi.cfg -o threepi_data_gen.root -l 0.7 -u 2.0 -n 50000 toy_detector threepi_data_gen.root threepi_data.root gen_3pi -c gen_3pi.cfg -o threepi_gen.root -f -l 0.7 -u 2.0 -n 200000 toy_detector threepi_gen.root threepi_acc.root fit -c fit_3pi.cfg threepi_plotter threepi.fit <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <><><><>Alternate recipe that uses the GlueX Detector <><><><><><> cd $HALLD_HOME/src/programs/AmplitudeAnalysis/Examples/threepi_all cp ../../../Simulation/gen_3pi/gen_3pi.cfg . gen_3pi -c gen_3pi.cfg -o threepi_data_gen.root -hd threepi_data_gen.hddm -l 0.7 -u 2.0 -n 50000 -> run HDGeant on threepi_data_gen.hddm and anlayze the output and -> write it to a file called threepi_data.root using the format -> encoded in the ROOTDataReader and put it in this directory gen_3pi -c gen_3pi.cfg -o threepi_gen.root -hd threepi_gen.hddm -f -l 0.7 -u 2.0 -n 200000 -> run HDGeant on threepi_gen.hddm and anlayze the output and -> write it to a file called threepi_acc.root using the format -> encoded in the ROOTDataReader and put it in this directory fit -c fit_3pi.cfg threepi_plotter threepi.fit <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ------------------------------------------------- A. Generate MC events ------------------------------------------------- 1. We first need to create a sample of MC that will act as the data. This sample should be generated with appropriate physics angular distributions. The executable gen_3pi is provided for this. You should copy the configuration file distributed with gen_3pi to the current working directory. cp ../../../Simulation/gen_3pi/gen_3pi.cfg . To generate at least 50000 events with 3 pi invariant mass from 0.7-2.0 GeV/c^2 run the command: gen_3pi -c gen_3pi.cfg -o threepi_data_gen.root -l 0.7 -u 2.0 -n 50000 You can examine the gen_3pi.cfg file to see the various generated resonances and strengths. The default file utilizes 100% polarized beam, but this can be altered as noted in the file. In reality the file would then be passed through HDGeant and also some reconstruction program. To save, time, we will use the executable toy_detector, which randomly throws away some events based on M(pi+pi-pi+) (examine source for details). Run: toy_detector threepi_data_gen.root threepi_data.root The file threepi_data.root is the analog of reconstructed data acquired with the detector. The file threepi_data_gen.root has no analog in a real analysis as it would correspond to list of the actual four-vectors produced in the pure signal events. 1. (Alternate) You can use the -hd flag to write out an HDDM version of the generated file. gen_3pi -c gen_3pi.cfg -o threepi_data_gen.root -hd threepi_data_gen.hddm -l 0.7 -u 2.0 -n 50000 Instead of using the toy_detector application then take this HDDM file and pass it through HDGeant and the analysis framework. Write the output of the analysis to a file called threepi_data.root and place it in this directory. It is important that the output be formatted properly. These examples utilize the ROOTDataReader in the library AMPTOOLS_DATAIO. You may have to examine the source code of this data reader to understand the expected format of the source tree. Proper order of the particles in the final state arrays is important. 2. Normalization of the probability distribution functions used in the fit depends on Monte-Carlo integration of the product of the detector acceptance and the model-predicted density of events over phase space. In order to construct these integrals we need samples of generated and accepted Monte Carlo which do not have any physics amplitudes. We use the -f flag to gen_3pi to do this. (A configuration file is still needed although its contents are not used.) gen_3pi -c gen_3pi.cfg -o threepi_gen.root -f -l 0.7 -u 2.0 -n 200000 Again we will use the toy_detector application: toy_detector threepi_gen.root threepi_acc.root These two files represent files that would actually be present in an analysis that uses real data (with the exception that toy_detector would be replaced by HDGeant + reconstruction). 2. (Alternate) Write a copy of the phase space MC to an HDDM file also gen_3pi -c ../../../Simulation/gen_3pi/gen_3pi.cfg -o threepi_gen.root -hd threepi_gen.hddm -f -l 0.7 -u 2.0 -n 200000 As in step 1 above, perform the detector simulation and analysis and write the output to a ROOT file in this directory called threepi_acc.root ------------------------------------------------- B. Perform fit ------------------------------------------------- 1. In this fit we are simply going to try to fit for what was input to the the generator. We will perform a "mass dependent fit" under the assumption that the resonances in 3 pi are described by the simple Breit-Wigner shapes that we generated. The file fit_3pi.cfg is provided to configure the fit. Note the only difference between it and the gen_3pi.cfg file used to generate the sample is that the locations of the input and MC files are specified and one of the fit parameters is fixed to be real. (There is always an arbitrary overall phase when performing a fit that needs to be removed by fixing a parameter to be real.) Perform the fit by executing the command: fit -c fit_3pi.cfg You can examine the output on the screen. The results of the fit will be written to the file threepi.fit. This file contains information about the configuration of the fit as well as the parameter values, covariances, and information about the convergence of MINUIT. ------------------------------------------------- C. View fit results using AmpPlotter GUI package ------------------------------------------------- 1. To view the results of the fit we will use the threepi_plotter application. The application generates plots of data and the Monte Carlo that has been weighted by the intensity determined by the fit. First examine the source code of threepi_plotter. The only relevant items are the definition of the PlotGenerator (in the example ThreePiPlotGenerator) and the registration of the amplitudes and data readers used in the fit. 2. The definition of ThreePiPlotGenerator can be found in the library AMPTOOLS_DATAIO. The source for this class specifies which 1D histograms to create and how to fill these histograms for a single event. It is useful to look at distributions that can be used to distinguish the various physics amplitudes like invariant masses and angles. 3. Start up the plotter GUI, passing in the fit results on the command line: threepi_plotter threepi.fit The GUI allows you to turn off and on amplitudes, select a projection and generate plots of data and/or MC. Access to both the accepted and generated MC is provided so the acceptance can be studied in the variables of interest.