KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVKinematicalFrame.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Thu Jan 19 17:29:54 2017
2 //Author: John Frankland,,,
3 
4 #include "KVKinematicalFrame.h"
5 #include "TClass.h"
6 
8 
9 
10 
14 KVKinematicalFrame::KVKinematicalFrame(const Char_t* name, const KVParticle* original, const KVFrameTransform& trans)
15  : TNamed(name, "Kinematical frame"), fTransform(trans), fParticle((KVParticle*)original->IsA()->New())
16 {
17  // Create representation of original particle in transformed frame
18  // This frame has a name which can be used to retrieve it from a list
19 
20  ReapplyTransform(original);
21  fParticle->SetFrameName(name);
22 }
23 
24 
25 
28 
30  : TNamed(), fTransform(trans), fParticle((KVParticle*)original->IsA()->New())
31 {
32  // Create representation of original particle in transformed frame
33 
34  ReapplyTransform(original);
35 }
36 
37 
38 
42 
44  : TNamed(), fTransform(t), fParticle(nullptr)
45 {
46  // Modify the kinematics of the particle according to the given transformation
47  // Recursively update the kinematics in all frames defined for this particle
49  p->UpdateAllFrames();
50 }
51 
52 
53 
56 
58  : TNamed((const TNamed&)o), fTransform(o.fTransform),
59  fParticle(o.GetParticle() ? (KVParticle*)o.GetParticle()->IsA()->New() : nullptr)
60 {
61  // Copy constructor required for rootcint (not rootcling)
62  if (GetParticle()) {
64  o.GetParticle()->Copy(*GetParticle());
66  fParticle->SetFrameName(o.GetParticle()->GetFrameName());
67  }
68 }
69 
70 
71 
74 
76 {
77  // Assignment operator required for rootcint (not rootcling)
78 
79  if (&o == this) return (*this);
81  fParticle.reset(o.GetParticle() ? (KVParticle*)o.GetParticle()->IsA()->New() : nullptr);
82  if (GetParticle()) {
84  o.GetParticle()->Copy(*GetParticle());
86  fParticle->SetFrameName(o.GetParticle()->GetFrameName());
87  }
88  return *this;
89 }
90 
91 
92 
95 
97 {
98  // Apply stored kinematical transformation to the particle
99 
100  original->SetFrameCopyOnly();
101  original->Copy(*(fParticle.get()));
102  original->ResetFrameCopyOnly();
103  fParticle->Transform(fTransform.Inverse());
104 }
105 
106 
107 
110 
112 {
113  // Apply new kinematical transformation to the particle and update all subframes
114 
115  fTransform = trans;
116  ReapplyTransform(original);
117  // recursively update all subframes
118  fParticle->UpdateAllFrames();
119 }
120 
121 
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
Utility class for kinematical transformations of KVParticle class.
Kinematical representation of a particle in different reference frames.
std::unique_ptr< KVParticle > fParticle
kinematically transformed particle
KVParticle * GetParticle() const
KVKinematicalFrame & operator=(const KVKinematicalFrame &)
Assignment operator required for rootcint (not rootcling)
KVFrameTransform fTransform
kinematical transform wrt 'parent' frame
void ReapplyTransform(const KVParticle *original)
Apply stored kinematical transformation to the particle.
KVKinematicalFrame(const Char_t *name, const KVParticle *original, const KVFrameTransform &trans)
void ApplyTransform(const KVParticle *original, const KVFrameTransform &trans)
Apply new kinematical transformation to the particle and update all subframes.
Base class for relativistic kinematics of massive particles.
Definition: KVParticle.h:398
void UpdateAllFrames()
Definition: KVParticle.cpp:913
const Char_t * GetFrameName(void) const
Definition: KVParticle.h:801
void ResetFrameCopyOnly() const
Definition: KVParticle.h:509
virtual void Copy(TObject &) const
Definition: KVParticle.cpp:269
void SetFrameCopyOnly() const
Definition: KVParticle.h:505
TLorentzRotation Inverse() const
TLorentzVector & Transform(const TLorentzRotation &)