* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.3.4.2 2000/03/04 23:43:57 nilsen
-Fixed up the comments/documentation.
-
-Revision 1.3.4.1 2000/01/12 19:03:32 nilsen
-This is the version of the files after the merging done in December 1999.
-See the ReadMe110100.txt file for details
-
-Revision 1.3 1999/09/29 09:24:20 fca
-Introduction of the Copyright and cvs Log
-
-*/
+/* $Id$ */
+#include <Riostream.h>
#include <TMath.h>
#include <TRandom.h>
#include <TGeometry.h>
#include <TNode.h>
#include <TTUBE.h>
+#include "TParticle.h"
#include "AliRun.h"
-#include "AliITSgeom.h"
#include "AliITS.h"
+#include "AliITSgeom.h"
#include "AliITShit.h"
+#include "AliMC.h"
ClassImp(AliITShit)
//
////////////////////////////////////////////////////////////////////////
//_____________________________________________________________________________
+AliITShit::AliITShit():AliHit(){
+ // Default Constructor
+ // Zero data member just to be safe.
+ // Intputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // A default created AliITShit class.
+
+ fStatus = 0; // Track Status
+ fLayer = 0; // Layer number
+ fLadder = 0; // Ladder number
+ fDet = 0; // Detector number
+ fPx = 0.0; // PX of particle at the point of the hit
+ fPy = 0.0; // PY of particle at the point of the hit
+ fPz = 0.0; // PZ of particle at the point of the hit
+ fDestep = 0.0; // Energy deposited in the current step
+ fTof = 0.0; // Time of flight at the point of the hit
+ fStatus0 = 0; // zero status bit by default.
+ fx0 = 0.0; // Starting point of this step
+ fy0 = 0.0; // Starting point of this step
+ fz0 = 0.0; // Starting point of this step
+ ft0 = 0.0; // Starting point of this step
+}
+AliITShit::AliITShit(Int_t shunt,Int_t track,Int_t *vol,Float_t edep,
+ Float_t tof,TLorentzVector &x,TLorentzVector &x0,
+ TLorentzVector &p) : AliHit(shunt, track){
+////////////////////////////////////////////////////////////////////////
+// Create ITS hit
+// The creator of the AliITShit class. The variables shunt and
+// track are passed to the creator of the AliHit class. See the AliHit
+// class for a full description. In the units of the Monte Carlo
+////////////////////////////////////////////////////////////////////////
+ // Intputs:
+ // Int_t shunt See AliHit
+ // Int_t track Track number, see AliHit
+ // Int_t *vol Array of integer hit data,
+ // vol[0] Layer where the hit is, 1-6 typicaly
+ // vol[1] Ladder where the hit is.
+ // vol[2] Detector number where the hit is
+ // vol[3] Set of status bits
+ // vol[4] Set of status bits at start
+ // Outputs:
+ // none.
+ // Return:
+ // A default created AliITShit class.
+
+ fLayer = vol[0]; // Layer number
+ fLadder = vol[2]; // Ladder number
+ fDet = vol[1]; // Detector number
+ fStatus = vol[3]; // Track status flags
+ fStatus0 = vol[4]; // Track status flag for start position.
+ fX = x.X(); // Track X global position
+ fY = x.Y(); // Track Y global position
+ fZ = x.Z(); // Track Z global position
+ fPx = p.Px(); // Track X Momentum
+ fPy = p.Py(); // Track Y Momentum
+ fPz = p.Pz(); // Track Z Momentum
+ fDestep = edep; // Track dE/dx for this step
+ fTof = tof ; // Track Time of Flight for this step
+ fx0 = x0.X(); // Track X global position
+ fy0 = x0.Y(); // Track Y global position
+ fz0 = x0.Z(); // Track Z global position
+ ft0 = x0.T(); // Starting point of this step
+}
+//______________________________________________________________________
AliITShit::AliITShit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
AliHit(shunt, track){
////////////////////////////////////////////////////////////////////////
// fZ = hits[2], fPx = hits[3], fPy = hits[4], fPz = hits[5],
// fDestep = hits[6], and fTof = hits[7]. In the units of the Monte Carlo
////////////////////////////////////////////////////////////////////////
+ // Intputs:
+ // Int_t shunt See AliHit
+ // Int_t track Track number, see AliHit
+ // Int_t *vol Array of integer hit data,
+ // vol[0] Layer where the hit is, 1-6 typicaly
+ // vol[1] Ladder where the hit is.
+ // vol[2] Detector number where the hit is
+ // vol[3] Set of status bits
+ // Float_t *hits Array of hit information
+ // hits[0] X global position of this hit
+ // hits[1] Y global position of this hit
+ // hits[2] Z global position of this hit
+ // hits[3] Px global position of this hit
+ // hits[4] Py global position of this hit
+ // hits[5] Pz global position of this hit
+ // hits[6] Energy deposited by this step
+ // hits[7] Time of flight of this particle at this step
+ // Outputs:
+ // none.
+ // Return:
+ // A standard created AliITShit class.
fLayer = vol[0]; // Layer number
fLadder = vol[2]; // Ladder number
fDet = vol[1]; // Detector number
fStatus = vol[3]; // Track status flags
- fX = hits[0]; // Track X position
- fY = hits[1]; // Track Y position
- fZ = hits[2]; // Track Z position
+ fX = hits[0]; // Track X global position
+ fY = hits[1]; // Track Y global position
+ fZ = hits[2]; // Track Z global position
fPx = hits[3]; // Track X Momentum
fPy = hits[4]; // Track Y Momentum
fPz = hits[5]; // Track Z Momentum
fDestep = hits[6]; // Track dE/dx for this step
fTof = hits[7]; // Track Time of Flight for this step
+ fStatus0 = 0;// Track Status of Starting point
+ fx0 = 0.0; // Starting point of this step
+ fy0 = 0.0; // Starting point of this step
+ fz0 = 0.0; // Starting point of this step
+ ft0 = 0.0; // Starting point of this step
}
//______________________________________________________________________
void AliITShit::GetPositionL(Float_t &x,Float_t &y,Float_t &z){
g[0] = fX;
g[1] = fY;
g[2] = fZ;
- gm->GtoL(fLayer,fLadder,fDet,g,l);
- x = l[0];
- y = l[1];
- z = l[2];
+ if(gm) {
+ gm->GtoL(fLayer,fLadder,fDet,g,l);
+ x = l[0];
+ y = l[1];
+ z = l[2];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ // AliITSv7 - SDD case
+ x=fX;
+ y=fY;
+ z=fZ;
+ }
return;
}
//______________________________________________________________________
g[0] = fX;
g[1] = fY;
g[2] = fZ;
- gm->GtoL(fLayer,fLadder,fDet,g,l);
- x = l[0];
- y = l[1];
- z = l[2];
+ if(gm) {
+ gm->GtoL(fLayer,fLadder,fDet,g,l);
+ x = l[0];
+ y = l[1];
+ z = l[2];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ // AliITSv7 - SDD case
+ x=fX;
+ y=fY;
+ z=fZ;
+ }
tof = fTof;
return;
}
//______________________________________________________________________
+void AliITShit::GetPositionL0(Double_t &x,Double_t &y,Double_t &z,
+ Double_t &tof){
+////////////////////////////////////////////////////////////////////////
+// Returns the initial position and time of flight of this hit in the local
+// coordinates of this module, and in the units of the Monte Carlo.
+////////////////////////////////////////////////////////////////////////
+ AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
+ Float_t g[3],l[3];
+
+ g[0] = fx0;
+ g[1] = fy0;
+ g[2] = fz0;
+ if(gm) {
+ gm->GtoL(fLayer,fLadder,fDet,g,l);
+ x = l[0];
+ y = l[1];
+ z = l[2];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ // AliITSv7 - SDD case
+ x=fx0;
+ y=fy0;
+ z=fz0;
+ }
+ tof = ft0;
+ return;
+}
+//______________________________________________________________________
Float_t AliITShit::GetXL(){
////////////////////////////////////////////////////////////////////////
// Returns the x position of this hit in the local coordinates of this
g[0] = fX;
g[1] = fY;
g[2] = fZ;
- gm->GtoL(fLayer,fLadder,fDet,g,l);
- return l[0];
+ if(gm) {
+ gm->GtoL(fLayer,fLadder,fDet,g,l);
+ return l[0];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return fX;
+ }
}
//______________________________________________________________________
Float_t AliITShit::GetYL(){
g[0] = fX;
g[1] = fY;
g[2] = fZ;
- gm->GtoL(fLayer,fLadder,fDet,g,l);
- return l[1];
+ if (gm) {
+ gm->GtoL(fLayer,fLadder,fDet,g,l);
+ return l[1];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return fZ;
+ }
}
//______________________________________________________________________
Float_t AliITShit::GetZL(){
g[0] = fX;
g[1] = fY;
g[2] = fZ;
- gm->GtoL(fLayer,fLadder,fDet,g,l);
- return l[2];
+ if(gm) {
+ gm->GtoL(fLayer,fLadder,fDet,g,l);
+ return l[2];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return fY;
+ }
}
//______________________________________________________________________
void AliITShit::GetMomentumL(Float_t &px,Float_t &py,Float_t &pz){
g[0] = fPx;
g[1] = fPy;
g[2] = fPz;
- gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
- px = l[0];
- py = l[1];
- pz = l[2];
+ if (gm) {
+ gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+ px = l[0];
+ py = l[1];
+ pz = l[2];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ px=fPx;
+ py=fPy;
+ pz=fPz;
+ }
return;
}
//______________________________________________________________________
g[0] = fPx;
g[1] = fPy;
g[2] = fPz;
- gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
- return l[0];
+ if (gm) {
+ gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+ return l[0];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return fPx;
+ }
}
//______________________________________________________________________
Float_t AliITShit::GetPYL(){
g[0] = fPx;
g[1] = fPy;
g[2] = fPz;
- gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
- return l[1];
+ if (gm) {
+ gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+ return l[1];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return fPy;
+ }
+
}
//______________________________________________________________________
Float_t AliITShit::GetPZL(){
g[0] = fPx;
g[1] = fPy;
g[2] = fPz;
- gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
- return l[2];
+ if (gm) {
+ gm->GtoLMomentum(fLayer,fLadder,fDet,g,l);
+ return l[2];
+ } else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return fPz;
+ }
+
}
//___________________________________________________________________________;
Int_t AliITShit::GetModule(){
////////////////////////////////////////////////////////////////////////
AliITSgeom *gm = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
- return gm->GetModuleIndex(fLayer,fLadder,fDet);
+ if (gm) return gm->GetModuleIndex(fLayer,fLadder,fDet);
+ else {
+ Error("AliITShit","NULL pointer to the geometry! return smth else",gm);
+ return 0;
+ }
}
//______________________________________________________________________
TParticle * AliITShit::GetParticle(){
// this hit. From the TParticle all kinds of information about this
// particle can be found. See the TParticle class.
////////////////////////////////////////////////////////////////////////
- TClonesArray *Parts = gAlice->Particles();
- return ((TParticle*)Parts->UncheckedAt(this->GetTrack()));
+ return gAlice->GetMCApp()->Particle(GetTrack());
+}
+//----------------------------------------------------------------------
+void AliITShit::Print(ostream *os){
+////////////////////////////////////////////////////////////////////////
+// Standard output format for this class.
+////////////////////////////////////////////////////////////////////////
+#if defined __GNUC__
+#if __GNUC__ > 2
+ ios::fmtflags fmt;
+#else
+ Int_t fmt;
+#endif
+#else
+#if defined __ICC || defined __ECC || defined _xlc_
+ ios::fmtflags fmt;
+#else
+ Int_t fmt;
+#endif
+#endif
+
+ fmt = os->setf(ios::scientific); // set scientific floating point output
+ *os << fTrack << " " << fX << " " << fY << " " << fZ << " ";
+ fmt = os->setf(ios::hex); // set hex for fStatus only.
+ *os << fStatus << " ";
+ fmt = os->setf(ios::dec); // every thing else decimel.
+ *os << fLayer << " " << fLadder << " " << fDet << " ";;
+ *os << fPx << " " << fPy << " " << fPz << " ";
+ *os << fDestep << " " << fTof;
+ *os << " " << fx0 << " " << fy0 << " " << fz0;
+// *os << " " << endl;
+ os->flags(fmt); // reset back to old formating.
+ return;
+}
+//----------------------------------------------------------------------
+void AliITShit::Read(istream *is){
+////////////////////////////////////////////////////////////////////////
+// Standard input format for this class.
+////////////////////////////////////////////////////////////////////////
+
+
+ *is >> fTrack >> fX >> fY >> fZ;
+ *is >> fStatus >> fLayer >> fLadder >> fDet >> fPx >> fPy >> fPz >>
+ fDestep >> fTof;
+ *is >> fx0 >> fy0 >> fz0;
+ return;
+}
+//----------------------------------------------------------------------
+ostream &operator<<(ostream &os,AliITShit &p){
+////////////////////////////////////////////////////////////////////////
+// Standard output streaming function.
+////////////////////////////////////////////////////////////////////////
+
+ p.Print(&os);
+ return os;
}
-//___________________________________________________________________________
-void AliITShit::Streamer(TBuffer &R__b){
-////////////////////////////////////////////////////////////////////////
-// The streamer function for this AliITShit class. This has been set
-// up so that future changes to this class can be easly incorporated.
-////////////////////////////////////////////////////////////////////////
- if (R__b.IsReading()) {
- Version_t R__v = R__b.ReadVersion();
- if (R__v==1) {
- AliHit::Streamer(R__b);
- R__b >> fStatus;
- R__b >> fLayer;
- R__b >> fLadder;
- R__b >> fDet;
- R__b >> fPx;
- R__b >> fPy;
- R__b >> fPz;
- R__b >> fDestep;
- R__b >> fTof;
- }else{ // for futrue changes to this class.
- } // end if R__v==1
- } else {
- R__b.WriteVersion(AliITShit::IsA());
- AliHit::Streamer(R__b);
- R__b << fStatus;
- R__b << fLayer;
- R__b << fLadder;
- R__b << fDet;
- R__b << fPx;
- R__b << fPy;
- R__b << fPz;
- R__b << fDestep;
- R__b << fTof;
- } // end if R__b.IsReading()
+//----------------------------------------------------------------------
+istream &operator>>(istream &is,AliITShit &r){
+////////////////////////////////////////////////////////////////////////
+// Standard input streaming function.
+////////////////////////////////////////////////////////////////////////
+
+ r.Read(&is);
+ return is;
}
+//----------------------------------------------------------------------