]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDsimpleMC.cxx
Replacing array of objects by array of pointers
[u/mrichter/AliRoot.git] / TRD / AliTRDsimpleMC.cxx
index 36e01a1c6e064338f6a64ad5fd32d592dcc35eb2..8a2fe1e8c33f47dd1729e22c5ae1ecd2ef8db5f9 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
  
-/*
-$Log$                                                          
-*/
+/* $Id$ */
+
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
 //  Simple TRD Monte Carlo class                                             //
@@ -28,15 +26,17 @@ $Log$
 #include <TLorentzVector.h>
  
 #include "AliRun.h"
-
-#include "AliTRDsimpleMC.h"
 #include "AliTRDgeometry.h"
+#include "AliTRDparameter.h"
+#include "AliTRDsimpleMC.h"
 #include "AliTRDv1.h"
+#include "AliTRDparameter.h"
+#include "AliMC.h"
  
 ClassImp(AliTRDsimpleMC)
  
 //_____________________________________________________________________________
-AliTRDsimpleMC::AliTRDsimpleMC():AliMC()
+AliTRDsimpleMC::AliTRDsimpleMC()
 {                       
   //
   // AliTRDsimpleMC default constructor
@@ -60,12 +60,13 @@ AliTRDsimpleMC::AliTRDsimpleMC():AliMC()
   fTrackEntering = kFALSE;   
 
   fTRD           = NULL;
+  fPar           = NULL;
                                         
 }                                                                               
 
 //_____________________________________________________________________________
 AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title)
-               :AliMC(name,title)
+               :TVirtualMC(name,title,kFALSE)
 {                       
   //
   // AliTRDsimpleMC default constructor
@@ -89,11 +90,12 @@ AliTRDsimpleMC::AliTRDsimpleMC(const char *name, const char *title)
   fTrackEntering = kFALSE;   
 
   fTRD           = NULL;
+  fPar           = NULL;
                                         
 }                                                                               
  
 //_____________________________________________________________________________
-AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m)
+AliTRDsimpleMC::AliTRDsimpleMC(const AliTRDsimpleMC &m):TVirtualMC(m)
 {
   //
   // AliTRDsimpleMC copy constructor
@@ -125,7 +127,7 @@ AliTRDsimpleMC &AliTRDsimpleMC::operator=(const AliTRDsimpleMC &m)
 }
  
 //_____________________________________________________________________________
-void AliTRDsimpleMC::Copy(TObject &m)
+void AliTRDsimpleMC::Copy(TObject &m) const
 {
   //
   // Copy function
@@ -158,10 +160,13 @@ void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg
   // Starts a new track.
   // 
 
+  if (!fPar) {
+    fPar = new AliTRDparameter("TRDparameter","Standard TRD parameter");
+  }
+
   if (!fTRD) {
     fTRD = (AliTRDv1 *) gAlice->GetDetector("TRD");   
-    AliTRDgeometry *geometry = fTRD->GetGeometry();
-    fX0 = geometry->GetTime0(0) - AliTRDgeometry::DrThick(); 
+    fX0  = fPar->GetTime0(0) - AliTRDgeometry::DrThick(); 
   }
 
   fTRD->ResetHits();
@@ -198,7 +203,7 @@ void AliTRDsimpleMC::NewTrack(Int_t iTrack, Int_t pdg
   fTrackY    = 0.0;
   fTrackZ    = 0.0;
 
-  gAlice->SetCurrentTrack(-1);
+  gAlice->GetMCApp()->SetCurrentTrack(0);
 
 }
                                                                                 
@@ -244,6 +249,19 @@ void AliTRDsimpleMC::TrackPosition(TLorentzVector& position) const
 
 }
 
+//_____________________________________________________________________________
+void AliTRDsimpleMC::TrackPosition(Double_t &x, Double_t &y, Double_t &z) const
+{
+  //
+  // Track Position
+  //
+
+  x = fTrackX;
+  y = fTrackY;
+  z = fTrackZ;
+
+}
+
 //_____________________________________________________________________________
 void AliTRDsimpleMC::TrackMomentum(TLorentzVector& momentum) const
 {
@@ -258,6 +276,21 @@ void AliTRDsimpleMC::TrackMomentum(TLorentzVector& momentum) const
 
 }
 
+//_____________________________________________________________________________
+void AliTRDsimpleMC::TrackMomentum(Double_t &px, Double_t &py,
+                                  Double_t &pz, Double_t &et) const
+{
+  //
+  // Track Momentum
+  //
+
+  px = fTrackPx;
+  py = fTrackPy;
+  pz = fTrackPz;
+  et = fTrackEtot;
+
+}
+
 //_____________________________________________________________________________
 Int_t AliTRDsimpleMC::VolId(const Text_t* volName) const
 {
@@ -270,13 +303,13 @@ Int_t AliTRDsimpleMC::VolId(const Text_t* volName) const
  
   Int_t volId = -1;
 
-  if      (strcmp(volName,"UL05") == 0) {
+  if      (strcmp(volName,"UJ00") == 0) {
     volId = kVolDrRg;
   }
-  else if (strcmp(volName,"UL06") == 0) {
+  else if (strcmp(volName,"UK00") == 0) {
     volId = kVolAmRg;
   }
-  else if (strcmp(volName,"UCII") == 0) {
+  else if (strcmp(volName,"UC00") == 0) {
     volId = kVolDrCh;
   }
 
@@ -309,7 +342,29 @@ Int_t AliTRDsimpleMC::CurrentVolID(Int_t& copyNo) const
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDsimpleMC::CurrentVolOffID(Int_t off, Int_t &copyNo) const
+const char *AliTRDsimpleMC::CurrentVolName() const
+{
+  //
+  // Check for the current volume
+  //
+
+  const char *volName = "UA00";
+
+  // Drift region
+  if      ((fTrackX-fX0) <  AliTRDgeometry::DrThick()) {
+    volName = "UJ00";
+  }
+  else if ((fTrackX-fX0) < (AliTRDgeometry::DrThick() +
+                            AliTRDgeometry::AmThick())) {
+    volName = "UK00";
+  }
+
+  return volName;
+
+}
+
+//_____________________________________________________________________________
+Int_t AliTRDsimpleMC::CurrentVolOffID(Int_t , Int_t &copyNo) const
 {
   //
   // Check for the current volume