Author: [log in to unmask] Date: Fri Feb 13 17:33:59 2015 New Revision: 3545 Log: Fix bug where some hit positions were not written to LCIO output. HPSJAVA-420 Modified: projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseHit.java Modified: projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseHit.java ============================================================================= --- projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseHit.java (original) +++ projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseHit.java Fri Feb 13 17:33:59 2015 @@ -177,17 +177,24 @@ } /** - * Calculate the position of the hit, depending on what variables are available on the object. - */ - protected void calculatePosition() { - // Was there no position information provided explicitly? - if (positionVec == null) { + * Calculate the position of the hit, depending on what information is available on the object. + */ + protected void calculatePosition() { + // Is the position not set already? + if (positionVec == null) { + + // Is the detector object not set yet? + if (detectorElement == null) { + // Try to find a detector object to link to this hit. + detectorElement = findDetectorElement(getIdentifier()); + } + // Does the hit ID match the DetectorElement exactly? - if (this.detectorElement != null && detectorElement.getIdentifier().equals(getIdentifier())) { + if (detectorElement != null && detectorElement.getIdentifier().equals(getIdentifier())) { // Set the position from the DetectorElement. - this.positionVec = detectorElement.getGeometry().getPosition(); + this.positionVec = detectorElement.getGeometry().getPosition(); } else { - // This is what should happen for IDs with virtual cell values. + // This is what should happen for IDs with virtual segmentation values. // The IDDecoder needs to be used here if it is set on the hit. if (this.metaData != null) { IDDecoder decoder = this.getIDDecoder(); ######################################################################## 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