/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class Ali3Vector
+// Handling of 3-vectors in various reference frames.
+//
+// This class is meant to serve as a base class for ALICE objects
+// that have 3-dimensional vector characteristics.
+// Error propagation is performed automatically.
+//
+// Note :
+// ------
+// Vectors (v), Errors (e) and reference frames (f) are specified via
+// SetVector(Float_t* v,TString f)
+// SetErrors(Float_t* e,TString f)
+// under the following conventions :
+//
+// f="car" ==> v in Cartesian coordinates (x,y,z)
+// f="sph" ==> v in Spherical coordinates (r,theta,phi)
+// f="cyl" ==> v in Cylindrical coordinates (rho,phi,z)
+//
+// All angles are in radians.
+//
+// Example :
+// ---------
+//
+// Ali3Vector a;
+// Float_t v[3]={-1,25,7};
+// Float_t e[3]={0.03,0.5,0.21};
+// a.SetVector(v,"car");
+// a.SetErrors(e,"car");
+// a.Info();
+//
+// Float_t vec[3];
+// Float_t err[3];
+// a.GetVector(vec,"sph");
+// a.GetErrors(vec,"sph");
+//
+// Ali3Vector b;
+// Float_t v2[3]={6,-18,33};
+// Float_t e2[3]={0.19,0.45,0.93};
+// b.SetVector(v2,"car");
+// b.SetErrors(e2,"car");
+//
+// Float_t dotpro=a.Dot(b);
+// Float_t doterror=a.GetResultError();
+//
+// Ali3Vector c=a.Cross(b);
+// c.Info("sph");
+// c.GetVector(vec,"cyl");
+// c.GetErrors(err,"cyl");
+//
+// Float_t norm=c.GetNorm();
+// Float_t normerror=c.GetResultError();
+//
+// c=a+b;
+// c=a-b;
+// c=a*5;
+//
+//--- Author: Nick van Eijndhoven 30-mar-1999 UU-SAP Utrecht
+//- Modified: NvE 25-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "Ali3Vector.h"
ClassImp(Ali3Vector) // Class implementation to enable ROOT I/O
Ali3Vector::Ali3Vector()
{
// Creation of an Ali3Vector object and initialisation of parameters
+// All attributes initialised to 0
fV=0;
fTheta=0;
fPhi=0;
+ fDx=0;
+ fDy=0;
+ fDz=0;
+ fDresult=0;
}
///////////////////////////////////////////////////////////////////////////
Ali3Vector::~Ali3Vector()
void Ali3Vector::SetVector(Double_t* v,TString f)
{
// Store vector according to reference frame f
+// All errors will be reset to 0
+ fDx=0;
+ fDy=0;
+ fDz=0;
+ fDresult=0;
+
Double_t pi=acos(-1.);
+
Int_t frame=0;
if (f == "car") frame=1;
if (f == "sph") frame=2;
void Ali3Vector::SetVector(Float_t* v,TString f)
{
// Store vector according to reference frame f
+// All errors will be reset to 0
Double_t vec[3];
for (Int_t i=0; i<3; i++)
{
}
}
///////////////////////////////////////////////////////////////////////////
+void Ali3Vector::SetErrors(Double_t* e,TString f)
+{
+// Store errors according to reference frame f
+// The error on scalar results is reset to 0
+ fDresult=0;
+
+ Int_t frame=0;
+ if (f == "car") frame=1;
+ if (f == "sph") frame=2;
+ if (f == "cyl") frame=3;
+
+ Double_t dx2,dy2,dz2,rho;
+
+ switch (frame)
+ {
+ case 1: // Cartesian coordinates
+ fDx=fabs(e[0]);
+ fDy=fabs(e[1]);
+ fDz=fabs(e[2]);
+ break;
+
+ case 2: // Spherical coordinates
+ dx2=pow((cos(fPhi)*sin(fTheta)*e[0]),2)+pow((fV*cos(fTheta)*cos(fPhi)*e[1]),2)
+ +pow((fV*sin(fTheta)*sin(fPhi)*e[2]),2);
+ dy2=pow((sin(fPhi)*sin(fTheta)*e[0]),2)+pow((fV*cos(fTheta)*sin(fPhi)*e[1]),2)
+ +pow((fV*sin(fTheta)*cos(fPhi)*e[2]),2);
+ dz2=pow((cos(fTheta)*e[0]),2)+pow((fV*sin(fTheta)*e[1]),2);
+ fDx=sqrt(dx2);
+ fDy=sqrt(dy2);
+ fDz=sqrt(dz2);
+ break;
+
+ case 3: // Cylindrical coordinates
+ rho=fV*sin(fTheta);
+ dx2=pow((cos(fPhi)*e[0]),2)+pow((rho*sin(fPhi)*e[1]),2);
+ dy2=pow((sin(fPhi)*e[0]),2)+pow((rho*cos(fPhi)*e[1]),2);
+ fDx=sqrt(dx2);
+ fDy=sqrt(dy2);
+ fDz=fabs(e[2]);
+ break;
+
+ default: // Unsupported reference frame
+ cout << "*Ali3Vector::SetErrors* Unsupported frame : " << f << endl
+ << " Possible frames are 'car', 'sph' and 'cyl'." << endl;
+ fDx=0;
+ fDy=0;
+ fDz=0;
+ break;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali3Vector::GetErrors(Double_t* e,TString f)
+{
+// Provide errors according to reference frame f
+ Int_t frame=0;
+ if (f == "car") frame=1;
+ if (f == "sph") frame=2;
+ if (f == "cyl") frame=3;
+
+ Double_t dr2,dtheta2,dphi2,rho,drho2;
+ Double_t v[3];
+
+ switch (frame)
+ {
+ case 1: // Cartesian coordinates
+ e[0]=fDx;
+ e[1]=fDy;
+ e[2]=fDz;
+ break;
+
+ case 2: // Spherical coordinates
+ GetVector(v,"car");
+ if (fV)
+ {
+ dr2=(pow((v[0]*fDx),2)+pow((v[1]*fDy),2)+pow((v[2]*fDz),2))/(fV*fV);
+ }
+ else
+ {
+ dr2=0;
+ }
+ if (v[2]-fV)
+ {
+ dtheta2=(v[2]*v[2]/(pow(fV,4)-pow(v[2],2)*pow(fV,2)))*dr2
+ +pow(fDz,2)/(pow(fV,2)-pow(v[2],2));
+ }
+ else
+ {
+// dr2=fDz*fDz;
+ dtheta2=0;
+ }
+ if (v[0] || v[1])
+ {
+ dphi2=(pow((v[1]*fDx),2)+pow((v[0]*fDy),2))/(pow(v[0],2)+pow(v[1],2));
+ }
+ else
+ {
+ dphi2=0;
+ }
+ e[0]=sqrt(dr2);
+ e[1]=sqrt(dtheta2);
+ e[2]=sqrt(dphi2);
+ break;
+
+ case 3: // Cylindrical coordinates
+ GetVector(v,"car");
+ rho=fV*sin(fTheta);
+ if (rho)
+ {
+ drho2=(pow((v[0]*fDx),2)+pow((v[1]*fDy),2))/(rho*rho);
+ }
+ else
+ {
+ drho2=0;
+ }
+ if (v[0] || v[1])
+ {
+ dphi2=(pow((v[1]*fDx),2)+pow((v[0]*fDy),2))/(pow(v[0],2)+pow(v[1],2));
+ }
+ else
+ {
+ dphi2=0;
+ }
+ e[0]=sqrt(drho2);
+ e[1]=sqrt(dphi2);
+ e[2]=fDz;
+ break;
+
+ default: // Unsupported reference frame
+ cout << "*Ali3Vector::GetErrors* Unsupported frame : " << f << endl
+ << " Possible frames are 'car', 'sph' and 'cyl'." << endl;
+ for (Int_t i=0; i<3; i++)
+ {
+ e[i]=0;
+ }
+ break;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali3Vector::SetErrors(Float_t* e,TString f)
+{
+// Store errors according to reference frame f
+// The error on scalar results is reset to 0
+ Double_t vec[3];
+ for (Int_t i=0; i<3; i++)
+ {
+ vec[i]=e[i];
+ }
+ SetErrors(vec,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali3Vector::GetErrors(Float_t* e,TString f)
+{
+// Provide errors according to reference frame f
+ Double_t vec[3];
+ GetErrors(vec,f);
+ for (Int_t i=0; i<3; i++)
+ {
+ e[i]=vec[i];
+ }
+}
+///////////////////////////////////////////////////////////////////////////
void Ali3Vector::Info(TString f)
{
// Print vector components according to reference frame f
if (f=="car" || f=="sph" || f=="cyl")
{
- Double_t vec[3];
+ Double_t vec[3],err[3];
GetVector(vec,f);
+ GetErrors(err,f);
cout << " Vector in " << f << " coordinates : "
<< vec[0] << " " << vec[1] << " " << vec[2] << endl;
+ cout << " Err. in " << f << " coordinates : "
+ << err[0] << " " << err[1] << " " << err[2] << endl;
}
else
{
///////////////////////////////////////////////////////////////////////////
Double_t Ali3Vector::GetNorm()
{
+// Provide the norm of the current vector
+// The error on the scalar result (norm) is updated accordingly
+ Double_t e[3];
+ GetErrors(e,"sph");
+ fDresult=e[0];
return fV;
}
///////////////////////////////////////////////////////////////////////////
+Double_t Ali3Vector::GetPseudoRapidity()
+{
+// Provide the pseudo-rapidity w.r.t. the z-axis.
+// In other words : eta=-log(tan(theta/2))
+// The error on the scalar result (pseudo-rap.) is updated accordingly
+ Double_t v[3];
+ GetVector(v,"sph");
+ Double_t thetahalf=v[1]/2.;
+ Double_t arg=tan(thetahalf);
+ Double_t eta=0;
+ if (arg>0) eta=-log(arg);
+ Double_t e[3];
+ GetErrors(e,"sph");
+ Double_t prod=cos(thetahalf)*sin(thetahalf);
+ fDresult=0;
+ if (prod) fDresult=fabs(e[1]/2.*prod);
+ return eta;
+}
+///////////////////////////////////////////////////////////////////////////
Double_t Ali3Vector::Dot(Ali3Vector& q)
{
// Provide the dot product of the current vector with vector q
- Double_t a[3],b[3];
+// The error on the scalar result (dotproduct) is updated accordingly
+
Double_t dotpro=0;
- GetVector(a,"car");
- q.GetVector(b,"car");
- for (Int_t i=0; i<3; i++)
+ if ((this) == &q) // Check for special case v.Dot(v)
{
- dotpro+=a[i]*b[i];
+ Double_t norm=GetNorm();
+ Double_t dnorm=GetResultError();
+ dotpro=pow(norm,2);
+ fDresult=2.*norm*dnorm;
}
-
+ else
+ {
+ Double_t a[3],b[3];
+ Double_t ea[3],eb[3];
+ Double_t d2=0;
+
+ GetVector(a,"car");
+ GetErrors(ea,"car");
+ q.GetVector(b,"car");
+ q.GetErrors(eb,"car");
+ for (Int_t i=0; i<3; i++)
+ {
+ dotpro+=a[i]*b[i];
+ d2+=pow(b[i]*ea[i],2)+pow(a[i]*eb[i],2);
+ }
+ fDresult=sqrt(d2);
+ }
+
return dotpro;
}
///////////////////////////////////////////////////////////////////////////
+Double_t Ali3Vector::GetResultError()
+{
+// Provide the error on the result of an operation yielding a scalar
+// E.g. GetNorm() or Dot()
+ return fDresult;
+}
+///////////////////////////////////////////////////////////////////////////
Ali3Vector Ali3Vector::Cross(Ali3Vector& q)
{
// Provide the cross product of the current vector with vector q
+// Error propagation is performed automatically
Double_t a[3],b[3],c[3];
+ Double_t ea[3],eb[3],ec[3],d2;
GetVector(a,"car");
+ GetErrors(ea,"car");
q.GetVector(b,"car");
+ q.GetErrors(eb,"car");
c[0]=a[1]*b[2]-a[2]*b[1];
c[1]=a[2]*b[0]-a[0]*b[2];
c[2]=a[0]*b[1]-a[1]*b[0];
+ d2=pow(b[2]*ea[1],2)+pow(a[1]*eb[2],2)
+ +pow(b[1]*ea[2],2)+pow(a[2]*eb[1],2);
+ ec[0]=sqrt(d2);
+
+ d2=pow(b[0]*ea[2],2)+pow(a[2]*eb[0],2)
+ +pow(b[2]*ea[0],2)+pow(a[0]*eb[2],2);
+ ec[1]=sqrt(d2);
+
+ d2=pow(b[1]*ea[0],2)+pow(a[0]*eb[1],2)
+ +pow(b[0]*ea[1],2)+pow(a[1]*eb[0],2);
+ ec[2]=sqrt(d2);
+
Ali3Vector v;
v.SetVector(c,"car");
+ v.SetErrors(ec,"car");
return v;
}
Ali3Vector Ali3Vector::operator+(Ali3Vector& q)
{
// Add vector q to the current vector
- Double_t a[3],b[3];
+// Error propagation is performed automatically
+ Double_t a[3],b[3],ea[3],eb[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
q.GetVector(b,"car");
+ q.GetErrors(eb,"car");
for (Int_t i=0; i<3; i++)
{
a[i]+=b[i];
+ ea[i]=sqrt(pow(ea[i],2)+pow(eb[i],2));
}
Ali3Vector v;
v.SetVector(a,"car");
+ v.SetErrors(ea,"car");
return v;
}
Ali3Vector Ali3Vector::operator-(Ali3Vector& q)
{
// Subtract vector q from the current vector
- Double_t a[3],b[3];
+// Error propagation is performed automatically
+ Double_t a[3],b[3],ea[3],eb[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
q.GetVector(b,"car");
+ q.GetErrors(eb,"car");
for (Int_t i=0; i<3; i++)
{
a[i]-=b[i];
+ ea[i]=sqrt(pow(ea[i],2)+pow(eb[i],2));
}
Ali3Vector v;
v.SetVector(a,"car");
+ v.SetErrors(ea,"car");
return v;
}
///////////////////////////////////////////////////////////////////////////
Ali3Vector Ali3Vector::operator*(Double_t s)
{
-// Multiply the current vector with a scalar s
- Double_t a[3];
+// Multiply the current vector with a scalar s.
+// Error propagation is performed automatically.
+ Double_t a[3],ea[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
for (Int_t i=0; i<3; i++)
{
a[i]*=s;
+ ea[i]*=s;
}
Ali3Vector v;
v.SetVector(a,"car");
+ v.SetErrors(ea,"car");
return v;
}
Ali3Vector Ali3Vector::operator/(Double_t s)
{
// Divide the current vector by a scalar s
+// Error propagation is performed automatically
if (fabs(s)<1.e-20) // Protect against division by 0
{
}
else
{
- Double_t a[3];
+ Double_t a[3],ea[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
for (Int_t i=0; i<3; i++)
{
a[i]/=s;
+ ea[i]/=s;
}
Ali3Vector v;
v.SetVector(a,"car");
+ v.SetErrors(ea,"car");
return v;
}
Ali3Vector& Ali3Vector::operator+=(Ali3Vector& q)
{
// Add vector q to the current vector
- Double_t a[3],b[3];
+// Error propagation is performed automatically
+ Double_t a[3],b[3],ea[3],eb[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
q.GetVector(b,"car");
+ q.GetErrors(eb,"car");
for (Int_t i=0; i<3; i++)
{
a[i]+=b[i];
+ ea[i]=sqrt(pow(ea[i],2)+pow(eb[i],2));
}
SetVector(a,"car");
+ SetErrors(ea,"car");
return *this;
}
Ali3Vector& Ali3Vector::operator-=(Ali3Vector& q)
{
// Subtract vector q from the current vector
- Double_t a[3],b[3];
+// Error propagation is performed automatically
+ Double_t a[3],b[3],ea[3],eb[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
q.GetVector(b,"car");
+ q.GetErrors(eb,"car");
for (Int_t i=0; i<3; i++)
{
a[i]-=b[i];
+ ea[i]=sqrt(pow(ea[i],2)+pow(eb[i],2));
}
SetVector(a,"car");
+ SetErrors(ea,"car");
return *this;
}
Ali3Vector& Ali3Vector::operator*=(Double_t s)
{
// Multiply the current vector with a scalar s
- Double_t a[3];
+// Error propagation is performed automatically
+ Double_t a[3],ea[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
for (Int_t i=0; i<3; i++)
{
a[i]*=s;
+ ea[i]*=s;
}
SetVector(a,"car");
+ SetErrors(ea,"car");
return *this;
}
Ali3Vector& Ali3Vector::operator/=(Double_t s)
{
// Divide the current vector by a scalar s
+// Error propagation is performed automatically
if (fabs(s)<1.e-20) // Protect against division by 0
{
}
else
{
- Double_t a[3];
+ Double_t a[3],ea[3];
GetVector(a,"car");
+ GetErrors(ea,"car");
for (Int_t i=0; i<3; i++)
{
a[i]/=s;
+ ea[i]/=s;
}
SetVector(a,"car");
+ SetErrors(ea,"car");
return *this;
}
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class Ali3Vector
-// Handling of 3-vectors in various reference frames.
-//
-// This class is meant to serve as a base class for ALICE objects
-// that have 3-dimensional vector characteristics.
-//
-// Note :
-// ------
-// Vectors (v) and reference frames (f) are specified via
-// SetVector(Float_t* v,TString f) under the following conventions :
-//
-// f="car" ==> v in Cartesian coordinates (x,y,z)
-// f="sph" ==> v in Spherical coordinates (r,theta,phi)
-// f="cyl" ==> v in Cylindrical coordinates (rho,phi,z)
-//
-// All angles are in radians.
-//
-// Example :
-// ---------
-//
-// Ali3Vector a;
-// Float_t v[3]={-1,25,7};
-// a.SetVector(v,"car");
-// a.Info();
-//
-// Float_t vec[3];
-// a.GetVector(vec,"sph");
-//
-// Ali3Vector b;
-// Float_t v2[3]={6,-18,33};
-// b.SetVector(v2,"car");
-//
-// Float_t dotpro=a.Dot(b);
-//
-// Ali3Vector c=a.Cross(b);
-// c.Info("sph");
-// c.GetVector(vec,"cyl");
-// Float_t norm=c.GetNorm();
-// c=a+b;
-// c=a-b;
-// c=a*5;
-//
-//--- NvE 30-mar-1999 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
virtual void GetVector(Double_t* v,TString f); // Provide vector v in frame f
virtual void SetVector(Float_t* v,TString f); // Store vector v in frame f
virtual void GetVector(Float_t* v,TString f); // Provide vector v in frame f
+ virtual void SetErrors(Double_t* e,TString f); // Store errors of vector in frame f
+ virtual void GetErrors(Double_t* e,TString f); // Provide errors of vector in frame f
+ virtual void SetErrors(Float_t* e,TString f); // Store errors of vector in frame f
+ virtual void GetErrors(Float_t* e,TString f); // Provide errors of vector in frame f
virtual void Info(TString f="car"); // Print vector components in frame f
Double_t GetNorm(); // Provide norm of the vector
Double_t Dot(Ali3Vector& q); // Provide dot product with q
+ Double_t GetPseudoRapidity(); // Provide the pseudorapidity w.r.t z-axis
+ Double_t GetResultError(); // Provide error on scalar result (e.g. norm)
Ali3Vector Cross(Ali3Vector& q); // Provide cross product with q
Ali3Vector operator+(Ali3Vector& q); // Add vector q
Ali3Vector operator-(Ali3Vector& q); // Subtract vector q
Ali3Vector& operator/=(Double_t s); // Divide by scalar s
protected:
- Double_t fV,fTheta,fPhi; // Vector in spherical coordinates
+ 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,1) // Class definition to enable ROOT I/O
+ ClassDef(Ali3Vector,1) // Handling of 3-vectors in various reference frames.
};
#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+///////////////////////////////////////////////////////////////////////////
+// Class Ali3VectorObj
+// Handling of 3-vectors in various reference frames.
+//
+// This class is meant to provide an Ali3Vector object which is derived
+// from TObject such that it can be stored in e.g. TObjArray etc...
+// and that it can be written out using the ROOT I/O machinery.
+//
+// Example :
+// =========
+//
+// Float_t a[3]={1,2,3};
+// Float_t ea[3]={0.01,0.02,0.03};
+// Float_t b[3]={4,5,6};
+// Float_t eb[3]={0.04,0.05,0.06};
+//
+// Ali3Vector v,w;
+//
+// v.SetVector(a,"car");
+// v.SetErrors(ea,"car");
+// w.SetVector(b,"car");
+// w.SetErrors(eb,"car");
+//
+// Ali3Vector cross=v.Cross(w);
+//
+// Ali3Vector add=v+w;
+//
+// Ali3VectorObj vec1(cross);
+//
+// Ali3VectorObj vec2;
+// vec2.Load(add);
+//
+// vec1.Info();
+// vec2.Info();
+//
+//--- Author: Nick van Eijndhoven 18-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
+#include "Ali3VectorObj.h"
+
+ClassImp(Ali3VectorObj) // Class implementation to enable ROOT I/O
+
+Ali3VectorObj::Ali3VectorObj()
+{
+// Creation of an Ali3VectorObj object and initialisation of parameters.
+// All attributes initialised to 0.
+}
+///////////////////////////////////////////////////////////////////////////
+Ali3VectorObj::Ali3VectorObj(Ali3Vector& q)
+{
+// Creation of an Ali3VectorObj object and initialisation of parameters.
+// All attributes are initialised to the values of the input Ali3Vector.
+ Load(q);
+}
+///////////////////////////////////////////////////////////////////////////
+Ali3VectorObj::~Ali3VectorObj()
+{
+// Destructor to delete dynamically allocated memory.
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali3VectorObj::Load(Ali3Vector& q)
+{
+// Load all attributes of the input Ali3Vector into this Ali3VectorObj object.
+ Double_t temp=q.GetResultError();
+ Double_t a[3];
+ q.GetVector(a,"sph");
+ SetVector(a,"sph");
+ q.GetErrors(a,"car");
+ SetErrors(a,"car");
+ fDresult=temp;
+}
+///////////////////////////////////////////////////////////////////////////
--- /dev/null
+#ifndef ALI3VECTOROBJ_H
+#define ALI3VECTOROBJ_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+#include "TObject.h"
+
+#include "Ali3Vector.h"
+
+class Ali3VectorObj : public TObject,public Ali3Vector
+{
+ public:
+ Ali3VectorObj(); // Default constructor
+ Ali3VectorObj(Ali3Vector& q); // Constructor
+ ~Ali3VectorObj(); // Destructor
+ void Load(Ali3Vector& q); // Load all attributes of input Ali3Vector
+
+ ClassDef(Ali3VectorObj,1) // Handling of 3-vectors in various reference frames.
+};
+#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class Ali4Vector
+// Handling of Lorentz 4-vectors in various reference frames.
+//
+// This class is meant to serve as a base class for ALICE objects
+// that have Lorentz 4-vector characteristics.
+// Error propagation is performed automatically.
+//
+// All 4-vectors are treated in the contravariant form and the convention
+// for the metric and the 4-vector components is according to the one
+// used in the book "Classical Electrodynamics" by J.D. Jackson.
+//
+// A 4-vector is said to have a scalar part and a 3-vector part,
+// which is indicated by the notation
+//
+// x^i = (x^0,x^1,x^2,x^3)
+//
+// The scalar part = x^0
+// The 3-vector part = (x^1,x^2,x^3)
+//
+// In view of accuracy and the fact that e.g. particle identity (mass)
+// is preserved in many physics processes, the Lorentz invariant
+// (x^i*x_i) is internally saved together with the scalar part.
+//
+// This allows the following two modes of functionality :
+//
+// Scalar mode : The scalar part and the 3-vector part are considered
+// as basic quantities and the invariant with its error
+// is derived from these.
+// Invariant mode : The invariant and the 3-vector part are considered
+// as basic quantities and the scalar with its error
+// is derived from these.
+//
+// The philosophy followed here is the following :
+// ===============================================
+//
+// 1) Invokation of SetVector() sets the scalar and 3-vector parts
+// and the invariant is calculated from these.
+// Automatically the scalar mode is selected and invokation of
+// SetErrors() will calculate the error on the invariant.
+//
+// 2) In case the scalar part is modified via SetScalar(), scalar mode is
+// automatically selected and the Lorentz invariant (x^i*x_i) and its
+// error are updated accordingly.
+// The 3-vector part is NOT modified.
+// This situation arises when one e.g. precisely determines the time
+// or energy (x^0).
+//
+// 3) In case the Lorentz invariant (x^i*x_i) is modified via SetInvariant(),
+// invariant mode is selected automatically and the scalar part and its
+// error are updated accordingly.
+// The 3-vector part is NOT modified.
+// This situation arises when one e.g. precisely determines the mass.
+//
+// 4) In case the vector part is modified via Set3Vector(), then the
+// current mode determines whether the scalar or the invariant is updated.
+// Scalar mode : The Lorentz invariant (x^i*x_i) and its error are updated;
+// the scalar part and its error are NOT modified.
+// This situation arises when one e.g. improves the 3-position
+// vector for a particle with a very precise timing.
+// Invariant mode : The scalar part and its error are updated;
+// the Lorentz invariant (x^i*x_i) and its error are NOT modified.
+// This situation arises when one e.g. improves the 3-momentum
+// vector for a particle with known mass.
+//
+// The dotproduct is defined such that p.Dot(p) yields the Lorentz invariant
+// scalar of the 4-vector p (i.e. m**2 in case p is a 4-momentum).
+//
+// Note :
+// ------
+// Vectors (v), Errors (e) and reference frames (f) are specified via
+// SetVector(Float_t* v,TString f)
+// SetErrors(Float_t* e,TString f)
+// under the following conventions :
+//
+// f="car" ==> 3-vector part of v in Cartesian coordinates (x,y,z)
+// f="sph" ==> 3-vector part of v in Spherical coordinates (r,theta,phi)
+// f="cyl" ==> 3-vector part of v in Cylindrical coordinates (rho,phi,z)
+//
+// All angles are in radians.
+//
+// Example :
+// ---------
+//
+// Ali4Vector a;
+//
+// Float_t v[4]={25,-1,3,7};
+// a.SetVector(v,"car");
+//
+// Float_t vec[4];
+// a.GetVector(vec,"sph");
+//
+// Ali4Vector b;
+// Float_t v2[4]={33,6,-18,2};
+// b.SetVector(v2,"car");
+//
+// Float_t dotpro=a.Dot(b);
+//
+// Float_t x0=16;
+// Ali3Vector x;
+// Float_t vec2[3]={1,2,3};
+// x.SetVector(vec2,"car");
+//
+// Ali4Vector c;
+// c.SetVector(x0,x);
+// c.GetVector(vec,"car");
+// c.Info("cyl");
+// c=a+b;
+// c=a-b;
+// c=a*5;
+//
+//--- Author: Nick van Eijndhoven 01-apr-1999 UU-SAP Utrecht
+//- Modified: NvE 15-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "Ali4Vector.h"
ClassImp(Ali4Vector) // Class implementation to enable ROOT I/O
Ali4Vector::Ali4Vector()
{
-// Creation of a contravariant 4-vector and initialisation of parameters
+// Creation of a contravariant 4-vector and initialisation of parameters.
+// All values are initialised to 0.
+// Scalar mode is initially selected.
+ fScalar=1;
+ fV2=0;
+ fDv2=0;
fV0=0;
+ fDv0=0;
+ fDresult=0;
Double_t a[3]={0,0,0};
fV.SetVector(a,"sph");
}
///////////////////////////////////////////////////////////////////////////
void Ali4Vector::SetVector(Double_t v0,Ali3Vector v)
{
-// Store contravariant vector
+// Store contravariant vector.
+// The error on the scalar part is initialised to 0.
+// The errors on the vector part are taken from the input Ali3Vector.
+// Scalar mode is automatically selected.
+// The error on scalar result operations is reset to 0.
+ fScalar=1;
fV0=v0;
fV=v;
+ fV2=pow(v0,2)-fV.Dot(fV);
+ SetScalarError(0);
}
///////////////////////////////////////////////////////////////////////////
void Ali4Vector::SetVector(Double_t* v,TString f)
{
-// Store vector according to reference frame f
- fV0=v[0];
+// Store vector according to reference frame f.
+// All errors are initialised to 0.
+// Scalar mode is automatically selected.
+// The error on scalar result operations is reset to 0.
+ fScalar=1;
Double_t a[3];
for (Int_t i=0; i<3; i++)
{
a[i]=v[i+1];
}
+ fV0=v[0];
fV.SetVector(a,f);
+ fV2=pow(fV0,2)-fV.Dot(fV);
+ fDv2=0;
+ fDv0=0;
+ fDresult=0;
}
///////////////////////////////////////////////////////////////////////////
void Ali4Vector::GetVector(Double_t* v,TString f)
{
-// Provide vector according to reference frame f
- v[0]=fV0;
+// Provide 4-vector components according to reference frame f
+// and according to the current mode.
+// Scalar mode : The scalar part is directly returned via v[0].
+// Invariant mode : The scalar part is re-calculated via the value
+// of the Lorentz invariant and then returned via v[0].
+ if (fScalar)
+ {
+ v[0]=fV0;
+ }
+ else
+ {
+ v[0]=sqrt(fV.Dot(fV)+fV2);
+ }
Double_t a[3];
fV.GetVector(a,f);
for (Int_t i=0; i<3; i++)
///////////////////////////////////////////////////////////////////////////
void Ali4Vector::SetVector(Float_t* v,TString f)
{
-// Store vector according to reference frame f
+// Store vector according to reference frame f.
+// All errors are initialised to 0.
+// Scalar mode is automatically selected.
+// The error on scalar result operations is reset to 0.
Double_t vec[4];
for (Int_t i=0; i<4; i++)
{
///////////////////////////////////////////////////////////////////////////
void Ali4Vector::GetVector(Float_t* v,TString f)
{
-// Provide vector according to reference frame f
+// Provide 4-vector components according to reference frame f
+// and according to the current mode.
+// Scalar mode : The scalar part is directly returned via v[0].
+// Invariant mode : The scalar part is re-calculated via the value
+// of the Lorentz invariant and then returned via v[0].
Double_t vec[4];
GetVector(vec,f);
for (Int_t i=0; i<4; i++)
///////////////////////////////////////////////////////////////////////////
Double_t Ali4Vector::GetScalar()
{
-// Provide the scalar part
- return fV0;
+// Provide the scalar part.
+// The error on the scalar value is available via GetResultError()
+// after invokation of GetScalar().
+ if (fScalar)
+ {
+ fDresult=fDv0;
+ return fV0;
+ }
+ else
+ {
+ Double_t dot=fV.Dot(fV);
+ Double_t ddot=fV.GetResultError();
+ Double_t v02=dot+fV2;
+ Double_t dv02=sqrt(pow(ddot,2)+pow(fDv2,2));
+ Double_t v0=sqrt(fabs(v02));
+ Double_t dv0=0;
+ if (v0) dv0=dv02/(2.*v0);
+ fDresult=dv0;
+ return v0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Double_t Ali4Vector::GetResultError()
+{
+// Provide the error on the result of an operation yielding a scalar
+// E.g. GetScalar(), GetInvariant() or Dot()
+ return fDresult;
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::SetScalar(Double_t v0,Double_t dv0)
+{
+// Modify the scalar part (v0) and its error (dv0).
+// The default value for dv0 is 0.
+// The vector part is not modified.
+// Scalar mode is automatically selected
+// ==> Lorentz invariant and its error are updated.
+// The error on scalar result operations is reset to 0.
+ fScalar=1;
+ fV0=v0;
+ fV2=pow(v0,2)-fV.Dot(fV);
+ SetScalarError(dv0);
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::SetScalarError(Double_t dv0)
+{
+// Set the error on the scalar part.
+// If in scalar mode, update error on the invariant accordingly.
+// The error on scalar result operations is reset to 0.
+ fDv0=dv0;
+ if (fScalar)
+ {
+ Double_t norm=fV.GetNorm();
+ Double_t dnorm=fV.GetResultError();
+ fDv2=sqrt(pow(2.*fV0*fDv0,2)+pow(2.*norm*dnorm,2));
+ }
+ fDresult=0;
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::Set3Vector(Ali3Vector v)
+{
+// Set the 3-vector part, the errors are taken from the input Ali3Vector
+// Scalar mode : The scalar part and its error are not modified,
+// the Lorentz invariantand its error are re-calculated.
+// Invariant mode : The Lorentz invariant and its error are not modified,
+// the scalar part and its error are re-calculated.
+// The error on scalar result operations is reset to 0.
+ fV=v;
+ if (fScalar)
+ {
+ SetScalar(fV0,fDv0);
+ }
+ else
+ {
+ SetInvariant(fV2,fDv2);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::Set3Vector(Double_t* v,TString f)
+{
+// Set the 3-vector part according to reference frame f
+// The errors on the vector part are initialised to 0
+// Scalar mode : The scalar part and its error are not modified,
+// the Lorentz invariantand its error are re-calculated.
+// Invariant mode : The Lorentz invariant and its error are not modified,
+// the scalar part and its error are re-calculated.
+// The error on scalar result operations is reset to 0.
+ Double_t a[3];
+ for (Int_t i=0; i<3; i++)
+ {
+ a[i]=v[i];
+ }
+ fV.SetVector(a,f);
+
+ if (fScalar)
+ {
+ SetScalar(fV0,fDv0);
+ }
+ else
+ {
+ SetInvariant(fV2,fDv2);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::Set3Vector(Float_t* v,TString f)
+{
+// Set the 3-vector part according to reference frame f
+// The errors on the vector part are initialised to 0
+// The Lorentz invariant is not modified
+// The error on scalar result operations is reset to 0.
+ Double_t vec[3];
+ for (Int_t i=0; i<3; i++)
+ {
+ vec[i]=v[i];
+ }
+ Set3Vector(vec,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::SetInvariant(Double_t v2,Double_t dv2)
+{
+// Modify the Lorentz invariant (v2) quantity v^i*v_i and its error (dv2).
+// The default value for the error dv2 is 0.
+// The vector part is not modified.
+// Invariant mode is automatically selected
+// ==> the scalar part and its error are updated.
+// The error on scalar result operations is reset to 0.
+//
+ fScalar=0;
+ fV2=v2;
+ fDv2=dv2;
+ fV0=GetScalar();
+ fDv0=GetResultError();
+ fDresult=0;
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::SetInvariantError(Double_t dv2)
+{
+// Set the error on the Lorentz invariant.
+// If in invariant mode, update error on the scalar part accordingly.
+// The error on scalar result operations is reset to 0.
+ fDv2=dv2;
+ if (!fScalar)
+ {
+ fDv0=GetResultError();
+ }
+ fDresult=0;
+}
+///////////////////////////////////////////////////////////////////////////
+Double_t Ali4Vector::GetInvariant()
+{
+// Provide the Lorentz invariant v^i*v_i.
+// The error on the Lorentz invariant is available via GetResultError()
+// after invokation of GetInvariant().
+ if (!fScalar)
+ {
+ fDresult=fDv2;
+ return fV2;
+ }
+ else
+ {
+ Double_t inv=Dot(*this);
+ return inv;
+ }
}
///////////////////////////////////////////////////////////////////////////
Ali3Vector Ali4Vector::Get3Vector()
return fV;
}
///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::SetErrors(Double_t* e,TString f)
+{
+// Store errors for vector v^i according to reference frame f
+// If in scalar mode, update error on the invariant accordingly.
+// The error on scalar result operations is reset to 0.
+ Double_t a[3];
+ for (Int_t i=0; i<3; i++)
+ {
+ a[i]=e[i+1];
+ }
+ SetScalarError(e[0]);
+ fV.SetErrors(a,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::SetErrors(Float_t* e,TString f)
+{
+// Store errors for vector v^i according to reference frame f
+// If in scalar mode, update error on the invariant accordingly.
+// The error on scalar result operations is reset to 0.
+ Double_t a[4];
+ for (Int_t i=0; i<4; i++)
+ {
+ a[i]=e[i];
+ }
+ SetErrors(a,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::GetErrors(Double_t* e,TString f)
+{
+// Provide errors for vector v^i according to reference frame f
+// and according to the current mode.
+// Scalar mode : The error on the scalar part is directly returned via e[0].
+// Invariant mode : The error on the scalar part is re-calculated via the error
+// value on the Lorentz invariant and then returned via e[0].
+ Double_t a[3];
+ fV.GetErrors(a,f);
+
+ e[0]=GetResultError();
+ for (Int_t i=0; i<3; i++)
+ {
+ e[i+1]=a[i];
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4Vector::GetErrors(Float_t* e,TString f)
+{
+// Provide errors for vector v^i according to reference frame f
+// and according to the current mode.
+// Scalar mode : The error on the scalar part is directly returned via e[0].
+// Invariant mode : The error on the scalar part is re-calculated via the error
+// value on the Lorentz invariant and then returned via e[0].
+ Double_t a[4];
+ GetErrors(a,f);
+ for (Int_t i=0; i<4; i++)
+ {
+ e[i]=a[i];
+ }
+}
+///////////////////////////////////////////////////////////////////////////
void Ali4Vector::Info(TString f)
{
-// Print contravariant vector components according to reference frame f
+// Print contravariant vector components and errors according to
+// reference frame f and according to the current mode.
+// Scalar mode : The scalar part and its error are directly returned.
+// Invariant mode : The scalar part and its error are re-calculated via the
+// value (and error) of the Lorentz invariant.
+
if (f=="car" || f=="sph" || f=="cyl")
{
- Double_t vec[4];
+ Double_t vec[4],err[4];
GetVector(vec,f);
+ GetErrors(err,f);
+ Double_t inv=GetInvariant();
+ Double_t dinv=GetResultError();
cout << " Contravariant vector in " << f << " coordinates : "
<< vec[0] << " " << vec[1] << " " << vec[2] << " " << vec[3] << endl;
+ cout << " ------------- Errors in " << f << " coordinates : "
+ << err[0] << " " << err[1] << " " << err[2] << " " << err[3] << endl;
+ cout << " --- Lorentz invariant (v^i*v_i) : " << inv << " error : " << dinv << endl;
}
else
{
Double_t Ali4Vector::Dot(Ali4Vector& q)
{
// Provide the dot product of the current vector with vector q
- Double_t a[4],b[4];
- Double_t dotpro;
+ Double_t dotpro=0;
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ if ((this) == &q) // Check for special case v.Dot(v)
+ {
+ Double_t norm=fV.GetNorm();
+ Double_t dnorm=fV.GetResultError();
+ dotpro=pow(a0,2)-pow(norm,2);
+ fDresult=sqrt(pow(2.*a0*da0,2)+pow(2.*norm*dnorm,2));
+ }
+ else
+ {
+ Double_t b0=q.GetScalar();
+ Double_t db0=q.GetResultError();
+ Ali3Vector b=q.Get3Vector();
- GetVector(a,"car");
- q.GetVector(b,"car");
+ Double_t dot=fV.Dot(b);
+ Double_t ddot=fV.GetResultError();
- dotpro=a[0]*b[0];
- for (Int_t i=1; i<4; i++)
- {
- dotpro-=a[i]*b[i];
+ dotpro=a0*b0-dot;
+
+ fDresult=sqrt(pow(b0*da0,2)+pow(a0*db0,2)+pow(ddot,2));
}
-
+
return dotpro;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector Ali4Vector::operator+(Ali4Vector& q)
{
-// Add vector q to the current vector
- Double_t a[4],b[4];
+// Add 4-vector q to the current 4-vector
+// Error propagation is performed automatically
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
+ Double_t b0=q.GetScalar();
+ Double_t db0=q.GetResultError();
+ Ali3Vector b=q.Get3Vector();
- GetVector(a,"car");
- q.GetVector(b,"car");
-
- for (Int_t i=0; i<4; i++)
- {
- a[i]+=b[i];
- }
+ Double_t c0=a0+b0;
+ Ali3Vector c=a+b;
+ Double_t dc0=sqrt(pow(da0,2)+pow(db0,2));
Ali4Vector v;
- v.SetVector(a,"car");
-
+ v.SetVector(c0,c);
+ v.SetScalarError(dc0);
return v;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector Ali4Vector::operator-(Ali4Vector& q)
{
-// Subtract vector q from the current vector
- Double_t a[4],b[4];
+// Subtract 4-vector q from the current 4-vector
+// Error propagation is performed automatically
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
+ Double_t b0=q.GetScalar();
+ Double_t db0=q.GetResultError();
+ Ali3Vector b=q.Get3Vector();
- GetVector(a,"car");
- q.GetVector(b,"car");
-
- for (Int_t i=0; i<4; i++)
- {
- a[i]-=b[i];
- }
+ Double_t c0=a0-b0;
+ Ali3Vector c=a-b;
+ Double_t dc0=sqrt(pow(da0,2)+pow(db0,2));
Ali4Vector v;
- v.SetVector(a,"car");
-
+ v.SetVector(c0,c);
+ v.SetScalarError(dc0);
return v;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector Ali4Vector::operator*(Double_t s)
{
-// Multiply the current vector with a scalar s
- Double_t a[4];
+// Multiply the current 4-vector with a scalar s
+// Error propagation is performed automatically
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
- GetVector(a,"car");
-
- for (Int_t i=0; i<4; i++)
- {
- a[i]*=s;
- }
+ a0*=s;
+ a*=s;
+ da0*=s;
Ali4Vector v;
- v.SetVector(a,"car");
+ v.SetVector(a0,a);
+ v.SetScalarError(da0);
return v;
}
Ali4Vector Ali4Vector::operator/(Double_t s)
{
// Divide the current vector by a scalar s
+// Error propagation is performed automatically
if (fabs(s)<1.e-20) // Protect against division by 0
{
}
else
{
- Double_t a[4];
-
- GetVector(a,"car");
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
- for (Int_t i=0; i<4; i++)
- {
- a[i]/=s;
- }
+ a0/=s;
+ a/=s;
+ da0/=s;
Ali4Vector v;
- v.SetVector(a,"car");
+ v.SetVector(a0,a);
+ v.SetScalarError(da0);
return v;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector& Ali4Vector::operator+=(Ali4Vector& q)
{
-// Add vector q to the current vector
- Double_t a[4],b[4];
+// Add 4-vector q to the current 4-vector
+// Error propagation is performed automatically
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
+ Double_t b0=q.GetScalar();
+ Double_t db0=q.GetResultError();
+ Ali3Vector b=q.Get3Vector();
- GetVector(a,"car");
- q.GetVector(b,"car");
+ Double_t c0=a0+b0;
+ Ali3Vector c=a+b;
+ Double_t dc0=sqrt(pow(da0,2)+pow(db0,2));
- for (Int_t i=0; i<4; i++)
- {
- a[i]+=b[i];
- }
-
- SetVector(a,"car");
+ SetVector(c0,c);
+ SetScalarError(dc0);
return *this;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector& Ali4Vector::operator-=(Ali4Vector& q)
{
-// Subtract vector q from the current vector
- Double_t a[4],b[4];
+// Subtract 4-vector q from the current 4-vector
+// Error propagation is performed automatically
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
+ Double_t b0=q.GetScalar();
+ Double_t db0=q.GetResultError();
+ Ali3Vector b=q.Get3Vector();
- GetVector(a,"car");
- q.GetVector(b,"car");
+ Double_t c0=a0-b0;
+ Ali3Vector c=a-b;
+ Double_t dc0=sqrt(pow(da0,2)+pow(db0,2));
- for (Int_t i=0; i<4; i++)
- {
- a[i]-=b[i];
- }
+ SetVector(c0,c);
+ SetScalarError(dc0);
- SetVector(a,"car");
-
return *this;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector& Ali4Vector::operator*=(Double_t s)
{
-// Multiply the current vector with a scalar s
- Double_t a[4];
+// Multiply the current 4-vector with a scalar s
+// Error propagation is performed automatically
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
- GetVector(a,"car");
+ a0*=s;
+ a*=s;
+ da0*=s;
- for (Int_t i=0; i<4; i++)
- {
- a[i]*=s;
- }
+ SetVector(a0,a);
+ SetScalarError(da0);
- SetVector(a,"car");
-
return *this;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector& Ali4Vector::operator/=(Double_t s)
{
// Divide the current vector by a scalar s
+// Error propagation is performed automatically
if (fabs(s)<1.e-20) // Protect against division by 0
{
- cout << " *Ali4Vector::/=* Division by 0 detected. No action taken." << endl;
+ cout << " *Ali4Vector::/* Division by 0 detected. No action taken." << endl;
return *this;
}
else
{
- Double_t a[4];
+ Double_t a0=GetScalar();
+ Double_t da0=GetResultError();
+ Ali3Vector a=Get3Vector();
- GetVector(a,"car");
+ a0/=s;
+ a/=s;
+ da0/=s;
- for (Int_t i=0; i<4; i++)
- {
- a[i]/=s;
- }
-
- SetVector(a,"car");
+ SetVector(a0,a);
+ SetScalarError(da0);
return *this;
}
}
///////////////////////////////////////////////////////////////////////////
+Int_t Ali4Vector::GetScalarFlag()
+{
+// Provide the value of the fScalar flag (for internal use only).
+ return fScalar;
+}
+///////////////////////////////////////////////////////////////////////////
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class Ali4Vector
-// Handling of Lorentz 4-vectors in various reference frames.
-//
-// This class is meant to serve as a base class for ALICE objects
-// that have Lorentz 4-vector characteristics.
-//
-// All 4-vectors are treated in the contravariant form and the convention
-// for the metric and the 4-vector components is according to the one
-// used in the book "Classical Electrodynamics" by J.D. Jackson.
-//
-// The dotproduct is defined such that p.Dot(p) yields the Lorentz invariant
-// scalar of the 4-vector p (i.e. m**2 in case p is a 4-momentum).
-//
-// Note :
-// ------
-// Vectors (v) and reference frames (f) are specified via
-// SetVector(Float_t* v,TString f) under the following conventions :
-//
-// f="car" ==> 3-vector part of v in Cartesian coordinates (x,y,z)
-// f="sph" ==> 3-vector part of v in Spherical coordinates (r,theta,phi)
-// f="cyl" ==> 3-vector part of v in Cylindrical coordinates (rho,phi,z)
-//
-// All angles are in radians.
-//
-// Example :
-// ---------
-//
-// Ali4Vector a;
-//
-// Float_t v[4]={25,-1,3,7};
-// a.SetVector(v,"car");
-//
-// Float_t vec[4];
-// a.GetVector(vec,"sph");
-//
-// Ali4Vector b;
-// Float_t v2[4]={33,6,-18,2};
-// b.SetVector(v2,"car");
-//
-// Float_t dotpro=a.Dot(b);
-//
-// Float_t x0=16;
-// Ali3Vector x;
-// Float_t vec2[3]={1,2,3};
-// x.SetVector(vec2,"car");
-//
-// Ali4Vector c;
-// c.SetVector(x0,x);
-// c.GetVector(vec,"car");
-// c.Info("cyl");
-// c=a+b;
-// c=a-b;
-// c=a*5;
-//
-//--- NvE 01-apr-1999 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
virtual void GetVector(Double_t* v,TString f); // Provide contravariant vector v^i in frame f
virtual void SetVector(Float_t* v,TString f); // Store contravariant vector v^i in frame f
virtual void GetVector(Float_t* v,TString f); // Provide contravariant vector v^i in frame f
+ virtual void SetScalar(Double_t v0,Double_t dv0=0); // Set the scalar part (with error) of v
+ virtual void SetScalarError(Double_t dv0); // Set error on the scalar part of v
Double_t GetScalar(); // Provide the scalar part of v
+ virtual void Set3Vector(Ali3Vector v); // Set the 3-vector part of v
+ virtual void Set3Vector(Double_t* v,TString f); // Set the 3-vector part of v in frame f
+ virtual void Set3Vector(Float_t* v,TString f); // Set the 3-vector part of v in frame f
Ali3Vector Get3Vector(); // Provide the 3-vector part of v
+ virtual void SetInvariant(Double_t v2,Double_t dv2=0); // Set the Lorentz invariant (with error)
+ virtual void SetInvariantError(Double_t dv2); // Set error on the Lorentz invariant
+ Double_t GetInvariant(); // Provide the Lorentz invariant
+ virtual void SetErrors(Double_t* v,TString f); // Store errors of vector v^i in frame f
+ virtual void GetErrors(Double_t* v,TString f); // Provide errors of vector v^i in frame f
+ virtual void SetErrors(Float_t* v,TString f); // Store errors of vector v^i in frame f
+ virtual void GetErrors(Float_t* v,TString f); // Provide errors of vector v^i in frame f
virtual void Info(TString f="car"); // Print contravariant components in frame f
Double_t Dot(Ali4Vector& q); // Provide dot product v^i*q_i
+ Double_t GetResultError(); // Provide error on scalar result (e.g. Dot)
Ali4Vector operator+(Ali4Vector& q); // Add contravariant vector q
Ali4Vector operator-(Ali4Vector& q); // Subtract contravariant vector q
Ali4Vector operator*(Double_t s); // Multiply contravariant vector with scalar s
Ali4Vector& operator-=(Ali4Vector& q); // Subtract contravariant vector q
Ali4Vector& operator*=(Double_t s); // Multiply with scalar s
Ali4Vector& operator/=(Double_t s); // Divide by scalar s
+ Int_t GetScalarFlag(); // Provide the fScalar flag value
protected:
- Double_t fV0; // The scalar part
- Ali3Vector fV; // The 3-vector part
+ Double_t fV2; // The Lorentz invariant (v^i*v_i)
+ Double_t fV0; // The scalar part
+ Ali3Vector fV; // The 3-vector part
+ Double_t fDv2; // The error on the Lorentz invariant
+ Double_t fDv0; // The error on the scalar part
+ Double_t fDresult; // The error on the scalar result of an operation (e.g. dotproduct)
+ Int_t fScalar; // Flag denoting scalar mode
- ClassDef(Ali4Vector,1) // Class definition to enable ROOT I/O
+ ClassDef(Ali4Vector,1) // Handling of Lorentz 4-vectors in various reference frames.
};
#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+///////////////////////////////////////////////////////////////////////////
+// Class Ali4VectorObj
+// Handling of Lorentz 4-vectors in various reference frames.
+//
+// This class is meant to provide an Ali4Vector object which is derived
+// from TObject such that it can be stored in e.g. TObjArray etc...
+// and that it can be written out using the ROOT I/O machinery.
+//
+// Example :
+// =========
+//
+// Float_t a[4]={5,1,2,3};
+// Float_t ea[4]={0.05,0.01,0.02,0.03};
+// Float_t b[4]={10,4,5,6};
+// Float_t eb[4]={0.1,0.04,0.05,0.06};
+//
+// Ali4Vector v,w;
+//
+// v.SetVector(a,"car");
+// v.SetErrors(ea,"car");
+// w.SetVector(b,"car");
+// w.SetErrors(eb,"car");
+//
+// Ali4Vector add=v+w;
+//
+// Ali4Vector sub=v-w;
+//
+// Ali4VectorObj vec1(add);
+//
+// Ali4VectorObj vec2;
+// vec2.Load(sub);
+//
+// vec1.Info();
+// vec2.Info();
+//
+//--- Author: Nick van Eijndhoven 18-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
+#include "Ali4VectorObj.h"
+
+ClassImp(Ali4VectorObj) // Class implementation to enable ROOT I/O
+
+Ali4VectorObj::Ali4VectorObj()
+{
+// Creation of an Ali4VectorObj object and initialisation of parameters.
+// All attributes initialised to 0.
+}
+///////////////////////////////////////////////////////////////////////////
+Ali4VectorObj::Ali4VectorObj(Ali4Vector& q)
+{
+// Creation of an Ali3VectorObj object and initialisation of parameters.
+// All attributes are initialised to the values of the input Ali3Vector.
+ Load(q);
+}
+///////////////////////////////////////////////////////////////////////////
+Ali4VectorObj::~Ali4VectorObj()
+{
+// Destructor to delete dynamically allocated memory.
+}
+///////////////////////////////////////////////////////////////////////////
+void Ali4VectorObj::Load(Ali4Vector& q)
+{
+// Load all attributes of the input Ali4Vector into this Ali4VectorObj object.
+ Int_t temp1=q.GetScalarFlag();
+ Double_t temp2=q.GetResultError();
+ Double_t a[4];
+ q.GetVector(a,"sph");
+ SetVector(a,"sph");
+ q.GetErrors(a,"car");
+ SetErrors(a,"car");
+ fScalar=temp1;
+ fDresult=temp2;
+}
+///////////////////////////////////////////////////////////////////////////
--- /dev/null
+#ifndef ALI4VECTOROBJ_H
+#define ALI4VECTOROBJ_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+#include "TObject.h"
+
+#include "Ali4Vector.h"
+
+class Ali4VectorObj : public TObject,public Ali4Vector
+{
+ public:
+ Ali4VectorObj(); // Default constructor
+ Ali4VectorObj(Ali4Vector& q); // Constructor
+ ~Ali4VectorObj(); // Destructor
+ void Load(Ali4Vector& q); // Load all attributes of input Ali4Vector
+
+ ClassDef(Ali4VectorObj,1) // Handling of Lorentz 4-vectors in various reference frames.
+};
+#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliBoost
+// Perform various Lorentz transformations.
+//
+// Example :
+// =========
+//
+// Float_t a[3]={0.1,0.2,0.3};
+// Float_t ea[3]={0.01,0.02,0.03};
+// Ali3Vector beta;
+// beta.SetVector(a,"car");
+// beta.SetErrors(ea,"car");
+//
+// AliBoost b1;
+// b1.SetBeta(beta);
+// b1.Info();
+//
+// Float_t b[4]={14,1,2,3};
+// Float_t eb[4]={1.4,0.1,0.2,0.3};
+// Ali4Vector p;
+// p.SetVector(b,"car");
+// p.SetErrors(eb,"car");
+// Ali4Vector pprim=b1.Boost(p);
+// p.Info();
+// pprim.Info();
+//
+// p=b1.Inverse(pprim);
+// pprim.Info();
+// p.Info();
+//
+// Float_t c[4]={5,0,0,4};
+// Float_t ec[4]={0.5,0,0,0.4};
+// Ali4Vector q;
+// q.SetVector(c,"car");
+// q.SetErrors(ec,"car");
+//
+// AliBoost b2;
+// b2.Set4Momentum(q);
+// b2.Info("sph");
+//
+//--- Author: Nick van Eijndhoven 14-may-1996 UU-SAP Utrecht
+//- Modified: NvE 24-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliBoost.h"
ClassImp(AliBoost) // Class implementation to enable ROOT I/O
AliBoost::AliBoost()
{
-// Creation of a Lorentz boost object and initialisation of parameters
- fGamma=1;
- fBeta2=0;
+// Creation of a Lorentz boost object and initialisation of parameters.
+// Beta is set to (0,0,0) and consequently Gamma=1.
+// All errors are initialised to 0.
Double_t a[3]={0,0,0};
fBeta.SetVector(a,"sph");
+ fGamma=1;
+ fDgamma=0;
+ fDresult=0;
}
///////////////////////////////////////////////////////////////////////////
AliBoost::~AliBoost()
{
-// Default destructor
+// Default destructor.
}
///////////////////////////////////////////////////////////////////////////
void AliBoost::SetBeta(Ali3Vector b)
{
-// Setting of boost parameters on basis of beta 3-vector
- fBeta2=b.Dot(b);
+// Setting of boost parameters on basis of beta 3-vector.
+// The errors on the beta 3-vector are taken from the input 3-vector.
+// The gamma value and its error are calculated accordingly.
fBeta=b;
+ Double_t beta2=fBeta.Dot(fBeta);
+ Double_t dbeta2=fBeta.GetResultError();
- if (fBeta2 > 1.)
+ if (beta2 > 1.)
{
cout << " *AliBoost::SetBeta* beta > 1." << endl;
}
- Double_t test=1.-fBeta2;
fGamma=0;
- if (test > 0.) fGamma=sqrt(1./test);
-}
-///////////////////////////////////////////////////////////////////////////
-void AliBoost::SetGamma(Double_t g,Ali3Vector v)
-{
-// Setting of boost parameters on basis of gamma and direction 3-vector
- if (g >= 1.)
- {
- fGamma=g;
- fBeta2=1.-(1./(fGamma*fGamma));
- fBeta=v*sqrt(fBeta2);
- }
- else
+ fDgamma=0;
+ Double_t temp=1.-beta2;
+ if (temp > 0.)
{
- cout << " *AliBoost::SetGamma* Invalid input gamma = " << g << endl;
+ fGamma=sqrt(1./temp);
+ fDgamma=fabs(dbeta2/(2.*pow(temp,1.5)));
}
}
///////////////////////////////////////////////////////////////////////////
void AliBoost::Set4Momentum(Ali4Vector& p)
{
-// Setting of boost parameters on basis of momentum 4-vector data
+// Setting of boost parameters on basis of momentum 4-vector data.
+// The errors of the input 4-vector are used to calculate the
+// errors on the beta 3-vector and the gamma factor.
Double_t E=p.GetScalar();
+ Double_t dE=p.GetResultError();
if (E <= 0.)
{
cout << " *AliBoost::Set4Momentum* Unphysical situation." << endl;
else
{
Ali3Vector b=p.Get3Vector();
+ Double_t vb[3],eb[3];
+ b.GetVector(vb,"car");
+ b.GetErrors(eb,"car");
b=b/E;
+ for (Int_t i=0; i<3; i++)
+ {
+ eb[i]=sqrt(pow(eb[i]/E,2)+pow(vb[i]*dE/(E*E),2));
+ }
+ b.SetErrors(eb,"car");
SetBeta(b);
}
}
///////////////////////////////////////////////////////////////////////////
Ali3Vector AliBoost::GetBetaVector()
{
-// Provide the the beta 3-vector
+// Provide the beta 3-vector.
return fBeta;
}
///////////////////////////////////////////////////////////////////////////
Double_t AliBoost::GetBeta()
{
-// Provide the norm of the beta 3-vector
- return sqrt(fBeta2);
+// Provide the norm of the beta 3-vector.
+// The error on the value can be obtained via GetResultError().
+ Double_t norm=fBeta.GetNorm();
+ fDresult=fBeta.GetResultError();
+ return norm;
}
///////////////////////////////////////////////////////////////////////////
Double_t AliBoost::GetGamma()
{
-// Provide the gamma factor
+// Provide the gamma factor.
+// The error on the value can be obtained via GetResultError().
+ fDresult=fDgamma;
return fGamma;
}
///////////////////////////////////////////////////////////////////////////
+Double_t AliBoost::GetResultError()
+{
+// Provide the error on the result of an operation yielding a scalar.
+// E.g. GetBeta() or GetGamma()
+ return fDresult;
+}
+///////////////////////////////////////////////////////////////////////////
void AliBoost::Info(TString f)
{
-// Printing of the boost parameter info in coordinate frame f
-
- cout << " *AliBoost::Info* beta = " << sqrt(fBeta2) << " gamma = " << fGamma << endl
- << " Beta";
+// Printing of the boost parameter info in coordinate frame f.
+ Double_t beta=fBeta.GetNorm();
+ Double_t dbeta=fBeta.GetResultError();
+ cout << " *AliBoost::Info* beta : " << beta << " error : " << dbeta
+ << " gamma : " << fGamma << " error : " << fDgamma << endl;
+ cout << " Beta";
fBeta.Info(f);
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector AliBoost::Boost(Ali4Vector& v)
{
-// Perform the Lorentz boost on the 4-vector v
- if (fBeta2 > 1.e-20)
+// Perform the Lorentz boost on the 4-vector v.
+// Error propagation is performed automatically.
+// Note : As an approximation Beta and p.Dot(Beta) are considered as
+// independent quantities.
+
+ Double_t beta=fBeta.GetNorm();
+ Double_t dbeta=fBeta.GetResultError();
+
+ Double_t beta2=pow(beta,2);
+
+ if (beta > 1.e-10)
{
Double_t E=v.GetScalar();
+ Double_t dE=v.GetResultError();
+
Ali3Vector p=v.Get3Vector();
+
Double_t pdotbeta=p.Dot(fBeta);
+ Double_t dpdotbeta=p.GetResultError();
+
+ // Determine the new vector components
+ Double_t Eprim=fGamma*(E-pdotbeta);
+
+ Double_t z=((fGamma-1.)*pdotbeta/beta2)-fGamma*E;
+ Ali3Vector add=fBeta*z;
+
+ // Determine errors on the new vector components
+ Double_t dEprim=sqrt(pow((E-pdotbeta)*fDgamma,2)+pow(fGamma*dE,2)
+ +pow(fGamma*dpdotbeta,2));
+ Double_t dz=sqrt( pow(((fGamma-1.)/beta2)*dpdotbeta,2) + pow(fGamma*dE,2)
+ +pow((
+ ((2./beta)-(4.*pow(beta,3)-6.*pow(beta,5))/(2.*pow((pow(beta,4)-pow(beta,6)),1.5)))*pdotbeta
+ +beta*E/pow(fGamma,3))*dbeta,2) );
- Double_t Eprim;
- Eprim=fGamma*(E-pdotbeta);
+ Double_t vb[3],eb[3];
+ fBeta.GetVector(vb,"car");
+ fBeta.GetErrors(eb,"car");
+ for (Int_t i=0; i<3; i++)
+ {
+ eb[i]=sqrt(pow(z*eb[i],2)+pow(vb[i]*dz,2));
+ }
+ add.SetErrors(eb,"car");
- Ali3Vector term1,term2,pprim;
- term1=fBeta*((fGamma-1.)*pdotbeta/fBeta2);
- term2=fBeta*(fGamma*E);
- pprim=p+term1-term2;
+ // Calculate the new 3-vector
+ Ali3Vector pprim=p+add;
+ // Set the components and errors of the new 4-vector
Ali4Vector w;
w.SetVector(Eprim,pprim);
+ w.SetScalarError(dEprim);
return w;
}
///////////////////////////////////////////////////////////////////////////
Ali4Vector AliBoost::Inverse(Ali4Vector& vprim)
{
-// Perform the inverse Lorentz boost on the 4-vector vprim
- if (fBeta2 > 1.e-20)
+// Perform the inverse Lorentz boost on the 4-vector vprim.
+// Error propagation is performed automatically.
+// Note : As an approximation Beta and pprim.Dot(Beta) are considered as
+// independent quantities.
+
+ Double_t beta=fBeta.GetNorm();
+ Double_t dbeta=fBeta.GetResultError();
+
+ Double_t beta2=pow(beta,2);
+
+ if (beta > 1.e-10)
{
Double_t Eprim=vprim.GetScalar();
+ Double_t dEprim=vprim.GetResultError();
+
Ali3Vector pprim=vprim.Get3Vector();
+
Double_t pprimdotbeta=pprim.Dot(fBeta);
+ Double_t dpprimdotbeta=pprim.GetResultError();
+
+ // Determine the new vector components
+ Double_t E=fGamma*(Eprim+pprimdotbeta);
+
+ Double_t z=((fGamma-1.)*pprimdotbeta/beta2)+fGamma*Eprim;
+ Ali3Vector add=fBeta*z;
+
+ // Determine errors on the prime-vector components
+ Double_t dE=sqrt(pow((Eprim+pprimdotbeta)*fDgamma,2)+pow(fGamma*dEprim,2)
+ +pow(fGamma*dpprimdotbeta,2));
+ Double_t dz=sqrt( pow(((fGamma-1.)/beta2)*dpprimdotbeta,2) + pow(fGamma*dEprim,2)
+ +pow((
+ ((2./beta)-(4.*pow(beta,3)-6.*pow(beta,5))/(2.*pow((pow(beta,4)-pow(beta,6)),1.5)))*pprimdotbeta
+ -beta*Eprim/pow(fGamma,3))*dbeta,2) );
- Double_t E;
- E=fGamma*(Eprim+pprimdotbeta);
+ Double_t vb[3],eb[3];
+ fBeta.GetVector(vb,"car");
+ fBeta.GetErrors(eb,"car");
+ for (Int_t i=0; i<3; i++)
+ {
+ eb[i]=sqrt(pow(z*eb[i],2)+pow(vb[i]*dz,2));
+ }
+ add.SetErrors(eb,"car");
- Ali3Vector term1,term2,p;
- term1=fBeta*((fGamma-1.)*pprimdotbeta/fBeta2);
- term2=fBeta*(fGamma*Eprim);
- p=pprim+term1+term2;
+ // Calculate the new 3-vector
+ Ali3Vector p=pprim+add;
+ // Set the components and errors of the new 4-vector
Ali4Vector w;
w.SetVector(E,p);
+ w.SetScalarError(dE);
return w;
}
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliBoost
-// Perform various Lorentz transformations.
-//
-// Example :
-// =========
-//
-// Float_t a[3]={0.1,0.2,0.3};
-// Ali3Vector beta;
-// beta.SetVector(a,"car");
-//
-// AliBoost b1;
-// b1.SetBeta(beta);
-// cout << " Boost b1 :" << endl;
-// b1.Info();
-//
-// Float_t b[4]={14,1,2,3};
-// Ali4Vector p;
-// p.SetVector(b,"car");
-// Ali4Vector pprim=b1.Boost(p);
-// cout << " Boost b1 result p,pprim :" << endl;
-// p.Info();
-// pprim.Info();
-//
-// p=b1.Inverse(pprim);
-// cout << " Inverse b1 result pprim,p :" << endl;
-// pprim.Info();
-// p.Info();
-//
-// Float_t c[4]={5,0,0,4};
-// Ali4Vector q;
-// q.SetVector(c,"car");
-//
-// AliBoost b2;
-// b2.Set4Momentum(q);
-// cout << " Lorbo b2 : " << endl;
-// b2.Info("sph");
-//
-//--- NvE 14-may-1996 UU-SAP Utrecht
-//--- Modified : NvE 01-apr-1999 UU-SAP Utrecht using Ali3Vector/Ali4Vector
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
AliBoost(); // Default constructor
~AliBoost(); // Default destructor
void SetBeta(Ali3Vector b); // Set boost parameters by beta 3-vector
- void SetGamma(Double_t g,Ali3Vector v); // Set boost parameters by gamma and direction 3-vector
void Set4Momentum(Ali4Vector& p); // Set boost parameters by 4-momentum
Ali3Vector GetBetaVector(); // Provide the beta 3-vector
Double_t GetBeta(); // Provide norm of beta 3-vector
void Info(TString f="car"); // Print boost parameter info in coord. frame f
Ali4Vector Boost(Ali4Vector& v); // Perform Lorentz boost on 4-vector v
Ali4Vector Inverse(Ali4Vector& v); // Perform inverse Lorentz boost on 4-vector v
+ Double_t GetResultError(); // Provide error on scalar result
protected:
- Ali3Vector fBeta; // The beta 3-vector
- Double_t fBeta2; // beta**2
- Double_t fGamma; // The gamma factor
+ Ali3Vector fBeta; // The beta 3-vector
+ Double_t fGamma; // The gamma factor
+ Double_t fDgamma; // Error on the gamma value
+ Double_t fDresult; // Error on scalar result
- ClassDef(AliBoost,1) // Class definition to enable ROOT I/O
+ ClassDef(AliBoost,1) // Perform various Lorentz transformations.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliCalcluster
+// Description of a cluster of calorimeter modules.
+// A matrix geometry is assumed in which a cluster center
+// is identified by (row,col) and contains sig as signal
+// being the signal of the complete cluster.
+// Some info about cluster topology is provided in order
+// to enable EM or hadronic cluster identification.
+//
+//--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
+//- Modified: NvE 31-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliCalcluster.h"
ClassImp(AliCalcluster) // Class implementation to enable ROOT I/O
///////////////////////////////////////////////////////////////////////////
void AliCalcluster::Start(AliCalmodule& m)
{
-// Reset cluster data and start with module m
+// Reset cluster data and start with module m.
// A module can only start a cluster when it contains
-// a signal, has not been used in a cluster yet and is not
-// situated at a detector edge
+// a signal, has not been used in a cluster yet, is not
+// situated at a detector edge and is not declared dead.
Float_t pos[3]={0,0,0};
- if ((m.GetClusteredSignal() > 0.) && (m.GetEdgeValue() == 0))
+ if (m.GetClusteredSignal()>0. && m.GetEdgeValue()==0 && m.GetDeadValue()==0)
{
fCenter=&m;
m.GetPosition(pos,"sph");
///////////////////////////////////////////////////////////////////////////
void AliCalcluster::AddVetoSignal(Float_t* r,TString f,Float_t s)
{
-// Associate an (extrapolated) AliSignal at location r as veto to the cluster
+// Associate an (extrapolated) AliSignal at location r as veto to the cluster.
+// The signal value s indicates the confidence level of hit association
+// and has to be provided by the user.
// Note : The default signal value (s) is 0
if (!fVetos)
{
fVetos=new TObjArray();
}
- fVetos->Add(new AliSignal);
+ fVetos->Add(new AliSignal(1));
fNvetos++;
((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
///////////////////////////////////////////////////////////////////////////
AliSignal* AliCalcluster::GetVetoSignal(Int_t i)
{
-// Provide access to the i-th veto signal of this cluster
-// Note : The first hit corresponds to i=1
+// Provide access to the i-th veto signal of this cluster.
+// Note : The first hit corresponds to i=1.
if (i>0 && i<=fNvetos)
{
}
}
///////////////////////////////////////////////////////////////////////////
+Float_t AliCalcluster::GetVetoLevel()
+{
+// Provide the confidence level of best associated veto signal.
+ Float_t cl=0;
+ Float_t clmax=0;
+ if (fVetos)
+ {
+ for (Int_t i=0; i<fNvetos; i++)
+ {
+ cl=((AliSignal*)fVetos->At(i))->GetSignal();
+ if (cl>clmax) clmax=cl;
+ }
+ }
+ return clmax;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCalcluster::HasVetoHit(Double_t cl)
+{
+// Investigate if cluster has an associated veto hit with conf. level > cl.
+// Returns 1 if there is such an associated veto hit, otherwise returns 0.
+// Note : This function is faster than GetVetoLevel().
+ if (fVetos)
+ {
+ for (Int_t i=0; i<fNvetos; i++)
+ {
+ if (((AliSignal*)fVetos->At(i))->GetSignal() > cl) return 1;
+ }
+ }
+ return 0;
+}
+///////////////////////////////////////////////////////////////////////////
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliCalcluster
-// Description of a cluster of calorimeter modules.
-// A matrix geometry is assumed in which a cluster center
-// is identified by (row,col) and contains sig as signal
-// being the signal of the complete cluster.
-// Some info about cluster topology is provided in order
-// to enable EM or hadronic cluster identification
-//
-//--- NvE 13-jun-1997 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
void AddVetoSignal(Float_t* r,TString f,Float_t s=0); // Associate (extrapolated) signal
AliSignal* GetVetoSignal(Int_t j); // Access to veto signal number j
Int_t GetNvetos(); // Provide the number of veto signals
+ Float_t GetVetoLevel(); // Provide confidence level of best associated veto hit
+ Int_t HasVetoHit(Double_t cl); // Check for ass. veto hit with conf. level > cl
protected:
AliCalmodule* fCenter; // Pointer to the central module of the cluster
Int_t fNvetos; // The number of associated veto signals
TObjArray* fVetos; // The array of associated veto signals
- ClassDef(AliCalcluster,1) // Class definition to enable ROOT I/O
+ ClassDef(AliCalcluster,1) // Description of a cluster of calorimeter modules.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliCalmodule
+// Description of a module in a calorimeter system.
+// A matrix geometry is assumed, such that a module
+// is identified by (row,col) and contains a certain signal.
+// Note : row and col start counting at 1.
+//
+//--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
+//- Modified: NvE 31-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliCalmodule.h"
ClassImp(AliCalmodule) // Class implementation to enable ROOT I/O
// Module constructor with initialisation of module data
fRow=row;
fCol=col;
- fSignal=sig;
+ AliSignal::SetSignal(sig);
fSigc=sig;
fEdge=0;
fDead=0;
// Set or change the data of the module
fRow=row;
fCol=col;
- fSignal=sig;
+ AliSignal::SetSignal(sig);
fSigc=sig;
}
///////////////////////////////////////////////////////////////////////////
// Add or change the data of the module
fRow=row;
fCol=col;
- fSignal+=sig;
+ AliSignal::AddSignal(sig);
fSigc+=sig;
}
///////////////////////////////////////////////////////////////////////////
return fCol;
}
///////////////////////////////////////////////////////////////////////////
-Float_t AliCalmodule::GetSignal()
-{
-// Provide the signal value of the module
- if (!fDead)
- {
- return fSignal;
- }
- else
- {
- return 0;
- }
-}
-///////////////////////////////////////////////////////////////////////////
Float_t AliCalmodule::GetClusteredSignal()
{
// Provide the signal of the module after clustering
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliCalmodule
-// Description of a module in a calorimeter system.
-// A matrix geometry is assumed, such that a module
-// is identified by (row,col) and contains a certain signal
-// Note : row and col start counting at 1
-//
-//--- NvE 13-jun-1997 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include "AliSignal.h"
void SetColumn(Int_t i); // Set the column number of the module
Int_t GetRow(); // Return the row number of the module
Int_t GetColumn(); // Return the column number of the module
- Float_t GetSignal(); // Return the signal value of the module
void SetClusteredSignal(Float_t val); // Set the signal of the module after clustering
Float_t GetClusteredSignal(); // Return module signal after clustering
void SetEdgeOn(); // Set flag to indicate modules at edges
Int_t fDead; // Flag to indicate dead module (1=dead 0=alive)
Float_t fGain; // Gain of the module's readout system
- ClassDef(AliCalmodule,1) // Class definition to enable ROOT I/O
+ ClassDef(AliCalmodule,1) // Description of a module in a calorimeter system.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliCalorimeter
+// Description of a modular calorimeter system.
+// A matrix geometry is used in which a module is identified by (row,col).
+// Note : First module is identified as (1,1).
+//
+// This is the way to define and enter signals into a calorimeter :
+//
+// AliCalorimeter cal(10,15); // Calorimeter of 10x15 modules
+// // All module signals set to 0.
+// cal.AddSignal(5,7,85.4);
+// cal.AddSignal(5,7,25.9);
+// cal.AddSignal(3,5,1000);
+// cal.SetSignal(5,7,10.3);
+// cal.Reset(3,5); // Reset module (3,5) as being 'not fired'
+// // All module data are re-initialised.
+// cal.SetEdgeOn(1,1); // Declare module (1,1) as an 'edge module'
+// cal.SetDead(8,3);
+// cal.SetGain(2,8,3.2);
+//
+// Float_t vec[3]={6,1,20};
+// cal.SetPosition(2,8,vec,"car");
+//
+// Float_t loc[3]={-1,12,3};
+// cal.AddVetoSignal(loc,"car"); // Associate (extrapolated) position as a veto
+//
+// cal.Group(2); // Group 'fired' modules into clusters
+// // Perform grouping over 2 rings around the center
+// cal.Reset(); // Reset the complete calorimeter
+// // Normally to prepare for the next event data
+// // Note : Module gain, edge and dead flags remain
+//
+//--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
+//- Modified: NvE 31-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliCalorimeter.h"
-
+
ClassImp(AliCalorimeter) // Class implementation to enable ROOT I/O
AliCalorimeter::AliCalorimeter()
if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
{
fMatrix[row-1][col-1].SetSignal(row,col,0);
- fNsignals--;
- fModules->Remove(&(fMatrix[row-1][col-1]));
+ AliCalmodule* m=(AliCalmodule*)fModules->Remove(&(fMatrix[row-1][col-1]));
+ if (m)
+ {
+ fNsignals--;
+ fModules->Compress();
+ }
}
else
{
///////////////////////////////////////////////////////////////////////////
Float_t AliCalorimeter::GetSignal(Int_t row, Int_t col)
{
-// Provide the signal of a certain calorimeter module
+// Provide the signal of a certain calorimeter module.
+// In case the module was marked dead, 0 is returned.
if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
{
- return fMatrix[row-1][col-1].GetSignal();
+ Int_t dead=fMatrix[row-1][col-1].GetDeadValue();
+ Float_t signal=0;
+ if (!dead) signal=fMatrix[row-1][col-1].GetSignal();
+ return signal;
}
else
{
if (fNclusters > 0) Ungroup(); // Restore unclustered situation if needed
// Order the modules with decreasing signal
- AliCalmodule* ordered=new AliCalmodule[fNsignals]; // temp. array for ordered modules
- Sortm(ordered);
+ AliCalmodule** ordered=new AliCalmodule*[fNsignals]; // temp. array for ordered modules
+ Int_t nord=0;
+ Sortm(ordered,nord);
// Clustering of modules. Start with the highest signal.
if (fClusters)
Int_t row=0;
Int_t col=0;
AliCalcluster* c=0;
- for (Int_t i=0; i<fNsignals; i++)
+ for (Int_t i=0; i<nord; i++)
{
- row=ordered[i].GetRow(); // row number of cluster center
- col=ordered[i].GetColumn(); // column number of cluster center
+ row=ordered[i]->GetRow(); // row number of cluster center
+ col=ordered[i]->GetColumn(); // column number of cluster center
if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
{
// only use modules not yet used in a cluster
}
// Delete the temp. array
- delete [] ordered;
+ if (ordered)
+ {
+ for (Int_t j=0; j<nord; j++)
+ {
+ ordered[j]=0;
+ }
+ delete [] ordered;
+ }
}
}
///////////////////////////////////////////////////////////////////////////
-void AliCalorimeter::Sortm(AliCalmodule* ordered)
+void AliCalorimeter::Sortm(AliCalmodule** ordered,Int_t& nord)
{
// Order the modules with decreasing signal
- Int_t nord=0;
+ nord=0;
for (Int_t i=0; i<fNrows; i++) // loop over all modules of the matrix
{
for (Int_t ii=0; ii<fNcolumns; ii++)
{
- if (fMatrix[i][ii].GetSignal() <= 0.) continue; // only take modules with a signal
+ if (GetSignal(i+1,ii+1) <= 0.) continue; // only take alive modules with a signal
if (nord == 0) // store the first module with a signal at the first ordered position
{
nord++;
- ordered[nord-1]=fMatrix[i][ii];
+ ordered[nord-1]=&(fMatrix[i][ii]);
continue;
}
if (j == nord) // module has smallest signal seen so far
{
nord++;
- ordered[j]=fMatrix[i][ii]; // add module at the end
+ ordered[j]=&(fMatrix[i][ii]); // add module at the end
break; // go for next matrix module
}
- if (fMatrix[i][ii].GetSignal() < ordered[j].GetSignal()) continue;
+ if (GetSignal(i+1,ii+1) < ordered[j]->GetSignal()) continue;
nord++;
- for (Int_t k=nord-1; k>j; k--) {ordered[k]=ordered[k-1];} // create empty position
- ordered[j]=fMatrix[i][ii]; // put module at empty position
+ for (Int_t k=nord-1; k>j; k--) // create empty position
+ {
+ ordered[k]=ordered[k-1];
+ }
+ ordered[j]=&(fMatrix[i][ii]); // put module at empty position
break; // go for next matrix module
}
}
for (Int_t j=lcol; j<=ucol; j++)
{
// add module(i,j) to cluster if the signal <= signal(row,col)
- if (fMatrix[i-1][j-1].GetSignal() <= signal)
+ if (GetSignal(i,j) <= signal)
{
((AliCalcluster*)fClusters->At(fNclusters-1))->Add(fMatrix[i-1][j-1]);
}
}
}
///////////////////////////////////////////////////////////////////////////
+AliCalmodule* AliCalorimeter::GetModule(Int_t row,Int_t col)
+{
+// Provide access to module (row,col).
+// Note : first module is at (1,1).
+
+ if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
+
+ if (row>=1 && row<=fNrows && col>=1 && col<=fNcolumns)
+ {
+ return &(fMatrix[row-1][col-1]);
+ }
+ else
+ {
+ cout << " *AliCalorimeter::GetModule* row,col : " << row << ", " << col
+ << " out of range." << endl;
+ return 0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
TH2F* AliCalorimeter::DrawModules()
{
// Provide a lego plot of the module signals
AliCalmodule* m;
Float_t row,col,signal;
+ Int_t dead;
for (Int_t i=0; i<fNsignals; i++)
{
m=(AliCalmodule*)fModules->At(i);
{
row=float(m->GetRow());
col=float(m->GetColumn());
- signal=m->GetSignal();
+ dead=m->GetDeadValue();
+ signal=0;
+ if (!dead) signal=m->GetSignal();
if (signal>0.) fHmodules->Fill(col,row,signal);
}
}
void AliCalorimeter::LoadMatrix()
{
// Load the Calorimeter module matrix data back from the TObjArray
-
+
// Create the module matrix space
if (fMatrix)
{
}
// Copy the module data back into the matrix
- AliCalmodule* m;
- Int_t row;
- Int_t col;
- for (Int_t j=0; j<fNsignals; j++)
+ AliCalmodule* m=0;
+ Int_t row=0;
+ Int_t col=0;
+ Int_t nsig=0;
+ if (fModules) nsig=fModules->GetSize();
+ for (Int_t j=0; j<nsig; j++)
{
m=(AliCalmodule*)fModules->At(j);
- row=m->GetRow();
- col=m->GetColumn();
- fMatrix[row-1][col-1]=*m;
- fModules->AddAt(&(fMatrix[row-1][col-1]),j); // Store new pointer
+ if (m)
+ {
+ row=m->GetRow();
+ col=m->GetColumn();
+ fMatrix[row-1][col-1]=*m;
+ fModules->AddAt(&(fMatrix[row-1][col-1]),j); // Store new pointer
+ }
}
+
}
///////////////////////////////////////////////////////////////////////////
void AliCalorimeter::Ungroup()
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliCalorimeter
-// Description of a modular calorimeter system.
-// A matrix geometry is used in which a module is identified by (row,col).
-// Note : First module is identified as (1,1).
-//
-// This is the way to define and enter signals into a calorimeter :
-//
-// AliCalorimeter cal(10,15); // Calorimeter of 10x15 modules
-// // All module signals set to 0.
-// cal.AddSignal(5,7,85.4);
-// cal.AddSignal(5,7,25.9);
-// cal.AddSignal(3,5,1000);
-// cal.SetSignal(5,7,10.3);
-// cal.Reset(3,5); // Reset module (3,5) as being 'not fired'
-// // All module data are re-initialised.
-// cal.SetEdgeOn(1,1); // Declare module (1,1) as an 'edge module'
-// cal.SetDead(8,3);
-// cal.SetGain(2,8,3.2);
-//
-// Float_t vec[3]={6,1,20};
-// cal.SetPosition(2,8,vec,"car");
-//
-// Float_t loc[3]={-1,12,3};
-// cal.AddVetoSignal(loc,"car"); // Associate (extrapolated) position as a veto
-//
-// cal.Group(2); // Group 'fired' modules into clusters
-// // Perform grouping over 2 rings around the center
-// cal.Reset(); // Reset the complete calorimeter
-// // Normally to prepare for the next event data
-// // Note : Module gain, edge and dead flags remain
-//
-//--- NvE 13-jun-1997 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
#include "TObjArray.h"
#include "TH2.h"
#include "TString.h"
-
-#include "AliDetector.h"
-
+
#include "AliCalmodule.h"
#include "AliCalcluster.h"
#include "AliSignal.h"
-class AliCalorimeter : public AliDetector
+class AliCalorimeter : public TObject
{
public:
AliCalorimeter(); // Default constructor
Float_t GetClusteredSignal(Int_t row,Int_t col); // Provide module signal after clustering
AliCalcluster* GetCluster(Int_t j); // Access to cluster number j
AliCalmodule* GetModule(Int_t j); // Access to 'fired' module number j
+ AliCalmodule* GetModule(Int_t row,Int_t col); // Access to module at (row,col)
void SetEdgeOn(Int_t row,Int_t col); // Indicate module as 'edge module'
void SetEdgeOff(Int_t row,Int_t col); // Indicate module as 'non-edge module'
Int_t GetEdgeValue(Int_t row,Int_t col); // Provide the edge flag of a module
Int_t fNsignals; // The number of modules with a signal
Int_t fNclusters; // The number of clusters
AliCalmodule** fMatrix; //! The matrix of modules for internal use
- void Sortm(AliCalmodule*); // Order the modules with decreasing signal
+ void Sortm(AliCalmodule** a,Int_t& n); // Order the modules with decreasing signal
TObjArray* fClusters; // The array of clusters
void AddRing(Int_t row,Int_t col,Int_t n); // add signals of n rings around cluster center
TObjArray* fModules; // The array of modules for output
Int_t fNvetos; // The number of associated veto signals
TObjArray* fVetos; // The array of associated (extrapolated) veto signals
- ClassDef(AliCalorimeter,1) // Class definition to enable ROOT I/O
+ ClassDef(AliCalorimeter,1) // Description of a modular calorimeter system.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+////////////////////////////////////////////////////////////////////////////////
+// Class AliInvmass
+// Construction of invariant mass and combinatorial background.
+//
+// Example :
+// ---------
+//
+// TObjArray* photons=new TObjArray(); // Array with photon tracks for pi0 rec.
+//
+// // Code to create some photon tracks from pi0 decays
+// Int_t ntracks=200;
+// for (Int_t i=0; i<ntracks; i++)
+// {
+// photons->Add(new Alitrack);
+// ...
+// ...
+// ...
+// }
+//
+// // Perform the invariant mass and comb. bkg. reconstruction
+//
+// TObjArray* allm=q.Invmass(photons,photons); // All reconstructed invariant masses
+//
+// TH1F* hall=new TH1F("hall","hall",200,0,2); // Histo with M_inv of all combinations
+//
+// Int_t nall=0;
+// if (allm) nall=allm->GetEntries();
+//
+// AliTrack* t;
+// Float_t minv;
+// for (Int_t j=0; j<nall; j++)
+// {
+// t=(AliTrack*)allm->At(j);
+// if (t)
+// {
+// minv=t->GetMass();
+// hall->Fill(minv);
+// }
+// }
+//
+// TObjArray* bkgm=q.CombBkg(photons,photons); // Reconstructed comb. background
+//
+// TH1F* hbkg=new TH1F("hbkg","hbkg",200,0,2); // Histo with M_inv. of comb. background
+//
+// Int_t nbkg=0;
+// if (bkgm) nbkg=bkgm->GetEntries();
+//
+// for (Int_t j=0; j<nbkg; j++)
+// {
+// t=(AliTrack*)bkgm->At(j);
+// if (t)
+// {
+// minv=t->GetMass();
+// hbkg->Fill(minv);
+// }
+// }
+//
+// TH1F* hsig=new TH1F("sig","sig",200,0,2); // Histo with the bkg. subtracted signal
+// hsig->Sumw2();
+// hsig->Add(hall,hbkg,1,-1);
+//
+//
+// Note : By default the storage of the reconstructed information is performed
+// in separate TObjArrays for the signal and comb. background resp.
+// In order to limit the memory usage, AliInvmass::SetStorageMode(1) may be
+// used to activate only a single TObjArray to store the reconstructed information.
+// Consequently, the following statements
+//
+// TObjArray* allm=q.Invmass(photons,photons);
+// TObjArray* bkgm=q.CombBkg(photons,photons);
+//
+// will result in the fact that after he invokation of CombBkg
+// the information of "allm" is lost due to the fact that the storage is
+// is re-used for "bkgm" in case the "single storage" option has been selected.
+// Usage of the, in that case invalid, pointer "allm" may cause your
+// program to crash.
+//
+// * Thus : In case of single storage usage, all invokations of the returned
+// array pointer have to be completed before invoking any memberfunction
+// of the same AliInvmass object again.
+//
+//
+//
+//--- Author: Nick van Eijndhoven 12-apr-1999 UU-SAP Utrecht
+////////////////////////////////////////////////////////////////////////////////
+
#include "AliInvmass.h"
ClassImp(AliInvmass) // Class implementation to enable ROOT I/O
/* $Id$ */
-////////////////////////////////////////////////////////////////////////////////
-// Class AliInvmass
-// Construction of invariant mass and combinatorial background.
-//
-// Example :
-// ---------
-//
-// TObjArray* photons=new TObjArray(); // Array with photon tracks for pi0 rec.
-//
-// // Code to create some photon tracks from pi0 decays
-// Int_t ntracks=200;
-// for (Int_t i=0; i<ntracks; i++)
-// {
-// photons->Add(new Alitrack);
-// ...
-// ...
-// ...
-// }
-//
-// // Perform the invariant mass and comb. bkg. reconstruction
-//
-// TObjArray* allm=q.Invmass(photons,photons); // All reconstructed invariant masses
-//
-// TH1F* hall=new TH1F("hall","hall",200,0,2); // Histo with M_inv of all combinations
-//
-// Int_t nall=0;
-// if (allm) nall=allm->GetEntries();
-//
-// AliTrack* t;
-// Float_t minv;
-// for (Int_t j=0; j<nall; j++)
-// {
-// t=(AliTrack*)allm->At(j);
-// if (t)
-// {
-// minv=t->GetMass();
-// hall->Fill(minv);
-// }
-// }
-//
-// TObjArray* bkgm=q.CombBkg(photons,photons); // Reconstructed comb. background
-//
-// TH1F* hbkg=new TH1F("hbkg","hbkg",200,0,2); // Histo with M_inv. of comb. background
-//
-// Int_t nbkg=0;
-// if (bkgm) nbkg=bkgm->GetEntries();
-//
-// for (Int_t j=0; j<nbkg; j++)
-// {
-// t=(AliTrack*)bkgm->At(j);
-// if (t)
-// {
-// minv=t->GetMass();
-// hbkg->Fill(minv);
-// }
-// }
-//
-// TH1F* hsig=new TH1F("sig","sig",200,0,2); // Histo with the bkg. subtracted signal
-// hsig->Sumw2();
-// hsig->Add(hall,hbkg,1,-1);
-//
-//
-// Note : By default the storage of the reconstructed information is performed
-// in separate TObjArrays for the signal and comb. background resp.
-// In order to limit the memory usage, AliInvmass::SetStorageMode(1) may be
-// used to activate only a single TObjArray to store the reconstructed information.
-// Consequently, the following statements
-//
-// TObjArray* allm=q.Invmass(photons,photons);
-// TObjArray* bkgm=q.CombBkg(photons,photons);
-//
-// will result in the fact that after he invokation of CombBkg
-// the information of "allm" is lost due to the fact that the storage is
-// is re-used for "bkgm" in case the "single storage" option has been selected.
-// Usage of the, in that case invalid, pointer "allm" may cause your
-// program to crash.
-//
-// * Thus : In case of single storage usage, all invokations of the returned
-// array pointer have to be completed before invoking any memberfunction
-// of the same AliInvmass object again.
-//
-//
-//
-//--- NvE 12-apr-1999 UU-SAP Utrecht
-////////////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
private:
void Combine(TObjArray* a1,TObjArray* a2); // Make two-particle combinations
- ClassDef(AliInvmass,1) // Class definition to enable ROOT I/O
+ ClassDef(AliInvmass,1) // Construction of invariant mass and combinatorial background.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliJet
+// Creation and investigation of a jet of particle tracks.
+// An AliJet can be constructed by adding AliTracks.
+//
+// Coding example to make 2 jets j1 and j2.
+// ----------------------------------------
+// j1 contains the AliTracks 1 and 2
+// j2 contains the AliTracks 3 and 4
+//
+// AliTrack t1,t2,t3,t4;
+// ...
+// ... // code to fill the AliTrack data
+// ...
+// AliJet j1(5);
+// AliJet j2(12);
+// j1.Add(t1);
+// j1.Add(t2);
+// j2.Add(t3);
+// j2.Add(t4);
+//
+// j1.Info();
+// j2.Info("sph");
+//
+// Float_t e1=j1.GetEnergy();
+// Float_t pnorm=j1->GetMomentum();
+// Ali3Vector p=j1->Get3Momentum();
+// Float_t m=j1.GetInvmass();
+// Int_t ntk=j1.GetNtracks();
+// AliTrack* tj=j1.GetTrack(1);
+//
+// Note : All quantities are in GeV, GeV/c or GeV/c**2
+//
+//--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht
+//- Modified: NvE 06-apr-1999 UU-SAP Utrecht to inherit from Ali4Vector
+///////////////////////////////////////////////////////////////////////////
+
#include "AliJet.h"
ClassImp(AliJet) // Class implementation to enable ROOT I/O
* See cxx source for full Copyright notice */
/* $Id$ */
-
-///////////////////////////////////////////////////////////////////////////
-// Class AliJet
-// Creation and investigation of a jet of particle tracks.
-// An AliJet can be constructed by adding AliTracks.
-//
-// Coding example to make 2 jets j1 and j2.
-// ----------------------------------------
-// j1 contains the AliTracks 1 and 2
-// j2 contains the AliTracks 3 and 4
-//
-// AliTrack t1,t2,t3,t4;
-// ...
-// ... // code to fill the AliTrack data
-// ...
-// AliJet j1(5);
-// AliJet j2(12);
-// j1.Add(t1);
-// j1.Add(t2);
-// j2.Add(t3);
-// j2.Add(t4);
-//
-// j1.Info();
-// j2.Info("sph");
-//
-// Float_t e1=j1.GetEnergy();
-// Float_t pnorm=j1->GetMomentum();
-// Ali3Vector p=j1->Get3Momentum();
-// Float_t m=j1.GetInvmass();
-// Int_t ntk=j1.GetNtracks();
-// AliTrack* tj=j1.GetTrack(1);
-//
-// Note : All quantities are in GeV, GeV/c or GeV/c**2
-//
-//--- NvE 10-jul-1997 UU-SAP Utrecht
-//--- Modified : NvE 06-apr-1999 UU-SAP Utrecht to inherit from Ali4Vector
-///////////////////////////////////////////////////////////////////////////
#include <iostream.h>
#include <math.h>
Int_t fNtrk; // The number of tracks in the jet
TObjArray* fTracks; // Array to hold the pointers to the tracks of the jet
- ClassDef(AliJet,1) // Class definition to enable ROOT I/O
+ ClassDef(AliJet,1) // Creation and investigation of a jet of particle tracks.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliMath
+// Various mathematical tools which may be very convenient while
+// performing physics analysis.
+//
+// Example : Probability of a Chi-squared value
+// =========
+//
+// AliMath M;
+// Float_t chi2=20; // The chi-squared value
+// Int_t ndf=12; // The number of degrees of freedom
+// Float_t p=M.Prob(chi2,ndf); // The probability that at least a Chi-squared
+// // value of chi2 will be observed, even for a
+// // correct model
+//
+//--- Author: Nick van Eijndhoven 14-nov-1998 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliMath.h"
ClassImp(AliMath) // Class implementation to enable ROOT I/O
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliMath
-// Various mathematical tools which may be very convenient while
-// performing physics analysis.
-//
-// Example : Probability of a Chi-squared value
-// =========
-//
-// AliMath M;
-// Float_t chi2=20 ; // The chi-squared value
-// Int_t ndf=12; // The number of degrees of freedom
-// Float_t p=M.Prob(chi2,ndf); // The probability that at least a Chi-squared
-// // value of chi2 will be observed, even for a
-// // correct model
-//
-//--- NvE 14-nov-1998 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
Float_t GamSer(Float_t a,Float_t x); // Compute P(a,x) via serial representation
Float_t GamCf(Float_t a,Float_t x); // Compute P(a,x) via continued fractions
- ClassDef(AliMath,1) // Class definition to enable ROOT I/O
+ ClassDef(AliMath,1) // Various mathematical tools for physics analysis.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliPosition
+// Handling of positions in various reference frames.
+//
+// This class is meant to serve as a base class for ALICE objects
+// that have a unique position in 3-dimensional space.
+//
+// Note :
+// ------
+// Positions (r), errors (e) and reference frames (f) are specified via
+//
+// SetPosition(Float_t* r,TString f)
+// SetPositionErrors(Float_t* e,TString f)
+//
+// under the following conventions :
+//
+// f="car" ==> r in Cartesian coordinates (x,y,z)
+// f="sph" ==> r in Spherical coordinates (r,theta,phi)
+// f="cyl" ==> r in Cylindrical coordinates (rho,phi,z)
+//
+// All angles are in radians.
+//
+// Example :
+// ---------
+//
+// AliPosition q;
+// Float_t pos[3]={-1,25,7};
+// Float_t err[3]={0.08,1.85,0.5};
+// q.SetPosition(pos,"car");
+// q.SetPositionErrors(pos,"car");
+// Float_t loc[3],dloc[3];
+// q.GetPosition(loc,"sph");
+// q.GetPositionErrors(dloc,"sph");
+//
+//--- Author: Nick van Eijndhoven 06-feb-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliPosition.h"
ClassImp(AliPosition) // Class implementation to enable ROOT I/O
Double_t a[3];
r.GetVector(a,"sph");
SetVector(a,"sph");
+ r.GetErrors(a,"car");
+ SetErrors(a,"car");
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPosition::SetPositionErrors(Double_t* r,TString f)
+{
+// Store position errors according to reference frame f
+ SetErrors(r,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPosition::GetPositionErrors(Double_t* r,TString f)
+{
+// Provide position errors according to reference frame f
+ GetErrors(r,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPosition::SetPositionErrors(Float_t* r,TString f)
+{
+// Store position errors according to reference frame f
+ SetErrors(r,f);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPosition::GetPositionErrors(Float_t* r,TString f)
+{
+// Provide position errors according to reference frame f
+ GetErrors(r,f);
}
///////////////////////////////////////////////////////////////////////////
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliPosition
-// Handling of positions in various reference frames.
-//
-// This class is meant to serve as a base class for ALICE objects
-// that have a unique position in 3-dimensional space.
-//
-// Note :
-// ------
-// Positions (r) and reference frames (f) are specified via
-// SetPosition(Float_t* r,TString f) under the following conventions :
-//
-// f="car" ==> r in Cartesian coordinates (x,y,z)
-// f="sph" ==> r in Spherical coordinates (r,theta,phi)
-// f="cyl" ==> r in Cylindrical coordinates (rho,phi,z)
-//
-// All angles are in radians.
-//
-// Example :
-// ---------
-//
-// AliPosition q;
-// Float_t pos[3]={-1,25,7};
-// q.SetPosition(pos,"car");
-// Float_t loc[3];
-// q.GetPosition(loc,"sph");
-//
-//--- NvE 06-feb-1999 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
class AliPosition : public Ali3Vector
{
public:
- AliPosition(); // Default constructor
- virtual ~AliPosition(); // Destructor
- virtual void SetPosition(Double_t* r,TString f); // Store position r in frame f
- virtual void GetPosition(Double_t* r,TString f); // Provide position r in frame f
- virtual void SetPosition(Float_t* r,TString f); // Store position r in frame f
- virtual void GetPosition(Float_t* r,TString f); // Provide position r in frame f
- AliPosition& GetPosition(); // Provide position
- virtual void SetPosition(Ali3Vector& r); // Store position r
+ AliPosition(); // Default constructor
+ virtual ~AliPosition(); // Destructor
+ virtual void SetPosition(Double_t* r,TString f); // Store position r in frame f
+ virtual void GetPosition(Double_t* r,TString f); // Provide position r in frame f
+ virtual void SetPosition(Float_t* r,TString f); // Store position r in frame f
+ virtual void GetPosition(Float_t* r,TString f); // Provide position r in frame f
+ AliPosition& GetPosition(); // Provide position
+ virtual void SetPosition(Ali3Vector& r); // Store position r
+
+ virtual void SetPositionErrors(Double_t* r,TString f); // Store position r in frame f
+ virtual void GetPositionErrors(Double_t* r,TString f); // Provide position r in frame f
+ virtual void SetPositionErrors(Float_t* r,TString f); // Store position r in frame f
+ virtual void GetPositionErrors(Float_t* r,TString f); // Provide position r in frame f
- ClassDef(AliPosition,1) // Class definition to enable ROOT I/O
+ ClassDef(AliPosition,1) // Handling of positions in various reference frames.
};
#endif
--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+/*
+$Log$
+*/
+
+///////////////////////////////////////////////////////////////////////////
+// Class AliPositionObj
+// Handling of positions in various reference frames.
+//
+// This class is meant to provide an AliPosition object which is derived
+// from TObject such that it can be stored in e.g. TObjArray etc...
+// and that it can be written out using the ROOT I/O machinery.
+//
+// Example :
+// =========
+//
+// Float_t a[3]={1,2,3};
+// Float_t ea[3]={0.01,0.02,0.03};
+// Float_t b[3]={4,5,6};
+// Float_t eb[3]={0.04,0.05,0.06};
+//
+// AliPosition r1,r2;
+//
+// r1.SetPosition(a,"car");
+// r1.SetPositionErrors(ea,"car");
+// r2.SetPosition(b,"car");
+// r2.SetPositionErrors(eb,"car");
+//
+// Ali3Vector sum=r1+r2;
+// Ali3Vector rel=r1-r2;
+//
+// AliPositionObj rr1(r1);
+// AliPositionObj rr2;
+// rr2.Load(r2);
+// AliPositionObj ssum(r1+r2);
+//
+// rr1.Info();
+// rr2.Info();
+// ssum.Info();
+//
+//--- Author: Nick van Eijndhoven 18-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
+#include "AliPositionObj.h"
+
+ClassImp(AliPositionObj) // Class implementation to enable ROOT I/O
+
+AliPositionObj::AliPositionObj()
+{
+// Creation of an AliPositionObj object and initialisation of parameters.
+// All attributes initialised to 0.
+}
+///////////////////////////////////////////////////////////////////////////
+AliPositionObj::AliPositionObj(Ali3Vector& q)
+{
+// Creation of an AliPositionObj object and initialisation of parameters.
+// All attributes are initialised to the values of the input Ali3Vector.
+ Load(q);
+}
+///////////////////////////////////////////////////////////////////////////
+AliPositionObj::~AliPositionObj()
+{
+// Destructor to delete dynamically allocated memory.
+}
+///////////////////////////////////////////////////////////////////////////
+void AliPositionObj::Load(Ali3Vector& q)
+{
+// Load all attributes of the input Ali3Vector into this AliPositionObj object.
+ Double_t temp=q.GetResultError();
+ Double_t a[3];
+ q.GetVector(a,"sph");
+ SetPosition(a,"sph");
+ q.GetErrors(a,"car");
+ SetPositionErrors(a,"car");
+ fDresult=temp;
+}
+///////////////////////////////////////////////////////////////////////////
--- /dev/null
+#ifndef ALIPOSITIONOBJ_H
+#define ALIPOSITIONOBJ_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+/* $Id$ */
+
+#include "TObject.h"
+
+#include "AliPosition.h"
+
+class AliPositionObj : public TObject,public AliPosition
+{
+ public:
+ AliPositionObj(); // Default constructor
+ AliPositionObj(Ali3Vector& q); // Constructor
+ ~AliPositionObj(); // Destructor
+ void Load(Ali3Vector& q); // Load all attributes of input AliPosition
+
+ ClassDef(AliPositionObj,1) // Handling of positions in various reference frames.
+};
+#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliRandom
+// Generate universal random numbers on all common machines.
+// Available distributions : Uniform, Gaussian, Poisson and
+// User defined function
+//
+// Features :
+// ----------
+// 1) Period = 2**144
+// 2) Same sequence of 24-bit real numbers on all common machines
+//
+// Reference :
+// -----------
+// G.Marsaglia and A.Zaman, FSU-SCRI-87-50, Florida State University, 1987.
+//
+// Coding example :
+// ----------------
+//
+// Float_t rndm; // Variable to hold a single random number
+// const Int_t n=1000;
+// Float_t rvec[n]; // Vector to hold n random numbers
+//
+// AliRandom r; // Create a Random object with default sequence
+//
+// rndm=r.Uniform(); // Provide a uniform random number in <0,1>
+// Float_t a=3.;
+// Float_t b=5.;
+// rndm=r.Uniform(a,b); // Provide a uniform random number in <a,b>
+// r.Uniform(rvec,n); // Provide n uniform randoms in <0,1> in rvec
+// r.Uniform(rvec,n,a,b); // Provide n uniform randoms in <a,b> in rvec
+//
+// rndm=r.Gauss(); // Provide a Gaussian random number with
+// // mean=0 and sigma=1
+// Float_t mean=25.;
+// Float_t sigma=5.;
+// rndm=r.Gauss(mean,sigma); // Provide a Gaussian random number
+// // with specified mean and sigma
+// r.Gauss(rvec,n); // n Gaussian randoms mean=0 sigma=1
+// r.Gauss(rvec,n,mean,sigma); // n Gaussian randoms with specified
+// // mean and sigma
+//
+// rndm=r.Poisson(mean); // Provide a Poisson random number with
+// // specified mean
+// r.Poisson(rvec,nmean); // n Poisson randoms with specified mean
+//
+// Int_t seed=1837724
+// AliRandom p(seed); // Create a Random object with specified seed.
+// // The sequence is started from scratch.
+// Int_t cnt1=25;
+// Int_t cnt2=8;
+// AliRandom q(seed,cnt1,cnt2); // Create a Random object with specified seed
+// // The sequence is started at the location
+// // denoted by the counters cnt1 and cnt2.
+//
+// q.Info(); // Print the current seed, cnt1 and cnt2 values.
+// q.GetSeed(); // Provide the current seed value.
+// q.GetCnt1(); // Provide the current cnt1 value.
+// q.GetCnt2(); // Provide the current cnt2 value.
+//
+// Float_t udist(Float_t x) // A user defined distribution
+// {
+// return x*x-4.*x;
+// }
+//
+// Int_t nbins=100;
+// q.SetUser(a,b,nbins,udist); // Initialise generator for udist distribution
+// q.User(); // Provide a random number according to the udist distribution
+// q.User(rvec,n); // Provide n randoms according to the udist distribution
+//
+// Float_t* x=new Float_t[nbins];
+// Float_t* y=new Float_t[nbins];
+//
+// ... code to fill x[] and y[] ..
+//
+// AliRandom s;
+// s.SetUser(x,y,nbins); // Initialise generator for (x[i],y[i]) distribution
+// s.User(); // Provide a random number according to the user distribution
+// s.User(rvec,n); // Provide n randoms according to the user distribution
+//
+// Notes :
+// -------
+// 1) Allowed seed values : 0 <= seed <= 921350143
+// Default seed = 53310452
+// 2) To ensure a unique sequence for each run, one can automatically
+// construct a seed value by e.g. using the date and time.
+// 3) Using the rvec facility saves a lot of CPU time for large n values.
+//
+//--- Author: Nick van Eijndhoven 11-oct-1997 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliRandom.h"
ClassImp(AliRandom) // Class implementation to enable ROOT I/O
AliRandom::AliRandom()
{
-// Creation of an AliRandom object and default initialisation
+// Creation of an AliRandom object and default initialisation.
//
// A seed is used to create the initial u[97] table.
// This seed is converted into four startup parameters i j k and l
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliRandom
-// Generate universal random numbers on all common machines.
-// Available distributions : Uniform, Gaussian, Poisson and
-// User defined function
-//
-// Features :
-// ----------
-// 1) Period = 2**144
-// 2) Same sequence of 24-bit real numbers on all common machines
-//
-// Reference :
-// -----------
-// G.Marsaglia and A.Zaman, FSU-SCRI-87-50, Florida State University, 1987.
-//
-// Coding example :
-// ----------------
-//
-// Float_t rndm; // Variable to hold a single random number
-// const Int_t n=1000;
-// Float_t rvec[n]; // Vector to hold n random numbers
-//
-// AliRandom r; // Create a Random object with default sequence
-//
-// rndm=r.Uniform(); // Provide a uniform random number in <0,1>
-// Float_t a=3.;
-// Float_t b=5.;
-// rndm=r.Uniform(a,b); // Provide a uniform random number in <a,b>
-// r.Uniform(rvec,n); // Provide n uniform randoms in <0,1> in rvec
-// r.Uniform(rvec,n,a,b); // Provide n uniform randoms in <a,b> in rvec
-//
-// rndm=r.Gauss(); // Provide a Gaussian random number with
-// // mean=0 and sigma=1
-// Float_t mean=25.;
-// Float_t sigma=5.;
-// rndm=r.Gauss(mean,sigma); // Provide a Gaussian random number
-// // with specified mean and sigma
-// r.Gauss(rvec,n); // n Gaussian randoms mean=0 sigma=1
-// r.Gauss(rvec,n,mean,sigma); // n Gaussian randoms with specified
-// // mean and sigma
-//
-// rndm=r.Poisson(mean); // Provide a Poisson random number with
-// // specified mean
-// r.Poisson(rvec,nmean); // n Poisson randoms with specified mean
-//
-// Int_t seed=1837724
-// AliRandom p(seed); // Create a Random object with specified seed.
-// // The sequence is started from scratch.
-// Int_t cnt1=25;
-// Int_t cnt2=8;
-// AliRandom q(seed,cnt1,cnt2); // Create a Random object with specified seed
-// // The sequence is started at the location
-// // denoted by the counters cnt1 and cnt2.
-//
-// q.Info(); // Print the current seed, cnt1 and cnt2 values.
-// q.GetSeed(); // Provide the current seed value.
-// q.GetCnt1(); // Provide the current cnt1 value.
-// q.GetCnt2(); // Provide the current cnt2 value.
-//
-// Float_t udist(Float_t x) // A user defined distribution
-// {
-// return x*x-4.*x;
-// }
-//
-// Int_t nbins=100;
-// q.SetUser(a,b,nbins,udist); // Initialise generator for udist distribution
-// q.User(); // Provide a random number according to the udist distribution
-// q.User(rvec,n); // Provide n randoms according to the udist distribution
-//
-// Float_t* x=new Float_t[nbins];
-// Float_t* y=new Float_t[nbins];
-//
-// ... code to fill x[] and y[] ..
-//
-// AliRandom s;
-// s.SetUser(x,y,nbins); // Initialise generator for (x[i],y[i]) distribution
-// s.User(); // Provide a random number according to the user distribution
-// s.User(rvec,n); // Provide n randoms according to the user distribution
-//
-// Notes :
-// -------
-// 1) Allowed seed values : 0 <= seed <= 921350143
-// Default seed = 53310452
-// 2) To ensure a unique sequence for each run, one can automatically
-// construct a seed value by e.g. using the date and time.
-// 3) Using the rvec facility saves a lot of CPU time for large n values.
-//
-//--- NvE 11-oct-1997 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
Float_t fYamin,fYamax; //! The min. and max. y values of the area function
Int_t* fIbins; //! The bin numbers of the random x candidates
- ClassDef(AliRandom,1) // Class definition to enable ROOT I/O
+ ClassDef(AliRandom,1) // Generate universal random numbers on all common machines.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliSample
+// Perform statistics on various multi-dimensional data samples
+// A data sample can be filled using the "Enter" and/or "Remove" functions,
+// whereas the "Reset" function resets the complete sample to 'empty'.
+// The info which can be extracted from a certain data sample are the
+// sum, mean, variance, sigma, covariance and correlation.
+// The "Info" function provides all statistics data for a certain sample.
+// The variables for which these stat. parameters have to be calculated
+// are indicated by the index of the variable which is passed as an
+// argument to the various member functions.
+// The index convention for a data point (x,y) is : x=1 y=2
+//
+// Example :
+// ---------
+// For an AliSample s a data point (x,y) can be entered as s.Enter(x,y) and
+// the mean_x can be obtained as s.GetMean(1) whereas the mean_y is obtained
+// via s.GetMean(2).
+// The correlation between x and y is available via s.GetCor(1,2).
+// The x-statistics are obtained via s.Info(1), y-statistics via s.Info(2),
+// and the covariance and correlation between x and y via s.Info(1,2).
+// All statistics of a sample are obtained via s.Info().
+//
+//--- Author: Nick van Eijndhoven 30-mar-1996 CERN Geneva
+///////////////////////////////////////////////////////////////////////////
+
#include "AliSample.h"
AliSample::AliSample()
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliSample
-// Perform statistics on various multi-dimensional data samples
-// A data sample can be filled using the "Enter" and/or "Remove" functions,
-// whereas the "Reset" function resets the complete sample to 'empty'.
-// The info which can be extracted from a certain data sample are the
-// sum, mean, variance, sigma, covariance and correlation.
-// The "Info" function provides all statistics data for a certain sample.
-// The variables for which these stat. parameters have to be calculated
-// are indicated by the index of the variable which is passed as an
-// argument to the various member functions.
-// The index convention for a data point (x,y) is : x=1 y=2
-//
-// Example :
-// ---------
-// For an AliSample s a data point (x,y) can be entered as s.Enter(x,y) and
-// the mean_x can be obtained as s.GetMean(1) whereas the mean_y is obtained
-// via s.GetMean(2).
-// The correlation between x and y is available via s.GetCor(1,2).
-// The x-statistics are obtained via s.Info(1), y-statistics via s.Info(2),
-// and the covariance and correlation between x and y via s.Info(1,2).
-// All statistics of a sample are obtained via s.Info().
-//
-//--- NvE 30-mar-1996 CERN Geneva
-///////////////////////////////////////////////////////////////////////////
-
#include <math.h>
#include <iostream.h>
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliSignal
+// Handling of ALICE (extrapolated) signals.
+//
+// Note :
+// ------
+// Signal positions (r) and reference frames (f) are specified via
+// SetPosition(r,f) under the following conventions :
+//
+// f="car" ==> r is Cartesian (x,y,z)
+// f="sph" ==> r is Spherical (r,theta,phi)
+// f="cyl" ==> r is Cylindrical (rho,phi,z)
+//
+// The same holds for SetPositionErrors().
+//
+// All angles are in radians.
+//
+// Example :
+// ---------
+//
+// AliSignal s;
+// Float_t pos[3]={-1,25,7};
+// Float_t err[3]={0.03,0.7,0.18};
+// Float_t signal=120.8;
+// Float_t error=1.73;
+// s.SetPosition(pos,"car");
+// s.SetPositionErrors(err,"car");
+// s.SetSignal(signal);
+// s.SetSignalError(error);
+// Float_t loc[3],dr[3],sigma;
+// s.GetPosition(loc,"sph");
+// s.GetPositionErrors(dr,"sph");
+// Float_t adc=s.GetSignal();
+// Float_t sigma=s.GetSignalError();
+//
+// AliSignal q(3); // q can store 3 signal values with their errors
+// // In the example below a signal contains the
+// // following data : timing, ADC and dE/dx
+// q.SetPosition(pos,"car");
+// q.SetPositionErrors(err,"car");
+// signal=82.5; // e.q. signal time in ns
+// error=2.01;
+// q.SetSignal(signal,1);
+// q.SetSignalError(error,1);
+// signal=268.1; // e.g. ADC value of signal
+// error=3.75;
+// q.SetSignal(signal,2);
+// q.SetSignalError(error,2);
+// signal=23.7; // e.g. corresponding dE/dx value
+// error=0.48;
+// q.SetSignal(signal,3);
+// q.SetSignalError(error,3);
+//
+//--- Author: Nick van Eijndhoven 23-jan-1999 UU-SAP Utrecht
+//- Modified: NvE 30-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliSignal.h"
ClassImp(AliSignal) // Class implementation to enable ROOT I/O
-AliSignal::AliSignal()
+AliSignal::AliSignal(Int_t n)
{
-// Creation of an AliSignal object and initialisation of parameters
- Reset();
+// Creation of an AliSignal object and initialisation of parameters.
+// A total of n (default n=1) values (with errors) can be stored.
+ fNvalues=n;
+ fSignal=0;
+ fDsignal=0;
}
///////////////////////////////////////////////////////////////////////////
AliSignal::~AliSignal()
{
// Destructor to delete dynamically allocated memory
+ if (fSignal)
+ {
+ delete fSignal;
+ fSignal=0;
+ }
+ if (fDsignal)
+ {
+ delete fDsignal;
+ fDsignal=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::Reset()
{
-// Reset all values
- Float_t r[3]={0,0,0};
+// Reset all signal and position values and errors to 0.
+// The data arrays are also created if not already existing.
+
+ if (!fSignal) fSignal=new TArrayF(fNvalues);
+ if (!fDsignal) fDsignal=new TArrayF(fNvalues);
+
+ Double_t r[3]={0,0,0};
SetPosition(r,"sph");
- fSignal=0;
+ SetErrors(r,"car");
+ for (Int_t i=0; i<fSignal->GetSize(); i++)
+ {
+ fSignal->AddAt(0,i);
+ fDsignal->AddAt(0,i);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::ResetSignals()
+{
+// Reset all signal values and errors to 0.
+// The data arrays are also created if not already existing.
+
+ if (!fSignal) fSignal=new TArrayF(fNvalues);
+ if (!fDsignal) fDsignal=new TArrayF(fNvalues);
+
+ for (Int_t i=0; i<fSignal->GetSize(); i++)
+ {
+ fSignal->AddAt(0,i);
+ fDsignal->AddAt(0,i);
+ }
}
///////////////////////////////////////////////////////////////////////////
-void AliSignal::SetSignal(Float_t sig)
+void AliSignal::ResetPosition()
{
-// Store signal value
- fSignal=sig;
+// Reset position and errors to 0.
+ Double_t r[3]={0,0,0};
+ SetPosition(r,"sph");
+ SetErrors(r,"car");
}
///////////////////////////////////////////////////////////////////////////
-Float_t AliSignal::GetSignal()
+void AliSignal::SetSignal(Double_t sig,Int_t j)
{
-// Provide signal value
- return fSignal;
+// Store j-th (default j=1) signal value.
+// Note : The first signal value is at j=1.
+
+ if (!fSignal) ResetSignals();
+
+ Int_t size=fSignal->GetSize();
+ if (j<=size)
+ {
+ fSignal->AddAt(float(sig),j-1);
+ }
+ else
+ {
+ cout << "*AliSignal::SetSignal* Index mismatch j : " << j
+ << " size : " << size << endl;
+ }
}
///////////////////////////////////////////////////////////////////////////
+void AliSignal::AddSignal(Double_t sig,Int_t j)
+{
+// Add value to j-th (default j=1) signal value.
+// Note : The first signal value is at j=1.
+
+ if (!fSignal) ResetSignals();
+
+ Int_t size=fSignal->GetSize();
+ if (j<=size)
+ {
+ Float_t sum=(fSignal->At(j-1))+sig;
+ fSignal->AddAt(sum,j-1);
+ }
+ else
+ {
+ cout << "*AliSignal::AddSignal* Index mismatch j : " << j
+ << " size : " << size << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliSignal::GetSignal(Int_t j)
+{
+// Provide j-th (default j=1) signal value.
+// Note : The first signal value is at j=1.
+ if (fSignal)
+ {
+ return fSignal->At(j-1);
+ }
+ else
+ {
+ return 0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::SetSignalError(Double_t dsig,Int_t j)
+{
+// Store error on j-th (default j=1) signal value.
+// Note : The error on the first signal value is at j=1.
+
+ if (!fDsignal) ResetSignals();
+
+ Int_t size=fDsignal->GetSize();
+ if (j<=size)
+ {
+ fDsignal->AddAt(float(dsig),j-1);
+ }
+ else
+ {
+ cout << "*AliSignal::SetSignalError* Index mismatch j : " << j
+ << " size : " << size << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Float_t AliSignal::GetSignalError(Int_t j)
+{
+// Provide error on the j-th (default j=1) signal value.
+// Note : The error on the first signal value is at j=1.
+ if (fDsignal)
+ {
+ return fDsignal->At(j-1);
+ }
+ else
+ {
+ return 0;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliSignal::Info(TString f)
+{
+// Provide signal information within the coordinate frame f
+ cout << " *AliSignal::Info* " << endl;
+ cout << " Position";
+ Ali3Vector::Info(f);
+
+ if (fSignal && fDsignal)
+ {
+ for (Int_t i=0; i<fSignal->GetSize(); i++)
+ {
+ cout << " Signal value : " << fSignal->At(i)
+ << " error : " << fDsignal->At(i) << endl;
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliSignal
-// Handling of ALICE (extrapolated) signals.
-//
-// Note :
-// ------
-// Signal positions (r) and reference frames (f) are specified via
-// SetPosition(r,f) under the following conventions :
-//
-// f="car" ==> r is Cartesian (x,y,z)
-// f="sph" ==> r is Spherical (r,theta,phi)
-// f="cyl" ==> r is Cylindrical (rho,phi,z)
-//
-// All angles are in radians.
-//
-// Example :
-// ---------
-//
-// AliSignal s;
-// Float_t pos[3]={-1,25,7};
-// Float_t signal=120.8;
-// s.SetPosition(pos,"car");
-// s.SetSignal(signal);
-// Float_t loc[3];
-// s.GetPosition(loc,"sph");
-// Float_t adc=s.GetSignal();
-//
-//--- NvE 23-jan-1999 UU-SAP Utrecht
-///////////////////////////////////////////////////////////////////////////
+#include "TObject.h"
+#include "TArrayF.h"
#include "AliPosition.h"
class AliSignal : public TObject,public AliPosition
{
public:
- AliSignal(); // Default constructor
- ~AliSignal(); // Destructor
- virtual void SetSignal(Float_t sig); // Store signal value
- virtual Float_t GetSignal(); // Provide signal value
- virtual void Reset(); // Reset all values to 0
+ AliSignal(Int_t n=1); // Default constructor
+ ~AliSignal(); // Destructor
+ virtual void SetSignal(Double_t sig,Int_t j=1); // Store j-th signal value
+ virtual void AddSignal(Double_t sig,Int_t j=1); // Add value to j-th signal value
+ virtual Float_t GetSignal(Int_t j=1); // Provide j-th signal value
+ virtual void SetSignalError(Double_t dsig,Int_t j=1); // Store error on j-th signal value
+ virtual Float_t GetSignalError(Int_t j=1); // Provide error j-th signal value
+ virtual void ResetSignals(); // Reset all signal values and errors to 0
+ virtual void ResetPosition(); // Reset position and errors to 0
+ virtual void Reset(); // Reset signal and pos. values and errors
+ void Info(TString f="car"); // Print signal info for coord. frame f
protected:
- Float_t fSignal; // Signal value
+ Int_t fNvalues; // The number of values per signal
+ TArrayF* fSignal; // Signal values
+ TArrayF* fDsignal; // Errors on signal values
- ClassDef(AliSignal,1) // Class definition to enable ROOT I/O
+ ClassDef(AliSignal,1) // Handling of ALICE (extrapolated) signals.
};
#endif
/*
$Log$
+Revision 1.2 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliTrack
+// Handling of the attributes of a reconstructed particle track.
+//
+// Coding example :
+// ----------------
+//
+// Float_t a[4]={195.,1.2,-0.04,8.5};
+// Ali4Vector pmu;
+// pmu.SetVector(a,"car");
+// AliTrack t1;
+// t1.Set4Momentum(pmu);
+//
+// Float_t b[3]={1.2,-0.04,8.5};
+// Ali3Vector p;
+// p.SetVector(b,"car");
+// AliTrack t2;
+// t2.Set3Momentum(p);
+// t2.SetCharge(0);
+// t2.SetMass(1.115);
+//
+// t1.Info();
+// t2.Info();
+//
+// Float_t pi=acos(-1.);
+// Float_t thcms=0.2*pi; // decay theta angle in cms
+// Float_t phicms=pi/4.; // decay theta angle in cms
+// Float_t m1=0.938;
+// Float_t m2=0.140;
+// t2.Decay(m1,m2,thcms,phicms); // Track t2 decay : Lambda -> proton + pion
+//
+// t2.List();
+//
+// Int_t ndec=t2.GetNdecay();
+// AliTrack* d1=t2.GetDecayTrack(1); // Access to decay track number 1
+// AliTrack* d2=t2.GetDecayTrack(2); // Access to decay track number 2
+//
+// AliSignal s1,s2,s3,s4;
+//
+// .... // Code (e.g. detector readout) to fill AliSignal data
+//
+// AliTrack trec; // Track which will be reconstructed from signals
+// trec.AddSignal(s1);
+// trec.AddSignal(s3);
+// trec.AddSignal(s4);
+//
+// Ali3Vector P;
+// Float_t Q,M;
+//
+// ... // Code which accesses signals from trec and reconstructs
+// 3-momentum P, charge Q, mass M etc...
+//
+// trec.Set3Momentum(P);
+// trec.SetCharge(Q);
+// trec.SetMass(M);
+//
+// Float_t r1[3]={1.6,-3.8,25.7};
+// Float_t er1[3]={0.2,0.5,1.8};
+// Float_t r2[3]={8.6,23.8,-6.7};
+// Float_t er2[3]={0.93,1.78,0.8};
+// AliPosition begin,end;
+// begin.SetPosition(r1,"car");
+// begin.SetPositionErrors(er1,"car");
+// end.SetPosition(r2,"car");
+// end.SetPositionErrors(er2,"car");
+// trec.SetBeginPoint(begin);
+// trec.SetEndPoint(end);
+//
+// Note : All quantities are in GeV, GeV/c or GeV/c**2
+//
+//--- Author: Nick van Eijndhoven 10-jul-1997 UU-SAP Utrecht
+//- Modified: NvE 29-oct-1999 UU-SAP Utrecht
+///////////////////////////////////////////////////////////////////////////
+
#include "AliTrack.h"
ClassImp(AliTrack) // Class implementation to enable ROOT I/O
// Default constructor
// All variables initialised to 0
fDecays=0;
+ fSignals=0;
Reset();
}
///////////////////////////////////////////////////////////////////////////
delete fDecays;
fDecays=0;
}
+ if (fSignals)
+ {
+ fSignals->Clear();
+ delete fSignals;
+ fSignals=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::Reset()
{
// Reset all variables to 0
- fM=0;
fQ=0;
fNdec=0;
+ fNsig=0;
Double_t a[4]={0,0,0,0};
SetVector(a,"sph");
if (fDecays)
delete fDecays;
fDecays=0;
}
+ if (fSignals)
+ {
+ fSignals->Clear();
+ delete fSignals;
+ fSignals=0;
+ }
+ Double_t b[3]={0,0,0};
+ fBegin.SetPosition(b,"sph");
+ fEnd.SetPosition(b,"sph");
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::Set3Momentum(Ali3Vector& p)
{
// Set the track parameters according to the 3-momentum p
- Double_t E=sqrt(p.Dot(p)+fM*fM);
- SetVector(E,p);
+ Set3Vector(p);
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::Set4Momentum(Ali4Vector& p)
{
// Set the track parameters according to the 4-momentum p
Double_t E=p.GetScalar();
+ Double_t dE=p.GetResultError();
Ali3Vector pv=p.Get3Vector();
SetVector(E,pv);
-
- Double_t m2=p.Dot(p);
- fM=0;
- if (m2 > 0.) fM=sqrt(m2);
+ SetScalarError(dE);
}
///////////////////////////////////////////////////////////////////////////
-void AliTrack::SetMass(Double_t m)
+void AliTrack::SetMass(Double_t m,Double_t dm)
{
// Set the particle mass
- fM=m;
- Ali3Vector p=Get3Vector();
- Double_t E=sqrt(p.Dot(p)+fM*fM);
- SetVector(E,p);
+// The default value for the error dm is 0.
+ Double_t inv=pow(m,2);
+ Double_t dinv=fabs(2.*m*dm);
+ SetInvariant(inv,dinv);
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::SetCharge(Float_t q)
void AliTrack::Info(TString f)
{
// Provide track information within the coordinate frame f
- cout << " *AliTrack::Info* Mass : " << fM << " Charge : " << fQ
- << " Momentum : " << GetMomentum() << " Ntracks : " << fNdec << endl;
- cout << " ";
+ Double_t m=GetMass();
+ Double_t dm=GetResultError();
+ cout << " *AliTrack::Info* Mass : " << m
+ << " error : " << dm << " Charge : " << fQ
+ << " Momentum : " << GetMomentum() << " Ntracks : " << fNdec
+ << " Nsignals : " << fNsig << endl;
Ali4Vector::Info(f);
}
///////////////////////////////////////////////////////////////////////////
if (td)
{
cout << " ---Level 1 sec. track no. " << id << endl;
- cout << " ";
td->Info(f);
}
else
// Provide complete track and decay information within the coordinate frame f
Info(f); // Information of the current track
+ cout << " Begin-point :"; fBegin.Info(f);
+ cout << " End-point :"; fEnd.Info(f);
+ for (Int_t is=1; is<=GetNsignals(); is++)
+ {
+ ((AliSignal*)GetSignal(is))->Info(f);
+ }
AliTrack* t=this;
Dump(t,1,f); // Information of all decay products
if (td)
{
cout << " ---Level " << n << " sec. track no. " << id << endl;
- cout << " ";
td->Info(f);
+ for (Int_t is=1; is<=td->GetNsignals(); is++)
+ {
+ ((AliSignal*)td->GetSignal(is))->Info(f);
+ }
// Go for next decay level of this decay track recursively
Dump(td,n+1,f);
//////////////////////////////////////////////////////////////////////////
Double_t AliTrack::GetMomentum()
{
-// Provide the value of the track 3-momentum
- Ali3Vector p=Get3Vector();
- return sqrt(p.Dot(p));
+// Provide the value of the track 3-momentum.
+// The error can be obtained by invoking GetResultError() after
+// invokation of GetMomentum().
+
+// Ali3Vector p=Get3Vector();
+// return sqrt(p.Dot(p));
+ Double_t norm=fV.GetNorm();
+ return norm;
}
///////////////////////////////////////////////////////////////////////////
Ali3Vector AliTrack::Get3Momentum()
///////////////////////////////////////////////////////////////////////////
Double_t AliTrack::GetMass()
{
-// Provide the particle mass
- return fM;
+// Provide the particle mass.
+// The error can be obtained by invoking GetResultError() after
+// invokation of GetMass().
+ Double_t inv=GetInvariant();
+ Double_t dinv=GetResultError();
+ Double_t dm=0;
+ if (inv >= 0)
+ {
+ Double_t m=sqrt(inv);
+ if (m) dm=dinv/(2.*m);
+ fDresult=dm;
+ return m;
+ }
+ else
+ {
+ cout << "*AliTrack::GetMass* Unphysical situation m**2 = " << inv << endl;
+ cout << " Value 0 will be returned." << endl;
+ fDresult=dm;
+ return 0;
+ }
}
///////////////////////////////////////////////////////////////////////////
Float_t AliTrack::GetCharge()
///////////////////////////////////////////////////////////////////////////
Double_t AliTrack::GetEnergy()
{
-// Provide the particle's energy
- return GetScalar();
+// Provide the particle's energy.
+// The error can be obtained by invoking GetResultError() after
+// invokation of GetEnergy().
+ Double_t E=GetScalar();
+ if (E>0)
+ {
+ return E;
+ }
+ else
+ {
+ cout << "*AliTrack::GetEnergy* Unphysical situation E = " << E << endl;
+ cout << " Value 0 will be returned." << endl;
+ return 0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliTrack::Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms)
// phicms : cms phi decay angle (in rad.) of m1
fNdec=2; // it's a 2-body decay
+
+ Double_t M=GetMass();
// Compute the 4-momenta of the decay products in the cms
// Note : p2=p1=pnorm for a 2-body decay
- Double_t e1=((fM*fM)+(m1*m1)-(m2*m2))/(2.*fM);
- Double_t e2=((fM*fM)+(m2*m2)-(m1*m1))/(2.*fM);
+ Double_t e1=0;
+ if (M) e1=((M*M)+(m1*m1)-(m2*m2))/(2.*M);
+ Double_t e2=0;
+ if (M) e2=((M*M)+(m2*m2)-(m1*m1))/(2.*M);
Double_t pnorm=(e1*e1)-(m1*m1);
if (pnorm>0.)
{
Ali4Vector pprim1;
pprim1.SetVector(e1,p);
+ pprim1.SetInvariant(m1*m1);
Ali4Vector pprim2;
p*=-1;
pprim2.SetVector(e2,p);
+ pprim2.SetInvariant(m2*m2);
// Determine boost parameters from the parent particle
- Double_t E=GetScalar();
+ Double_t E=GetEnergy();
p=Get3Vector();
Ali4Vector pmu;
pmu.SetVector(E,p);
fDecays->Add(new AliTrack);
((AliTrack*)fDecays->At(0))->Set4Momentum(p1);
+ ((AliTrack*)fDecays->At(0))->SetMass(m1);
fDecays->Add(new AliTrack);
((AliTrack*)fDecays->At(1))->Set4Momentum(p2);
-
-// Set the mass values to m1 and m2 to omit roundoff errors
- ((AliTrack*)fDecays->At(0))->SetMass(m1);
((AliTrack*)fDecays->At(1))->SetMass(m2);
}
///////////////////////////////////////////////////////////////////////////
}
}
///////////////////////////////////////////////////////////////////////////
+void AliTrack::AddSignal(AliSignal& s)
+{
+// Relate an AliSignal object to this track.
+ if (!fSignals) fSignals=new TObjArray();
+ fNsig++;
+ fSignals->Add(&s);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::RemoveSignal(AliSignal& s)
+{
+// Remove related AliSignal object to this track.
+ if (fSignals)
+ {
+ AliSignal* test=(AliSignal*)fSignals->Remove(&s);
+ if (test)
+ {
+ fNsig--;
+ fSignals->Compress();
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliTrack::GetNsignals()
+{
+// Provide the number of related AliSignals.
+ return fNsig;
+}
+///////////////////////////////////////////////////////////////////////////
+AliSignal* AliTrack::GetSignal(Int_t j)
+{
+// Provide the related AliSignal number j.
+// Note : j=1 denotes the first signal.
+ if ((j >= 1) && (j <= fNsig))
+ {
+ return (AliSignal*)fSignals->At(j-1);
+ }
+ else
+ {
+ cout << " *AliTrack* signal number : " << j << " out of range." << endl;
+ cout << " -- Signal number 1 (if any) returned." << endl;
+ return (AliSignal*)fDecays->At(0);
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::SetBeginPoint(AliPosition p)
+{
+// Store the position of the track begin-point.
+ fBegin=p;
+}
+///////////////////////////////////////////////////////////////////////////
+AliPosition AliTrack::GetBeginPoint()
+{
+// Provide the position of the track begin-point.
+ return fBegin;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliTrack::SetEndPoint(AliPosition p)
+{
+// Store the position of the track end-point.
+ fEnd=p;
+}
+///////////////////////////////////////////////////////////////////////////
+AliPosition AliTrack::GetEndPoint()
+{
+// Provide the position of the track end-point.
+ return fEnd;
+}
+///////////////////////////////////////////////////////////////////////////
#ifndef ALITRACK_H
#define ALITRACK_H
+
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliTrack
-// Handling of the attributes of a reconstructed particle track.
-//
-// Coding example :
-// ----------------
-//
-// Float_t a[4]={195.,1.2,-0.04,8.5};
-// Ali4Vector pmu;
-// pmu.SetVector(a,"car");
-// AliTrack t1;
-// t1.Set4Momentum(pmu);
-//
-// Float_t b[3]={1.2,-0.04,8.5};
-// Ali3Vector p;
-// p.SetVector(b,"car");
-// AliTrack t2;
-// t2.Set3Momentum(p);
-// t2.SetCharge(0);
-// t2.SetMass(1.115);
-//
-// t1.Info();
-// t2.Info();
-//
-// Float_t pi=acos(-1.);
-// Float_t thcms=0.2*pi; // decay theta angle in cms
-// Float_t phicms=pi/4.; // decay theta angle in cms
-// Float_t m1=0.938;
-// Float_t m2=0.140;
-// t2.Decay(m1,m2,thcms,phicms); // Track t2 decay : Lambda -> proton + pion
-//
-// t2.List();
-//
-// Int_t ndec=t2.GetNdecay();
-// AliTrack* d1=t2.GetDecayTrack(1); // Access to decay track number 1
-// AliTrack* d2=t2.GetDecayTrack(2); // Access to decay track number 2
-//
-// Note : All quantities are in GeV, GeV/c or GeV/c**2
-//
-//--- NvE 10-jul-1997 UU-SAP Utrecht
-//--- Modified : NvE 06-apr-1999 UU-SAP Utrecht to inherit from Ali4Vector
-///////////////////////////////////////////////////////////////////////////
-
+
#include "TObject.h"
#include "TObjArray.h"
+#include "AliSignal.h"
#include "AliBoost.h"
+#include "AliPosition.h"
class AliTrack : public TObject,public Ali4Vector
{
void Reset(); // Reset all values to 0
void Set4Momentum(Ali4Vector& p); // Set track 4-momentum
void Set3Momentum(Ali3Vector& p); // Set track 3-momentum
- void SetMass(Double_t m); // Set particle mass
+ void SetMass(Double_t m,Double_t dm=0); // Set particle mass and error
void SetCharge(Float_t q); // Set particle charge
void Info(TString f="car"); // Print track information for coord. frame f
void List(TString f="car"); // Print track and decay level 1 information for coord. frame f
void Decay(Double_t m1,Double_t m2,Double_t thcms,Double_t phicms); // Perform 2-body decay
Int_t GetNdecay(); // Provide number of decay products
AliTrack* GetDecayTrack(Int_t j); // Access to decay produced track number j
+ void AddSignal(AliSignal& s); // Relate an AliSignal to this track
+ void RemoveSignal(AliSignal& s); // Remove related AliSignal from this track
+ Int_t GetNsignals(); // Provide number of related AliSignals
+ AliSignal* GetSignal(Int_t j); // Access to the related AliSignal number j
+ void SetBeginPoint(AliPosition p);// Set the track begin-point
+ AliPosition GetBeginPoint(); // Provide the track begin-point
+ void SetEndPoint(AliPosition p); // Set the track end-point
+ AliPosition GetEndPoint(); // Provide the track end-point
protected:
- Double_t fM; // The mass of the particle
- Float_t fQ; // The charge of the particle
- Int_t fNdec; // The number of decay products
- TObjArray* fDecays; // The array of decay produced tracks for output
+ Float_t fQ; // The charge of the particle
+ Int_t fNdec; // The number of decay products
+ TObjArray* fDecays; // The array of decay produced tracks
+ Int_t fNsig; // The number of related AliSignals
+ TObjArray* fSignals; // The array of related AliSignals
+ AliPosition fBegin; // The begin-point of the track
+ AliPosition fEnd; // The end-point of the track
private:
void Dump(AliTrack* t,Int_t n,TString f); // Recursively print all decay levels
- ClassDef(AliTrack,1) // Class definition to enable ROOT I/O
+ ClassDef(AliTrack,1) // Handling of the attributes of a reconstructed particle track.
};
#endif
/*
$Log$
+Revision 1.3 1999/09/29 09:24:28 fca
+Introduction of the Copyright and cvs Log
+
*/
+///////////////////////////////////////////////////////////////////////////
+// Class AliVertex
+// Creation and investigation of an AliVertex.
+// An AliVertex can be constructed by adding AliTracks and/or AliJets.
+//
+// Note : Also (secondary) vertices can be added to a vertex.
+//
+// Coding example to make 3 vertices v1, v2 and v3.
+// ------------------------------------------------
+// v1 contains the tracks 1,2,3 and 4
+// v2 contains the tracks 5,6 and 7
+// v3 contains the jets 1 and 2
+//
+// AliTrack t1,t2,t3,t4,t5,t6,t7;
+// ...
+// ... // code to fill the track data
+// ...
+//
+// AliJet j1,j2;
+// ...
+// ... // code to fill the jet data
+// ...
+//
+// AliVertex v1(5);
+//
+// v1.Add(t1);
+// v1.Add(t2);
+// v1.Add(t3);
+// v1.Add(t4);
+//
+// Float_t r1[3]={2.4,0.1,-8.5};
+// v1.SetPosition(r1,"car");
+//
+// AliVertex v2(2);
+// v2.Add(t5);
+// v2.Add(t6);
+// v2.Add(t7);
+//
+// Float_t r2[3]={1.6,-3.2,5.7};
+// v2.SetPosition(r2,"car");
+//
+// AliVertex v3;
+//
+// v3.Add(j1);
+// v3.Add(j2);
+//
+// Float_t r3[3]={6.2,4.8,1.3};
+// v3.SetPosition(r3,"car");
+//
+// v1.Info("sph");
+// v2.ListAll();
+// v3.List("cyl");
+//
+// Float_t e1=v1.GetEnergy();
+// Ali3Vector p1=v1.Get3Momentum();
+// Float_t loc[3];
+// v1.GetPosition(loc,"sph");
+// AliPosition r=v2.GetPosition();
+// r.Info();
+// Int_t nt=v2.GetNtracks();
+// AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
+//
+// Specify the vertices v2 and v3 as secondary vertices of v1
+//
+// v1.Add(v2);
+// v1.Add(v3);
+//
+// v1.List();
+//
+// Int_t nv=v1.GetNvtx();
+// AliVertex* vx=v1.GetVertex(1); // Access 1st secondary vertex of v1
+// Float_t e=vx->GetEnergy();
+//
+// Float_t M=v1.GetInvmass();
+//
+// Reconstruct Vertex v1 from scratch
+//
+// v1.Reset();
+// v1.SetNvmax(25); // Increase initial no. of sec. vertices
+// v1.Add(t3);
+// v1.Add(t7);
+// v1.Add(j2);
+// Float_t pos[3]={7,9,4};
+// v1.SetPosition(pos,"car");
+//
+// Note : All quantities are in GeV, GeV/c or GeV/c**2
+//
+//--- Author: Nick van Eijndhoven 04-apr-1998 UU-SAP Utrecht
+//- Modified: NvE 08-apr-1999 UU-SAP Utrecht to inherit from AliJet
+///////////////////////////////////////////////////////////////////////////
+
#include "AliVertex.h"
ClassImp(AliVertex) // Class implementation to enable ROOT I/O
AliVertex::AliVertex()
{
-// Default constructor
-// All variables initialised to 0
-// Initial maximum number of tracks is set to the default value
-// Initial maximum number of sec. vertices is set to the default value
+// Default constructor.
+// All variables initialised to 0.
+// Initial maximum number of tracks is set to the default value.
+// Initial maximum number of sec. vertices is set to the default value.
fNvmax=0;
fVertices=0;
Reset();
// Update 4-momentum for current vertex
fNvtx++;
fVertices->Add(&v);
- (*(Ali4Vector*)this)+=v;
+ (Ali4Vector)(*this)+=v;
}
///////////////////////////////////////////////////////////////////////////
void AliVertex::Info(TString f)
/* $Id$ */
-///////////////////////////////////////////////////////////////////////////
-// Class AliVertex
-// Creation and investigation of an AliVertex.
-// An AliVertex can be constructed by adding AliTracks and/or AliJets.
-//
-// Note : Also (secondary) vertices can be added to a vertex.
-//
-// Coding example to make 3 vertices v1, v2 and v3.
-// ------------------------------------------------
-// v1 contains the tracks 1,2,3 and 4
-// v2 contains the tracks 5,6 and 7
-// v3 contains the jets 1 and 2
-//
-// AliTrack t1,t2,t3,t4,t5,t6,t7;
-// ...
-// ... // code to fill the track data
-// ...
-//
-// AliJet j1,j2;
-// ...
-// ... // code to fill the jet data
-// ...
-//
-// AliVertex v1(5);
-//
-// v1.Add(t1);
-// v1.Add(t2);
-// v1.Add(t3);
-// v1.Add(t4);
-//
-// Float_t r1[3]={2.4,0.1,-8.5};
-// v1.SetPosition(r1,"car");
-//
-// AliVertex v2(2);
-// v2.Add(t5);
-// v2.Add(t6);
-// v2.Add(t7);
-//
-// Float_t r2[3]={1.6,-3.2,5.7};
-// v2.SetPosition(r2,"car");
-//
-// AliVertex v3;
-//
-// v3.Add(j1);
-// v3.Add(j2);
-//
-// Float_t r3[3]={6.2,4.8,1.3};
-// v3.SetPosition(r3,"car");
-//
-// v1.Info("sph");
-// v2.ListAll();
-// v3.List("cyl");
-//
-// Float_t e1=v1.GetEnergy();
-// Ali3Vector p1=v1.Get3Momentum();
-// Float_t loc[3];
-// v1.GetPosition(loc,"sph");
-// AliPosition r=v2.GetPosition();
-// r.Info();
-// Int_t nt=v2.GetNtracks();
-// AliTrack* tv=v2.GetTrack(1); // Access track number 1 of Vertex v2
-//
-// Specify the vertices v2 and v3 as secondary vertices of v1
-//
-// v1.Add(v2);
-// v1.Add(v3);
-//
-// v1.List();
-//
-// Int_t nv=v1.GetNvtx();
-// AliVertex* vx=v1.GetVertex(1); // Access 1st secondary vertex of v1
-// Float_t e=vx->GetEnergy();
-//
-// Float_t M=v1.GetInvmass();
-//
-// Reconstruct Vertex v1 from scratch
-//
-// v1.Reset();
-// v1.SetNvmax(25); // Increase initial no. of sec. vertices
-// v1.Add(t3);
-// v1.Add(t7);
-// v1.Add(j2);
-// Float_t pos[3]={7,9,4};
-// v1.SetPosition(pos,"car");
-//
-// Note : All quantities are in GeV, GeV/c or GeV/c**2
-//
-//--- NvE 04-apr-1998 UU-SAP Utrecht
-//--- Modified : NvE 08-apr-1999 UU-SAP Utrecht to inherit from AliJet
-///////////////////////////////////////////////////////////////////////////
-
#include <iostream.h>
#include <math.h>
private:
void Dump(AliVertex* v,Int_t n,TString f); // Recursively print all sec. vertices
- ClassDef(AliVertex,1) // Class definition to enable ROOT I/O
+ ClassDef(AliVertex,1) // Creation and investigation of an AliVertex.
};
#endif
SRCS = Ali3Vector.cxx Ali4Vector.cxx AliBoost.cxx AliCalcluster.cxx \
AliCalmodule.cxx AliCalorimeter.cxx AliInvmass.cxx AliJet.cxx \
AliMath.cxx AliPosition.cxx AliRandom.cxx AliSample.cxx AliSignal.cxx \
- AliTrack.cxx AliVertex.cxx
+ AliTrack.cxx AliVertex.cxx Ali3VectorObj.cxx Ali4VectorObj.cxx \
+ AliPositionObj.cxx
# C++ Headers
-#ifdef __CINT__
////////////////////////////////////////////////////////////////////////////////
// All classes of RALICE
// This class list is used to create the RALICE dictionary via rootcint
// in the automatic installation of the ROOT loadable library.
//
-// Note : Headers have also to be entered into the list in file allhead.h
+// Note : Headers have also to be entered into the list in the file
+// RALICEHeaders.h
//
//--- NvE 12-apr-1998 UU-SAP Utrecht
////////////////////////////////////////////////////////////////////////////////
+
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* $Id$ */
+#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class AliSample;
#pragma link C++ class AliRandom;
#pragma link C++ class Ali3Vector;
+ #pragma link C++ class Ali3VectorObj;
#pragma link C++ class Ali4Vector;
+ #pragma link C++ class Ali4VectorObj;
#pragma link C++ class AliBoost;
#pragma link C++ class AliPosition;
+ #pragma link C++ class AliPositionObj;
#pragma link C++ class AliSignal;
#pragma link C++ class AliCalorimeter;
#pragma link C++ class AliCalmodule;
28-jun-1999 NvE Ali4Vector casting changed in AliVertex::Add() and some explicit type conversions
added and an unused variable removed in AliInvmass to prevent g++ errors/warnings
(thanks to Eugene van der Pijll).
+23-sep-1999 NvE Errors and error propagation introduced in Ali3Vector in view of track
+ reconstruction/extrapolation development.
+ Also AliPosition and AliSignal updated accordingly by introducing the
+ SetPositionErrors(), SetSignalErrors() and Get memberfunctions.
+ Note : Errors (propagation) not yet fully implemented in Ali4Vector and
+ AliBoost.
+24-sep-1999 NvE In Ali4Vector internally the Lorentz invariant (x^mu x_mu) is now stored
+ instead of the scalar part x^0. This will yield better precision and
+ e.g. automatically conserves the particle identity (mass) in elastic
+ collisions.
+08-oct-1999 NvE GetResultError() introduced in Ali3Vector to provide error information
+ on results obtained from operations which yield a scalar.
+ Examples are the error on the norm (GetNorm) and the dotproduct (Dot).
+13-oct-1999 NvE Errors and error propagation fully implemented in Ali4Vector.
+15-oct-1999 NvE Algorithms for error calculations optimised for accuracy in Ali3Vector
+ and Ali4Vector.
+ Also particle mass datamember removed from AliTrack, since this is now
+ automatically handled via the SetInvariant()/GetInvariant() memberfunctions
+ of Ali4Vector.
+16-oct-1999 NvE Storage of multiple signal values (with errors) implemented in AliSignal
+ and AliCalmodule updated accordingly.
+ All documentation moved from the .h files into the .cxx files and also
+ Copyright and cvs logs introduced.
+ Html documentation generated for all classes using the ROOT automatic
+ documentation generator facility.
+18-oct-1999 NvE Classes Ali3VectorObj, Ali4VectorObj and AliPositionObj introduced.
+20-oct-1999 NvE AliTrack::AddSignal() & co. added to enable relating AliSignals to a certain
+ AliTrack object in view of track reconstruction development.
+ Also memberfunction Info() added to AliSignal.
+24-oct-1999 NvE Full error propagation implemented in AliBoost and obsolete memberfunction
+ AliBoost::SetGamma() removed.
+25-oct-1999 NvE Undefined "dtheta2" fixed in Ali3Vector::GetErrors() thanks to Rene Brun.
+29-oct-1999 NvE Compress() invoked for TObjArray fModules after removal of a single module
+ in AliCalorimeter::Reset().
+ Begin- and endpoint introduced for AliTrack.
+30-oct-1999 NvE Pointer handling introduced instead of object copying in AliCalorimeter::Sortm
+ to enhance speed. Also AliCalorimeter::GetModule(row,col) introduced.
+ Array creation moved out of default constructor of AliSignal to comply with
+ ROOT I/O requirements.
+31-oct-1999 NvE AliCalmodule::GetSignal() removed; the AliSignal memberfunction is used
+ instead and AliCalorimeter::GetSignal() takes care of the dead modules.
+ AliCalcluster::Start updated accordingly.
+ New memberfunctions GetVetoLevel() and HasVetoHit() introduced
+ for AliCalcluster.
# THtml specific settings.
Root.Html.OutputDir: roothtml
-Unix.*.Root.Html.SourceDir: ../ALIROOT/:../CASTOR/:../EVGEN/:../FMD/:../ITS/:../MUON/:../PDF/:../PHOS/:../PMD/:../RICH/:../STEER/:../STRUCT/:../TGeant3/:../TOF/:../TPC/:../TRD/:../ZDC/:../CPV:../START
+Unix.*.Root.Html.SourceDir: ../ALIROOT/:../CASTOR/:../EVGEN/:../FMD/:../ITS/:../MUON/:../PDF/:../PHOS/:../PMD/:../RICH/:../STEER/:../STRUCT/:../TGeant3/:../TOF/:../TPC/:../TRD/:../ZDC/:../CPV:../START:../RALICE
#WinNT.*.Root.Html.SourceDir: ./
#Root.Html.Author: //*-- Author :
#Root.Html.Author: Fons Rademakers