Commit in projects/lcdd/branches/v05-00-00-dev on MAIN | |||
include/lcdd/detectors/CurrentTrackState.hh | +7 | -7 | 3283 -> 3284 |
src/lcdd/detectors/BasicTrackerHitProcessor.cc | +24 | -7 | 3283 -> 3284 |
/CurrentTrackState.cc | +1 | -1 | 3283 -> 3284 |
/DDSegmentationCalorimeterHitProcessor.cc | +21 | -29 | 3283 -> 3284 |
/ScoringTrackerHitProcessor.cc | +14 | -6 | 3283 -> 3284 |
+67 | -50 |
Handle case where Track has not been flagged as having a hit in which case the current global track ID is used for the hit. Remove some debug prints.
--- projects/lcdd/branches/v05-00-00-dev/include/lcdd/detectors/CurrentTrackState.hh 2014-08-27 19:33:39 UTC (rev 3283) +++ projects/lcdd/branches/v05-00-00-dev/include/lcdd/detectors/CurrentTrackState.hh 2014-08-27 22:49:25 UTC (rev 3284) @@ -21,22 +21,22 @@
_currentTrackID = trackID; }
- static void setCurrentPrimaryID(G4int trackID) { - _currentPrimaryID = trackID; - }
+ //static void setCurrentPrimaryID(G4int trackID) { + // _currentPrimaryID = trackID; + //}
static G4int getCurrentTrackID() { return _currentTrackID; }
- static G4int getCurrentPrimaryID() { - return _currentPrimaryID; - }
+ //static G4int getCurrentPrimaryID() { + // return _currentPrimaryID; + //}
public: static G4int _currentTrackID;
- static G4int _currentPrimaryID;
+ //static G4int _currentPrimaryID;
}; #endif
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/BasicTrackerHitProcessor.cc 2014-08-27 19:33:39 UTC (rev 3283) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/BasicTrackerHitProcessor.cc 2014-08-27 22:49:25 UTC (rev 3284) @@ -17,6 +17,8 @@
bool BasicTrackerHitProcessor::processHits(G4Step* step) {
+ //G4cout << "BasicTrackerHitProcessor::processHits" << G4endl; +
TrackerSD* tracker = getTracker(); // Get the total energy deposition.
@@ -37,6 +39,8 @@
// Get the track. G4Track* track = step->GetTrack();
+ //G4cout << " trackID: " << track->GetTrackID() << G4endl; +
// Get the pre-step point. G4StepPoint* pre = step->GetPreStepPoint();
@@ -80,8 +84,23 @@
// Create the hit's identifier. Id64bit id64 = tracker->makeIdentifier(step);
+ 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.
- hit->setTrackID(trackID);
+ if (trackInformation != NULL) { + trackInformation->setHasTrackerHit(); + + // Use the ID from this track, as it has track info for creating the TrackSummary. + hit->setTrackID(trackID); + } else { + // In the case where there is no track info, then we use the current global track ID. + hit->setTrackID(CurrentTrackState::getCurrentTrackID()); + }
hit->setEdep(edep); hit->setPosition(mid); hit->setMomentum(momentum);
@@ -92,12 +111,10 @@
// Add the hit to the TrackerSD. tracker->addHit(hit, _collectionIndex);
- // 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("BasicTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation.");
+ //G4cout << " CurrentTrackState::getCurrentTrackID: " + // << CurrentTrackState::getCurrentTrackID() << G4endl; + //else + // G4Exception("BasicTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation.");
// Return true because created new hit. return true;
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/CurrentTrackState.cc 2014-08-27 19:33:39 UTC (rev 3283) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/CurrentTrackState.cc 2014-08-27 22:49:25 UTC (rev 3284) @@ -1,4 +1,4 @@
#include "lcdd/detectors/CurrentTrackState.hh" int CurrentTrackState::_currentTrackID = -1;
-int CurrentTrackState::_currentPrimaryID = -1;
+//int CurrentTrackState::_currentPrimaryID = -1;
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc 2014-08-27 19:33:39 UTC (rev 3283) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/DDSegmentationCalorimeterHitProcessor.cc 2014-08-27 22:49:25 UTC (rev 3284) @@ -27,10 +27,11 @@
bool DDSegmentationCalorimeterHitProcessor::processHits(G4Step* step) {
- G4cout << "DDSegmentationCalorimeterHitProcessor::processHits" << G4endl;
+ //G4cout << "DDSegmentationCalorimeterHitProcessor::processHits" << G4endl;
// Get the energy deposition. G4double edep = step->GetTotalEnergyDeposit();
+ //G4cout << " edep: " << edep << G4endl;
// Check for Geantino particle type. G4ParticleDefinition* def = step->GetTrack()->GetDefinition();
@@ -41,6 +42,7 @@
// Cut on energy deposition <= cut but allow Geantinos. if (edep <= _calorimeter->getEnergyCut() && isGeantino == false) {
+ //G4cout << " cut on low energy" << G4endl;
return false; }
@@ -75,43 +77,33 @@
// Was there a hit found with this identifier? if (hit == NULL) {
- G4cout << "creating a new hit " << G4endl; - G4cout << "cellID: " << std::hex << cellId << G4endl;
+ //G4cout << " creating a new hit " << G4endl; + //G4cout << " cellID: " << std::hex << cellId << G4endl;
- G4cout << "fieldDescription: " << segmentation->decoder()->fieldDescription() << G4endl;
+ //G4cout << " fieldDescription: " << segmentation->decoder()->fieldDescription() << G4endl;
- //segmentation->decoder()->setValue(cellId); -
//int size = segmentation->decoder()->size();
- //G4cout << "size: " << size << G4endl;
+ //G4cout << " size: " << size << G4endl;
//for (int i=0; i<size; i++) {
- //G4cout << "value[" << i << "] = " - G4cout << segmentation->decoder()[0] << G4endl;
+ // G4cout << " value[" << i << "] = " << std::dec << (*segmentation->decoder())[i] << G4endl;
//}
- //int ix = segmentation->decoder()->index("x"); - //int iy = segmentation->decoder()->index("y"); - - // FIXME: Commented code causes Seg Fault. - //G4cout << "x = " << segmentation->decoder()[ix] << G4endl; - //G4cout << "y = " << segmentation->decoder()[iy] << G4endl; -
int id0 = segmentation->decoder()->lowWord(); int id1 = segmentation->decoder()->highWord(); Id64bit id = Id64bit(id0, id1);
- G4cout << "id0: " << std::hex << id0 << G4endl; - G4cout << "id1: " << std::hex << id1 << G4endl;
+ //G4cout << " id0: " << std::hex << id0 << G4endl; + //G4cout << " id1: " << std::hex << id1 << G4endl;
// Get the global cell position from the Segmentation. DD4hep::DDSegmentation::Vector3D localCellPosition = segmentation->position(cellId);
- G4cout << "local cell position: " - << std::dec - << localCellPosition.x() << ", " - << localCellPosition.y() << ", " - << localCellPosition.z() << G4endl;
+ //G4cout << "local cell position: " + // << std::dec + // << localCellPosition.x() << ", " + // << localCellPosition.y() << ", " + // << localCellPosition.z() << G4endl;
// Create a G4ThreeVector for the hit's local cell position. G4ThreeVector localCellVec = G4ThreeVector(localCellPosition.x(), localCellPosition.y(), localCellPosition.z());
@@ -119,11 +111,11 @@
// Compute the global cell position from the local. G4ThreeVector globalCellVec = touchable->GetHistory()->GetTopTransform().Inverse().TransformPoint(localCellVec);
- G4cout << "global cell position: " - << std::dec - << globalCellVec.x() << ", " - << globalCellVec.y() << ", " - << globalCellVec.z() << G4endl;
+ //G4cout << "global cell position: " + // << std::dec + // << globalCellVec.x() << ", " + // << globalCellVec.y() << ", " + // << globalCellVec.z() << G4endl;
// No hit was found, so a new one is created. hit = new CalorimeterHit(id, edep, globalCellVec);
@@ -133,7 +125,7 @@
} else {
- G4cout << "adding " << std::dec << edep << " to existing hit" << G4endl;
+ //G4cout << "adding " << std::dec << edep << " to existing hit" << G4endl;
// Add energy deposition to an existing hit. hit->addEdep(edep);
--- projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/ScoringTrackerHitProcessor.cc 2014-08-27 19:33:39 UTC (rev 3283) +++ projects/lcdd/branches/v05-00-00-dev/src/lcdd/detectors/ScoringTrackerHitProcessor.cc 2014-08-27 22:49:25 UTC (rev 3284) @@ -2,6 +2,7 @@
// LCDD #include "lcdd/core/VUserTrackInformation.hh"
+#include "lcdd/detectors/CurrentTrackState.hh"
// Geant4 #include "G4ThreeVector.hh"
@@ -53,8 +54,15 @@
// 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));
+ VUserTrackInformation* trackInformation = dynamic_cast<VUserTrackInformation*>(step->GetTrack()->GetUserInformation()); +
// Set the hit information.
- newHit->setTrackID(trackID);
+ if (trackInformation != NULL) { + trackInformation->setHasTrackerHit(); + newHit->setTrackID(trackID); + } else { + newHit->setTrackID(CurrentTrackState::getCurrentTrackID()); + }
newHit->setEdep(edep); newHit->setPosition(midPoint); newHit->setMomentum(step->GetPreStepPoint()->GetMomentum());
@@ -63,12 +71,12 @@
newHit->setLength(length); // 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.");
+ //if (trackInformation) + // trackInformation->setHasTrackerHit(); + //else + // G4Exception("ScoringTrackerHitProcessor::processHits", "", FatalException, "Missing required VUserTrackInformation."); +
// Add hit to detector. getTracker()->addHit(newHit, getCollectionIndex()); }
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