6 modified files
lcsim/src/org/lcsim/event/base
diff -u -r1.2 -r1.3
--- CalorimeterHitImpl.java 23 Nov 2010 23:12:21 -0000 1.2
+++ CalorimeterHitImpl.java 20 Jul 2012 09:23:15 -0000 1.3
@@ -1,12 +1,14 @@
package org.lcsim.event.base;
+import hep.physics.vec.BasicHep3Vector;
+
/**
* A concrete implementation of CalorimeterHit
*
* @author Norman A. Graf
*
- * @version $Id: CalorimeterHitImpl.java,v 1.2 2010/11/23 23:12:21 jeremy Exp $
+ * @version $Id: CalorimeterHitImpl.java,v 1.3 2012/07/20 09:23:15 grefe Exp $
*/
public class CalorimeterHitImpl extends BaseCalorimeterHit
{
@@ -24,7 +26,7 @@
{
this.corrEnergy = energy;
this.energyError = energyError;
- this.position = position;
+ this.positionVec = new BasicHep3Vector(position);
this.time = time;
this.id = id;
this.type = type;
@@ -42,7 +44,7 @@
public CalorimeterHitImpl(double energy, double[] position, double time, long id, int type)
{
this.corrEnergy = energy;
- this.position = position;
+ this.positionVec = new BasicHep3Vector(position);
this.time = time;
this.id = id;
this.type = type;
lcsim/src/org/lcsim/event/base
diff -u -r1.8 -r1.9
--- BaseSimCalorimeterHit.java 10 Jul 2012 19:57:14 -0000 1.8
+++ BaseSimCalorimeterHit.java 20 Jul 2012 09:23:15 -0000 1.9
@@ -43,7 +43,7 @@
super.id = id;
super.rawEnergy = rawEnergy;
super.time = time;
- super.position = null;
+ super.positionVec = null;
// MCParticle contributions.
this.nContributions = mcparts.length;
@@ -71,7 +71,7 @@
super.id = id;
super.rawEnergy = rawEnergy;
super.time = time;
- super.position = null;
+ super.positionVec = null;
// MCParticle contributions.
this.nContributions = mcparts.length;
lcsim/src/org/lcsim/event/base
diff -u -r1.14 -r1.15
--- BaseCalorimeterHit.java 10 Jul 2012 19:57:14 -0000 1.14
+++ BaseCalorimeterHit.java 20 Jul 2012 09:23:15 -0000 1.15
@@ -1,5 +1,6 @@
package org.lcsim.event.base;
+import hep.physics.vec.BasicHep3Vector;
import hep.physics.vec.Hep3Vector;
import org.lcsim.detector.DetectorElementStore;
@@ -21,7 +22,7 @@
*
* @author tonyj
* @author jeremym
- * @version $Id: BaseCalorimeterHit.java,v 1.14 2012/07/10 19:57:14 jeremy Exp $
+ * @version $Id: BaseCalorimeterHit.java,v 1.15 2012/07/20 09:23:15 grefe Exp $
*/
public abstract class BaseCalorimeterHit extends BaseHitWithPosition implements CalorimeterHit {
@@ -29,8 +30,6 @@
protected double rawEnergy = UNSET_ENERGY;
protected double corrEnergy = UNSET_ENERGY;
protected double energyError;
- protected double[] position;
- protected Hep3Vector positionVec;
protected double time;
protected long id;
protected int type;
@@ -49,12 +48,20 @@
}
return rawEnergy;
}
-
+
+ @Override
public double[] getPosition() {
- if (position == null) {
- calculatePosition();
- }
- return position;
+ if (positionVec == null) {
+ calculatePosition();
+ }
+ return super.getPosition();
+ }
+
+ public Hep3Vector getPositionVec() {
+ if (positionVec == null) {
+ calculatePosition();
+ }
+ return super.getPositionVec();
}
public double getCorrectedEnergy() {
@@ -81,12 +88,9 @@
private void calculatePosition() {
if (getMetaData() != null) {
- position = new double[3];
IDDecoder decoder = getIDDecoder();
decoder.setID(id);
- position[0] = decoder.getX();
- position[1] = decoder.getY();
- position[2] = decoder.getZ();
+ positionVec = new BasicHep3Vector(decoder.getPosition());
} else {
throw new RuntimeException("Can't calculate position. MetaData is null.");
}
@@ -121,7 +125,7 @@
public String toString() {
StringBuffer sb = new StringBuffer("CalorimeterHitImpl: \n");
sb.append("type: " + type + " energy: " + corrEnergy + " energyError: " + energyError + "\n");
- sb.append("position: " + position[0] + " " + position[1] + " " + position[2] + "\n");
+ sb.append("position: " + positionVec.x() + " " + positionVec.y() + " " + positionVec.z() + "\n");
sb.append("id: " + id + " time: " + time);
return sb.toString();
}
lcsim/src/org/lcsim/util/lcio
diff -u -r1.12 -r1.13
--- SIOSimCalorimeterHit.java 10 Jul 2012 19:57:14 -0000 1.12
+++ SIOSimCalorimeterHit.java 20 Jul 2012 09:23:15 -0000 1.13
@@ -2,6 +2,7 @@
import hep.io.sio.SIOInputStream;
import hep.io.sio.SIOOutputStream;
+import hep.physics.vec.BasicHep3Vector;
import java.io.IOException;
import java.util.ArrayList;
@@ -13,7 +14,7 @@
/**
* @author Tony Johnson
* @author Jeremy McCormick
- * @version $Id: SIOSimCalorimeterHit.java,v 1.12 2012/07/10 19:57:14 jeremy Exp $
+ * @version $Id: SIOSimCalorimeterHit.java,v 1.13 2012/07/20 09:23:15 grefe Exp $
*/
public class SIOSimCalorimeterHit extends BaseSimCalorimeterHit
{
@@ -32,11 +33,7 @@
if (LCIOUtil.bitTest(flags,LCIOConstants.CHBIT_LONG))
{
- position = new double[3];
- position[0] = in.readFloat();
- position[1] = in.readFloat();
- position[2] = in.readFloat();
- setPosition(position);
+ positionVec = new BasicHep3Vector(in.readFloat(), in.readFloat(), in.readFloat());
}
nContributions = in.readInt();
particle = new Object[nContributions];
lcsim/src/org/lcsim/util/lcio
diff -u -r1.16 -r1.17
--- SIOCalorimeterHit.java 10 Jul 2012 19:57:14 -0000 1.16
+++ SIOCalorimeterHit.java 20 Jul 2012 09:23:15 -0000 1.17
@@ -2,6 +2,7 @@
import hep.io.sio.SIOInputStream;
import hep.io.sio.SIOOutputStream;
+import hep.physics.vec.BasicHep3Vector;
import java.io.IOException;
import org.lcsim.event.CalorimeterHit;
@@ -12,7 +13,7 @@
* SIO-based I/O implementation of the CalorimeterHit interface
*
* @author Guilherme Lima
- * @version $Id: SIOCalorimeterHit.java,v 1.16 2012/07/10 19:57:14 jeremy Exp $
+ * @version $Id: SIOCalorimeterHit.java,v 1.17 2012/07/20 09:23:15 grefe Exp $
*/
class SIOCalorimeterHit extends BaseCalorimeterHit {
@@ -33,11 +34,7 @@
time = in.readFloat();
}
if ((flags & (1 << LCIOConstants.RCHBIT_LONG)) != 0) {
- position = new double[3];
- position[0] = in.readFloat();
- position[1] = in.readFloat();
- position[2] = in.readFloat();
- setPosition(position);
+ positionVec = new BasicHep3Vector(in.readFloat(), in.readFloat(), in.readFloat());
}
if (version > 1002) {
lcsim/src/org/lcsim/digisim
diff -u -r1.5 -r1.6
--- MyCalorimeterHit.java 23 May 2008 03:12:09 -0000 1.5
+++ MyCalorimeterHit.java 20 Jul 2012 09:23:15 -0000 1.6
@@ -7,7 +7,7 @@
* Implements a calorimeter hit, to be created from unpacking DigiSim output.
*
* @author Guilherme Lima
- * @version $Id: MyCalorimeterHit.java,v 1.5 2008/05/23 03:12:09 jeremy Exp $
+ * @version $Id: MyCalorimeterHit.java,v 1.6 2012/07/20 09:23:15 grefe Exp $
*/
public class MyCalorimeterHit extends BaseCalorimeterHit
{
@@ -20,6 +20,6 @@
this.id = rawhit.getCellID();
this.rawEnergy = ((double)rawhit.getAmplitude()) * 1.0e-8;
this.time = (double)rawhit.getTimeStamp() * 1.0e-6;
- this.position = null;
+ this.positionVec = null;
}
}
CVSspam 0.2.12