]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TGeant4/TG4TrackingAction.cxx
Enable creation of fast rec points for ITS, when input argument for ITS = 2.
[u/mrichter/AliRoot.git] / TGeant4 / TG4TrackingAction.cxx
index 64cf69622093596013bf08cf56dc162ccb808b70..b88ebaa667c063ab6c61521e3db9491548273bb7 100644 (file)
@@ -1,28 +1,37 @@
 // $Id$
 // Category: event
 //
+// Author: I.Hrivnacova
+//
+// Class TG4TrackingAction
+// -----------------------
 // See the class description in the header file.
 
 #include "TG4TrackingAction.h"
 #include "TG4StepManager.h"
 #include "TG4VSensitiveDetector.h"
+#include "TG4SDServices.h"
 #include "TG4Globals.h"
 
+//_____________________________________________________________________________
 TG4TrackingAction::TG4TrackingAction() {
 //
 }
 
+//_____________________________________________________________________________
 TG4TrackingAction::TG4TrackingAction(const TG4TrackingAction& right) {
 //
   TG4Globals::Exception("TG4TrackingAction is protected from copying.");
 }
 
+//_____________________________________________________________________________
 TG4TrackingAction::~TG4TrackingAction() {
 //
 }
 
 // operators
 
+//_____________________________________________________________________________
 TG4TrackingAction& 
 TG4TrackingAction::operator=(const TG4TrackingAction &right)
 {
@@ -36,11 +45,16 @@ TG4TrackingAction::operator=(const TG4TrackingAction &right)
 
 // public methods
 
+//_____________________________________________________________________________
 void TG4TrackingAction::PreUserTrackingAction(const G4Track* track)
 {
 // Called by G4 kernel before starting tracking.
 // ---
 
+  // set step manager status
+  TG4StepManager* stepManager = TG4StepManager::Instance();
+  stepManager->SetStep((G4Track*)track, kVertex);
+  
   // call pre-tracking action of derived class
   PreTrackingAction(track);
 
@@ -48,9 +62,6 @@ void TG4TrackingAction::PreUserTrackingAction(const G4Track* track)
   // (this ensures compatibility with G3 that
   // makes first step of zero length)
    
-  TG4StepManager* stepManager = TG4StepManager::Instance();
-  stepManager->SetStep((G4Track*)track, kVertex);
-  
   G4VPhysicalVolume* pv = stepManager->GetCurrentPhysicalVolume();
   
   if (!pv) {
@@ -59,21 +70,22 @@ void TG4TrackingAction::PreUserTrackingAction(const G4Track* track)
     TG4Globals::Exception(text);
   }  
   
-  G4VSensitiveDetector* sd
-    = pv->GetLogicalVolume()->GetSensitiveDetector();
-
-  if (sd) {
-    TG4VSensitiveDetector* tsd = dynamic_cast<TG4VSensitiveDetector*>(sd);
-    if (tsd) 
-      tsd->UserProcessHits((G4Track*)track, 0);
-    else {
-      G4String text = "TG4TrackingAction::PreUserTrackingAction: \n";
-      text = text + "   Unknown sensitive detector type"; 
-      TG4Globals::Exception(text);
-    }          
-  } 
+#ifdef TGEANT4_DEBUG
+  TG4VSensitiveDetector* tsd
+    = TG4SDServices::Instance()
+         ->GetSensitiveDetector(
+             pv->GetLogicalVolume()->GetSensitiveDetector());
+
+  if (tsd) tsd->UserProcessHits((G4Track*)track, 0);
+#else
+  TG4VSensitiveDetector* tsd
+    = (TG4VSensitiveDetector*) pv->GetLogicalVolume()->GetSensitiveDetector();
+
+  if (tsd) tsd->UserProcessHits((G4Track*)track, 0);
+#endif  
 }
 
+//_____________________________________________________________________________
 void TG4TrackingAction::PostUserTrackingAction(const G4Track* track)
 {
 // Called by G4 kernel after finishing tracking.