Feature #1655

TOF momentum and emittance reconstruction

Added by Blackmore, Victoria about 9 years ago. Updated over 8 years ago.

Start date:
23 March 2015
Due date:
% Done:


Estimated time:


A reimplementation of Mark Rayner's TOF reconstruction code + the analysis used in the Step I Paper.

Files (432 KB) Blackmore, Victoria, 23 March 2015 17:24 (1.55 MB) Blackmore, Victoria, 19 May 2015 11:28

Updated by Blackmore, Victoria about 9 years ago

- MAUS (included binaries were compiled with v0.9.4)
- ROOT (though this is included with MAUS)
- A Qt distribution (see though this is already installed on many linux distributions)

If all of the above exist, then running this program "should be" as simple as extracting the archive, navigating to the "build-TOFReconstruction-Qt5-Release" folder, and typing "./TOFReconstruction" into a terminal. (If this doesn't work, make sure you've sourced MAUS's script in your current terminal, or it will complain about missing MAUS libraries)

Running the reconstruction --> Left-hand side of the program

  • Select the type of ROOT file to look at:
    • G4MICE is only suitable for looking at output files from the Step I analysis
    • MAUS will read a reconstructed ROOT output file
    • Calibrate? checkbox is (for now) not selectable. See below for caveat about PMT drift time calibration.
  • Choose a ROOT file (Input ROOT File: box). Clicking on the "..." button opens a file dialog, or type the file path in the box.
  • Select quadrupole settings:
    • Quadrupole positions can be entered manually, if desired. This program only cares about the relative distance between the quadrupoles and TOF0/1.
    • Quadrupole currents can be entered manually, if desired. Alternatively (recommended) default beam settings can be loaded from the Default Beams menu at the top left-hand corner of the screen (in the menu bar). If this option is chosen, proceed to selecting an output ROOT file name.
    • Quadrupole currents remain positive independent of beam polarity. It is assumed that the beam line is always set to Focus-Defocus-Focus in the horizontal plane, and Defocus-Focus-Defocus in the vertical.
  • Position TOF0 and TOF1 along the beamline.
    • Any transverse offsets in the x and y fields will be added to the positions recorded in the ROOT files. If survey information has already been applied, leave these at 0 mm.
  • Pick beam momentum and polarity.
    • Beam polarity does not have any effect on this program. However, the default quadrupole currents for Q789 are different between positive and negative beams -- this acts as a reminder if a default beam setting is selected. The beam line is always set to Focus-Defocus-Focus in the horizontal plane.
  • Select muon time of flight range:
    • Particles that fall within this time of flight window are assumed to be muons and are used in the analysis. Minimum TOF is on the left, maximum on the right.
  • Set simulated mean electron path through the quadrupole currents (SimElePath).
    • If a simulation of these quadrupole currents exists, this value can be changed to improve accuracy. The current values are derived from G4MICE simulations of the default beam line settings at 140, 200, and 240 MeV.
  • Set the mean time of flight of electrons in the data (DataEleTOF).
    • Current values are derived from the Step I beams at 140, 200, and 240 MeV.
  • Select an output ROOT file name (Output ROOT File:).
  • Click Reconstruct data at TOF0 and TOF1.
  • A root file (with the selected name) will be created containing the positions and reconstructed angles of particles at TOF0 and TOF1.
    • It is not possible to account for multiple scattering in the air over the ~8m distance between the TOFs.
    • The mean momentum loss expected from traversing ~8m of air is applied to the particles.

Running the analysis --> Right-hand side of the program

  • Select an input ROOT file
    • If you've just finished reconstructing data at TOF0 and TOF1, this field will automatically set to the output of the previous step.
    • ROOT files must be formatted the same as the output of the reconstruction step.
  • Select cuts
    • Ideally, you only want to accept muons that have passed through calibrated TOF slabs.
    • Custom cuts can be defined by selecting "Custom cuts" from the drop-down list, and then typing (or copy/pasting) into the table.
  • Click the "Analyse Data" button. When complete, the results pane will reveal itself.
  • NB: Clicking on the Cuts and Results tabs switches between the two.
  • A ROOT file containing all of the histograms produced by the analysis
  • A PDF file containing all of the histograms (complete with index and list of applied cuts)
  • The results pane will be filled with the calculated Twiss parameters.
Known problems
  • This program should replicate Mark Rayner's TOF Reconstruction code (, but when testing with (G4MICE) ROOT files, an odd "double peak" was seen in (y, y'). The origin of this is currently unknown, but it's probably wisest to view that "with suspicion".
  • No checks have been carried out with large MAUS-produced ROOT files
    • Small ROOT files load and read fine, but statistics weren't large enough to check for the "double peak" effect noted above.
  • This method depends on finding (x, y) at the TOFs according to the timing of the PMT's at either end of the slabs. Hence, it requires a different calibration to what the TOFs include by default. A "default" calibration is applied to all MAUS files, which originates from Mark Rayner and the 2010 data -- this will probably bias the result a small (but unknown) amount. Mark Rayner's extra calibration determined the speed of light in the scintillator and an additional timing offset, which may have changed over time.
    • Addressing this issue requires recent TOF calibration data in MAUS reconstructed ROOT file. The basic code for performing this recalibration is included in the uploaded .zip file, but is not currently utilised (instead, the 2010 Rayner calibration is applied as the default).

Updated by Blackmore, Victoria almost 9 years ago

An update to the known problems from the previous entry:

I had been running into trouble installing the latest version of MAUS (, but after fixing that (see the issue tracker) I can continue with the more up-to-date TOF calibration.

-- The "double peak" problem noted above is solved: it was a result of clashing ROOT libraries (a system version of ROOT and the MAUS-installed ROOT apparently do not get along)

Latest upload has been recompiled with MAUS 0.9.5 (but can obviously be compiled on any system with MAUS and Qt by sourcing the MAUS environment then running qmake, make clean, make) This update includes no significant code changes, so still assumes the 2010 TOF calibration -- however, progress can now (finally) be made there.

(Edit: New (v2) file size is larger since I've included an output pdf with emittance distributions in it from Step I data)


Updated by Blackmore, Victoria over 8 years ago

A note for anyone interested in using this on the current reconstructed MAUS data set: it won't work until calibrated PMT time information is included in the MAUS output file (Durga has been informed -- the next data reprocessing will coincide with the official Monte Carlo production).

Also available in: Atom PDF