Tvector3/tlorentvector strangeness

Hi,

My question is easy: What I am doing wrong?:

     //[tempV is a TVector3, _D[0] is a TLorentzVector*]

//----------------------------------------------------------------------
tempV.SetPtThetaPhi(D_p, _D_theta, _D_phi);
_D[0]-> SetVectM(tempV, D_m);

     cout << "xxxxx "                                                       
          << _D_theta << ' ' << _D[0]->Theta() << ' ' << tempV.Theta()      
          << ' '                                                            
          << _D_phi << ' ' << _D[0]->Phi() << endl

//----------------------------------------------------------------------
=>

xxxxx 2.93952 0.202073 0.202073 0.868022 -2.27357
xxxxx 0.352845 0.352845 0.352845 1.02842 1.02842
xxxxx 2.97352 0.16807 0.16807 2.32567 -0.815922
xxxxx 0.322986 0.322986 0.322986 -0.50465 -0.50465
xxxxx 2.94664 0.194951 0.194951 3.38337 0.241779
xxxxx 0.260796 0.260796 0.260796 0.145974 0.145974
xxxxx 3.03626 0.105328 0.105328 3.17692 0.0353308

Is it as it should work?

The domain of the theta should be [0;Pi], not? In this case why it comes back with numbers [0; Pi/2]?

[the code segment is copied directly from the code which is compiled! I cant reproduce it in CINT via “command line”]

parameters:
root: 5.15/06 compiled with gcc 4.1.2 on debian 4.0

Thanx, k.

Hi ,
Theta should be define between [0,PI) while Phi between (-PI,PI]

I cannot reproduce your problem. Can you send me your shortest running program producing this ?

You could also try to use the LorentzVector and 3D Vectors from mathcore.
I would be interested to know if you observe the same thing also in that case.

Best Regards

Lorenzo

The problem is lying at the momentum:
[the sortest code which produces the problem:]


#include <TVector3.h>
#include <TLorentzVector.h>
#include <TRandom.h>
#include <TMath.h>

#include

using namespace std;

main(){

TVector3 V3;// = new TVector3();
TLorentzVector* LV = new TLorentzVector();
double D_p;
TRandom* R = new TRandom();

double _D_theta, _D_phi, D_m = 2;

for(int i =0; i < 10; i++){

  D_p = 100*(R->Rndm()-0.5);
  _D_theta = TMath::Pi()*R->Rndm();
  _D_phi = 2*TMath::Pi()*(R->Rndm() - 0.5);

  V3.SetPtThetaPhi(D_p, _D_theta, _D_phi);

  cout << "xxxxx -- " << D_p << ' '
       << _D_theta << ' ' << V3.Theta() << endl;
  LV-> SetVectM(V3, D_m);

  cout << "xxxxx " << D_p << ' '
       << _D_theta << ' ' << LV->Theta() << ' ' << V3.Theta() << ' '
       << _D_phi << ' ' << LV->Phi() << endl;

}
}

=>

xxxxx – -34.57 1.32966 1.81193
xxxxx -34.57 1.32966 1.81193 1.81193 1.82589 -1.3157
xxxxx – -25.3613 0.608553 2.53304
xxxxx -25.3613 0.608553 2.53304 2.53304 -2.07756 1.06403
xxxxx – 27.5951 0.683429 0.683429
xxxxx 27.5951 0.683429 0.683429 0.683429 2.27448 2.27448
xxxxx – 9.93828 1.54033 1.54033
xxxxx 9.93828 1.54033 1.54033 1.54033 2.47725 2.47725

So if the momentum haz negativ sign, the theta and phi will be changed but not the sign of the momentum (in my calculation the sing of the momentum was strongly connected with the theta angle)

So here we come, this is what we have :slight_smile:

Butthe question remains:
Is this as it should work?

k.
proba.C (804 Bytes)

Ah, now it is clear, you are setting nevative values of pt. The pt MUST BE grater than zero is defined as sqrt(px2+py2).
If you are doing that, you cannot expect then that the angle came out right.
If you sign the pt using for example the particle charge you should set in the TVector3 the module.

Maybe the classes could be protected against this, but it is probably un un-necessary overhead.

Cheers

Lorenzo