Author: [log in to unmask]
Date: Mon Feb 9 19:09:48 2015
New Revision: 3519
Log:
Remove conditions information from ECAL geometry API. HPSJAVA-419
Modified:
projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java
Modified: projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java
=============================================================================
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java (original)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/detector/converter/compact/EcalCrystal.java Mon Feb 9 19:09:48 2015
@@ -1,27 +1,25 @@
package org.lcsim.detector.converter.compact;
+
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.VecOp;
import org.lcsim.detector.DetectorElement;
import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.IGeometryInfo;
import org.lcsim.detector.identifier.IIdentifier;
+import org.lcsim.detector.solids.Trd;
/**
* This class implements behavior specific to the ECal crystals of the HPS experiment,
* which includes access to time dependent conditions as well as DAQ setup information.
* @author Jeremy McCormick <[log in to unmask]>
*/
+// TODO: Add method for getting an EcalCrystal objects neighbors.
+// FIXME: Remove conditions. These should come directly from conditions objects instead.
public class EcalCrystal extends DetectorElement {
-
- /** Electronics setup. */
- int crate;
- int slot;
- int channel;
-
- /** Time dependent conditions data. */
- boolean badChannel = false;
- double pedestal = Double.NaN;
- double noise = Double.NaN;
- double gain = Double.NaN;
- double timeShift = Double.NaN;
+
+ Hep3Vector positionFront;
/**
* Class constructor.
@@ -32,133 +30,6 @@
*/
EcalCrystal(String name, IDetectorElement parent, String path, IIdentifier id) {
super(name, parent, path, id);
- }
-
- /**
- * Set the bad channel flag.
- * @param badChannel True if channel is bad; false if not.
- */
- public void setBadChannel(boolean badChannel) {
- this.badChannel = badChannel;
- }
-
- /**
- * Set the pedestal value.
- * @param pedestal The pedestal value.
- */
- public void setPedestal(double pedestal) {
- this.pedestal = pedestal;
- }
-
- /**
- * Set the noise value.
- * @param noise The noise value.
- */
- public void setNoise(double noise) {
- this.noise = noise;
- }
-
- /**
- * Set the gain value.
- * @param gain The gain value.
- */
- public void setGain(double gain) {
- this.gain = gain;
- }
-
- /**
- * Set the time shift value in nanoseconds.
- */
- public void setTimeShift(double timeShift) {
- this.timeShift = timeShift;
- }
-
- /**
- * Set the crate value.
- * @param crate The crate value.
- */
- public void setCrate(int crate) {
- this.crate = crate;
- }
-
- /**
- * Set the slot value.
- * @param slot The slot value.
- */
- public void setSlot(int slot) {
- this.slot = slot;
- }
-
- /**
- * Set the channel value.
- * @param channel The channel value.
- */
- public void setChannel(int channel) {
- this.channel = channel;
- }
-
- /**
- * Get whether this is a bad channel or not.
- * @return True if is bad channel; false if not.
- */
- public boolean isBadChannel() {
- return badChannel;
- }
-
- /**
- * Get the pedestal value.
- * @return The pedestal value.
- */
- public double getPedestal() {
- return pedestal;
- }
-
- /**
- * Get the noise value.
- * @return The noise value.
- */
- public double getNoise() {
- return noise;
- }
-
- /**
- * Get the gain value.
- * @return The gain value.
- */
- public double getGain() {
- return gain;
- }
-
- /**
- * Get the time shift in nanoseconds.
- * @return the time shift
- */
- public double getTimeShift() {
- return timeShift;
- }
-
- /**
- * Get the crate number.
- * @return The crate number.
- */
- public int getCrate() {
- return crate;
- }
-
- /**
- * Get the slot number.
- * @return The slot number.
- */
- public int getSlot() {
- return slot;
- }
-
- /**
- * Get the channel number.
- * @return The channel number.
- */
- public int getChannel() {
- return channel;
}
/**
@@ -176,16 +47,21 @@
public int getY() {
return getIdentifierHelper().getValue(getIdentifier(), "iy");
}
+
+ /**
+ * Get the global center position of the XY plane in the front of the crystal.
+ * This is used in the recon clustering algorithm for the "corrected"
+ * hit position, so it is best to cache it once used for performance purposes.
+ * @return The center position of the XY plane in the front of the crystal.
+ */
+ public Hep3Vector getPositionFront() {
+ if (positionFront == null) {
+ IGeometryInfo geom = getGeometry();
+ double[] p = geom.transformLocalToGlobal(VecOp.add(geom.transformGlobalToLocal(geom.getPosition()),
+ (Hep3Vector) new BasicHep3Vector(0, 0, -1 * ((Trd) geom.getLogicalVolume().getSolid()).getZHalfLength()))).v();
+ positionFront = new BasicHep3Vector(p[0], p[1], p[2]);
+ }
+ return positionFront;
+ }
- /**
- * Reset the time dependent conditions. This will NOT reset
- * hardware information as it is considered fixed once set.
- */
- public void resetConditions() {
- badChannel = false;
- pedestal = Double.NaN;
- noise = Double.NaN;
- gain = Double.NaN;
- timeShift = Double.NaN;
- }
}
########################################################################
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
|