Author: [log in to unmask] Date: Thu Nov 5 15:52:08 2015 New Revision: 3689 Log: [SLIC-253] Fix problem with hits not being written from scoring plane by activating processor reset hook; includes other minor code cleanup. Modified: projects/lcdd/trunk/include/lcdd/detectors/CurrentTrackState.hh projects/lcdd/trunk/include/lcdd/detectors/HitProcessor.hh projects/lcdd/trunk/include/lcdd/detectors/ScoringTrackerHitProcessor.hh projects/lcdd/trunk/src/lcdd/detectors/BasicTrackerHitProcessor.cc projects/lcdd/trunk/src/lcdd/detectors/CurrentTrackState.cc projects/lcdd/trunk/src/lcdd/detectors/HitProcessorManager.cc projects/lcdd/trunk/src/lcdd/detectors/ScoringTrackerHitProcessor.cc projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetector.cc Modified: projects/lcdd/trunk/include/lcdd/detectors/CurrentTrackState.hh ============================================================================= --- projects/lcdd/trunk/include/lcdd/detectors/CurrentTrackState.hh (original) +++ projects/lcdd/trunk/include/lcdd/detectors/CurrentTrackState.hh Thu Nov 5 15:52:08 2015 @@ -21,17 +21,9 @@ _currentTrackID = trackID; } - //static void setCurrentPrimaryID(G4int trackID) { - // _currentPrimaryID = trackID; - //} - static G4int getCurrentTrackID() { return _currentTrackID; } - - //static G4int getCurrentPrimaryID() { - // return _currentPrimaryID; - //} public: Modified: projects/lcdd/trunk/include/lcdd/detectors/HitProcessor.hh ============================================================================= --- projects/lcdd/trunk/include/lcdd/detectors/HitProcessor.hh (original) +++ projects/lcdd/trunk/include/lcdd/detectors/HitProcessor.hh Thu Nov 5 15:52:08 2015 @@ -73,6 +73,9 @@ return _collectionIndex; } + virtual void reset() { + } + protected: SensitiveDetector* _detector; Modified: projects/lcdd/trunk/include/lcdd/detectors/ScoringTrackerHitProcessor.hh ============================================================================= --- projects/lcdd/trunk/include/lcdd/detectors/ScoringTrackerHitProcessor.hh (original) +++ projects/lcdd/trunk/include/lcdd/detectors/ScoringTrackerHitProcessor.hh Thu Nov 5 15:52:08 2015 @@ -30,6 +30,13 @@ */ bool processHits(G4Step* step); + /** + * Reset state of hit processor. + */ + void reset() { + _currentTrackId = -1; + } + private: int _currentTrackId; Modified: projects/lcdd/trunk/src/lcdd/detectors/BasicTrackerHitProcessor.cc ============================================================================= --- projects/lcdd/trunk/src/lcdd/detectors/BasicTrackerHitProcessor.cc (original) +++ projects/lcdd/trunk/src/lcdd/detectors/BasicTrackerHitProcessor.cc Thu Nov 5 15:52:08 2015 @@ -16,8 +16,6 @@ } bool BasicTrackerHitProcessor::processHits(G4Step* step) { - - //G4cout << "BasicTrackerHitProcessor::processHits" << G4endl; TrackerSD* tracker = getTracker(); @@ -38,8 +36,6 @@ // Get the track. G4Track* track = step->GetTrack(); - - //G4cout << " trackID: " << track->GetTrackID() << G4endl; // Get the pre-step point. G4StepPoint* pre = step->GetPreStepPoint(); @@ -70,7 +66,6 @@ G4ThreeVector momentum = (end - start); // If the momentum is > 0 then set to average momentum. - // FIXME: Not sure I understand this!!! if (momentum.mag() > 0) { momentum.setMag(averageMomentum); } @@ -86,10 +81,6 @@ VUserTrackInformation* trackInformation = dynamic_cast<VUserTrackInformation*>(step->GetTrack()->GetUserInformation()); - - // If there is a user track info object, then flag it as having a hit. - //if (trackInformation) - // trackInformation->setHasTrackerHit(); // Set the hit information from above. if (trackInformation != NULL) { @@ -111,11 +102,6 @@ // Add the hit to the TrackerSD. tracker->addHit(hit, _collectionIndex); - //G4cout << " CurrentTrackState::getCurrentTrackID: " - // << CurrentTrackState::getCurrentTrackID() << G4endl; - //else - // G4Exception("BasicTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation."); - // Return true because created new hit. return true; } Modified: projects/lcdd/trunk/src/lcdd/detectors/CurrentTrackState.cc ============================================================================= --- projects/lcdd/trunk/src/lcdd/detectors/CurrentTrackState.cc (original) +++ projects/lcdd/trunk/src/lcdd/detectors/CurrentTrackState.cc Thu Nov 5 15:52:08 2015 @@ -1,4 +1,3 @@ #include "lcdd/detectors/CurrentTrackState.hh" int CurrentTrackState::_currentTrackID = -1; -//int CurrentTrackState::_currentPrimaryID = -1; Modified: projects/lcdd/trunk/src/lcdd/detectors/HitProcessorManager.cc ============================================================================= --- projects/lcdd/trunk/src/lcdd/detectors/HitProcessorManager.cc (original) +++ projects/lcdd/trunk/src/lcdd/detectors/HitProcessorManager.cc Thu Nov 5 15:52:08 2015 @@ -26,7 +26,6 @@ registerFactory(new BasicCalorimeterHitProcessorFactory()); registerFactory(new ScoringTrackerHitProcessorFactory()); registerFactory(new BasicTrackerHitProcessorFactory()); - registerFactory(new DDSegmentationCalorimeterHitProcessorFactory()); } Modified: projects/lcdd/trunk/src/lcdd/detectors/ScoringTrackerHitProcessor.cc ============================================================================= --- projects/lcdd/trunk/src/lcdd/detectors/ScoringTrackerHitProcessor.cc (original) +++ projects/lcdd/trunk/src/lcdd/detectors/ScoringTrackerHitProcessor.cc Thu Nov 5 15:52:08 2015 @@ -15,6 +15,7 @@ } bool ScoringTrackerHitProcessor::processHits(G4Step* step) { + bool sameTrack = false; int trackId = step->GetTrack()->GetTrackID(); @@ -70,13 +71,6 @@ newHit->setId(id64.getId0()); newHit->setLength(length); - // Get the TrackInformation and flag track as having a tracker hit. - - //if (trackInformation) - // trackInformation->setHasTrackerHit(); - //else - // G4Exception("ScoringTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation."); - // Add hit to detector. getTracker()->addHit(newHit, getCollectionIndex()); } Modified: projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetector.cc ============================================================================= --- projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetector.cc (original) +++ projects/lcdd/trunk/src/lcdd/detectors/SensitiveDetector.cc Thu Nov 5 15:52:08 2015 @@ -28,8 +28,8 @@ SensitiveDetector::SensitiveDetector(G4String name, G4String theCollectionName, EType detectorType) : G4VSensitiveDetector(name), _idspec(NULL), + _verbose(false), _type(detectorType), - _verbose(false), _endcap(false), _ecut(0) { @@ -78,6 +78,9 @@ } void SensitiveDetector::EndOfEvent(G4HCofThisEvent*) { + for (HitProcessors::iterator it = _hitProcessors.begin(); it != _hitProcessors.end(); it++) { + (*it)->reset(); + } } G4bool SensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*) { ######################################################################## 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