Problems and inconsistent behaviours with several KVParticle methods handling different kinematical frames
KVParticle::get_frame(name) does not check if "name" is the name of the current default kinematics i.e. fFrameName and therefore if returns nullptr when called with the name of the current default kinematics. As a result, HasFrame(defaultFrameName) returns false even though GetFrame(defaultFrameName) correctly returns the address of the particles itself:
KVParticle p;
p.SetFrameName("lab");
p.GetFrame("lab");
(const KVParticle *) 0x746f7af42000
p.HasFrame("lab");
(bool) false ===> should be 'true'
As a result, SetFrame(newframe,oldframe,transform) fails when 'oldframe' is the current default kinematics:
p.SetFrame("cm","lab",TVector3(0,0,1));
Error in <KVParticle::SetFrame(newframe,oldframe)>: oldframe=lab does not exist!
although defining the new frame without explicit reference to the original frame works fine:
p.SetFrame("cm",TVector3(0,0,1))
If we now change the default frame, the old default frame is no longer problematic, while we have the same problem with the new default as before:
p.ChangeDefaultFrame("cm");
p.HasFrame("lab");
(bool) true ===> OK!
p.HasFrame("cm");
(bool) false ===> NOOOO!
Other problems arise with ChangeDefaultFrame() and SetFrame(frame,transform) when using the name of the current default kinematics:
p.ChangeDefaultFrame("cm");
*** Break *** segmentation violation
KVParticle m(1000,{0,0,250});
m.SetFrameName("lab");
m.SetFrame("lab",TVector3(0,0,1));
m.Print();
KVParticle mass=1000 Theta=0 Phi=0 KE=30.7764 Vpar=7.27104
lab: Theta=0 Phi=0 KE=23.0066 Vpar=6.32218
KVNameValueList::ParticleParameters : Parameters associated with a particle in an event (0x746f77640178)
<frameName=lab>
In the second case, a second "lab" frame is added to the particle according to the new frame definition.
Now each time that ChangeDefaultFrame("lab")
is called causes the particle's kinematics to flip-flop between the two:
m.ChangeDefaultFrame("lab")
m.Print()
KVParticle mass=1000 Theta=0 Phi=0 KE=23.0066 Vpar=6.32218
lab: Theta=0 Phi=0 KE=30.7764 Vpar=7.27104
KVNameValueList::ParticleParameters : Parameters associated with a particle in an event (0x746f77640178)
<frameName=lab>
m.ChangeDefaultFrame("lab")
m.Print()
KVParticle mass=1000 Theta=0 Phi=0 KE=30.7764 Vpar=7.27104
lab: Theta=0 Phi=0 KE=23.0066 Vpar=6.32218
etc. etc.
This affects both the dev
branch (current v1.14/2) and dev_new_filter
(future v1.15) branches