Commit in projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors on MAIN
ScoringTrackerHitProcessor.cc+13-93235 -> 3236
Several fixes for scoring processor.  Make sure TrackInformation is flagged as having hit.  Set the position to the mid position to be consistent with API.

projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors
ScoringTrackerHitProcessor.cc 3235 -> 3236
--- projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/ScoringTrackerHitProcessor.cc	2014-08-06 08:00:45 UTC (rev 3235)
+++ projects/lcdd/branches/v04-01-00-pre/src/lcdd/detectors/ScoringTrackerHitProcessor.cc	2014-08-07 19:06:26 UTC (rev 3236)
@@ -26,12 +26,6 @@
         // edep
         G4double edep = step->GetTotalEnergyDeposit();
 
-        // get track information
-        //TrackInformation* trkInfo = TrackInformation::getTrackInformation(step);
-
-        // set hit flag in trk info
-        //trkInfo->setHasTrackerHit(true);
-
         // Get track ID.
         G4int trackID = step->GetTrack()->GetTrackID();
 
@@ -50,20 +44,30 @@
         // Get the end position from the post-step point.
         G4ThreeVector endPosition = step->GetPostStepPoint()->GetPosition();
 
+        // Compute the midpoint.
+        G4ThreeVector midPoint = (0.5 * (step->GetPreStepPoint()->GetPosition() + step->GetPostStepPoint()->GetPosition()));
+
         // Compute the step's path length.
         G4double length = sqrt(pow(startPosition.x() - endPosition.x(), 2) + pow(startPosition.y() - endPosition.y(), 2) + pow(startPosition.z() - endPosition.z(), 2));
 
         // Set the hit information.
         newHit->setTrackID(trackID);
         newHit->setEdep(edep);
-        newHit->setPosition(startPosition);
+        newHit->setPosition(midPoint);
         newHit->setMomentum(step->GetPreStepPoint()->GetMomentum());
         newHit->setTdep(tdep);
         newHit->setId(id64.getId0());
         newHit->setLength(length);
 
-        // Add hit to SD.
-        getTracker()->addHit(newHit, false);
+        // Get the TrackInformation and flag track as having a tracker hit.
+        VUserTrackInformation* trackInformation = dynamic_cast<VUserTrackInformation*>(step->GetTrack()->GetUserInformation());
+        if (trackInformation)
+            trackInformation->setHasTrackerHit();
+        else
+            G4Exception("ScoringTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation.");
+
+        // Add hit to detector.
+        getTracker()->addHit(newHit, getCollectionIndex());
     }
     return true;
 }
SVNspam 0.1


Use REPLY-ALL to reply to list

To unsubscribe from the LCDET-SVN list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCDET-SVN&A=1