]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDv1.cxx
Add public ~AliTRDcalibDB and delete fCalibration in the ~AliTRDtransform to avoid...
[u/mrichter/AliRoot.git] / TRD / AliTRDv1.cxx
index 9d16f949b1c2d39c21894f341992c433b2a8c73a..91b34dcd75d6d90c27d08993b0dab6a9e818c405 100644 (file)
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
-#include <stdlib.h> 
-
 #include <TLorentzVector.h>
 #include <TMath.h>
 #include <TRandom.h>
-#include <TVector.h>
 #include <TVirtualMC.h>
 #include <TGeoManager.h>
 #include <TGeoMatrix.h>
 #include <TGeoPhysicalNode.h>
 
-#include "AliConst.h"
-#include "AliLog.h"
 #include "AliTrackReference.h"
 #include "AliMC.h"
 #include "AliRun.h"
@@ -41,7 +36,6 @@
 
 #include "AliTRDgeometry.h"
 #include "AliTRDCommonParam.h"
-#include "AliTRDhit.h"
 #include "AliTRDsimTR.h"
 #include "AliTRDv1.h"
 
@@ -50,7 +44,7 @@ ClassImp(AliTRDv1)
 //_____________________________________________________________________________
 AliTRDv1::AliTRDv1()
   :AliTRD()
-  ,fTRon(kFALSE)
+  ,fTRon(kTRUE)
   ,fTR(NULL)
   ,fStepSize(0)
   ,fWion(0)
@@ -272,7 +266,7 @@ void AliTRDv1::CreateTRhit(Int_t det)
   Int_t   nTR;
 
   // Create TR photons
-  gMC->TrackMomentum(mom);
+  TVirtualMC::GetMC()->TrackMomentum(mom);
   Float_t pTot = mom.Rho();
   fTR->CreatePhotons(11,pTot,nTR,eTR);
   if (nTR > kNTR) {
@@ -329,7 +323,7 @@ void AliTRDv1::CreateTRhit(Int_t det)
 
     // The position of the absorbtion
     Float_t posHit[3];
-    gMC->TrackPosition(pos);
+    TVirtualMC::GetMC()->TrackPosition(pos);
     posHit[0] = pos[0] + mom[0] / pTot * absLength;
     posHit[1] = pos[1] + mom[1] / pTot * absLength;
     posHit[2] = pos[2] + mom[2] / pTot * absLength;
@@ -343,7 +337,7 @@ void AliTRDv1::CreateTRhit(Int_t det)
           ,det
           ,posHit
           ,-q
-          ,gMC->TrackTime()*1.0e06
+          ,TVirtualMC::GetMC()->TrackTime()*1.0e06
           ,kTRUE);
 
   }
@@ -421,16 +415,16 @@ void AliTRDv1::StepManager()
 
   // Set the maximum step size to a very large number for all 
   // neutral particles and those outside the driftvolume
-  gMC->SetMaxStep(kBig); 
+  if (!fPrimaryIonisation) TVirtualMC::GetMC()->SetMaxStep(kBig); 
 
   // If not charged track or already stopped or disappeared, just return.
-  if ((!gMC->TrackCharge()) || 
-        gMC->IsTrackDisappeared()) {
+  if ((!TVirtualMC::GetMC()->TrackCharge()) || 
+        TVirtualMC::GetMC()->IsTrackDisappeared()) {
     return;
   }
 
   // Inside a sensitive volume?
-  cIdCurrent = gMC->CurrentVolName();
+  cIdCurrent = TVirtualMC::GetMC()->CurrentVolName();
 
   if (cIdSensDr == cIdCurrent[1]) {
     drRegion = kTRUE;
@@ -445,7 +439,7 @@ void AliTRDv1::StepManager()
   }
 
   // The hit coordinates and charge
-  gMC->TrackPosition(pos);
+  TVirtualMC::GetMC()->TrackPosition(pos);
   hits[0] = pos[0];
   hits[1] = pos[1];
   hits[2] = pos[2];
@@ -471,28 +465,29 @@ void AliTRDv1::StepManager()
 
   // Special hits only in the drift region
   if      ((drRegion) &&
-           (gMC->IsTrackEntering())) {
+           (TVirtualMC::GetMC()->IsTrackEntering())) {
 
     // Create a track reference at the entrance of each
     // chamber that contains the momentum components of the particle
-    gMC->TrackMomentum(mom);
+    TVirtualMC::GetMC()->TrackMomentum(mom);
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTRD);
     trkStat = 1;
 
     // Create the hits from TR photons if electron/positron is
     // entering the drift volume
-    if ((fTR) && 
-        (TMath::Abs(gMC->TrackPid()) == kPdgElectron)) {
+    if ((fTR)   &&
+        (fTRon) &&
+        (TMath::Abs(TVirtualMC::GetMC()->TrackPid()) == kPdgElectron)) {
       CreateTRhit(det);
     }
 
   }
   else if ((amRegion) && 
-           (gMC->IsTrackExiting())) {
+           (TVirtualMC::GetMC()->IsTrackExiting())) {
 
     // Create a track reference at the exit of each
     // chamber that contains the momentum components of the particle
-    gMC->TrackMomentum(mom);
+    TVirtualMC::GetMC()->TrackMomentum(mom);
     AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kTRD);
     trkStat = 2;
 
@@ -500,7 +495,7 @@ void AliTRDv1::StepManager()
   
   // Calculate the charge according to GEANT Edep
   // Create a new dEdx hit
-  eDep = TMath::Max(gMC->Edep(),0.0) * 1.0e+09;
+  eDep = TMath::Max(TVirtualMC::GetMC()->Edep(),0.0) * 1.0e+09;
   qTot = (Int_t) (eDep / fWion);
   if ((qTot) ||
       (trkStat)) {
@@ -508,15 +503,15 @@ void AliTRDv1::StepManager()
           ,det
           ,hits
           ,qTot
-          ,gMC->TrackTime()*1.0e06
+          ,TVirtualMC::GetMC()->TrackTime()*1.0e06
           ,drRegion);
   }
 
   // Set Maximum Step Size
   // Produce only one hit if Ekin is below cutoff
-  if ((gMC->Etot() - gMC->TrackMass()) < kEkinMinStep) {
+  if ((TVirtualMC::GetMC()->Etot() - TVirtualMC::GetMC()->TrackMass()) < kEkinMinStep) {
     return;
   }
-  gMC->SetMaxStep(fStepSize);
+  if (!fPrimaryIonisation) TVirtualMC::GetMC()->SetMaxStep(fStepSize);
 
 }