20 #include "KVPosition.h"
21 #include "KVParticle.h"
27 #include "KVKinematicalFrame.h"
55 fGroups.SetOwner(
kTRUE);
67 #if ROOT_VERSION_CODE >= ROOT_VERSION(3,4,0)
97 SetMomentum(px, py, pz);
105 KVParticle::~KVParticle()
121 return kSpeedOfLight;
189 void KVParticle::print_frames(
TString fmt)
const
195 TIter next(&fBoosted);
198 cout << fmt <<
" [" << frame->
GetName() <<
"] : ";
200 cout <<
" Theta=" << part->
GetTheta() <<
" Phi=" << part->
GetPhi()
201 <<
" KE=" << part->
GetKE() <<
" Vpar=" << part->
GetVpar() << endl;
202 part->print_frames(fmt);
216 cout <<
"Mass=" <<
M() << endl;
225 if (ngroups > 1) cout <<
"s";
230 while ((
gr = it())) {
232 if (ngroups > 1 &&
index < ngroups) cout <<
", ";
255 if (et * et >
M2()) {
258 if (pmod && newp.
Mag()) {
268 SetMomentum(0., 0., 0.);
272 SetMomentum(0., 0., 0.);
297 if (!fFrameCopyOnly) {
307 GetTopmostParentFrame()->fBoosted.
Copy(((
KVParticle&)obj).fBoosted);
331 SetXYZM(0., 0., 0., 0.);
391 TIter next(&fBoosted);
409 if (rhs.GetPInitial())
SetE0(rhs.GetPInitial());
447 GetOriginal()->fName.
Form(
"%s", nom);
458 return GetOriginal()->fName.
Data();
519 Int_t KVParticle::_GetNumberOfDefinedFrames()
const
529 nf +=
p->GetParticle()->_GetNumberOfDefinedFrames();
594 cout <<
"Particle belongs to no groups" << endl;
598 cout <<
"----------------------------------------" << endl;
599 cout <<
"List of groups this particle belongs to:" << endl;
600 cout <<
"----------------------------------------" << endl;
605 cout <<
"----------------------------------------" << endl;
667 if (_defname ==
"") _defname =
"default";
673 f = get_parent_frame(ff);
686 f->GetParticle()->GetListOfFrames()->Remove(newdframe);
688 next_trans =
f->GetTransform();
697 Set4Mom(*(save_newdef->GetParticle()));
698 save_newdef->GetParticle()->
Set4Mom(old_def_p);
699 save_newdef->SetTransform(next_trans.
Inverse());
700 save_newdef->
SetName(_defname);
708 fBoosted.
Clear(
"nodelete");
709 fBoosted.
AddAll(&frame_list);
836 if (!strcmp(frame,
""))
return;
851 tmp->GetParticle()->SetOriginal(GetOriginal());
854 tmp->ApplyTransform(
this, ft);
939 (warn_and_return_null_if_unknown ?
940 KVError::Warning(
this,
"GetFrame(const Char_t*)",
"No frame \"%s\" defined for particle. 0x0 returned.",
964 f->ReapplyTransform(
this);
966 f->GetParticle()->UpdateAllFrames();
986 if (!fBoosted.
GetEntries() || !strcmp(frame,
"")) {
996 if ((f =
p->GetParticle()->get_frame(_frame)))
break;
1011 if (!fBoosted.
GetEntries() || !strcmp(f,
"")) {
1016 TIter it(&fBoosted);
1021 if ((r =
p->GetParticle()->get_parent_frame(_frame, p)))
return r;
1050 KVError::Error(
this,
"SetFrame(newframe,oldframe)",
"oldframe=%s does not exist!", oldframe);
1053 f->GetParticle()->SetFrame(newframe, ft);
1070 beta.SetXYZ(0, 0, 0);
1072 return (kSpeedOfLight *
beta);
1105 if (!strcmp(
"spher", opt) || !strcmp(
"spherical", opt)) {
1110 SetVectM(pvec,
M());
1113 if (strcmp(
"cart", opt) && strcmp(
"cartesian", opt)) {
1114 KVError::Warning(
this,
"SetMomentum(Double_t,Double_t,Double_t,Option_t*)",
1115 "Unkown coordinate system\n known system are :\n\t\"cartesian\" or \"cart\" (default)\n\t\"spherical\" or \"spher\"");
1116 KVError::Warning(
this,
"SetMomentum(Double_t,Double_t,Double_t,Option_t*)",
1120 SetVectM(pvec,
M());
1183 if (_f->GetParticle()->GetParentFrame() == parent) {
1184 _f->GetParticle()->SetParentFrame(
nullptr);
1202 if (
f->GetParticle()->GetParentFrame() == parent) {
1203 f->GetParticle()->SetParentFrame(
nullptr);
1220 f->GetParticle()->SetParentFrame(parent);
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Kinematical representation of a particle in different reference frames.
void Copy(TObject &nvl) const override
void ls(Option_t *opt="") const override
void Clear(Option_t *opt="") override
const Char_t * GetStringValue(const Char_t *name) const
void Clear(Option_t *="") override
When the frame list is cleared, this particle is no longer the parent of any frames in the list.
TObject * Remove(TObject *) override
When a kinematical frame is removed, this particle is no longer the parent frame.
void Add(TObject *) override
When a kinematical frame is added, this particle becomes the parent frame.
void Copy(TObject &_new_list) const override
void AddAll(const TCollection *) override
When all frames in a list are added to this one, this particle becomes the parent of all frames in th...
Base class for relativistic kinematics of massive particles.
Int_t GetNumberOfDefinedGroups() const
void SetIsOK(Bool_t flag=kTRUE)
TVector3 * GetPInitial() const
virtual void SetMass(Double_t m)
void RemoveGroup(const Char_t *groupname)
Remove group from list of groups.
void AddGroup(const Char_t *groupname, const Char_t *from="") const
TVector3 GetMomentum() const
void RemoveAllGroups()
Remove all groups.
KVNameValueList * GetParameters() const
Double_t GetTheta() const
KVParticle & operator=(const KVParticle &rhs)
KVParticle assignment operator.
const Char_t * GetFrameName(void) const
void ls(Option_t *option="") const override
void SetVelocity(const TVector3 &)
Set velocity of particle (in cm/ns units)
KVUniqueNameList * GetGroups() const
Bool_t IsDetected() const
const Char_t * GetName() const override
return the field fName
void SetKE(Double_t ecin)
void init()
default initialisation
void Copy(TObject &) const override
void Set4Mom(const TLorentzVector &p)
KVParticle InFrame(const KVFrameTransform &) const
void SetE0(TVector3 *e=0)
void Clear(Option_t *opt="") override
Reset particle properties i.e. before creating/reading a new event.
void ListGroups() const
List all stored groups.
void SetFrameName(const Char_t *framename)
void SetName(const Char_t *nom)
Set Name of the particle.
void SetFrame(const Char_t *frame, const KVFrameTransform &)
friend class KVKinematicalFrame
KVParticle const * GetFrame(const Char_t *frame, Bool_t warn_and_return_null_if_unknown=kTRUE) const
void ChangeFrame(const KVFrameTransform &, const KVString &="")
Bool_t BelongsToGroup(const Char_t *groupname) const
void ChangeDefaultFrame(const Char_t *, const Char_t *defname="")
void SetRandomMomentum(Double_t T, Double_t thmin, Double_t thmax, Double_t phmin, Double_t phmax, Option_t *opt="isotropic")
const KVParticle * GetCurrentDefaultKinematics() const
void Print(Option_t *t="") const override
print out characteristics of particle
TVector3 GetVelocity() const
returns velocity vector in cm/ns units
Double_t GetVperp() const
KVList * GetListOfFrames() const
Base class used for handling geometry in a multidetector array.
virtual TVector3 GetRandomDirection(Option_t *t="isotropic")
TObject * Remove(TObject *obj) override
Remove object from list.
void Add(TObject *obj) override
void Clear(Option_t *option="") override
void Delete(Option_t *option="") override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Optimised list in which named objects can only be placed once.
void Add(TObject *obj) override
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual void AddAll(const TCollection *col)
virtual Int_t GetEntries() const
void Add(TObject *obj) override
TLorentzRotation Inverse() const
TLorentzVector & operator=(const TLorentzVector &)
void Streamer(TBuffer &) override
const char * GetName() const override
const char * GetName() const override
virtual const char * GetName() const
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual TObject * FindObject(const char *name) const
virtual void ls(Option_t *option="") const
int CompareTo(const char *cs, ECaseCompare cmp=kExact) const
const char * Data() const
void Form(const char *fmt,...)
void SetXYZ(Double_t x, Double_t y, Double_t z)
RooCmdArg Parameters(const RooArgSet ¶ms)
Expr< UnaryOp< Sqrt< T >, SMatrix< T, D, D2, R >, T >, T, D, D2, R > sqrt(const SMatrix< T, D, D2, R > &rhs)
double beta(double x, double y)
RVec< PromoteTypes< T0, T1 > > pow(const T0 &x, const RVec< T1 > &v)
void Error(UserClass p, const char *location, const char *va_(fmt),...)
void Warning(UserClass p, const char *location, const char *va_(fmt),...)
Double_t Sqrt(Double_t x)