14 TVector3 dX = (p1->
GetX())-(p2->
GetX());
15 TVector3 dV = (p1->
GetV())-(p2->
GetV());
16 Double_t cc = (dX*dV)/(dX.Mag() * dV.Mag());
42 if(
name==e.name)
return e.id;
49 if(e.id==
id)
return TString(e.name);
76 std::cout<<
"No Function Name Defined / "<<
ftn << std::endl;
105 if(((
p1->
GetX())-(
p2->
GetX())).Mag2()==0.)
return kTRUE;
106 if(needV && ((
p1->
GetV())-(
p2->
GetV())).Mag2()==0.)
return kTRUE;
118 if(dX.Mag2()==0.)
return TMath::QuietNaN();
119 return (dX*dV)/dX.Mag();
126 Double_t cc = (dX*dV)/(dX.Mag() * dV.Mag());
128 return TMath::Max(-1., TMath::Min(1., cc));
136 Double_t angle = TMath::ATan2(dX.Cross(dV).Mag(), dX.Dot(dV));
137 return rad ? angle : angle * TMath::RadToDeg();
159 cerr<<
"inspector::SetInitial_D function needs to be fixed. do not use without any instruction "<<endl;
170 }
else if(
mtd==
"DEG"){
171 objval = TMath::Cos((180-var)*TMath::DegToRad());
172 }
else if(
mtd==
"RAD"){
173 objval = TMath::Cos((180-var));
175 std::cerr<<
"No Function Name Defined / "<<
ftn << std::endl;
191 Double_t A1 = (p0_->
GetX().Mag());
192 Double_t A2 = cos0-TMath::Sqrt(1-TMath::Power(cos0,2))*(cos1/TMath::Sqrt(1-TMath::Power(cos1,2)));
195 p0_->
x -= A*(p0_->
GetV());
215 TString result = TString(
"");
216 result += TString(
"[ Inspector Particle: ");
275 Bool_t separating = kFALSE;
278 return separating && (rest<
val);
285 std::cerr<<
"inspectorE::Inspect : inspecting method isn't defined well." << std::endl;
302 return std::numeric_limits<Double_t>::max();
316 return TMath::Abs(e);
318 return TMath::Abs((e-
ref)/
ref);
328 std::cerr<<
"inspectorE::Inspect : inspecting method isn't defined well." << std::endl;
334 TString result = TString(
"");
335 result += TString(
"[ Inspector Event: ");
static Double_t RemainingChange(event *ev, Bool_t *separating=nullptr)
static Double_t RemainingDeflection(event *ev, Bool_t *separating=nullptr)
One simulated system: particles, pairwise forces, inspectors and the time integration.
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()).
Double_t GetNetKERel()
Relativistic kinetic energy, the sum of over the non-invincible particles (amu c^2).
Double_t GetNetPE()
Potential energy of the whole event (amu c^2).
Long_t GetDeriveN(const Bool_t minima=kFALSE)
Number of derived steps (particle::GetECNT()) over all particles, invincible ones included.
Double_t GetMinDistance()
The smallest distance between two particles, invincible ones included (fm). The largest double for fe...
@ kTaylor
"TAYLOR", original scheme (default)
integrator GetIntegrator()
The integrator in use (default kTaylor).
Double_t GetNetE(const Bool_t SR=kFALSE)
GetNetKE(SR) + GetNetPE(); conserved in the non-relativistic mode only (see GetNetERel()).
Double_t GetNetKE(const Bool_t SR=kFALSE)
Kinetic energy of the non-invincible particles (amu c^2).
Double_t GetTime()
The largest evolved time among the particles (fm/c). Invincible particles do not advance their time,...
Bool_t IsRelativistic()
Whether the relativistic flag is set (the flag only; kTaylor ignores it).
Double_t GetNetERel()
GetNetKERel() + GetNetPE(); the conserved energy of the relativistic mode.
TString Print(Bool_t element=kFALSE, Bool_t mechanics=kFALSE, Bool_t mute=kFALSE, Bool_t pprint=kFALSE)
Describe as text "[ Inspector Event: MTD, CRT, VAL, RST (, ABORT) ]".
Bool_t IsValid()
Whether the method is one of the inspectorE methods.
Double_t ref
reference energy E0 of "EDG"/"EDL"
inspectorE(event *event_, TString method_, Double_t val_=-1)
Make an inspector on an event, method by name.
Bool_t Inspect()
Whether the condition is satisfied now (kFALSE for an invalid method, with a message on stderr).
event * evt
the watched event (not owned)
void SetEvent(event *event_)
Set the event to watch (forgets the reference energy E0).
Double_t Evaluate()
The compared quantity, see the table (the first "EDG"/"EDL" call sets E0 and gives 0).
Double_t Evaluate()
The compared quantity: cosine, angle (degree or radian), step count, relative speed (c),...
TString Print(Bool_t particles=kFALSE, Bool_t mechanics=kFALSE, Bool_t mute=kFALSE, Bool_t pprint=kFALSE)
Describe as text "[ Inspector Particle: MTD, CRT (criterion), VAL (value), RST (result) ]".
Bool_t SetInitial_D(Bool_t index=0, TString mtd="", Double_t var=0.1)
Move one particle back along its velocity so that the present condition is the one of the given angle...
Double_t CalculateRadialVelocity()
dX.dV/norm(dX) (c), positive when receding; NaN if dX = 0.
inspectorP(particle *p1_, particle *p2_, TString method_, Double_t val_=-1)
Make an inspector on two particles, method by name.
Double_t CalculateAngle(Bool_t rad=kFALSE)
Angle between dX and dV in degree (radian if rad), NaN for a zero vector.
particle * GetParticle2()
The second particle.
Bool_t IsValid()
Whether the method is one of the inspectorP methods.
void SetParticles(particle *p1_, particle *p2_)
Set both particles.
particle * p2
the two particles (not owned)
particle * GetParticle1()
The first particle.
Bool_t Inspect()
Whether the condition is satisfied now.
Double_t CalculateCosine()
Cosine of the angle between dX and dV, clamped to [-1, 1] (NaN for a zero vector).
Double_t CaculateSPD()
Relative speed, norm of dV (c).
Bool_t IsDegenerate(Bool_t needV=kTRUE)
Whether dX (or, if needV, dV) is the zero vector.
Double_t CalculateDistance()
Distance, norm of dX (fm).
Long_t CountDeriving()
Smaller of the step counts of the two particles.
Inspector : one terminating condition of event::DeriveInspect().
void SetValue(Double_t val_)
Set the criterion value to compare with (in the unit of the quantity).
static methodID ParseMethod(TString name)
Parse a method name.
Double_t GetCriterion()
The criterion value (default -1).
methodID mtd
parsed method
void SetMethod(TString methodname)
Set the method by name.
methodID
Method identifier.
@ kPEL
"PEL": net potential energy < value
@ kACG
"ACG": largest acceleration > value
@ kKEG
"KEG": net kinetic energy > value
@ kDSTL
"DSTL": distance < value
@ kASYD
"ASYD": remaining deflection of every moving particle < value (rad), all pairs receding
@ kCNT
"CNT": number of derived steps > value
@ kDNL
"DNL": smallest step count < value
@ kTML
"TML": evolved time < value
@ kRAD
"RAD": angle between dX and dV in radian < value
@ kDSTG
"DSTG": distance > value
@ kDSL
"DSL": smallest distance between two particles < value
@ kKEL
"KEL": net kinetic energy < value
@ kVRL
"VRL": radial velocity < value
@ kASYV
"ASYV": remaining relative velocity change of every moving particle < value, all pairs receding
@ kDSG
"DSG": smallest distance between two particles > value
@ kInvalid
unknown method name
@ kVOUT
"VOUT": any moving particle is outside the volume
@ kVRG
"VRG": radial velocity > value
@ kCOS
"COS": cosine of the angle between dX and dV < value
@ kDNG
"DNG": largest step count > value (Evaluate() gives the smallest, see inspectorE)
@ kTMG
"TMG": evolved time > value
@ kVOUTA
"VOUTA": all moving particles are outside the volume
@ kEDL
"EDL": relative drift of the net energy < value
@ kPKL
"PKL": abs(net PE / net KE) < value
@ kDXG
"DXG": largest step count > value
@ kPEG
"PEG": net potential energy > value
@ kSPDL
"SPDL": relative speed < value
@ kDEG
"DEG": angle between dX and dV in degree < value
@ kPKG
"PKG": abs(net PE / net KE) > value
@ kACL
"ACL": largest acceleration < value
@ kSPDG
"SPDG": relative speed > value
@ kEDG
"EDG": relative drift of the net energy > value
@ kDXL
"DXL": smallest step count < value (Evaluate() gives the largest, see inspectorE)
static TString MethodName(methodID id)
Name of a method identifier.
Double_t val
criterion value
TString ftn
method name as given
virtual TString Print(Bool_t element=kFALSE, Bool_t mechanics=kFALSE, Bool_t mute=kFALSE, Bool_t pprint=kFALSE)
Describe the inspector as text (the base class : empty).
Bool_t IsAbort()
Whether this is an abort inspector.
A point body with mass, position, velocity, step count, time and an optional recorded path.
TVector3 GetV()
Velocity in c (a copy).
Long_t GetECNT()
Number of derived steps ("evolved count"), counted also for an invincible particle.
TString Print(Bool_t onlymechanic=kFALSE, Bool_t mute=kFALSE)
Describe the particle as text "[ Particle x: [..], v: [..] ]".
TVector3 GetX()
Position in fm (a copy).
static const struct @0 gMethodTable[]
Double_t XVCosine(particle *p1, particle *p2)