GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » Tracking » Charge in FairTrackPar and GeaneTrackRep
icon4.gif  Charge in FairTrackPar and GeaneTrackRep [message #11112] Fri, 22 October 2010 06:11 Go to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 140.109.130*
Hi,
I have seen that in the constructors of FairTrackPar and GeaneTrackRep the charge is defined as integer and double respectively.
This leaves the following warning:

/.../trunk/GenfitTools/trackrep/GeaneTrackRep/GeaneTrackRep.cxx:53: warning: passing 'double' for argument 5 to 'FairTrackParP::FairTrackParP(TVector3, TVector3, TVector3, TVector3, Int_t, TVector3, TVector3, TVector3)'

and not only, due to the following lines:

GeaneTrackRep::GeaneTrackRep(FairGeanePro* geane,
                             const GFDetPlane& plane,
                             const TVector3& mom,
                             const TVector3& poserr,
                             const TVector3& momerr,
                             double q,
                             int PDGCode)
  : GFAbsTrackRep(5), _geane(geane), _pdg(PDGCode), _backw(0)
{
  FairTrackParP par(plane.getO(),mom,poserr,momerr,q,plane.getO(),plane.getU(),plane.getV());
(5th parameter -> q).
I think both objects should use the same kind of variable, to be much less "error prone". Indeed, the conversion from double to integer is dangerous:

int(0.9999999) = 0

I think this is quite important! Even other tracking codes should be changed to use a common standard for the particle charge, by substitution of all the current conversions (once fixed if it is better to use int or double).

Re: Charge in FairTrackPar and GeaneTrackRep [message #11113 is a reply to message #11112] Fri, 22 October 2010 06:16 Go to previous messageGo to next message
Anonymous Poster From: *aspublic.wlan.sinica.edu.tw
Hi,

in principle the charge could be eliminated from the ctor of GeaneTrackRep, since it is fixed by the PDG id.

I am not sure what is the better choice for the charge (int vs. double). I guess int is enough. I absolutely agree that we should fix it to one of them.

Cheers, Christian
Re: Charge in FairTrackPar and GeaneTrackRep [message #11114 is a reply to message #11113] Fri, 22 October 2010 10:24 Go to previous messageGo to next message
Lia Lavezzi
Messages: 291
Registered: May 2007
Location: Torino
first-grade participant

From: *pv.infn.it
Hi,
I remember some time ago it was decided to use the integer for the charge in geane interface and, in trackbase, all the double were changed to int with the function TMath::Sign, e.g.:
fq = (int)TMath::Sign(1.0, fQp);
to avoid bad conversions.
Ciao,
Lia.
Re: Charge in FairTrackPar and GeaneTrackRep [message #11118 is a reply to message #11114] Sun, 24 October 2010 05:41 Go to previous messageGo to next message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: 219.238.111*
Then we could modify GeaneTrackRep in order to get an integer, or maybe it would be better to put the proper conversion in the "double" constructor and add a new GeaneTrackRep constructor which takes also integer charge, in order to have no need of modifications in other parts of the code (we should be double-safe in this case).
Re: Charge in FairTrackPar and GeaneTrackRep [message #11125 is a reply to message #11118] Wed, 27 October 2010 11:26 Go to previous message
StefanoSpataro is currently offline  StefanoSpataro
Messages: 2736
Registered: June 2005
Location: Torino
first-grade participant

From: *vpn.unito.it
Hi,
I have committed the code in svn, so that we have a "proper" double constructur (uwing TMath::Sign), and also a int constructor.
If you don't like this solution, just scream!
Previous Topic: Geometry of STT
Next Topic: Bug in PndGenfitAdapters
Goto Forum:
  


Current Time: Sat Dec 21 15:53:29 CET 2024

Total time taken to generate the page: 0.00752 seconds