|
RooParticle
Particle scattering simulator with ROOT
|
Makes a fresh event for each run from a template event. More...
#include <experiment.hpp>
Public Member Functions | |
| experiment () | |
| Empty experiment; the template must be set with SetTemplate(). | |
| experiment (event *eventT_) | |
| Experiment with a template. | |
| void | SetTemplate (event *eventT_) |
| Set (or replace) the template event. | |
| void | MakeEvent (Int_t ninparticle_,...) |
| Create a new event as a copy of the template and add particles to it. | |
| void | OffEvent () |
| Mark the current event as off. The event itself is kept; only an internal flag changes (nothing else reads it). | |
| void | DelEvent () |
| Mark the current event as off and delete it (with its particles and inspectors). | |
| event * | GetEvent () |
| The event created by the last MakeEvent() (owned by the experiment's user: see DelEvent()). | |
Private Attributes | |
| event * | eventT = nullptr |
| template event, not owned | |
| Bool_t | eventOn = false |
| true after MakeEvent(), false after OffEvent()/DelEvent(); informational only | |
| event * | currentEvent = nullptr |
| last created event (heap) | |
Friends | |
| class | experimentP |
Makes a fresh event for each run from a template event.
Template pattern: configure one event once (integrator, forces, volume, time step, ...) and give it with SetTemplate(). MakeEvent() then copies that template (the event copy constructor) and adds the particles of the run to the copy. The experiment keeps only the latest event, reachable with GetEvent().
Ownership: the template is not owned (the caller keeps it alive while the experiment is used). The created event is heap-allocated by MakeEvent() and the experiment holds the pointer but never deletes it by itself: call DelEvent() when the event is no longer needed (it also deletes the particles and inspectors added to the event, see event). The particles passed to MakeEvent() are owned by the event from then on, so create them with new and do not pass one particle to two events. Calling MakeEvent() again without DelEvent() leaks the previous event.
Definition at line 37 of file experiment.hpp.
|
inline |
Empty experiment; the template must be set with SetTemplate().
Definition at line 40 of file experiment.hpp.
| experiment::experiment | ( | event * | eventT_ | ) |
Experiment with a template.
| eventT_ | the template event (not owned, must outlive the experiment) |
Definition at line 44 of file experiment.cpp.
|
inline |
Mark the current event as off and delete it (with its particles and inspectors).
Definition at line 62 of file experiment.hpp.
|
inline |
The event created by the last MakeEvent() (owned by the experiment's user: see DelEvent()).
Definition at line 64 of file experiment.hpp.
| void experiment::MakeEvent | ( | Int_t | ninparticle_, |
| ... | |||
| ) |
Create a new event as a copy of the template and add particles to it.
Variadic C call: ninparticle_ must equal the number of particle* arguments that follow. There is no type or count check, a wrong count reads garbage from the stack (undefined behaviour). Each argument must be exactly of type particle* (cast a pointer to a derived class first); passing 0 / NULL literals as an int is also wrong. The new event replaces the previous one (the previous is not deleted).
| ninparticle_ | number of particle pointers that follow |
| ... | the particles, added in this order; owned by the new event |
Definition at line 9 of file experiment.cpp.
|
inline |
Mark the current event as off. The event itself is kept; only an internal flag changes (nothing else reads it).
Definition at line 59 of file experiment.hpp.
|
inline |
Set (or replace) the template event.
| eventT_ | the template event (not owned) |
Definition at line 46 of file experiment.hpp.
|
friend |
Definition at line 66 of file experiment.hpp.
|
private |
last created event (heap)
Definition at line 71 of file experiment.hpp.
|
private |
true after MakeEvent(), false after OffEvent()/DelEvent(); informational only
Definition at line 70 of file experiment.hpp.
|
private |
template event, not owned
Definition at line 69 of file experiment.hpp.