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 everyTHaApparatus
object defined in thegHaApps
list and everyTHaPhysicsModule
object defined in thegHaPhysics
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 withSetOdefFile()
). This sets up aTTree
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 each apparatus defined in
gHaApps
, callTHaApparatus::Decode()
. - For each apparatus, call
CoarseReconstruct()
. If the apparatus does not implementCoarseReconstruct()
, this call does nothing. - For each apparatus, call
Reconstruct()
. - For each defined physics module, call
Process()
. - Fill the output tree and histograms by calling
THaOutput::Process()
.
- For each apparatus defined in
- 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 theirCoarseTrack()
methods. - Loop over all
THaNonTrackingDetectors
and call theirCoarseProcess()
methods. - Loop over all
THaTrackingDetectors
and call theirFineTrack()
methods. - Loop over all
THaNonTrackingDetectors
and call theirFineProcess()
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