Difference between revisions of "Mattione sim-recon Code Documentation"
From GlueXWiki
(→hd_root) |
|||
Line 20: | Line 20: | ||
=== JApplication.LaunchThread() === | === JApplication.LaunchThread() === | ||
− | |||
JApplication.LaunchThread(): | JApplication.LaunchThread(): | ||
- Create JEventLoop with the instantiated JApplication object as the argument | - Create JEventLoop with the instantiated JApplication object as the argument | ||
Line 39: | Line 38: | ||
- calls JEvent.FreeEvent() to free up the memory from this event | - calls JEvent.FreeEvent() to free up the memory from this event | ||
- Exits | - Exits | ||
− | |||
=== JEventLoop.Get(vector<const T*>) === | === JEventLoop.Get(vector<const T*>) === | ||
− | |||
JEventLoop.Get(vector<const T*>): call to retrieve data objects of type T with an associated factory (e.g. DChargedTrack, DPhysicsEvent) | JEventLoop.Get(vector<const T*>): call to retrieve data objects of type T with an associated factory (e.g. DChargedTrack, DPhysicsEvent) | ||
- The JEventLoop.Get(vector<const T*>) function retrieves or generates the requested objects in this order: | - The JEventLoop.Get(vector<const T*>) function retrieves or generates the requested objects in this order: | ||
Line 56: | Line 53: | ||
- It then calls JFactory.erun() and JFactory.brun() if appropriate. | - It then calls JFactory.erun() and JFactory.brun() if appropriate. | ||
- Then JFactory.evnt() is called to generate the data, then it calls JFactory.CopyFrom(vector<const T*>) to copy the data into the input vector and returns. | - Then JFactory.evnt() is called to generate the data, then it calls JFactory.CopyFrom(vector<const T*>) to copy the data into the input vector and returns. | ||
− | |||
== Track Reconstruction == | == Track Reconstruction == | ||
+ | |||
+ | === DTrackFitter::FindHitsAndFitTrack() === | ||
+ | DTrackFitter::FindHitsAndFitTrack(): | ||
+ | - call CorrectForELoss (WireBased fit only): assumes momentum from DTrackCandidate is at middle of track (avg), swims backwards to target center & increases momentum based on eloss | ||
+ | - swim reference trajectory | ||
+ | - get DTrackHitSelector_ALT1, all DCDCTrackHit objects, and all DFDCPseudo objects | ||
+ | - call DTrackHitSelector::GetAllHits() with reference trajectory, DTrackHitSelector::fit_type_t (kHelical for kWireBased fit, or kWireBased for kTimeBased fit), DCDCTrackHit's, DFDCPseudo's | ||
+ | - calls DTrackHitSelector::GetCDCHits | ||
+ | - calls DTrackHitSelector_ALT1::GetCDCHits (with reference trajectory, DTrackHitSelector::fit_type_t, all DCDCTrackHit objects), sorts hits by ring, then stores them in the fitter | ||
+ | - loop over DCDCTrackHit objects: | ||
+ | - calc residual: diff btw "use reference trajectory to find DOCA of track to hit" and "use cell size & drift times (for TimeBased) to find "measured" distance" | ||
+ | - if FOM > minimum prob then keep the DCDCTrackHit | ||
+ | - sort kept DCDCTrackHit objects by ring & hit probability (reject hits in the same ring that are far away) | ||
+ | - output saved DCDCTrackHit objects | ||
+ | - calls DTrackHitSelector::GetFDCHits | ||
+ | - calls DTrackHitSelector_ALT1::GetFDCHits (with reference trajectory, DTrackHitSelector::fit_type_t, all DFDCPseudo objects), sorts hits by z, then stores them in the fitter | ||
+ | - loop over DFDCPseudo objects: | ||
+ | - calc anode residual: diff btw "use reference trajectory to find DOCA of track to hit" and "use cell size & drift times (for TimeBased) to find "measured" distance" | ||
+ | - calc cathode residual: diff btw "hit position along the wire" and "ref traj hit along the wire" | ||
+ | - if FOM (from both anode & cathode) > minimum prob then keep the DCDCTrackHit | ||
+ | - sort kept DFDCPseudo objects by ring & hit probability (reject hits in the same ring that are far away) | ||
+ | - output saved DFDCPseudo objects | ||
+ | - call FitTrack with position, momentum, q, mass, start time: sets DTrackFitter.input_params (a DKinematicData object) with these info, then calls FitTrack(void) of DTrackFitterKalmanSIMD |
Revision as of 18:55, 30 August 2011
Contents
Plugin-Independent Execution
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
JEventLoop.Get(vector<const T*>)
JEventLoop.Get(vector<const T*>): call to retrieve data objects of type T with an associated factory (e.g. DChargedTrack, DPhysicsEvent)
- The JEventLoop.Get(vector<const T*>) function retrieves or generates the requested objects in this order: - If already generated, returns them. Else if present in input data file, retrieves them. Else generates them via the appropriate JFactory. - These objects are only generated once, and the generating factories retain ownership (only const pointers are returned) - To check if they were already generated, JEventLoop.Get(vector<const T*>) calls JEventLoop::GetFromFactory() - It grabs the associated JFactory. Note that all of the factories inherit from JFactory, which inherits from JFactory_base, which inherits from JEventProcessor - If its JFactory.evnt() method has already been called, then the JFactory.CopyFrom(vector<const T*>) method is called to just copy the already-generated information into the input vector. - To check if they are located in the source, JFactory.GetCheckSourceFirst() is called. If so, then JEventLoop.GetFromSource() is called to retrieve the input information. - To generate the data, the JFactory.Get(vector<const T*>) method is called. - If JFactory.evnt() has already been called, then it calls JFactory.CopyFrom(vector<const T*>) to copy the data into the input vector and returns. Else the function continues. - It calls JFactory.init() if it has not been called already. - It then calls JFactory.erun() and JFactory.brun() if appropriate. - Then JFactory.evnt() is called to generate the data, then it calls JFactory.CopyFrom(vector<const T*>) to copy the data into the input vector and returns.
Track Reconstruction
DTrackFitter::FindHitsAndFitTrack()
DTrackFitter::FindHitsAndFitTrack():
- call CorrectForELoss (WireBased fit only): assumes momentum from DTrackCandidate is at middle of track (avg), swims backwards to target center & increases momentum based on eloss - swim reference trajectory - get DTrackHitSelector_ALT1, all DCDCTrackHit objects, and all DFDCPseudo objects - call DTrackHitSelector::GetAllHits() with reference trajectory, DTrackHitSelector::fit_type_t (kHelical for kWireBased fit, or kWireBased for kTimeBased fit), DCDCTrackHit's, DFDCPseudo's - calls DTrackHitSelector::GetCDCHits - calls DTrackHitSelector_ALT1::GetCDCHits (with reference trajectory, DTrackHitSelector::fit_type_t, all DCDCTrackHit objects), sorts hits by ring, then stores them in the fitter - loop over DCDCTrackHit objects: - calc residual: diff btw "use reference trajectory to find DOCA of track to hit" and "use cell size & drift times (for TimeBased) to find "measured" distance" - if FOM > minimum prob then keep the DCDCTrackHit - sort kept DCDCTrackHit objects by ring & hit probability (reject hits in the same ring that are far away) - output saved DCDCTrackHit objects - calls DTrackHitSelector::GetFDCHits - calls DTrackHitSelector_ALT1::GetFDCHits (with reference trajectory, DTrackHitSelector::fit_type_t, all DFDCPseudo objects), sorts hits by z, then stores them in the fitter - loop over DFDCPseudo objects: - calc anode residual: diff btw "use reference trajectory to find DOCA of track to hit" and "use cell size & drift times (for TimeBased) to find "measured" distance" - calc cathode residual: diff btw "hit position along the wire" and "ref traj hit along the wire" - if FOM (from both anode & cathode) > minimum prob then keep the DCDCTrackHit - sort kept DFDCPseudo objects by ring & hit probability (reject hits in the same ring that are far away) - output saved DFDCPseudo objects - call FitTrack with position, momentum, q, mass, start time: sets DTrackFitter.input_params (a DKinematicData object) with these info, then calls FitTrack(void) of DTrackFitterKalmanSIMD