Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking on MAIN | |||
HPSSVTSensorSetup.java | +274 | added 1.1 |
Driver to configure SVT sensors for version 4pt0 of HPS detector
diff -N HPSSVTSensorSetup.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ HPSSVTSensorSetup.java 2 Feb 2012 06:24:04 -0000 1.1 @@ -0,0 +1,274 @@
+ +package org.lcsim.hps.recon.tracking; + +//--- Java ---// +import java.util.HashSet; +import java.util.Set; + +//--- HEP ---// +import hep.physics.matrix.BasicMatrix; +import hep.physics.vec.BasicHep3Vector; +import hep.physics.vec.VecOp; + +//--- org.lcsim ---// +import org.lcsim.detector.IDetectorElement; +import org.lcsim.detector.IRotation3D; +import org.lcsim.detector.ITranslation3D; +import org.lcsim.detector.RotationPassiveXYZ; +import org.lcsim.detector.Transform3D; +import org.lcsim.detector.Translation3D; +import org.lcsim.detector.solids.Box; +import org.lcsim.detector.solids.Polygon3D; +import org.lcsim.detector.solids.Trd; +import org.lcsim.detector.tracker.silicon.ChargeCarrier; +import org.lcsim.detector.tracker.silicon.SiSensor; +import org.lcsim.detector.tracker.silicon.SiStrips; +import org.lcsim.geometry.Detector; +import org.lcsim.util.Driver; + +/** + * + * @author Mathew Graham <[log in to unmask]> + * @author Omar Moreno <[log in to unmask]> + */ +public class HPSSVTSensorSetup extends Driver { + + String subdetectorName; + boolean debug = false; + + // Sensor Characteristics + private double readoutStripPitch = 0.060; // micro-m + private double senseStripPitch = 0.030; // micro-m + + private double readoutStripCapacitanceIntercept = 0; + private double readoutStripCapacitanceSlope = 0.16; // pf/cm + private double senseStripCapacitanceIntercept = 0; + private double senseStripCapacitanceSlope = 0.16; // pf/cm + + private double readoutTransferEfficiency = 0.986; + private double senseTransferEfficiency = 0.419; + + // Set of sensors + Set<SiSensor> sensors = new HashSet<SiSensor>(); + + /** + * Default Constructor (Not in use) + */ + private HPSSVTSensorSetup(){} + + /** + * + */ + public HPSSVTSensorSetup(String subdetectorName) + { + this.subdetectorName = subdetectorName; + } + + @Override + public void detectorChanged(Detector detector) + { + // Call the sub-Driver's detectorChanged methods. + super.detectorChanged(detector); + + if(subdetectorName == null){ + throw new RuntimeException("The subdetector name was not set!"); + } + + // Get the SVT + IDetectorElement detectorElement + = detector.getDetectorElement().findDetectorElement(subdetectorName); + + // Get all SVT sensors + sensors.addAll(detectorElement.findDescendants(SiSensor.class)); + if(debug) + System.err.println(this.getClass().getName() + ": Added " + sensors.size() + " sensors"); + + + // Configure the sensors + configureSensors(sensors); + } + + /** + * Configure the SVT sensors + * + * @param subdetector + */ + private void configureSensors(Set<SiSensor> sensors) + { + // Loop through all the sensors in the set + for(SiSensor sensor : sensors){ + + // Set the sensor Id + setSensorId(sensor); + + Box sensorSolid + = (Box) sensor.getGeometry().getLogicalVolume().getSolid(); + + Polygon3D pSide + = sensorSolid.getFacesNormalTo( + new BasicHep3Vector(0, 0, 1)).get(0); + Polygon3D nSide = sensorSolid.getFacesNormalTo( + new BasicHep3Vector(0, 0, -1)).get(0); + + // p side collects holes + sensor.setBiasSurface(ChargeCarrier.HOLE, pSide); + // n side collects electrons + sensor.setBiasSurface(ChargeCarrier.ELECTRON, nSide); + + // Translate to the outside of the box in order to setup + // electrodes + ITranslation3D electrodesPosition + = new Translation3D(VecOp.mult(-pSide.getDistance(), + pSide.getNormal())); + + // Align the strips with the edge of the sensor + IRotation3D electrodesRotation + = new RotationPassiveXYZ(0, 0, 0); + Transform3D electrodesTransform + = new Transform3D(electrodesPosition, electrodesRotation); + + // Set the number of readout and sense electrodes + SiStrips readoutElectrodes + = new SiStrips(ChargeCarrier.HOLE, readoutStripPitch, sensor, + electrodesTransform); + SiStrips senseElectrodes + = new SiStrips(ChargeCarrier.HOLE, senseStripPitch, + (readoutElectrodes.getNCells()*2-1), + sensor, electrodesTransform); + + System.out.println(this.getClass().getName() + ": The number of readout strips are " + readoutElectrodes.getNCells()); + System.out.println(this.getClass().getName() + ": The number of sense strips are " + senseElectrodes.getNCells()); + + // Set the strip capacitance + readoutElectrodes.setCapacitanceIntercept( + readoutStripCapacitanceIntercept); + readoutElectrodes.setCapacitanceSlope( + readoutStripCapacitanceSlope); + senseElectrodes.setCapacitanceIntercept( + senseStripCapacitanceIntercept); + senseElectrodes.setCapacitanceSlope( + senseStripCapacitanceSlope); + + // Set sense and readout electrodes + sensor.setSenseElectrodes(senseElectrodes); + sensor.setReadoutElectrodes(readoutElectrodes); + + // Set the charge transfer efficiency + double[][] transferEfficiencies + = {{readoutTransferEfficiency, senseTransferEfficiency}}; + sensor.setTransferEfficiencies(ChargeCarrier.HOLE, + new BasicMatrix(transferEfficiencies)); + } + } + + /** + * Set the SVT sensor ID. + * + * @param sensor + */ + private void setSensorId(SiSensor sensor) + { + // This is ugly but it works + String sensorParentNames + = sensor.getParent().getParent().getName(); + + String[] sensorDescriptions = sensorParentNames.split("_"); + + if(sensorDescriptions[1].matches("positive")){ + + // Get the layer number + int layerNumber + = Integer.parseInt(sensorDescriptions[2].substring(5)); + + if(debug) + System.out.println(this.getClass().getName() + ": layer number " + layerNumber); + + // Set the sensor ID + sensor.setSensorID(2*layerNumber - 2); + + if(debug) + System.out.println(this.getClass().getName() + ": sensor number " + sensor.getSensorID()); + + } else { + + // Get the layer number + int layerNumber + = Integer.parseInt(sensorDescriptions[3].substring(9)); + + if(debug) + System.out.println(this.getClass().getName() + ": layer number " + layerNumber); + + // Set the sensor ID + sensor.setSensorID(2*layerNumber - 1); + + if(debug) + System.out.println(this.getClass().getName() + ": sensor number " + sensor.getSensorID()); + + } + } + + /** + * Set the readout strip capacitance + * + * @param intercept + * @param slope + */ + public void setReadoutStripCapacitance(double intercept, double slope) + { + readoutStripCapacitanceIntercept = intercept; + readoutStripCapacitanceSlope = slope; + } + + /** + * Set the sense strip capacitance + * + * @param intercept + * @param slope + */ + public void setSenseStripCapacitance(double intercept, double slope) + { + senseStripCapacitanceIntercept = intercept; + senseStripCapacitanceSlope = slope; + } + + /** + * Set readout strip pitch + * + * @param strip pitch + */ + public void setReadoutStripPitch(double pitch) + { + readoutStripPitch = pitch; + } + + /** + * Set sense strip pitch + * + * @param strip pitch + */ + public void setSenseStripPitch(double pitch) + { + senseStripPitch = pitch; + } + + /** + * Set readout strip transfer efficiency + * + * @param efficiency + */ + public void setReadoutTransferEfficiency(double efficiency) + { + readoutTransferEfficiency = efficiency; + } + + /** + * Set sense strip transfer efficiency + * + * @param efficiency + */ + public void setSenseTransferEfficiency(double efficiency) + { + senseTransferEfficiency = efficiency; + } + +}
Use REPLY-ALL to reply to list
To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1