RooParticle
Particle scattering simulator with ROOT
Loading...
Searching...
No Matches
oddevent.cpp
Go to the documentation of this file.
1#include "TROOT.h"
2#include "oddevent.hpp"
3#include "event.hpp"
4
5void oddevent::DeriveDT(Double_t dt){
6 // Int_t pi, pj, fi;
7 vector<particle*>::iterator p1_;
8 vector<particle*>::iterator p2_;
9 vector<force*>::iterator ff_;
10
11 particle *p1, *p2;
12 force *ff;
13
14 TVector3 tempforce = TVector3();
15 for(p1_=particles.begin(); p1_!=particles.end(); p1_++){
16 p1 = *p1_;
17 if(p1->IsInvincible()){
18 // not moved, but the step is counted and recorded like in event::DeriveDT.
19 // (otherwise "CNT" inspectors on an invincible particle are never satisfied)
20 p1->releaseForce(dt);
21 continue;
22 }
23 for(p2_=particles.begin(); p2_!=particles.end(); p2_++){
24 p2 = *p2_;
25 if(p1==p2){
26 continue;
27 }
28 for(ff_=forces.begin(); ff_!=forces.end(); ff_++){
29 ff = *ff_;
30 tempforce = ff->Evaluate(p1, p2);
31 p1->holdForce(tempforce);
32 }
33 }
34 p1->releaseForce(dt);
35 }
36 return;
37}
std::vector< particle * > particles
the particles, in the order of addition (owned)
Definition event.hpp:495
std::vector< force * > forces
the forces (not owned)
Definition event.hpp:496
Base class of the pairwise forces.
Definition force.hpp:24
virtual TVector3 Evaluate(particle *p1_, particle *p2_)
Force on the first particle by the second.
Definition force.hpp:33
void DeriveDT(Double_t dt=1)
Advance every particle by dt, one after another.
Definition oddevent.cpp:5
A point body with mass, position, velocity, step count, time and an optional recorded path.
Definition particle.hpp:36
void releaseForce(const Double_t dt)
Apply the held force for one step of dt (see applyForce()) and clear it.
Definition particle.cpp:70
void holdForce(const TVector3 f)
Add a force to the pending force of this particle.
Definition particle.cpp:60
Bool_t IsInvincible()
Whether the particle is fixed (invincible).
Definition particle.hpp:208