lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.1 -r1.2
--- CDFSiSensorSim.java 24 Apr 2009 01:22:58 -0000 1.1
+++ CDFSiSensorSim.java 13 May 2009 15:15:50 -0000 1.2
@@ -196,7 +196,7 @@
// Set up segments
double segment_length = track.getLength()/nsegments;
double segment_charge = track.getEloss()/nsegments/_sensor.getBulk().ENERGY_EHPAIR;
-
+
// System.out.println("length of subsegments: " + segment_length);
// System.out.println("subsegment charge: " + segment_charge);
@@ -408,22 +408,33 @@
// System.out.println("Position: "+local_position);
- double carrier_mobility = _sensor.getBulk().mobility(carrier);
// System.out.println("Carrier: "+carrier);
-
+
+ // Get the magnetic field - already in Si units (Tesla)
Hep3Vector b_field = _sensor.getBField(local_position);
// System.out.println("B field: "+b_field);
-
- Hep3Vector e_field = _sensor.electricField(local_position);
+
+ // Get the electric field and convert from V/mm to Si units (V/m)
+ Hep3Vector e_field = VecOp.mult(1000., _sensor.electricField(local_position));
// System.out.println("E field: "+e_field);
-
- double tan_lorentz = _sensor.getBulk().tanLorentzAngle(b_field.magnitude(), carrier);
-
-// System.out.println("Tan lorentz: "+tan_lorentz);
-
- Hep3Vector drift_direction = VecOp.mult(carrier.charge(),VecOp.unit(VecOp.add(
- e_field,VecOp.mult(tan_lorentz, VecOp.cross(e_field,VecOp.unit(b_field)))
- )));
+
+ // Get the mobility and convert from cm^2/V/s to Si units of m^2/V/s
+ double mobility = 1.0e-4 * _sensor.getBulk().mobility(carrier);
+
+ // Get the charge (to be consistent with mobility, this should be in units of e)
+ double qmu = carrier.charge() * mobility;
+// System.out.println("mobility: "+mobility+" charge: "+qmu/mobility;
+
+ // Calculate the velocity parallel to the E field vpar = q * mu * E
+ Hep3Vector vpar = VecOp.mult(qmu, e_field);
+// System.out.println("vpar: "+vpar);
+
+ // Calculate the velocity perpendicular to the E field vperp = q^2 * mu^2 * E x B
+ Hep3Vector vperp = VecOp.mult(qmu*qmu, VecOp.cross(e_field, b_field));
+// System.out.println("vperp: "+vperp);
+
+ // Calculate a unit vector in the drift direction
+ Hep3Vector drift_direction = VecOp.unit(VecOp.add(vpar, vperp));
// System.out.println("Drift direction: "+drift_direction);
lcsim/src/org/lcsim/recon/tracking/digitization/sisim
diff -u -r1.3 -r1.4
--- GenericReadoutChip.java 7 May 2009 22:36:21 -0000 1.3
+++ GenericReadoutChip.java 13 May 2009 15:15:51 -0000 1.4
@@ -126,7 +126,7 @@
// return the digitized charge data as a map that associates a hit
// channel with a list of raw data for the channel
- return digitize(data);
+ return digitize(data, electrodes);
}
/**
@@ -168,7 +168,8 @@
* @param data electrode data collection
* @return map associating channels with a list of raw data
*/
- private SortedMap<Integer, List<Integer>> digitize(SiElectrodeDataCollection data) {
+ private SortedMap<Integer, List<Integer>> digitize(SiElectrodeDataCollection data,
+ SiSensorElectrodes electrodes) {
// Create the map that associates a given sensor channel with it's list of raw data
SortedMap<Integer, List<Integer>> chip_data = new TreeMap<Integer, List<Integer>>();
@@ -179,8 +180,36 @@
// Fetch the electrode data for this channel
SiElectrodeData eldata = data.get(channel);
+ // Get the charge in units of electrons
+ double charge = eldata.getCharge();
+
+ // If the charge is below the neighbor threshold, don't digitize it
+ if (charge < _neighbor_threshold) continue;
+
+ // If charge is between neighbor and noise thresholds, check it's neighbors
+ if (charge < _noise_threshold) {
+
+ // Loop over neighbors and look for a neighbor with charge above the noise
+ boolean nbrhit = false;
+ for (Integer nbr : electrodes.getNearestNeighborCells(channel)) {
+
+ // See if we have electrode data for this neighbor
+ SiElectrodeData nbrdata = data.get(nbr);
+ if (nbrdata == null) continue;
+
+ // See if we have found a neigbor above the noise threshold
+ if (nbrdata.getCharge() >= _noise_threshold) {
+ nbrhit = true;
+ break;
+ }
+ }
+
+ // If there were no neighbor channels above threshold, don't digitize it
+ if (!nbrhit) continue;
+ }
+
// Calculate the ADC value for this channel and make sure it is positive
- int adc = getChannel(channel).computeAdcValue(eldata);
+ int adc = getChannel(channel).computeAdcValue(charge);
if (adc <= 0) {
continue;
}
@@ -394,10 +423,7 @@
* @param data electrode data
* @return charge
*/
- private int computeAdcValue(SiElectrodeData data) {
-
- // Get the charge in units of electrons
- double charge = data.getCharge();
+ private int computeAdcValue(double charge) {
// Convert from electrons to ADC counts (1 electron = 1.6 x 10^-4 fC)
int adc = (int) Math.floor(charge * 1.6e-4 * _adc_per_fC);