Memberfunction GetX introduced in Ali3Vector for easy component access.
Picosecond support and calculation of time difference introduced in AliTimestamp
to enable investigation of both very short (i.e. time of flight analysis in
particle physics experiments) and very long (i.e. astrophysical phenomena)
time intervals.
return v;
}
///////////////////////////////////////////////////////////////////////////
+Double_t Ali3Vector::GetX(Int_t i,TString f)
+{
+// Provide i-th vector component according to reference frame f.
+// The vector components are addressed via the generic x1,x2,x3 notation.
+// So, i=1 denotes the first vector component.
+// The error on the selected component can be obtained via the
+// usual GetResultError() facility.
+
+ fDresult=0;
+
+ if (i<1 || i>3) return 0;
+
+ Double_t vec[3];
+ Double_t err[3];
+ GetVector(vec,f);
+ GetErrors(err,f);
+
+ fDresult=err[i-1];
+
+ return vec[i-1];
+}
+///////////////////////////////////////////////////////////////////////////
Ali3Vector GetVecLong() const; // Provide longitudinal vector w.r.t. z-axis
Ali3Vector GetPrimed(TRotMatrix* m) const; // Provide vector components in a rotated frame
Ali3Vector GetUnprimed(TRotMatrix* m) const; // Provide original vector components from a rotated one
+ Double_t GetX(Int_t i,TString f); // Provide i-th vector component in frame f
protected:
Double_t fV,fTheta,fPhi; // Vector in spherical coordinates
Double_t fDx,fDy,fDz; // Errors on Cartesian coordinates
Double_t fDresult; // Error on scalar result (e.g. norm or dotproduct)
- ClassDef(Ali3Vector,8) // Handling of 3-vectors in various reference frames.
+ ClassDef(Ali3Vector,9) // Handling of 3-vectors in various reference frames.
};
#endif
// Creation of an AliPosition object and initialisation of parameters.
// The unit scale for position coordinates is initialised to cm.
fScale=0.01;
+ fTstamp=0;
}
///////////////////////////////////////////////////////////////////////////
AliPosition::~AliPosition()
{
// Destructor to delete dynamically allocated memory
+ if (fTstamp)
+ {
+ delete fTstamp;
+ fTstamp=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
AliPosition::AliPosition(const AliPosition& p) : Ali3Vector(p)
{
// Copy constructor
fScale=p.fScale;
+ if (p.fTstamp) fTstamp=new AliTimestamp(*(p.fTstamp));
}
///////////////////////////////////////////////////////////////////////////
void AliPosition::SetPosition(Double_t* r,TString f)
return fScale;
}
///////////////////////////////////////////////////////////////////////////
+void AliPosition::SetTimestamp(AliTimestamp& t)
+{
+// Store the timestamp for this position.
+ if (fTstamp) delete fTstamp;
+ fTstamp=new AliTimestamp(t);
+}
+///////////////////////////////////////////////////////////////////////////
+AliTimestamp* AliPosition::GetTimestamp()
+{
+// Provide the timestamp of this position.
+ return fTstamp;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPosition::RemoveTimestamp()
+{
+// Remove the timestamp from this postion.
+ if (fTstamp)
+ {
+ delete fTstamp;
+ fTstamp=0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPosition::Data(TString f) const
+{
+// Provide all position/time information within the coordinate frame f.
+ Ali3Vector::Data(f);
+ if (fTstamp) fTstamp->Date(1);
+}
+///////////////////////////////////////////////////////////////////////////
#include "TString.h"
#include "Ali3Vector.h"
+#include "AliTimestamp.h"
class AliPosition : public Ali3Vector
{
void ResetPosition(); // Reset position and errors to 0
void SetUnitScale(Float_t s); // Set unit scale for the position coordinates
Float_t GetUnitScale() const; // Provide unit scale for the position coordinates
+ void SetTimestamp(AliTimestamp& t); // Set the timestamp for this position
+ AliTimestamp* GetTimestamp(); // Provide the timestamp for this position
+ void RemoveTimestamp(); // Remove the timestamp from this position
+ virtual void Data(TString f="car") const; // Print all position/time info for coord. frame f
protected:
- Float_t fScale; // The unit scale used for the position coordinates
+ Float_t fScale; // The unit scale used for the position coordinates
+ AliTimestamp* fTstamp; // The timestamp for this position
- ClassDef(AliPosition,6) // Handling of positions in various reference frames.
+ ClassDef(AliPosition,7) // Handling of positions (with timestamps) in various reference frames.
};
#endif
if (strlen(title)) cout << " Title : " << title;
cout << endl;
cout << " Position";
- Ali3Vector::Data(f);
+ AliPosition::Data(f);
if (fDevice)
{
const char* devname=fDevice->GetName();
// they provide an absolute timescale irrespective of timezone or daylight
// saving time (DST).
//
-// This AliTimestamp facility allows for nanosecond precision.
-// However, when the fractional JD, MJD and TJD counts are used instead
+// This AliTimestamp facility allows for picosecond precision, in view
+// of time of flight analyses for particle physics experiments.
+// For normal date/time indication the standard nanosecond precision
+// will in general be sufficient.
+// Note that when the fractional JD, MJD and TJD counts are used instead
// of the integer (days,sec,ns) specification, the nanosecond precision
// may be lost due to computer accuracy w.r.t. floating point operations.
//
// in the docs of TTimeStamp.
FillJulian();
+ fJps=0;
}
///////////////////////////////////////////////////////////////////////////
AliTimestamp::AliTimestamp(TTimeStamp& t) : TTimeStamp(t)
// All attributes are initialised to the values of the input TTimeStamp.
FillJulian();
+ fJps=0;
}
///////////////////////////////////////////////////////////////////////////
AliTimestamp::~AliTimestamp()
fMJD=t.fMJD;
fJsec=t.fJsec;
fJns=t.fJns;
+ fJps=t.fJps;
fCalcs=t.fCalcs;
fCalcns=t.fCalcns;
}
return je;
}
///////////////////////////////////////////////////////////////////////////
-void AliTimestamp::SetMJD(Int_t mjd,Int_t sec,Int_t ns)
+void AliTimestamp::SetMJD(Int_t mjd,Int_t sec,Int_t ns,Int_t ps)
{
// Set the Modified Julian Date (MJD) and time and update the TTimeStamp
// parameters accordingly (if possible).
// mjd : The modified Julian date.
// sec : The number of seconds elapsed within the MJD.
// ns : The remaining fractional number of seconds (in ns) elapsed within the MJD.
+// ps : The remaining fractional number of nanoseconds (in ps) elapsed within the MJD.
+//
+// Note : ps=0 is the default value.
- if (sec<0 || ns<0)
+ if (sec<0 || sec>=24*3600 || ns<0 || ns>=1e9 || ps<0 || ps>=1000)
{
cout << " *AliTimestamp::SetMJD* Invalid input."
<< " sec : " << sec << " ns : " << ns << endl;
fMJD=mjd;
fJsec=sec;
fJns=ns;
+ fJps=ps;
Int_t epoch=40587;
SetMJD(days,secs,ns);
}
///////////////////////////////////////////////////////////////////////////
-void AliTimestamp::SetJD(Int_t jd,Int_t sec,Int_t ns)
+void AliTimestamp::SetJD(Int_t jd,Int_t sec,Int_t ns,Int_t ps)
{
// Set the Julian Date (JD) and time and update the TTimeStamp
// parameters accordingly (if possible).
// jd : The Julian date.
// sec : The number of seconds elapsed within the JD.
// ns : The remaining fractional number of seconds (in ns) elapsed within the JD.
+// ps : The remaining fractional number of nanoseconds (in ps) elapsed within the JD.
+//
+// Note : ps=0 is the default value.
Int_t mjd=jd-2400000;
sec-=12*3600;
mjd-=1;
}
- SetMJD(mjd,sec,ns);
+ SetMJD(mjd,sec,ns,ps);
}
///////////////////////////////////////////////////////////////////////////
void AliTimestamp::SetJD(Double_t jd)
SetJD(days,secs,ns);
}
///////////////////////////////////////////////////////////////////////////
-void AliTimestamp::SetTJD(Int_t tjd,Int_t sec,Int_t ns)
+void AliTimestamp::SetTJD(Int_t tjd,Int_t sec,Int_t ns,Int_t ps)
{
// Set the Truncated Julian Date (TJD) and time and update the TTimeStamp
// parameters accordingly (if possible).
// tjd : The Truncated Julian date.
// sec : The number of seconds elapsed within the JD.
// ns : The remaining fractional number of seconds (in ns) elapsed within the JD.
+// ps : The remaining fractional number of nanoseconds (in ps) elapsed within the JD.
+//
+// Note : ps=0 is the default value.
Int_t mjd=tjd+40000;
SetTJD(days,secs,ns);
}
///////////////////////////////////////////////////////////////////////////
+Int_t AliTimestamp::GetPicoSec() const
+{
+// Provide remaining fractional number of nanoseconds in picoseconds.
+// This memberfunction supports time of flight analysis for particle physics
+// experiments.
+
+ return fJps;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliTimestamp::GetDifference(AliTimestamp& t,Int_t& d,Int_t& s,Int_t& ns,Int_t& ps) const
+{
+// Provide the time difference w.r.t the AliTimestamp specified on the input.
+// This memberfunction supports both very small (i.e. time of flight analysis
+// for particle physics experiments) and very long (i.e. investigation of
+// astrophysical phenomena) timescales.
+//
+// The time difference is returned via the following output arguments :
+// d : elapsed number of days
+// s : remaining elapsed number of seconds
+// ns : remaining elapsed number of nanoseconds
+// ps : remaining elapsed number of picoseconds
+//
+// The integer return argument indicates whether the AliTimestamp specified
+// on the input argument occurred earlier (-1), simultaneously (0) or later (1).
+
+ Int_t tmjd=0;
+ Int_t tsec=0;
+ Int_t tnsec=0;
+ t.GetMJD(tmjd,tsec,tnsec);
+ Int_t tpsec=t.GetPicoSec();
+
+ // Convert all stamps to seconds, nanoseconds and picoseconds
+ // to simplify the algebra.
+ tsec+=tmjd*24*3600;
+ Int_t sec=fJsec+fMJD*24*3600;
+
+ d=0;
+ s=tsec-sec;
+ ns=tnsec-fJns;
+ ps=tpsec-fJps;
+
+ if (!d && !s && !ns && !ps) return 0;
+
+ Int_t sign=0;
+
+ if (s>0) sign=1;
+ if (s<0) sign=-1;
+
+ if (!sign && ns>0) sign=1;
+ if (!sign && ns<0) sign=-1;
+
+ if (!sign && ps>0) sign=1;
+ if (!sign && ps<0) sign=-1;
+
+ // In case the input stamp was earlier, take the reverse difference
+ // to simplify the algebra.
+ if (sign<0)
+ {
+ s=-s;
+ ns=-ns;
+ ps=-ps;
+ }
+
+ // Here we always have a positive time difference
+ // and can now unambiguously correct for other negative values
+ // and determine the resulting daycount.
+ if (ps<0)
+ {
+ ns-=1;
+ ps+=1000;
+ }
+
+ if (ns<0)
+ {
+ s-=1;
+ ns+=1e9;
+ }
+
+ d=s/(24*3600);
+ s=s%(24*3600);
+
+ return sign;
+}
+///////////////////////////////////////////////////////////////////////////
void GetJD(Int_t& jd,Int_t& sec,Int_t& ns); // Provide corresponding Julian Date and time
Double_t GetJD(); // Provide corresponding Julian Date in fractional days
Double_t GetJE(); // Provide corresponding Julian Epoch
- void SetMJD(Int_t mjd,Int_t sec,Int_t ns); // Set Modified Julian Date and time
- void SetMJD(Double_t mjd); // Set Modified Julian Date and time
- void SetJD(Int_t jd,Int_t sec,Int_t ns); // Set Julian Date and time
- void SetJD(Double_t jd); // Set Julian Date and time
- void SetTJD(Int_t mjd,Int_t sec,Int_t ns); // Set Modified Julian Date and time
- void SetTJD(Double_t mjd); // Set Modified Julian Date and time
+ void SetMJD(Int_t mjd,Int_t sec,Int_t ns,Int_t ps=0); // Set Modified Julian Date and time
+ void SetMJD(Double_t mjd); // Set Modified Julian Date and time
+ void SetJD(Int_t jd,Int_t sec,Int_t ns,Int_t ps=0); // Set Julian Date and time
+ void SetJD(Double_t jd); // Set Julian Date and time
+ void SetTJD(Int_t tjd,Int_t sec,Int_t ns,Int_t ps=0); // Set Truncated Julian Date and time
+ void SetTJD(Double_t tjd); // Set Truncated Julian Date and time
+ Int_t GetPicoSec() const; // Provide remaining fractional number of ns in picoseconds
+ Int_t GetDifference(AliTimestamp& t,Int_t& days,Int_t& sec,Int_t& ns,Int_t& ps) const; // Provide time difference
protected:
Int_t fMJD; // Modified Julian Date
Int_t fJsec; // Number of seconds elapsed within the MJD
Int_t fJns; // Remaining fractional number of seconds (in nanoseconds) elapsed within the MJD
+ Int_t fJps; // Remaining fractional number of nanoseconds (in picoseconds) elapsed within the MJD
private:
void FillJulian(); // Calculation and setting of the corresponding Julian parameters
Int_t fCalcs; // The TTimeStamp seconds counter value at Julian parameter calculation
Int_t fCalcns; // The TTimeStamp nanoseconds counter value at Julian parameter calculation
- ClassDef(AliTimestamp,1) // Handling of timestamps for (astro)particle physics research.
+ ClassDef(AliTimestamp,2) // Handling of timestamps for (astro)particle physics research.
};
#endif
fClosest=0;
fParent=0;
fFit=0;
+ fTstamp=0;
}
///////////////////////////////////////////////////////////////////////////
AliTrack::~AliTrack()
delete fFit;
fFit=0;
}
+ if (fTstamp)
+ {
+ delete fTstamp;
+ fTstamp=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
AliTrack::AliTrack(const AliTrack& t) : TNamed(t),Ali4Vector(t)
if (t.fImpactYZ) fImpactYZ=new AliPositionObj(*(t.fImpactYZ));
if (t.fClosest) fClosest=new AliPositionObj(*(t.fClosest));
if (t.fFit) fFit=t.fFit->Clone();
+ if (t.fTstamp) fTstamp=new AliTimestamp(*(t.fTstamp));
fUserId=t.fUserId;
fChi2=t.fChi2;
fNdf=t.fNdf;
delete fFit;
fFit=0;
}
+ if (fTstamp)
+ {
+ delete fTstamp;
+ fTstamp=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::Set3Momentum(Ali3Vector& p)
if (strlen(name)) cout << " Name : " << name;
if (strlen(title)) cout << " Title : " << title;
cout << endl;
+ if (fTstamp) fTstamp->Date(1);
cout << " Id : " << fUserId << " Code : " << fCode
<< " m : " << m << " dm : " << dm << " Charge : " << fQ
<< " p : " << GetMomentum() << endl;
return fFit;
}
///////////////////////////////////////////////////////////////////////////
+void AliTrack::SetTimestamp(AliTimestamp& t)
+{
+// Store the timestamp for this track.
+ if (fTstamp) delete fTstamp;
+ fTstamp=new AliTimestamp(t);
+}
+///////////////////////////////////////////////////////////////////////////
+AliTimestamp* AliTrack::GetTimestamp()
+{
+// Provide the timestamp of this track.
+ return fTstamp;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::RemoveTimestamp()
+{
+// Remove the timestamp from this track.
+ if (fTstamp)
+ {
+ delete fTstamp;
+ fTstamp=0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
TObject* AliTrack::Clone(const char* name) const
{
// Make a deep copy of the current object and provide the pointer to the copy.
#include "AliSignal.h"
#include "AliBoost.h"
#include "AliPositionObj.h"
+#include "AliTimestamp.h"
class AliTrack : public TNamed,public Ali4Vector
{
void SetFitDetails(TObject* obj); // Enter the object containing the fit details
void SetFitDetails(TObject& obj) { SetFitDetails(&obj); }
TObject* GetFitDetails(); // Provide pointer to the object containing the fit details
-
+ void SetTimestamp(AliTimestamp& t); // Set the track timestamp
+ AliTimestamp* GetTimestamp(); // Provide the track timestamp
+ void RemoveTimestamp(); // Remove timestamp from this track
protected:
void Init(); // Initialisation of pointers etc...
AliTrack* fParent; // Pointer to the parent track
Float_t fProb; // Probability for this track as a hypothesis
TObject* fFit; // Object containing details of the fit
+ AliTimestamp* fTstamp; // The track timestamp
private:
void Dumps(AliTrack* t,Int_t n,TString f); // Recursively print all decay levels
- ClassDef(AliTrack,13) // Handling of the attributes of a reconstructed particle track.
+ ClassDef(AliTrack,14) // Handling of the attributes of a reconstructed particle track.
};
#endif
18-apr-2005 NvE New memberfunction GetTracks introduced in AliJet to provide various track selections.
19-apr-2005 NvE Memberfunctions GetNtracks and GetTracks of AliJet extended in functionality.
20-apr-2005 NvE Id of owning device added to the output of AliSignal::Data().
+10-may-2005 NvE Support for timestamps introduced in AliTrack and AliPosition.
+ Memberfunction GetX introduced in Ali3Vector for easy component access.
+ Picosecond support and calculation of time difference introduced in AliTimestamp
+ to enable investigation of both very short (i.e. time of flight analysis in
+ particle physics experiments) and very long (i.e. astrophysical phenomena)
+ time intervals.
+
\ No newline at end of file