4 modified files
hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
diff -u -r1.2 -r1.3
--- Apv25Full.java 13 Aug 2012 23:09:42 -0000 1.2
+++ Apv25Full.java 15 Aug 2012 02:52:59 -0000 1.3
@@ -13,32 +13,30 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: Apv25Full.java,v 1.2 2012/08/13 23:09:42 omoreno Exp $
+ * @version $Id: Apv25Full.java,v 1.3 2012/08/15 02:52:59 omoreno Exp $
*/
public class Apv25Full {
// APV25 trigger bit
- public static boolean triggerBit = false;
- // APV25 clock cycle
- public static int apv25ClockCycle = 0;
+ public static boolean readoutBit = false;
// APV25 Channels; An APV25 Readout Chip contains a total of 128 channels
- private APV25Channel[] channels = new APV25Channel[128];
+ private Apv25Channel[] channels = new Apv25Channel[128];
public Apv25Full(){
// Instantiate all APV25 channels
for(int channel = 0; channel < channels.length; channel++){
- channels[channel] = new APV25Channel();
+ channels[channel] = new Apv25Channel();
}
}
/**
* Return an instance of an APV25 channel
*
- * @return an instance of APV25Channel
+ * @return an instance of Apv25Channel
*/
- public APV25Channel getChannel(int channel){
+ public Apv25Channel getChannel(int channel){
return channels[channel];
}
@@ -54,7 +52,7 @@
// Only inject charge if the channel isn't bad
if(!this.getChannel(channel).isBadChannel()){
- // Shape the injected charge
+ // Shape the injected charge
this.getChannel(channel).shapeSignal(charge);
// Sample the resulting shaper signal
@@ -83,7 +81,7 @@
// Only readout the channel if the channel isn't bad
if(!this.getChannel(channel).isBadChannel()){
- data.setChannelData(channel, channels[channel].pipeline.readout());
+ data.setChannelData(channel, channels[channel].pipeline.readout());
}
}
return data;
@@ -92,10 +90,10 @@
//------------------------------------------//
// APV25 Channel //
//------------------------------------------//
- public class APV25Channel {
+ public class Apv25Channel {
- private APV25ShaperSignal shaperSignal;
- private APV25Pipeline pipeline;
+ private Apv25ShaperSignal shaperSignal;
+ private Apv25Pipeline pipeline = new Apv25Pipeline();
private double shapingTime = 50; // [ns]
private double baseline = 0;
@@ -105,7 +103,7 @@
/**
* Default Constructor
*/
- public APV25Channel(){
+ public Apv25Channel(){
}
/**
@@ -144,14 +142,21 @@
public boolean isBadChannel(){
return badChannel;
}
-
+
+ /**
+ *
+ */
+ public Apv25Pipeline getPipeline(){
+ return pipeline;
+ }
+
/**
* Shape the injected charge
*
* @param charge
*/
public void shapeSignal(double charge){
- shaperSignal = new APV25ShaperSignal(charge);
+ shaperSignal = new Apv25ShaperSignal(charge);
}
public void sampleShaperSignal(){
@@ -179,7 +184,7 @@
//-------------------------------------//
// APV25 Analog Pipeline //
//-------------------------------------//
- public class APV25Pipeline extends RingBuffer {
+ public class Apv25Pipeline extends RingBuffer {
// TODO: Possibly store the pipeline in the event
@@ -191,17 +196,17 @@
/**
* Constructor
*/
- public APV25Pipeline(){
+ public Apv25Pipeline(){
// Initialize the pipeline to the APV25 pipeline length
super(ANALOG_PIPELINE_LENGTH);
// Initialize the position of the trigger pointer to a random position
- this.ptr = (int) (Math.random()*(ANALOG_PIPELINE_LENGTH + 1));
+ this.ptr = (int) (Math.random()*ANALOG_PIPELINE_LENGTH);
// Set the position of the writer pointer
writerPointer = (ptr + triggerLatency)%ANALOG_PIPELINE_LENGTH;
- }
+ }
/**
*
@@ -251,12 +256,19 @@
analogPipeline += "] ";
return analogPipeline;
}
+
+ /**
+ *
+ */
+ public double getWriterPointerValue(){
+ return array[writerPointer];
+ }
}
//-----------------------------------//
// APV25 Shaper Signal //
//-----------------------------------//
- public class APV25ShaperSignal {
+ public class Apv25ShaperSignal {
// Shaper signal maximum amplitude
private double maxAmp = 0;
@@ -266,7 +278,7 @@
*
* @param charge: Charge injected into a channel
*/
- APV25ShaperSignal(double charge) {
+ Apv25ShaperSignal(double charge) {
// Find the maximum amplitude of the shaper signal
maxAmp = (charge/MIP)*FRONT_END_GAIN; // mV
}
hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
diff -u -r1.2 -r1.3
--- Apv25Constants.java 13 Aug 2012 23:09:42 -0000 1.2
+++ Apv25Constants.java 15 Aug 2012 02:52:59 -0000 1.3
@@ -3,7 +3,7 @@
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: Apv25Constants.java,v 1.2 2012/08/13 23:09:42 omoreno Exp $
+ * @version $Id: Apv25Constants.java,v 1.3 2012/08/15 02:52:59 omoreno Exp $
*/
public class Apv25Constants {
@@ -15,7 +15,7 @@
public static final int MIP = 25000; // electrons
// Time intervals at which an APV25 shaper signal is sampled at
- public static final double SAMPLING_INTERVAL = 25.0; // [ns]
+ public static final double SAMPLING_INTERVAL = 24.0; // [ns]
// The APV25 front end gain
public static final double FRONT_END_GAIN = 100.0; //
hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
diff -u -r1.2 -r1.3
--- SvtHalfModule.java 13 Aug 2012 23:09:42 -0000 1.2
+++ SvtHalfModule.java 15 Aug 2012 02:52:59 -0000 1.3
@@ -12,7 +12,7 @@
/**
*
* @author Omar Moreno
- * @version $Id: SvtHalfModule.java,v 1.2 2012/08/13 23:09:42 omoreno Exp $
+ * @version $Id: SvtHalfModule.java,v 1.3 2012/08/15 02:52:59 omoreno Exp $
*/
public class SvtHalfModule {
@@ -50,8 +50,11 @@
}
public Apv25Full getAPV25(int physicalChannel){
- int apv = (int) ((TOTAL_APV25_PER_HYBRID - 1) - Math.floor(physicalChannel/CHANNELS));
- return apv25[apv];
+ return apv25[this.getAPV25Number(physicalChannel)];
+ }
+
+ public int getAPV25Number(int physicalChannel){
+ return (int) ((TOTAL_APV25_PER_HYBRID - 1) - Math.floor(physicalChannel/CHANNELS));
}
public Apv25Full[] getAllApv25s(){
hps-java/src/main/java/org/lcsim/hps/recon/tracking/apv25
diff -u -r1.2 -r1.3
--- SvtReadout.java 13 Aug 2012 23:09:42 -0000 1.2
+++ SvtReadout.java 15 Aug 2012 02:52:59 -0000 1.3
@@ -15,19 +15,28 @@
import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
import org.lcsim.event.EventHeader;
import org.lcsim.geometry.Detector;
-import org.lcsim.hps.recon.tracking.SvtUtils;
-import org.lcsim.hps.util.ClockSingleton;
import org.lcsim.recon.tracking.digitization.sisim.CDFSiSensorSim;
import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeData;
import org.lcsim.recon.tracking.digitization.sisim.SiElectrodeDataCollection;
import org.lcsim.recon.tracking.digitization.sisim.SiSensorSim;
+import org.lcsim.recon.tracking.digitization.sisim.config.SimTrackerHitReadoutDriver;
import org.lcsim.util.Driver;
+//--- hps-java ---//
+import org.lcsim.hps.recon.tracking.SvtUtils;
+import org.lcsim.hps.util.ClockSingleton;
+
+//--- Constants ---//
+import static org.lcsim.hps.recon.tracking.apv25.Apv25Constants.SAMPLING_INTERVAL;
+import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_APV25_CHANNELS;
+import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_APV25_PER_HYBRID;
+import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_NUMBER_OF_SAMPLES;
+import static org.lcsim.hps.recon.tracking.HPSSVTConstants.TOTAL_STRIPS_PER_SENSOR;
/**
*
* @author Omar Moreno <[log in to unmask]>
- * @version $Id: SvtReadout.java,v 1.2 2012/08/13 23:09:42 omoreno Exp $
+ * @version $Id: SvtReadout.java,v 1.3 2012/08/15 02:52:59 omoreno Exp $
*/
public class SvtReadout extends Driver {
@@ -36,14 +45,25 @@
String apv25AnalogDataCollectioName = "APV25AnalogData";
// FIFO queue to store "local" triggers by time
private Queue<Double> triggerQueue = new LinkedList<Double>();
-
+ List<String> readouts = new ArrayList<String>();
double readoutDeadTime = 24; // ns
double lastTriggerTime = 0;
- boolean readingOut = false;
+ boolean debug = false;
public SvtReadout(){
+ // Load the driver which transfers SimTrackerHits to their
+ // corresponding sensor readout
+ readouts.add("TrackerHits");
+ add(new SimTrackerHitReadoutDriver(readouts));
+ }
+
+ /**
+ *
+ */
+ public void setDebug(boolean debug){
+ this.debug = debug;
}
/**
@@ -56,7 +76,7 @@
// Instantiate all SVT Half modules
for(SiSensor sensor : SvtUtils.getInstance().getSensors()){
halfModules.add(new SvtHalfModule(sensor));
- }
+ }
}
/**
@@ -67,11 +87,15 @@
super.process(event);
// Increment all trigger pointer and writer positions when necessary
- if((ClockSingleton.getTime() + ClockSingleton.getDt()) % 25 == 0){
- for(SvtHalfModule halfModule : halfModules){
+ if((ClockSingleton.getTime() + ClockSingleton.getDt()) % SAMPLING_INTERVAL == 0){
+ if(debug){
+ System.out.println(this.getClass().getSimpleName() + ": Time: " + (ClockSingleton.getTime() + ClockSingleton.getDt()));
+ System.out.println(this.getClass().getSimpleName() + ": Incrementing trigger positions");
+ }
+
+ for(SvtHalfModule halfModule : halfModules){
halfModule.incrementPointerPositions();
}
- Apv25Full.apv25ClockCycle++;
}
// Create a list to hold the analog data
@@ -84,10 +108,12 @@
// If an Ecal trigger is received, generate six local triggers in order to read out six
// samples
- if(Apv25Full.triggerBit){
+ if(Apv25Full.readoutBit){
- Apv25Full.triggerBit = false;
+ Apv25Full.readoutBit = false;
+ if(debug) System.out.println(this.getClass().getSimpleName() + ": APVs have been triggered!");
+
// An APV25 cannot receive a trigger while it's still reading out samples;
// drop the trigger
// TODO: Verify that the APV25 readout time is approx. 24 ns
@@ -95,22 +121,24 @@
lastTriggerTime = ClockSingleton.getTime();
- for(int sample = 0; sample < 6; sample++){
+ for(int sample = 0; sample < TOTAL_NUMBER_OF_SAMPLES; sample++){
// Add the time at which each of the six samples should be collected
// the trigger queue
triggerQueue.offer(ClockSingleton.getTime() + sample*ClockSingleton.getDt()*2);
}
-
- readingOut = true;
- }
+ } else if(debug) System.out.println(this.getClass().getSimpleName() + ": Trigger has been dropped!");
}
// Process any triggers in the queue
if(triggerQueue.peek() != null){
if(triggerQueue.peek() == ClockSingleton.getTime()){
- // Clear the analog data and readout all APV25's
+ if(debug){
+ System.out.println(this.getClass().getSimpleName() + ": Reading out sample " + (TOTAL_NUMBER_OF_SAMPLES - triggerQueue.size()));
+ System.out.println(this.getClass().getSimpleName() + ": " + triggerQueue.toString());
+ }
+ // Clear the analog data and readout all APV25's
analogData.addAll(this.readoutAPV25s());
triggerQueue.remove();
}
@@ -147,16 +175,20 @@
}
// Loop over all sensor channels
- for(Integer channel : electrodeDataCol.keySet()){
+ for(Integer physicalChannel : electrodeDataCol.keySet()){
// Get the electrode data for this channel
- SiElectrodeData electrodeData = electrodeDataCol.get(channel);
+ SiElectrodeData electrodeData = electrodeDataCol.get(physicalChannel);
// Get the charge in units of electrons
double charge = electrodeData.getCharge();
+ // find the APV channel number from the physical channel
+ int channel = physicalChannel - TOTAL_STRIPS_PER_SENSOR
+ + halfModule.getAPV25Number(physicalChannel)*TOTAL_APV25_CHANNELS + (TOTAL_APV25_CHANNELS - 1);
+
// Inject the charge into the APV25 amplifier chain
- halfModule.getAPV25(channel).injectCharge(channel, charge);
+ halfModule.getAPV25(physicalChannel).injectCharge(channel, charge);
}
}
}
@@ -183,7 +215,6 @@
// Readout all APV25's
for(int apvN = 0; apvN < apv25.length; apvN++){
-
Apv25AnalogData analogDatum = apv25[apvN].readOut();
analogDatum.setSensor(sensor);
analogDatum.setApv(apvN);
CVSspam 0.2.12