Print

Print


Commit in lcdd on MAIN
include/G4TrackerCombineSD.hh+2-11.3 -> 1.4
src/G4TrackerCombineSD.cc+30-401.10 -> 1.11
+32-41
2 modified files
JM: Fix for https://jira.slac.stanford.edu/browse/SLIC-175 and more debug prints.

lcdd/include
G4TrackerCombineSD.hh 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- G4TrackerCombineSD.hh	5 Sep 2006 23:25:20 -0000	1.3
+++ G4TrackerCombineSD.hh	13 Dec 2006 21:23:07 -0000	1.4
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/include/G4TrackerCombineSD.hh,v 1.3 2006/09/05 23:25:20 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/include/G4TrackerCombineSD.hh,v 1.4 2006/12/13 21:23:07 jeremy Exp $
 #ifndef G4TRACKERCOMBINESD_HH
 #define G4TRACKERCOMBINESD_HH 1
 
@@ -43,6 +43,7 @@
   G4double m_edepTotal;
   G4double m_minTime; 
   bool m_startedHit;
+  G4Track* m_currentTrack;
 };
 
 #endif

lcdd/src
G4TrackerCombineSD.cc 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- G4TrackerCombineSD.cc	5 Dec 2006 23:29:50 -0000	1.10
+++ G4TrackerCombineSD.cc	13 Dec 2006 21:23:07 -0000	1.11
@@ -1,4 +1,4 @@
-// $Header: /cvs/lcd/lcdd/src/G4TrackerCombineSD.cc,v 1.10 2006/12/05 23:29:50 jeremy Exp $
+// $Header: /cvs/lcd/lcdd/src/G4TrackerCombineSD.cc,v 1.11 2006/12/13 21:23:07 jeremy Exp $
 #include "G4TrackerCombineSD.hh"
 
 // LCDD
@@ -14,7 +14,8 @@
     m_currentPV(0),
     m_edepTotal(0),
     m_minTime(0),
-    m_startedHit(false)
+    m_startedHit(false),
+    m_currentTrack(false)
 {}
 
 G4TrackerCombineSD::~G4TrackerCombineSD()
@@ -34,6 +35,9 @@
 #ifdef G4VERBOSE
   if (getVerbose() > 0) {
     G4cout << "G4TrackerCombineSD::ProcessHits - " << GetName() << G4endl;
+    G4cout << "trackID - " << trackID() << G4endl;
+    G4cout << "particle - " << track()->GetDefinition()->GetParticleName() << G4endl;
+    G4cout << "edep - " << step()->GetTotalEnergyDeposit() << G4endl;
     G4cout << "pre-physvol=" << aStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() << G4endl;
     G4cout << "post-physvol=" << aStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetName() << G4endl;
     if ( prePV() != postPV() ) {
@@ -42,22 +46,20 @@
   }
 #endif
 
-  // edep
-  G4double e = edep();
-
+  // Return value indicating whether a hit was inserted.
   bool r = false;
 
-  // started a hit?
+  // Started a hit already?
   if ( !m_startedHit ) {
     
-    // start new hit on preStep
+    // If no hit, then start a new hit on the pre-step.
     startHit( pre() );
   }
 
-  // cached trackID is valid?
+  // Check if the cached trackID is valid.
   if ( m_currentTrackID != -1 ) {
 
-    // this step's trackID != cached trackID?
+    // Is this step's trackID different from the cached trackID?
     if ( trackID() != m_currentTrackID ) {
 
 #ifdef G4VERBOSE
@@ -66,10 +68,10 @@
       }
 #endif
 
-      // insert the hit
+      // Insert the hit on the old track.
       r = insertHit();
 
-      // start new hit on preStep
+      // Start a new hit on the pre-step.
       startHit( pre() );
     }
   }
@@ -79,10 +81,10 @@
   }
 #endif
 
-  // update hit, checking if applicable
+  // Update the hit, checking if the call to this function is applicable.
   updateHit();
 
-  // entering new PV on this step?
+  // Entering a new PV on this step?
   if ( prePV() != postPV() ) {
 
 #ifdef G4VERBOSE
@@ -91,30 +93,27 @@
     }
 #endif
 
-    // insert current hit
+    // Insert the current hit.
     r = insertHit();
 
-    // pre and post have same SD?
+    // Check if pre and post steps have the same detector.
     if ( hasSameSD() ) {
 
-      // start new hit for the adjacent tracker layer
+      // Start a new hit for the adjacent tracker layer.
       startHit( post() );
     }
+  } 
+  // Special case where the track status is StopAndKill.  
+  // If so, we won't see it again, so need to insert the hit.
+  else if ( m_currentTrack->GetTrackStatus() == fStopAndKill ) {
+    r = insertHit();
   }
 
-  // DEBUG
-  
-  // get track information
-  TrackInformation* trkInfo = trackInformation();    
-
-  // set hit flag in trk info
-  if ( r ) {
-//     trkInfo->setHasTrackerHit( false );
-//   }
-//   else {
-    trkInfo->setHasTrackerHit( true );
+#ifdef G4VERBOSE
+  if ( getVerbose() > 0 ) {
+    G4cerr << "----" << G4endl;
   }
-  // END DEBUG
+#endif
 
   return r;
 }
@@ -179,12 +178,6 @@
 #ifdef G4VERBOSE
     if ( getVerbose() > 0 ) {
       std::cout << GetName() << " : cut this edep " << m_edepTotal << std::endl;
-
-//       // get track information
-//       TrackInformation* trkInfo = trackInformation();
-      
-//       // set hit flag in trk info
-//       trkInfo->setHasTrackerHit( false );
     }
 
 #endif
@@ -233,6 +226,8 @@
 
   m_HC->insert(trkhit);
 
+  TrackInformation::getTrackInformation( m_currentTrack )->setHasTrackerHit( true );
+
   // clear cached data
   clear();
 
@@ -253,6 +248,7 @@
   }
 #endif
 
+  m_currentTrack = step()->GetTrack();
   m_currentPV = aStepPoint->GetPhysicalVolume();
   m_entryPoint = m_exitPoint = aStepPoint->GetPosition();
   m_entryMomentum = m_exitMomentum = aStepPoint->GetMomentum();
@@ -267,12 +263,6 @@
     std::cout << "entry point = " << m_entryPoint << std::endl;
   }
 #endif
-
-  // get track information
-  //TrackInformation* trkInfo = trackInformation();
-
-  // set hit flag in trk info
-  //trkInfo->setHasTrackerHit( true );
 }
 
 
CVSspam 0.2.8