Difference between revisions of "Mattione sim-recon Code Documentation"
From GlueXWiki
Line 1: | Line 1: | ||
== hd_root == | == hd_root == | ||
− | |||
− | |||
<pre> | <pre> | ||
main(): | main(): | ||
Line 14: | Line 12: | ||
- Calls DApplication.Init() | - Calls DApplication.Init() | ||
- Calls JApplication.Init() | - Calls JApplication.Init() | ||
− | - Attaches plugins, adds auto-activated factories (from the JParameterManager), calls JEventProcessor.init() for each processor (MyProcessor.init() creates the output root file) | + | - Attaches plugins (JEventProcessors), adds auto-activated factories (from the JParameterManager), calls JEventProcessor.init() for each processor (MyProcessor.init() creates the output root file) |
- Checks to see if should use SSE instructions | - Checks to see if should use SSE instructions | ||
- Launches threads (each thread calls JApplication.LaunchThread()) | - Launches threads (each thread calls JApplication.LaunchThread()) | ||
- Sends the main thread to sleep while the threads execute, wake up occassionally to check status, exits when done | - Sends the main thread to sleep while the threads execute, wake up occassionally to check status, exits when done | ||
- Exits | - Exits | ||
+ | </pre> | ||
+ | == JApplication.LaunchThread() == | ||
+ | <pre> | ||
+ | JApplication.LaunchThread(): | ||
+ | - Create JEventLoop with the instantiated JApplication object as the argument | ||
+ | - JEventLoop constructor: | ||
+ | - registers the JEventLoop with the JApplication object and its member JEvent object "event" | ||
+ | - call JEventLoop.Loop() on the JEventLoop object | ||
+ | - calls JEventLoop.OneEvent() in an infinite loop until that function tells it to quit the loop (that function loops over each event) | ||
+ | - calls JEventLoop.Initialize() if not initialized: gets event processors and auto-activated factories from JApplication (which were listed in JParameterManager) | ||
+ | - calls JEventLoop.ClearFactories(), which calls the .Reset() function of each factory | ||
+ | - calls JApplication.NextEvent(JEvent), which grabs the next event from the event buffer | ||
+ | - loops over JEventProcessors (for plugins, functionality is plugin-specific), calling these virtual functions: | ||
+ | - JEventProcessors.brun() if it's a new run number: | ||
+ | - if hd_root, calls MyProcessor.brun(): figures out which factories are needed, sets up their information (factory_info_t) in MyProcessor.fac_info | ||
+ | - JEventProcessors.erun() if the run number changes: | ||
+ | - if hd_root, calls MyProcessor.erun(): does nothing | ||
+ | - JEventProcessors.evnt() for each event: | ||
+ | - if hd_root, calls MyProcessor.evnt(): loops over all factories listed in MyProcessor.fac_info, grabs them from the JEventLoop, for each calls factory->GetNrows() | ||
+ | - calls JEvent.FreeEvent() to free up the memory from this event | ||
+ | - Exits | ||
</pre> | </pre> |
Revision as of 18:30, 30 August 2011
hd_root
main(): - instantiates MyProcessor and DApplication - MyProcessor inherits from JEventProcessor - JEventProcessor basically empty/virtual, constructor only initializes a few conrol variables during instantiation - MyProcessor constructor basically empty - DApplication inherits from JApplication - JApplication constructor sets up user signal instructions, mutexes, parses the command line, sets up the parameters in JParameterManager, etc. - DApplication constructor instantiates the DEventSourceHDDMGenerator and DFactoryGenerator, and registers them with JApplication - calls DApplication.Run(JEventProcessor) with the instantiated MyProcessor as the argument (DApplication.Run(JEventProcessor) is JApplication.Run(JEventProcessor)) - Calls DApplication.Init() - Calls JApplication.Init() - Attaches plugins (JEventProcessors), adds auto-activated factories (from the JParameterManager), calls JEventProcessor.init() for each processor (MyProcessor.init() creates the output root file) - Checks to see if should use SSE instructions - Launches threads (each thread calls JApplication.LaunchThread()) - Sends the main thread to sleep while the threads execute, wake up occassionally to check status, exits when done - Exits
JApplication.LaunchThread()
JApplication.LaunchThread(): - Create JEventLoop with the instantiated JApplication object as the argument - JEventLoop constructor: - registers the JEventLoop with the JApplication object and its member JEvent object "event" - call JEventLoop.Loop() on the JEventLoop object - calls JEventLoop.OneEvent() in an infinite loop until that function tells it to quit the loop (that function loops over each event) - calls JEventLoop.Initialize() if not initialized: gets event processors and auto-activated factories from JApplication (which were listed in JParameterManager) - calls JEventLoop.ClearFactories(), which calls the .Reset() function of each factory - calls JApplication.NextEvent(JEvent), which grabs the next event from the event buffer - loops over JEventProcessors (for plugins, functionality is plugin-specific), calling these virtual functions: - JEventProcessors.brun() if it's a new run number: - if hd_root, calls MyProcessor.brun(): figures out which factories are needed, sets up their information (factory_info_t) in MyProcessor.fac_info - JEventProcessors.erun() if the run number changes: - if hd_root, calls MyProcessor.erun(): does nothing - JEventProcessors.evnt() for each event: - if hd_root, calls MyProcessor.evnt(): loops over all factories listed in MyProcessor.fac_info, grabs them from the JEventLoop, for each calls factory->GetNrows() - calls JEvent.FreeEvent() to free up the memory from this event - Exits