Presentation is loading. Please wait.

Presentation is loading. Please wait.

DANA uses a factory model to deliver data “just in time”

Similar presentations


Presentation on theme: "DANA uses a factory model to deliver data “just in time”"— Presentation transcript:

1

2

3 DANA uses a factory model to deliver data “just in time”

4 Factories and Data Objects Factory: Implements an algorithm to create one type of object from other type(s) of object(s). Data Object:Object produced by a factory. It may have persistence through a file. Factory: Implements an algorithm to create one type of object from other type(s) of object(s). Data Object:Object produced by a factory. It may have persistence through a file.

5 Factories are accessed via the type of data they produce vector cdchits; eventLoop->Get(cdchits); for(int i=0; i<cdchits.size(); i++){ float x = cdchits[i]->x; float y = cdchits[i]->y; }

6 Factory Tags Two factories producing data of the same type may be distinguished via their “tag”s Example: One factory may provide a list of objects that is a subset of the objects produced by another factory. Two factories producing data of the same type may be distinguished via their “tag”s Example: One factory may provide a list of objects that is a subset of the objects produced by another factory.

7 Factory Tags vector particles; vector kaons; eventLoop->Get(particles); eventLoop->Get(kaons, “Kaon”);

8 Object Identifiers All Data Objects have a member: identifier_t id (identifier_t is typedef’d as int) Identifiers are used to reference one object from another in a way that can be stored and retrieved from a file. All Data Objects have a member: identifier_t id (identifier_t is typedef’d as int) Identifiers are used to reference one object from another in a way that can be stored and retrieved from a file.

9 Object Identifiers vector trackcandidates; vector tracks; loop->Get(trackcandidates); loop->Get(tracks); for(unsigned int i=0;i<tracks.size();i++){ const DTrackCandidate *trackcandidate = GetByID(trackcandidates, tracks[i]->candidateid); … }

10 DEventProcessor  Programs are made by deriving from the DEventProcessor class  DEventProcessor defines a set of callback methods that are called at the appropriate times during the data processing  Programs are made by deriving from the DEventProcessor class  DEventProcessor defines a set of callback methods that are called at the appropriate times during the data processing

11 DEventProcessor Callback Methods class DEventProcessor{ public: … virtual derror_t init(void); virtual derror_t brun(DEventLoop *eventLoop, int runnumber); virtual derror_t evnt(DEventLoop *eventLoop, int eventnumber); virtual derror_t erun(void); virtual derror_t fini(void); … }

12 Multi-threading  Multi-core processors are on the near horizon. To fully leverage the next generation of CPUs, processes must be multi-threaded  Data analysis is a natural application for multi-threading where events are dispatched to processing threads.  Multi-core processors are on the near horizon. To fully leverage the next generation of CPUs, processes must be multi-threaded  Data analysis is a natural application for multi-threading where events are dispatched to processing threads.

13 Threads

14 Threads and ROOT Caution: End Users don’t get multi- threading for free! Since the evnt() callback can be called from multiple threads simultaneously, the ROOT global area must be locked when filling histograms. TThread::Lock() TThread::UnLock() Caution: End Users don’t get multi- threading for free! Since the evnt() callback can be called from multiple threads simultaneously, the ROOT global area must be locked when filling histograms. TThread::Lock() TThread::UnLock()

15 DEventSource Event sources inherit from DEventSource which defines the API for extracting data This way, the framework is divorced from the specific file format New file formats (or online sources) may be added by defining a new DEventSource-based class Event sources inherit from DEventSource which defines the API for extracting data This way, the framework is divorced from the specific file format New file formats (or online sources) may be added by defining a new DEventSource-based class

16 Shared Objects  DANA supports shared objects for implementing factories and DEventSource objects  Factories and Event Sources obtained from shared objects are given precedence over statically linked ones.  DANA supports shared objects for implementing factories and DEventSource objects  Factories and Event Sources obtained from shared objects are given precedence over statically linked ones.

17 Configuration Parameters  Parameters used to control the behavior of the algorithms (e.g. minimum number of hits per track)  Kept as key/value pairs in DApplication with standard way of setting and retrieving  NOT calibration constants  Parameters used to control the behavior of the algorithms (e.g. minimum number of hits per track)  Kept as key/value pairs in DApplication with standard way of setting and retrieving  NOT calibration constants

18 Example main() routine #include "MyProcessor.h" #include "DApplication.h" int main(int narg, char *argv[]) { // Instantiate our event processor MyProcessor myproc; // Instantiate an event loop object DApplication app(narg, argv); // Run though all events, calling our event processor's methods app.Run(&myproc, 4); return 0; }

19 Nightly Generated DOxygen documentation http://www.jlab.org/Hall- D/software/HDSoftware_Document ation/ http://www.jlab.org/Hall- D/software/HDSoftware_Document ation/


Download ppt "DANA uses a factory model to deliver data “just in time”"

Similar presentations


Ads by Google