hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
diff -u -r1.5 -r1.6
--- HPSAPV25.java 11 Apr 2012 23:57:12 -0000 1.5
+++ HPSAPV25.java 21 Apr 2012 07:39:18 -0000 1.6
@@ -15,7 +15,7 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: HPSAPV25.java,v 1.5 2012/04/11 23:57:12 meeg Exp $
+ * @version $Id: HPSAPV25.java,v 1.6 2012/04/21 07:39:18 omoreno Exp $
*/
public class HPSAPV25 {
@@ -27,21 +27,27 @@
private static final double APV25_NOISE_INTERCEPT_DECON = 396; //e- RMS
private static final double APV25_NOISE_SLOPE_PEAK = 36; // e- rms/pF
private static final double APV25_NOISE_SLOPE_DECON = 59.4; // e- rms/pF
+
// Number of electron-hole pairs created by a min. ionizing particle
// in 300 micrometers of Si
private static final int MIP = 25000; // electron-hole pairs
+
// Total number of channels per APV25 chip
private static final int APV25_CHANNELS = 128;
+
// APV25 trigger bit
public static boolean triggerBit = false;
+
//
private int apv25ShapingTime = 35; // [ns]
private int apv25SamplingTime = 24; // [ns]
private double analogDCLevel = 0; // [mA] (Pedestal)
public int apv25ClockCycle = 0;
private String apv25Mode = "multi-peak";
+
// APV25 Channel
private APV25Channel channel;
+
// Histograms
protected AIDA aida = AIDA.defaultInstance();
@@ -110,9 +116,8 @@
* @param charge : Total charge being injected
* @param pipeline : Analog pipeline associated with a channel
*/
- public void injectCharge(double charge,
- double noiseRMS,
- APV25AnalogPipeline pipeline) {
+ public void injectCharge(double charge, double noiseRMS, APV25AnalogPipeline pipeline) {
+
// Shape the injected charge
getChannel().shapeSignal(charge);
@@ -126,14 +131,12 @@
*
* @param analogPipelineMap :
*/
- public void incrementAllPointerPositions(
- Map<Integer, APV25AnalogPipeline> analogPipelineMap) {
+ public void incrementAllPointerPositions(Map<Integer, APV25AnalogPipeline> analogPipelineMap) {
// Loop through all of the channels and increment the position of
// all the trigger and writer pointers
for (Map.Entry<Integer, APV25AnalogPipeline> entry : analogPipelineMap.entrySet()) {
entry.getValue().step();
}
-
}
/**
@@ -164,21 +167,15 @@
double[] output;
// Create the data streams
- for (int chipIndex = 0;
- chipIndex < Math.ceil((double) pipelineMap.size() / APV25_CHANNELS);
- chipIndex++) {
-
+ for (int chipIndex = 0; chipIndex < Math.ceil((double) pipelineMap.size() / APV25_CHANNELS); chipIndex++) {
apv25Map.put(chipIndex, createOutputArray(apv25Address, -4));
}
// Loop over all channels and readout the cells which the
// trigger pointer points to
for (int channelN = 0; channelN < pipelineMap.size(); channelN++) {
-
output = apv25Map.get((int) Math.floor(channelN / APV25_CHANNELS));
-
output[channelN % 128 + 12] += (pipelineMap.get(channelN).readOut() / APV25_FRONT_END_GAIN) * APV25_MULTIPLEXER_GAIN + analogDCLevel;
-
}
return apv25Map;
}
@@ -239,14 +236,9 @@
* @return noise in electrons
*/
public double computeNoise(double capacitance) {
- if (apv25Mode.equals("peak")
- || apv25Mode.equals("multi-peak")) {
- return APV25_NOISE_INTERCEPT_PEAK
- + APV25_NOISE_SLOPE_PEAK * capacitance;
- } else {
- return APV25_NOISE_INTERCEPT_DECON
- + APV25_NOISE_SLOPE_DECON * capacitance;
- }
+ if (apv25Mode.equals("peak") || apv25Mode.equals("multi-peak"))
+ return APV25_NOISE_INTERCEPT_PEAK + APV25_NOISE_SLOPE_PEAK * capacitance;
+ else return APV25_NOISE_INTERCEPT_DECON + APV25_NOISE_SLOPE_DECON * capacitance;
}
/**
@@ -272,19 +264,12 @@
// Sample the shaper signal
double sample = shaperSignal.getAmplitudeAtTime(sample_time);
- // Only add the value into the buffer if it is greater than
- // the noise threshold. Note that this isn't done within
- // the apv25, however, it will clean up the signal a bit
- // for simulation purposes
- // This should be done by the data processing module
- //if( sample > 0.0001 /*(1*noiseRMS/MIP)*APV25_FRONT_END_GAIN)*/) {
pipeline.addToCell(cell, sample);
- //}
}
}
//-----------------------------------//
- //--- APV25 Shaper Signal ---//
+ //--- APV25 Shaper Signal ---//
//-----------------------------------//
/**
*
@@ -315,9 +300,7 @@
* sampled
*/
private double getAmplitudeAtTime(double time) {
-
- return maxAmp * (Math.max(0, time) / apv25ShapingTime) * Math.exp(
- 1 - (time / apv25ShapingTime));
+ return maxAmp * (Math.max(0, time) / apv25ShapingTime) * Math.exp(1 - (time / apv25ShapingTime));
}
}
@@ -328,9 +311,7 @@
public class APV25AnalogPipeline extends RingBuffer {
private int _trigger_latency = (int) Math.floor(220 / apv25SamplingTime);
- public APV25AnalogPipeline() {
- super(ANALOG_PIPELINE_LENGTH);
- }
+ public APV25AnalogPipeline() { super(ANALOG_PIPELINE_LENGTH); }
/**
* Set the trigger latency