Standard Analyzer Algorithm

9 March 2007

The "standard analyzer" provides a generic event loop and analysis chain that will (hopefully) be sufficient for many nuclear physics analysis tasks. The event loop and high-level algorithm are implemented in the method THaAnalyzer::Process() of the class THaAnalyzer. The standard spectrometer processing algorithm is implemented in the method THaSpectrometer::Reconstruct() of the class THaSpectrometer.

THaAnalyzer::Process( THaRunBase& run ) carries out the following functions:

  • Open the CODA input file associated with the run using THaRun::Open().
  • Open the ROOT output file if not already open. If the file is already open, but the filename has changed, close the old file and open a new one.
  • Loop over all events in the CODA file.
  • Skip events until the a prestart event is found. Extract the time stamp of the prestart event and call Init(time_stamp) for every THaApparatus object defined in the gHaApps list and every THaPhysicsModule object defined in the gHaPhysics list.
  • After initializing the modules (and thus setting up their global variables), load the tests defined in the definition file (set with SetCutFile()).
  • After loading the tests, load the output definitions (THaOutput::Init()) from the output definition file (set with SetOdefFile()). This sets up a TTree in the output file.
  • After finding the prestart event and initializing the apparatuses, analyze events in the event range of the run. For physics events, do
  • For scaler events, do
    • For each THaScaler object defined in gHaScalers, call THaScaler::LoadData().
  • Close() the CODA input file.
  • Write() the ROOT output file.

If an apparatus is a THaSpectrometer, processing in the Reconstruct() stage is carried out by THaSpectrometer::Reconstruct() as follows:

  • Loop over all THaTrackingDetectors and call their CoarseTrack() methods.
  • Loop over all THaNonTrackingDetectors and call their CoarseProcess() methods.
  • Loop over all THaTrackingDetectors and call their FineTrack() methods.
  • Loop over all THaNonTrackingDetectors and call their FineProcess() methods.
  • Call TrackCalc(). This method usually calculates overall track properties such as the absolute momentum and beta and may also be used to identify the "Golden Track".
  • Call FindVertices(). This method usually reconstructs tracks to the target.

TrackCalc() and FindVertices() have to be implemented by the actual spectrometer class (see how to write an apparatus class).

Updated by Ole Hansen over 6 years ago · 2 revisions