RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
oddevent Class Reference

Variant of event which moves each particle right after its force is calculated. More...

#include <oddevent.hpp>

Inheritance diagram for oddevent:
event

Public Member Functions

void DeriveDT (Double_t dt=1)
 Advance every particle by dt, one after another.
 
- Public Member Functions inherited from event
 event ()
 Make an empty event: no particles, forces, inspectors nor volume.
 
 event (event &e)
 Make a copy of an event, to run many events from one template.
 
virtual ~event ()
 Delete the particles, the inspectors and the pre-derived copy (not the forces nor the volume).
 
event & operator= (const event &)=delete
 Deleted: the default assignment would copy the pointers and delete them twice.
 
particle * AddParticle (particle *particle_)
 Add a particle to the event.
 
void AddForce (force *force_)
 Add a force that acts on every pair of particles of the event.
 
void AddInspector (inspector *inspector_)
 Add an inspector (a terminating condition for DeriveInspect()).
 
void SetVolume (eventVolume *volume_)
 Set the volume used by IsInsideVolume() and the "VOUT"/"VOUTA" inspectors.
 
void SetIntegrator (integrator integ_)
 Select the integrator by enumerator (see integrator).
 
Bool_t SetIntegrator (TString name)
 Select the integrator by name.
 
integrator GetIntegrator ()
 The integrator in use (default kTaylor).
 
TString GetIntegratorName ()
 Name of the integrator in use, as accepted by SetIntegrator(TString).
 
void SetTolerance (Double_t rel, Double_t abs)
 Set the tolerances of kRK45.
 
Double_t GetRelTolerance ()
 Relative tolerance of kRK45.
 
Double_t GetAbsTolerance ()
 Absolute tolerance of kRK45 (fm for positions, c for velocities).
 
Double_t GetRK45Substep ()
 Substep suggested for the next kRK45 DeriveDT, in fm/c (0 : none yet).
 
Long_t GetRK45NSubsteps ()
 Number of accepted kRK45 substeps so far.
 
Long_t GetRK45NRejected ()
 Number of rejected kRK45 substeps so far.
 
void SetPairSymmetric (Bool_t sym_=kTRUE)
 Use Newton's third law to evaluate each pair once (default on).
 
Bool_t IsPairSymmetric ()
 Whether the pair symmetry is in use (default kTRUE).
 
void SetRelativistic (Bool_t rel_=kTRUE)
 Switch the dynamics to special relativity (default off).
 
Bool_t IsRelativistic ()
 Whether the relativistic flag is set (the flag only; kTaylor ignores it).
 
void SetInspectMode (inspectMode mode_)
 Set how the non-abort inspectors are combined in Inspect() (default kInspectAND).
 
inspectMode GetInspectMode ()
 The way the non-abort inspectors are combined.
 
void SetMaxInspectSteps (Long_t n)
 Set the safety cap of DeriveInspect().
 
Long_t GetMaxInspectSteps ()
 The safety cap of steps of DeriveInspect() (0 : unlimited).
 
stopReason GetStopReason ()
 Why the last DeriveInspect() ended (kStopNone before the first call).
 
TString GetStopReasonName ()
 Name of the last stop reason: "NONE", "INSPECTOR", "ABORT", "MAXSTEPS", "INVALID" or "FAILED".
 
Bool_t HasIntegratorFailed ()
 True once the integrator has given up.
 
void CalibrateVelocity ()
 Correct the speed of every non-invincible particle so that the given velocity is the velocity far from the others.
 
void DeriveDTN (Int_t n=1, Double_t dt=1)
 Call DeriveDT() n times.
 
void DeriveMAX (Double_t dt=1)
 Call DeriveDT() MAXSTEPS times (100,000, RPConfig.hpp), ignoring the inspectors.
 
Bool_t DeriveInspect (Int_t iperiod=1, Double_t dt=1)
 Derive until Inspect() is satisfied.
 
particle * getParticle (Int_t index)
 Get a particle by the order of addition.
 
force * getForce (Int_t index)
 Get a force by the order of addition (index as in getParticle(); the force is not owned).
 
inspector * getInspector (Int_t index)
 Get an inspector by the order of addition (index as in getParticle(); owned by the event).
 
Int_t getNParticle ()
 Number of particles.
 
Int_t getNForce ()
 Number of forces.
 
Int_t getNInspector ()
 Number of inspectors.
 
Long_t GetDeriveN (const Bool_t minima=kFALSE)
 Number of derived steps (particle::GetECNT()) over all particles, invincible ones included.
 
Double_t GetPE (Int_t index, Bool_t OnlyInvincibles=kFALSE)
 Potential energy of one particle with the other particles (amu c^2).
 
Double_t GetPE (particle *p, Bool_t OnlyInvincibles=kFALSE)
 Same as GetPE(Int_t, Bool_t) for a particle pointer.
 
Double_t GetNetKE (const Bool_t SR=kFALSE)
 Kinetic energy of the non-invincible particles (amu c^2).
 
Double_t GetNetPE ()
 Potential energy of the whole event (amu c^2).
 
Double_t GetNetE (const Bool_t SR=kFALSE)
 GetNetKE(SR) + GetNetPE(); conserved in the non-relativistic mode only (see GetNetERel()).
 
Double_t GetNetKERel ()
 Relativistic kinetic energy, the sum of \((\gamma-1) m_0\) over the non-invincible particles (amu c^2).
 
Double_t GetNetERel ()
 GetNetKERel() + GetNetPE(); the conserved energy of the relativistic mode.
 
TVector3 GetNetMomentum ()
 Total momentum of the non-invincible particles (amu c).
 
TVector3 GetNetAngularMomentum (TVector3 origin=TVector3())
 Total angular momentum \(\sum (\vec x - \vec o) \times \vec p\) of the non-invincible particles (amu c fm).
 
Double_t GetTime ()
 The largest evolved time among the particles (fm/c). Invincible particles do not advance their time, so it is 0 if all are invincible.
 
Double_t GetMinDistance ()
 The smallest distance between two particles, invincible ones included (fm). The largest double for fewer than two particles.
 
Double_t GetMaxAcceleration ()
 The largest acceleration (force / rest mass) of the non-invincible particles (amu c^2/fm/amu = c^2/fm).
 
Bool_t IsInsideVolume (Bool_t all=kTRUE)
 Whether the non-invincible particles are inside the volume (SetVolume()).
 
void preDerive ()
 Make a copy of the event and derive it until its inspectors are satisfied (pre-derivation).
 
void preDeriveSetup ()
 Placeholder for the set-up after preDerive().
 
Bool_t resetPreDerive ()
 Delete the pre-derived copy.
 
Bool_t Inspect ()
 Evaluate the terminating condition once, without deriving.
 
TString Print (Bool_t onlymechanic=kFALSE, Bool_t mute=kFALSE, Bool_t pprint=kFALSE)
 Describe the event (particles and inspectors) as text.
 
Bool_t SetInitial ()
 Set the initial condition from the present one.
 

Protected Member Functions

Bool_t UseRelativistic ()
 Always kFALSE: this scheme never uses the relativistic option.
 
- Protected Member Functions inherited from event
void DeriveTaylor (Double_t dt)
 The original scheme: all forces are evaluated for the present state of every moving particle (every ordered pair), then every particle is moved.
 
void DeriveSymplecticEuler (Double_t dt)
 Symplectic Euler step, v += a dt then x += v dt (momentum in the relativistic mode).
 
void DeriveVelocityVerlet (Double_t dt)
 Velocity-Verlet step (kick-drift-kick on the momentum in the relativistic mode).
 
void DeriveRK4 (Double_t dt)
 Classical 4th order Runge-Kutta step.
 
void DeriveRK45 (Double_t dt)
 Dormand-Prince 5(4) with adaptive substeps, advancing exactly dt (see integrator).
 
void ComputeForce (std::vector< TVector3 > &frc)
 Net force on every particle at the present state, in amu c^2/fm (zero for invincibles).
 
void ComputeAcceleration (std::vector< TVector3 > &acc)
 Acceleration F/m0 of every particle at the present state, in c^2/fm (zero for invincibles).
 
void FinishStep (Double_t dt)
 Close one step: every particle counts the step, the moving ones advance their time, paths are recorded.
 
TVector3 MomentumOf (particle *p, const TVector3 &v)
 The state variable u of the velocity v: v itself, or \(\gamma m_0 v\) when relativistic.
 
TVector3 VelocityOf (particle *p, const TVector3 &u)
 The velocity v of the state variable u (inverse of MomentumOf()).
 
void GetState (std::vector< TVector3 > &x, std::vector< TVector3 > &u)
 Read the positions x and state variables u of all particles.
 
void SetState (const std::vector< TVector3 > &x, const std::vector< TVector3 > &u)
 Write positions and state variables back to the non-invincible particles.
 
void ComputeDerivative (std::vector< TVector3 > &dx, std::vector< TVector3 > &du)
 Time derivatives dx/dt = v and du/dt (F/m0, or F when relativistic) at the present state.
 

Additional Inherited Members

- Public Types inherited from event
enum  integrator {
  kTaylor = 0 , kSymplecticEuler , kVelocityVerlet , kRK4 ,
  kRK45
}
 Integration scheme used by DeriveDT(). More...
 
enum  inspectMode { kInspectAND = 0 , kInspectOR }
 How the non-abort inspectors are combined in Inspect(). More...
 
enum  stopReason {
  kStopNone = 0 , kStopInspector , kStopAbort , kStopMaxSteps ,
  kStopInvalid , kStopFailed
}
 Why the last DeriveInspect() returned. More...
 
- Protected Attributes inherited from event
std::vector< particle * > particles
 the particles, in the order of addition (owned)
 
std::vector< force * > forces
 the forces (not owned)
 
Int_t nparticle = 0
 number of particles
 
Int_t nforce = 0
 number of forces
 

Detailed Description

Variant of event which moves each particle right after its force is calculated.

The particles are visited in the order of addition: the force on a particle is evaluated from the present positions of all the others (every ordered pair, every force), the particle is moved at once, and the later particles therefore see the already moved ones. An invincible particle is not moved but counts the step.

It has its own scheme (TAYLOR-like, non-relativistic) and ignores the integrator, event::SetPairSymmetric() and event::SetRelativistic() settings.

Many bodies: because the update is sequential, action and reaction are not applied at the same state. As soon as more than one particle moves (two or more moving bodies, the usual case in a many-body event), the total momentum is not exactly conserved, and the energy error is larger than with the simultaneous schemes of event. With a single moving particle (all others invincible) it is equivalent to the TAYLOR scheme. A copy of an oddevent made with new event(*ev) is a plain event, not an oddevent.

Definition at line 23 of file oddevent.hpp.

Member Function Documentation

◆ DeriveDT()

void oddevent::DeriveDT ( Double_t  dt = 1)
virtual

Advance every particle by dt, one after another.

Parameters
dttime step in fm/c

Each non-invincible particle receives the sum of the forces from all other particles (positions as left by the particles moved before it) and moves with x += v dt + a dt^2/2 ; v += a dt. Every particle counts one step and moving ones advance their time by dt.

Reimplemented from event.

Definition at line 5 of file oddevent.cpp.

◆ UseRelativistic()

Bool_t oddevent::UseRelativistic ( )
inlineprotectedvirtual

Always kFALSE: this scheme never uses the relativistic option.

Reimplemented from event.

Definition at line 35 of file oddevent.hpp.


The documentation for this class was generated from the following files: