Project

General

Profile

Standard Algorithm » History » Version 2

Ole Hansen, 03/05/2018 03:15 PM

1 1 Ole Hansen
h1. Standard Analyzer Algorithm
2
3 2 Ole Hansen
9 March 2007
4
5 1 Ole Hansen
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()@":http://hallaweb.jlab.org/podd/html/THaAnalyzer.html#THaAnalyzer:Process of the class "@THaAnalyzer@":http://hallaweb.jlab.org/podd/html/THaAnalyzer.html. The standard spectrometer processing algorithm is implemented in the method "@THaSpectrometer::Reconstruct()@":http://hallaweb.jlab.org/podd/html/THaSpectrometer.html#THaSpectrometer:Reconstruct of the class "@THaSpectrometer@":http://hallaweb.jlab.org/podd/html/THaSpectrometer.html.
6
7
"@THaAnalyzer::Process( THaRunBase& run )@":http://hallaweb.jlab.org/podd/html/THaAnalyzer.html#THaAnalyzer:Process carries out the following functions:
8
9
* Open the CODA input file associated with the run using "@THaRun::Open()@":http://hallaweb.jlab.org/podd/html/THaRun.html#THaRun:Open.
10
* 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.
11
* Loop over all events in the CODA file.
12
* 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@":http://hallaweb.jlab.org/podd/html/THaApparatus.html object defined in the @gHaApps@ list and every "@THaPhysicsModule@":http://hallaweb.jlab.org/podd/html/THaPhysicsModule.html object defined in the @gHaPhysics@ list.
13
* After initializing the modules (and thus setting up their global variables), load the tests defined in the definition file (set with "@SetCutFile()@":http://hallaweb.jlab.org/podd/html/THaAnalyzer.html#THaAnalyzer:SetCutFile).
14
* After loading the tests, load the output definitions ("@THaOutput::Init()@":http://hallaweb.jlab.org/podd/html/THaOutput.html#THaOutput:Init) from the output definition file (set with "@SetOdefFile()@":http://hallaweb.jlab.org/podd/html/THaAnalyzer.html#THaAnalyzer:SetOdefFile). This sets up a "@TTree@":https://root.cern.ch/doc/master/classTTree.html in the output file.
15
* After finding the prestart event and initializing the apparatuses, analyze events in the event range of the run. For physics events, do
16
** For each apparatus defined in @gHaApps@, call "@THaApparatus::Decode()@":http://hallaweb.jlab.org/podd/html/THaApparatus.html#THaApparatus:Decode.
17
** For each apparatus, call "@CoarseReconstruct()@":http://hallaweb.jlab.org/podd/html/THaApparatus.html#THaApparatus:CoarseReconstruct. If the apparatus does not implement @CoarseReconstruct()@, this call does nothing.
18
** For each apparatus, call "@Reconstruct()@":http://hallaweb.jlab.org/podd/html/THaApparatus.html#THaApparatus:Reconstruct.
19
** For each defined physics module, call "@Process()@":http://hallaweb.jlab.org/podd/html/THaPhysicsModule.html#THaPhysicsModule:Process.
20
** Fill the output tree and histograms by calling "@THaOutput::Process()@":http://hallaweb.jlab.org/podd/html/THaOutput.html#THaOutput:Process. 
21
* For scaler events, do
22
** For each THaScaler object defined in gHaScalers, call THaScaler::LoadData().
23
* "@Close()@":http://hallaweb.jlab.org/podd/html/THaCodaRun.html#THaCodaRun:Close the CODA input file.
24
* "@Write()@":https://root.cern.ch/doc/master/classTFile.html#a78e89aad1200bc6a2113b29f5e541cba the ROOT output file. 
25
26
If an apparatus is a "@THaSpectrometer@":http://hallaweb.jlab.org/podd/html/THaSpectrometer.html, processing in the @Reconstruct()@ stage is carried out by "@THaSpectrometer::Reconstruct()@":http://hallaweb.jlab.org/podd/html/THaSpectrometer.html#THaSpectrometer:Reconstruct as follows:
27
28
* Loop over all "@THaTrackingDetectors@":http://hallaweb.jlab.org/podd/html/THaTrackingDetector.html and call their @CoarseTrack()@ methods.
29
* Loop over all "@THaNonTrackingDetectors@":http://hallaweb.jlab.org/podd/html/THaNonTrackingDetector.html and call their @CoarseProcess()@ methods.
30
* Loop over all "@THaTrackingDetectors@":http://hallaweb.jlab.org/podd/html/THaTrackingDetector.html and call their @FineTrack()@ methods.
31
* Loop over all "@THaNonTrackingDetectors@":http://hallaweb.jlab.org/podd/html/THaNonTrackingDetector.html and call their @FineProcess()@ methods.
32
* 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".
33
* Call @FindVertices()@. This method usually reconstructs tracks to the target. 
34
35
TrackCalc() and FindVertices() have to be implemented by the actual spectrometer class (see [[Adding a new apparatus|how to write an apparatus class]]).