GeomConverter/src/org/lcsim/detector/converter/compact
diff -N EcalCrystal.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ EcalCrystal.java 16 Oct 2013 23:11:45 -0000 1.1
@@ -0,0 +1,174 @@
+package org.lcsim.detector.converter.compact;
+
+import org.lcsim.detector.DetectorElement;
+import org.lcsim.detector.IDetectorElement;
+import org.lcsim.detector.identifier.IIdentifier;
+
+/**
+ * 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]>
+ */
+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;
+
+ /**
+ * Class constructor.
+ * @param name The name of the DetectorElement.
+ * @param parent The parent component.
+ * @param path The physical path.
+ * @param id The component's ID.
+ */
+ 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 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 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;
+ }
+
+ /**
+ * Get the X index of this crystal.
+ * @return The X index of this crystal.
+ */
+ public int getX() {
+ return getIdentifierHelper().getValue(getIdentifier(), "ix");
+ }
+
+ /**
+ * Get the Y index of this crystal.
+ * @return The Y index of this crystal.
+ */
+ public int getY() {
+ return getIdentifierHelper().getValue(getIdentifier(), "iy");
+ }
+
+ /**
+ * Reset the time dependent conditions. This will NOT reset
+ * hardware information as it is considered fixed once set.
+ */
+ public void reset() {
+ badChannel = false;
+ pedestal = Double.NaN;
+ noise = Double.NaN;
+ gain = Double.NaN;
+ }
+}
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.4 -r1.5
--- HPSEcal3Converter.java 11 Jun 2012 22:32:04 -0000 1.4
+++ HPSEcal3Converter.java 16 Oct 2013 23:11:45 -0000 1.5
@@ -10,7 +10,6 @@
import org.jdom.DataConversionException;
import org.jdom.Element;
-import org.lcsim.detector.DetectorElement;
import org.lcsim.detector.ILogicalVolume;
import org.lcsim.detector.IPhysicalVolume;
import org.lcsim.detector.IRotation3D;
@@ -107,11 +106,11 @@
Element layout;
double beamgap;
int nx, ny;
- double dface;
- double tdx, tdy, tdz;
+ double dface;
+ double tdx, tdy, tdz;
double bdx, bdy, bdz;
tdx = tdy = tdz = bdx = bdy = bdz = 0.;
-
+
try {
dx1 = dimensions.getAttribute("x1").getDoubleValue();
dx2 = dimensions.getAttribute("x2").getDoubleValue();
@@ -125,7 +124,7 @@
nx = layout.getAttribute("nx").getIntValue();
ny = layout.getAttribute("ny").getIntValue();
dface = layout.getAttribute("dface").getDoubleValue();
-
+
Element topElement = layout.getChild("top");
Element bottomElement = layout.getChild("bottom");
if (topElement != null) {
@@ -313,16 +312,11 @@
/**
* Create a DetectorElement for an ECal crystal.
*
- * @param detector
- * The full detector.
- * @param subdet
- * The subdetector.
- * @param crystal
- * The crystal physical volume.
- * @param ix
- * The value of the ix field.
- * @param iy
- * The value of the iy field.
+ * @param detector The full detector.
+ * @param subdet The subdetector.
+ * @param crystal The crystal physical volume.
+ * @param ix The value of the ix field.
+ * @param iy The value of the iy field.
*/
private final void createDetectorElement(Detector detector, Subdetector subdet, IPhysicalVolume crystal, int ix, int iy) {
final String path = "/" + crystal.getName();
@@ -331,7 +325,7 @@
expId.setValue(dict.getFieldIndex("ix"), ix);
expId.setValue(dict.getFieldIndex("iy"), iy);
final IIdentifier id = helper.pack(expId);
- new DetectorElement(subdet.getName() + "_crystal" + crystal.getCopyNumber(), subdet.getDetectorElement(), path, id);
+ new EcalCrystal(subdet.getName() + "_crystal" + crystal.getCopyNumber(), subdet.getDetectorElement(), path, id);
}
public Class getSubdetectorType() {