Commit in hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25 on MAIN | |||
HPSSiSensorReadout.java | +63 | -90 | 1.7 -> 1.8 |
Maps now make use of SiSensor instead sensor Id
diff -u -r1.7 -r1.8 --- HPSSiSensorReadout.java 10 Apr 2012 01:00:13 -0000 1.7 +++ HPSSiSensorReadout.java 21 Apr 2012 07:41:59 -0000 1.8 @@ -22,13 +22,10 @@
//--- org.lcsim ---//
-import org.lcsim.detector.IDetectorElement;
import org.lcsim.detector.tracker.silicon.ChargeCarrier; import org.lcsim.detector.tracker.silicon.SiSensor; import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
-import org.lcsim.detector.tracker.silicon.SiTrackerModule;
import org.lcsim.event.EventHeader;
-import org.lcsim.event.SimTrackerHit;
import org.lcsim.geometry.Detector; import org.lcsim.math.probability.Erf; import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeData;
@@ -44,30 +41,32 @@
import org.lcsim.hps.recon.tracking.apv25.HPSAPV25.APV25Channel.APV25AnalogPipeline; import org.lcsim.hps.recon.tracking.HPSDataProcessingModule; import org.lcsim.hps.recon.tracking.HPSRTM;
+import org.lcsim.hps.recon.tracking.HPSSVTDAQMaps;
import org.lcsim.hps.util.ClockSingleton; /**
+ * Class used to Readout HPS APV25's
* * @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSSiSensorReadout.java,v 1.7 2012/04/10 01:00:13 meeg Exp $
+ * @version $Id: HPSSiSensorReadout.java,v 1.8 2012/04/21 07:41:59 omoreno Exp $
*/
+
public class HPSSiSensorReadout extends Driver { // boolean debug = true;
+ + String subdetectorName = "tracker"; +
// Array to store the trigger time public static final List<Double> triggerTimeStamp = new ArrayList<Double>();
+
//
- List<String> processPaths = new ArrayList<String>(); - List<IDetectorElement> processDetectorElements = new ArrayList<IDetectorElement>();
List<String> readouts = new ArrayList<String>();
- // - Set<SiSensor> processSensors = new HashSet<SiSensor>(); - Set<SiTrackerModule> processModules = new HashSet<SiTrackerModule>();
+
// FIFO queue to store trigger times public Queue<Integer> triggerQueue;
- // # of strips per Si sensor - private static final int STRIPS_PER_SENSOR = 667;
+
private HPSAPV25 apv25; private SiSensorSim siSimulation; private HPSRTM rtm;
@@ -76,21 +75,26 @@
private static BinomialDistribution binomial = new BinomialDistributionImpl(1, 1); private static NormalDistribution gaussian = new NormalDistributionImpl(0.0, 1.0); private double noiseThreshold = 4; // e- RMS
+
// A map used to associate a sensor to the channels and analog pipelines // of the APV25s being used to readout the sensor
- public Map< Long /* sensor number */, Map<Integer /* channel */, APV25AnalogPipeline>> sensorToPipelineMap;
+ public Map<SiSensor /* sensor */, Map<Integer /* channel */, APV25AnalogPipeline> > sensorToPipelineMap; +
// A map used to associate an APV25 channel to its analog pipeline public Map<Integer /* channel */, APV25AnalogPipeline> analogPipelineMap;
+
// A map used to associate a sensor to the output of the APV25s being // used to readout the sensor
- public Map<Long, Map<Integer /* chip # */, double[]>> sensorToAnalogDataMap; - // A map used to associate a sensor to the digitzed output of the APV25s
+ public Map<SiSensor, Map<Integer /* chip # */, double[]>> sensorToAnalogDataMap; + + // A map used to associate a sensor to the digitized output of the APV25s
// being used to readout the sensor
- public Map<Long, Map<Integer /*chip # */, double[]>> sensorToDigitalDataMap;
+ public Map<SiSensor, Map<Integer /*chip # */, double[]>> sensorToDigitalDataMap;
+
// public Map<Integer, double[]> analogData; public Map<Integer, double[]> digitalData;
- public Map<Integer, List<SimTrackerHit>> eventToSimTrackerHitMap;
+
// protected AIDA aida = AIDA.defaultInstance(); public Profile1D pipe;
@@ -100,11 +104,10 @@
* Constructor */ public HPSSiSensorReadout() {
- sensorToPipelineMap = new HashMap<Long, Map<Integer, APV25AnalogPipeline>>(); - sensorToAnalogDataMap = new HashMap<Long, Map<Integer, double[]>>(); - sensorToDigitalDataMap = new HashMap<Long, Map<Integer, double[]>>(); - - eventToSimTrackerHitMap = new HashMap<Integer, List<SimTrackerHit>>();
+ + sensorToPipelineMap = new HashMap<SiSensor, Map<Integer, APV25AnalogPipeline>>(); + sensorToAnalogDataMap = new HashMap<SiSensor, Map<Integer, double[]>>(); + sensorToDigitalDataMap = new HashMap<SiSensor, Map<Integer, double[]>>();
//--- Sensor Simulation ---// //-------------------------//
@@ -119,8 +122,7 @@
apv25.setAPV25Mode("multi-peak"); // Set the APV25 analog pipeline sampling time apv25.setSamplingTime(24);
- -
+
// rtm = new HPSRTM(14);
@@ -140,9 +142,6 @@
// Specify the readouts to process readouts.add("TrackerHits");
- // Specify the detectors to process - processPaths.add("Tracker"); -
} /**
@@ -150,42 +149,39 @@
*/ @Override public void detectorChanged(Detector detector) {
+ // Call the sub-Drivfer's detectorChanged methods
super.detectorChanged(detector);
- // Proces detectors specified by path, otherwise process the entire - // detector - IDetectorElement detectorElement = detector.getDetectorElement(); - for (String detectorElementPath : processPaths) { - processDetectorElements.add( - detectorElement.findDetectorElement(detectorElementPath));
+ // Instantiate all maps + for(SiSensor sensor : HPSSVTDAQMaps.sensors){ + + sensorToPipelineMap.put(sensor, new HashMap<Integer, APV25AnalogPipeline>()); + + // Instantiate all analog pipelines + for(int channel = 0; channel < sensor.getReadoutElectrodes(ChargeCarrier.HOLE).getNCells(); channel++) + sensorToPipelineMap.get(sensor).put(channel, apv25.getChannel().new APV25AnalogPipeline()); + + if(debug) System.out.println(this.getClass().getSimpleName() + ": Sensor: " + sensor.getName() + + ": Number of Analog Pipelines: " + sensorToPipelineMap.get(sensor).size()); + + sensorToAnalogDataMap.put(sensor, new HashMap<Integer, double[]>()); + sensorToDigitalDataMap.put(sensor, new HashMap<Integer, double[]>());
}
- - if (processDetectorElements.isEmpty()) { - processDetectorElements.add(detectorElement); - } - - for (IDetectorElement dElement : processDetectorElements) { - processSensors.addAll(dElement.findDescendants(SiSensor.class)); - processModules.addAll( - dElement.findDescendants(SiTrackerModule.class));
+ } + + /** + * + */ + @Override + public void startOfData() { + // Set up readouts if they haven't been set + if (!readouts.isEmpty()) { + super.add(new SimTrackerHitReadoutDriver(readouts));
}
- // Initialize the sensor maps - for (SiSensor sensor : processSensors) { - - sensorToPipelineMap.put(sensor.getIdentifier().getValue(), - new HashMap<Integer, APV25AnalogPipeline>()); - for (int channel = 0; channel < STRIPS_PER_SENSOR; channel++) { - sensorToPipelineMap.get(sensor.getIdentifier().getValue()).put(channel, apv25.getChannel().new APV25AnalogPipeline()); - } - - sensorToAnalogDataMap.put(sensor.getIdentifier().getValue(), - new HashMap<Integer, double[]>()); - - sensorToDigitalDataMap.put(sensor.getIdentifier().getValue(), - new HashMap<Integer, double[]>());
+ super.startOfData(); + readouts.clear();
- }
} /**
@@ -198,14 +194,14 @@
super.process(event); if ((ClockSingleton.getTime() + ClockSingleton.getDt()) % 24 == 0) {
- for (Map.Entry<Long, Map<Integer, APV25AnalogPipeline>> sensor : sensorToPipelineMap.entrySet()) {
+ for (Map.Entry<SiSensor, Map<Integer, APV25AnalogPipeline>> sensor : sensorToPipelineMap.entrySet()) {
apv25.incrementAllPointerPositions(sensor.getValue()); } apv25.stepAPV25Clock(); } // Loop over all sensors
- for (SiSensor sensor : processSensors) {
+ for (SiSensor sensor : HPSSVTDAQMaps.sensors) {
// Readout the sensors readoutSensor(sensor); }
@@ -243,28 +239,6 @@
} }
- /** - * - */ - @Override - public void startOfData() { - // Set up readouts if they haven't been set - if (!readouts.isEmpty()) { - super.add(new SimTrackerHitReadoutDriver(readouts)); - } - - super.startOfData(); - readouts.clear(); - - } - - /** - * - * @param sensor - */ - public void makeRawHits(SiSensor sensor) { - readoutSensor(sensor); - }
/** * Readout the electrodes of an HPS Si sensor and inject the charge into
@@ -285,13 +259,11 @@
// If the sensor is capable of collecting the given charge carrier // then obtain the electrode data for the sensor if (sensor.hasElectrodesOnSide(carrier)) {
+
SiElectrodeDataCollection electrodeDataCol = electrodeDataMap.get(carrier);
- // If there is no electrode data available create a new - // instance of electode data - if (electrodeDataCol == null) { - electrodeDataCol = new SiElectrodeDataCollection(); - }
+ // If there is no electrode data available create a new instance of electrode data + if (electrodeDataCol == null) electrodeDataCol = new SiElectrodeDataCollection();
// Get the readout electrodes SiSensorElectrodes readoutElectrodes = sensor.getReadoutElectrodes(carrier);
@@ -300,7 +272,7 @@
addNoise(electrodeDataCol, readoutElectrodes); // Get the analog pipeline map associated with this sensor
- analogPipelineMap = sensorToPipelineMap.get(sensor.getIdentifier().getValue());
+ analogPipelineMap = sensorToPipelineMap.get(sensor);
// Loop over all channels for (Integer channel : electrodeDataCol.keySet()) {
@@ -340,7 +312,7 @@
} // Place the analog pipeline back into the sensor map
- sensorToPipelineMap.put(sensor.getIdentifier().getValue(), analogPipelineMap);
+ sensorToPipelineMap.put(sensor, analogPipelineMap);
// Clear the sensors of all deposited charge siSimulation.clearReadout();
@@ -351,18 +323,19 @@
*/ public void readoutAPV25() { // Readout all apv25s
- for (Map.Entry<Long, Map<Integer, APV25AnalogPipeline>> sensor : sensorToPipelineMap.entrySet()) {
+ for (Map.Entry<SiSensor, Map<Integer, APV25AnalogPipeline>> sensor : sensorToPipelineMap.entrySet()) {
sensorToAnalogDataMap.put(sensor.getKey(), apv25.APV25Multiplexer(sensor.getValue())); } // Digitize all signals
- for (Map.Entry<Long, Map<Integer, double[]>> sensor : sensorToAnalogDataMap.entrySet()) {
+ for (Map.Entry<SiSensor, Map<Integer, double[]>> sensor : sensorToAnalogDataMap.entrySet()) {
sensorToDigitalDataMap.put(sensor.getKey(), rtm.digitize(sensor.getValue())); } // Buffer the samples for further processing
+ //---> Needs to change!
dpm.addSample(sensorToDigitalDataMap);
-
+ //--->
} /**
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