Author: [log in to unmask]
Date: Wed Apr 1 16:00:15 2015
New Revision: 3581
Log:
Add copy constructor to BaseCalorimeterHit.
Modified:
projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseCalorimeterHit.java
Modified: projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseCalorimeterHit.java
=============================================================================
--- projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseCalorimeterHit.java (original)
+++ projects/lcsim/trunk/event-model/src/main/java/org/lcsim/event/base/BaseCalorimeterHit.java Wed Apr 1 16:00:15 2015
@@ -1,5 +1,6 @@
package org.lcsim.event.base;
+import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import org.lcsim.detector.identifier.IIdentifier;
@@ -43,8 +44,34 @@
this.id = id;
this.positionVec = positionVec;
this.type = type;
-
+
setMetaData(metaData);
+ }
+
+ public BaseCalorimeterHit(BaseCalorimeterHit hit) {
+ this.rawEnergy = hit.getRawEnergy();
+ this.energyError = hit.getEnergyError();
+ this.time = hit.getTime();
+ this.type = hit.getType();
+ this.id = hit.getCellID();
+ if (hit.positionVec != null) {
+ this.positionVec = new BasicHep3Vector(hit.getPositionVec().x(), hit.getPositionVec().y(), hit.getPositionVec().z());
+ }
+ if (hit.metaData != null) {
+ setMetaData(hit.getMetaData());
+ }
+ try {
+ this.correctedEnergy = hit.getCorrectedEnergy();
+ } catch (Exception e) {
+ // This can conceivably fail sometimes without valid sampling fraction conditions.
+ }
+ if (hit.detectorElement != null) {
+ this.detectorElement = hit.getDetectorElement();
+ }
+ }
+
+ public BaseCalorimeterHit clone() {
+ return new BaseCalorimeterHit(this);
}
public double getTime() {
########################################################################
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
|