6 added + 5 removed, total 11 files
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N CDFSiSensorSim.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ CDFSiSensorSim.java 18 May 2007 21:59:23 -0000 1.1
@@ -0,0 +1,310 @@
+/*
+ * CDFSiSensorSim.java
+ *
+ * Created on May 10, 2007, 3:03 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.SiStripSim;
+
+
+import org.lcsim.detector.tracker.silicon.ErrorEllipse2D;
+import org.lcsim.event.SimTrackerHit;
+
+import org.lcsim.detector.Rotation3D;
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.ChargeCarrier;
+
+import hep.physics.vec.Hep3Vector;
+import hep.physics.vec.BasicHep3Vector;
+import hep.physics.vec.VecOp;
+
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+
+import java.util.Map;
+import java.util.EnumMap;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ *
+ * @author tknelson
+ */
+public class CDFSiSensorSim implements SiSensorSim
+{
+
+ // Fields
+ SiSensor _sensor = null;
+ Map<ChargeCarrier,Hep3Vector> _drift_direction = null;
+ Map<ChargeCarrier,SortedMap<Integer,SiElectrodeData>> _sense_data = null;
+ Map<ChargeCarrier,SortedMap<Integer,SiElectrodeData>> _readout_data = null;
+
+// SiElectrodeSim
+
+ // Static parameters - not intended to be user modifiable
+ private static double _DEPOSITION_GRANULARITY = 0.10; // 10% of pitch or depleted thickness
+
+
+ /**
+ * Creates a new instance of CDFSiSensorSim
+ */
+ public CDFSiSensorSim()
+ {
+ _drift_direction = new EnumMap<ChargeCarrier,Hep3Vector>(ChargeCarrier.class);
+ _sense_data = new EnumMap<ChargeCarrier,SortedMap<Integer,SiElectrodeData>>(ChargeCarrier.class);
+ _readout_data = new EnumMap<ChargeCarrier,SortedMap<Integer,SiElectrodeData>>(ChargeCarrier.class);
+ for (ChargeCarrier carrier : ChargeCarrier.values())
+ {
+ _sense_data.put(carrier,new TreeMap<Integer,SiElectrodeData>());
+ _readout_data.put(carrier,new TreeMap<Integer,SiElectrodeData>());
+ }
+ }
+
+ // Implementation of SiSensorSim interface
+ //==================================
+
+ // Get charge map on electrodes
+ public SortedMap<Integer,SiElectrodeData> getReadoutData(ChargeCarrier carrier)
+ {
+ return _readout_data.get(carrier);
+ }
+
+ // Simulate charge deposition
+ public void simulate(SiSensor sensor)
+ {
+ _sensor = sensor;
+ depositChargeOnSense();
+ transferChargeToReadout();
+ }
+
+ private void depositChargeOnSense()
+ {
+
+ List<SimTrackerHit> hits = _sensor.getReadout().getHits(SimTrackerHit.class);
+
+ for (SimTrackerHit hit : hits)
+ {
+
+ int nsegments = 0;
+
+ // Compute number of segments
+ for (ChargeCarrier carrier : ChargeCarrier.values())
+ {
+ _drift_direction.put( carrier, this.driftDirection(carrier,new BasicHep3Vector(0.0,0.0,0.0)) );
+ if (_sensor.hasElectrodesOnSide(carrier))
+ {
+ nsegments = Math.max(nsegments,nSegments(hit,carrier, _DEPOSITION_GRANULARITY));
+ }
+ }
+
+ // Set up segments
+ double segment_length = hit.getPathLength()/nsegments;
+ double segment_charge = hit.getdEdx()/nsegments/_sensor.getBulk().ENERGY_EHPAIR;
+
+ Hep3Vector segment_step = VecOp.mult(segment_length,VecOp.unit( new BasicHep3Vector(hit.getMomentum()) ));
+ Hep3Vector segment_center = VecOp.add( new BasicHep3Vector(hit.getStartPoint()), VecOp.mult(0.5,segment_step) );
+
+ // Loop over segments
+ for (int iseg = 0; iseg < nsegments; iseg++)
+ {
+ // FIXME: Add correct straggling treatment for thin layers
+
+ // loop over sides of detector
+ for (ChargeCarrier carrier : ChargeCarrier.values())
+ {
+ if (_sensor.hasElectrodesOnSide(carrier))
+ {
+ Rotation3D sensor_to_electrodes = new Rotation3D();
+ sensor_to_electrodes.setPassiveXYZ(0.0,0.0,-_sensor.getElectrodeAngle(carrier));
+
+ Hep3Vector electrode_drift_destination = VecOp.mult(sensor_to_electrodes.getRotationMatrix(),driftDestination(segment_center,carrier));
+ ErrorEllipse2D electrode_charge_distribution = diffusionEllipse(segment_center,carrier).rotate(-_sensor.getElectrodeAngle(carrier));
+
+ Map<Integer,Integer> sense_charge = _sensor.getElectrodes(carrier).
+ computeElectrodeData(segment_charge,electrode_drift_destination,electrode_charge_distribution);
+
+ for (Integer strip : sense_charge.keySet())
+ {
+ if (!_sense_data.get(carrier).containsKey(strip))
+ {
+ _sense_data.get(carrier).put(strip,new SiElectrodeData());
+ }
+ _sense_data.get(carrier).get(strip).add(sense_charge.get(strip),hit);
+ }
+
+
+
+// _sense_data.get(carrier).
+// add(_sensor.getElectrodes(carrier).computeElectrodeData(segment_charge,electrode_drift_destination,electrode_charge_distribution));
+
+
+// _electrodes.get(carrier).depositCharge(segment_charge,electrode_drift_destination,electrode_charge_distribution);
+
+ }
+ }
+
+ // step to next segment
+ segment_center = VecOp.add(segment_center, segment_step);
+ }
+
+ }
+
+ }
+
+ private void transferChargeToReadout()
+ {
+ for (ChargeCarrier carrier : ChargeCarrier.values())
+ {
+// _transfer_model.transferCharge(_sensor.getElectrodes(carrier)
+ }
+
+ }
+
+
+ private int nSegments(SimTrackerHit hit, ChargeCarrier carrier, double deposition_granularity)
+ {
+ // Decide how to cut track into pieces as a fraction of strip pitch
+ int nsegments = 0;
+ if (!_sensor.hasElectrodesOnSide(carrier)) return nsegments;
+
+ // Construct endpoints for charge deposition
+ Hep3Vector p1 = new BasicHep3Vector(hit.getStartPoint());
+ Hep3Vector p2 = new BasicHep3Vector(hit.getEndPoint());
+
+
+// System.out.println("Track P1: " + track.getP1());
+// System.out.println("Track P2: " + track.getP2());
+// System.out.println("Drift Destination of P1: " + driftDestination(track.getP1(),carrier));
+// System.out.println("Drift Destination of P2: " + driftDestination(track.getP2(),carrier));
+
+ nsegments = (int)Math.ceil(VecOp.sub(p2,p1).z()/(_sensor.getThickness()*deposition_granularity));
+
+ Hep3Vector deposition_line = VecOp.sub( driftDestination(p2,carrier), driftDestination(p1,carrier) );
+
+ int naxes = _sensor.getElectrodes(carrier).getNAxes();
+ for (int iaxis = 0; iaxis < naxes; iaxis++)
+ {
+ double projected_deposition_length = Math.abs(VecOp.dot(deposition_line,_sensor.getMeasuredCoordinates(carrier)[iaxis]));
+
+// System.out.println("Projected deposition Length: " + projected_deposition_length);
+
+ int required_segments = (int)Math.ceil(projected_deposition_length/
+ (deposition_granularity*_sensor.getElectrodes(carrier).getPitch(iaxis)));
+ nsegments = Math.max(nsegments,required_segments);
+ }
+ return nsegments;
+ }
+
+
+ private Hep3Vector driftDestination(Hep3Vector origin, ChargeCarrier carrier)
+ {
+// System.out.println("Beginning driftDestination");
+ return VecOp.add(origin,driftVector(origin, carrier));
+ }
+
+ private Hep3Vector driftVector(Hep3Vector origin, ChargeCarrier carrier)
+ {
+// System.out.println("Beginning driftVector");
+ double drift_vector_scale = _sensor.distanceFromSide(origin,carrier)/_drift_direction.get(carrier).z();
+ return VecOp.mult(drift_vector_scale,_drift_direction.get(carrier));
+ }
+
+ private Hep3Vector driftDirection(ChargeCarrier carrier, Hep3Vector local_position)
+ {
+// System.out.println("Beginning driftDirection");
+
+// System.out.println("Position: "+local_position);
+
+ double carrier_mobility = _sensor.getBulk().mobility(carrier);
+// System.out.println("Carrier: "+carrier);
+
+ Hep3Vector b_field = _sensor.getBField(local_position);
+// System.out.println("B field: "+b_field);
+
+ Hep3Vector e_field = _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)))
+ )));
+
+// System.out.println("Drift direction: "+drift_direction);
+
+ return drift_direction;
+
+ }
+
+
+ private ErrorEllipse2D diffusionEllipse(Hep3Vector point, ChargeCarrier carrier)
+ {
+
+ // Common factors
+ double difference_V = _sensor.getBiasVoltage() - _sensor.getDepletionVoltage();
+ double sum_V = _sensor.getBiasVoltage() + _sensor.getDepletionVoltage();
+ double common_factor = 2.0*_sensor.distanceFromSide(point,carrier)*_sensor.getDepletionVoltage()/_sensor.getThickness();
+
+// System.out.println("sum_V: "+sum_V);
+// System.out.println("common_factor: "+common_factor);
+
+ // Calculate charge spreading without magnetic field
+ double sigmasq = _sensor.getBulk().K_BOLTZMANN * _sensor.getBulk().getTemperature() *
+ _sensor.getThickness()*_sensor.getThickness() / _sensor.getDepletionVoltage();
+ if (_sensor.getBulk().isNtype() == (carrier==ChargeCarrier.HOLE))
+ {
+ sigmasq *= Math.log( sum_V / (sum_V - common_factor));
+ }
+ else
+ {
+ sigmasq *= Math.log( (difference_V + common_factor) / difference_V );
+ }
+
+ double sigma = Math.sqrt(sigmasq);
+
+// System.out.println("Sigma: "+sigma);
+
+ // Corrections for magnetic field -- this is an approximation, may have to be done better for high fields
+ double cos_theta_lorentz = VecOp.cosTheta(_drift_direction.get(carrier));
+ double phi_lorentz = VecOp.phi(_drift_direction.get(carrier));
+ double phi_electrode = _sensor.getElectrodeAngle(carrier);
+
+ double minor_axis = sigma*(1.0/cos_theta_lorentz); // drift time correction
+ double major_axis = minor_axis*(1.0/cos_theta_lorentz); // + drift angle correction
+ double phi_ellipse = -phi_electrode; // orientation of ellipse, relative to electrode coordinates
+
+// System.out.println("Minor axis: "+minor_axis);
+// System.out.println("Major axis: "+major_axis);
+
+ // Create error ellipse
+ return new ErrorEllipse2D(major_axis, minor_axis, phi_ellipse);
+
+ }
+
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N SiElectrodeData.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SiElectrodeData.java 18 May 2007 21:59:23 -0000 1.1
@@ -0,0 +1,37 @@
+/*
+ * SiElectrodeData.java
+ *
+ * Created on May 11, 2007, 1:16 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.SiStripSim;
+
+import org.lcsim.event.SimTrackerHit;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ *
+ * @author tknelson
+ */
+public class SiElectrodeData
+{
+ int _charge = 0;
+ List<SimTrackerHit> _simulated_hits = new ArrayList<SimTrackerHit>();
+
+ /** Creates a new instance of SiElectrodeData */
+ public SiElectrodeData()
+ {
+ }
+
+ public void add(int charge, SimTrackerHit simulated_hit)
+ {
+ _charge += charge;
+ _simulated_hits.add(simulated_hit);
+ }
+
+}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N SiSensorSim.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SiSensorSim.java 18 May 2007 21:59:24 -0000 1.1
@@ -0,0 +1,28 @@
+/*
+ * SiSensorSim.java
+ *
+ * Created on May 9, 2007, 2:02 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.SiStripSim;
+
+import org.lcsim.detector.tracker.silicon.SiSensor;
+import org.lcsim.detector.tracker.silicon.ChargeCarrier;
+
+import java.util.SortedMap;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface SiSensorSim
+{
+ // process a sensor
+ void simulate(SiSensor sensor);
+
+ // get charge maps for this sensor
+ SortedMap<Integer,SiElectrodeData> getReadoutData(ChargeCarrier carrier);
+}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N RawKpixHit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ RawKpixHit.java 18 May 2007 21:59:24 -0000 1.1
@@ -0,0 +1,66 @@
+/*
+ * RawKpixHit.java
+ *
+ * Created on May 7, 2007, 11:18 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.SiStripSim;
+
+import org.lcsim.event.RawTrackerHit;
+import org.lcsim.event.SimTrackerHit;
+
+import java.util.List;
+
+/**
+ *
+ * @author tknelson
+ */
+public class RawKpixHit// implements RawTrackerHit
+{
+
+ // Fields
+ double _time;
+ long _cellid;
+ short _adc;
+ List<SimTrackerHit> _simulated_hits;
+
+ /** Creates a new instance of RawKpixHit */
+ public RawKpixHit()
+ {
+ }
+
+ // Accessors
+ /**
+ * Returns a time measurement associated with the adc values.
+ * E.g. the t0 of the spectrum for the TPC. Subdetector dependent.
+ */
+// public int getTime();
+ /**
+ * Returns the detector specific cell id.
+ */
+// public long getCellID();
+ /**
+ * Returns the array of ADCValues.
+ * The array may be of length 1 if this detector only reads out a single value per cell.
+ * The value may also need decoding (for example the KPiX chip uses one bit as a
+ * range indicator).
+ */
+// public short[] getADCValues();
+
+ /** Returns the IDDecoder associated with this hit */
+// public IDDecoder getIDDecoder();
+
+ /** Using the IDDecoder, returns the Subdetector associated with this hit */
+// public Subdetector getSubdetector();
+
+ /** Returns the associated SimTrackerHit. Note this may be <code>null</code>
+ * if there is no associated SimTrackerHit (for example because this is a noise
+ * hit, or because there is no MC information.
+ */
+ // FixMe: This should return an array of tracker hits
+// public SimTrackerHit getSimTrackerHit();
+
+}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N ChargeTransferModel.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ChargeTransferModel.java 18 May 2007 21:59:24 -0000 1.1
@@ -0,0 +1,26 @@
+/*
+ * ChargeTransferModel.java
+ *
+ * Created on May 18, 2007, 12:42 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.SiStripSim;
+
+import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
+
+import java.util.SortedMap;
+
+/**
+ *
+ * @author tknelson
+ */
+public interface ChargeTransferModel
+{
+
+ void transferCharge(SiSensorElectrodes sense_electrodes, SiSensorElectrodes readout_electrodes,
+ SortedMap<Integer,SiElectrodeData> sense_data, SortedMap<Integer,SiElectrodeData> readout_data);
+
+}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N StripChargeTransferModel.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ StripChargeTransferModel.java 18 May 2007 21:59:24 -0000 1.1
@@ -0,0 +1,35 @@
+/*
+ * StripChargeTransferModel.java
+ *
+ * Created on May 18, 2007, 12:42 PM
+ *
+ * To change this template, choose Tools | Template Manager
+ * and open the template in the editor.
+ */
+
+package org.lcsim.contrib.SiStripSim;
+
+import org.lcsim.detector.tracker.silicon.SiSensorElectrodes;
+
+import java.util.SortedMap;
+
+/**
+ *
+ * @author tknelson
+ */
+public class StripChargeTransferModel implements ChargeTransferModel
+{
+
+ /** Creates a new instance of StripChargeTransferModel */
+ public StripChargeTransferModel()
+ {
+ }
+
+ public void transferCharge(SiSensorElectrodes sense_electrodes, SiSensorElectrodes readout_electrodes,
+ SortedMap<Integer,SiElectrodeData> sense_data, SortedMap<Integer,SiElectrodeData> readout_data)
+ {
+
+ }
+
+
+}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N TrackSegment.java
--- TrackSegment.java 3 Aug 2006 23:25:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,118 +0,0 @@
-package org.lcsim.contrib.SiStripSim;
-/*
- * TrackSegment.java
- *
- * Created on July 27, 2005, 3:34 PM
- *
- * To change this template, choose Tools | Options and locate the template under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.VecOp;
-
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.geometry.IDDecoder;
-
-import java.util.*;
-
-/**
- *
- * @author tknelson
- */
-public class TrackSegment
-{
-
- // Fields
- private Hep3Vector _p1;
- private Hep3Vector _p2;
- private double _energy_loss;
-
- /**
- * Creates a new instance of TrackSegment
- */
-
- public TrackSegment(Hep3Vector p1, Hep3Vector p2, double energy_loss)
- {
- _p1 = p1;
- _p2 = p2;
- _energy_loss = energy_loss;
- }
-
-// Construct from a SimTrackerHit: currently broken
-//
-// public TrackSegment(SimTrackerHit simulated_hit, IDDecoder decoder)
-// {
-// Hep3Vector midpoint = new BasicHep3Vector(simulated_hit.getPoint());
-// Hep3Vector direction = VecOp.unit(new BasicHep3Vector(simulated_hit.getMomentum()));
-//
-// BasicHep3Vector normal = new BasicHep3Vector();
-// decoder.setID(simulated_hit.getCellID());
-// if (decoder.getBarrelEndcapFlag().isBarrel())
-// {
-// normal.setV(midpoint.x(), midpoint.y(), 0.0);
-// normal = (BasicHep3Vector)VecOp.unit(normal);
-// }
-// else if (decoder.getBarrelEndcapFlag().isEndcap())
-// {
-// normal.setV(0.0,0.0,1.0);
-// }
-//
-// Hep3Vector half_length = VecOp.mult(simulated_hit.getPathLength(),direction);
-//
-// }
-
- // Accessors
- public Hep3Vector getP1()
- {
- return _p1;
- }
-
- public Hep3Vector getP2()
- {
- return _p2;
- }
-
- public double getEloss()
- {
- return _energy_loss;
- }
-
- public Hep3Vector getVector()
- {
- return VecOp.sub(_p2,_p1);
- }
-
- public Hep3Vector getDirection()
- {
- return VecOp.unit(getVector());
- }
-
- public double getLength()
- {
- return getVector().magnitude();
- }
-
- public double getDedx()
- {
- return _energy_loss/getLength();
- }
-
- public void rotateMedium(Hep3Vector axis, double center, double angle)
- {
- double old_length = getLength();
- rotateMedium(_p1,axis,center,angle);
- rotateMedium(_p2,axis,center,angle);
- _energy_loss *= getLength()/old_length;
- }
-
- private void rotateMedium(Hep3Vector point, Hep3Vector axis, double center, double angle)
- {
- assert (axis.z() == 0.0); // assumed that we are rotating silicon z-planes
- point = VecOp.add(point,VecOp.mult(Math.tan(angle)*(center - point.z()),
- VecOp.unit(VecOp.cross(axis, new BasicHep3Vector(0,0,1)))));
- }
-
-}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N ChargeCarrier.java
--- ChargeCarrier.java 3 Aug 2006 23:25:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,54 +0,0 @@
-package org.lcsim.contrib.SiStripSim;
-/*
- * ChargeCarrier.java
- *
- * Created on October 13, 2005, 3:41 PM
- *
- * To change this template, choose Tools | Options and locate the template under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-/**
- *
- * @author tknelson
- */
-
-public enum ChargeCarrier
-{
- ELECTRON(1268.0,-2.33,92.0,-0.57,1.3E+17,2.4,0.91,-0.146),
- HOLE(406.9,-2.23,54.3,-0.57,2.35E+17,2.4,0.88,-0.146);
-
- private final double _mu_0_factor;
- private final double _mu_0_exponent;
- private final double _mu_min_factor;
- private final double _mu_min_exponent;
- private final double _N_ref_factor;
- private final double _N_ref_exponent;
- private final double _alpha_factor;
- private final double _alpha_exponent;
-
- ChargeCarrier(double mu_0_factor, double mu_0_exponent, double mu_min_factor, double mu_min_exponent,
- double N_ref_factor, double N_ref_exponent, double alpha_factor, double alpha_exponent)
- {
- _mu_0_factor = mu_0_factor;
- _mu_0_exponent = mu_0_exponent;
- _mu_min_factor = mu_min_factor;
- _mu_min_exponent = mu_min_exponent;
- _N_ref_factor = N_ref_factor;
- _N_ref_exponent = N_ref_exponent;
- _alpha_factor = alpha_factor;
- _alpha_exponent = alpha_exponent;
- }
-
- // Methods
- double mu0(double temperature)
- {return _mu_0_factor * Math.pow( (temperature/300.0), _mu_0_exponent);}
- double muMin(double temperature)
- {return _mu_min_factor * Math.pow( (temperature/300.0), _mu_min_exponent);}
- double nRef(double temperature)
- {return _N_ref_factor * Math.pow( (temperature/300.0), _N_ref_exponent);}
- double alpha(double temperature)
- {return _alpha_factor * Math.pow( (temperature/300.0), _alpha_exponent);}
-
-}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N DopedSilicon.java
--- DopedSilicon.java 3 Aug 2006 23:25:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,84 +0,0 @@
-package org.lcsim.contrib.SiStripSim;
-/*
- * DopedSilicon.java
- *
- * Created on July 26, 2005, 3:31 PM
- *
- * To change this template, choose Tools | Options and locate the template under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-import java.util.*;
-
-/**
- *
- * @author tknelson
- */
-public class DopedSilicon
-{
-
- // Fields
- //=======
-
- // Static
- static public double K_BOLTZMANN = 8.617385E-5; // eV/degK
- static public double E_PAIR = 3.6E-9; // 3.6E-9 GeV/e-h pair
-
- // Member
- private double _temperature = 293.0;
- private double _doping_concentration = 6.0E+11;
- private EnumMap<ChargeCarrier,Double> _carrier_concentration = new EnumMap<ChargeCarrier,Double>(ChargeCarrier.class);
-
- // Constructors
- //=============
- public DopedSilicon()
- {
- setElectronConcentration(1.0E+14);
- setHoleConcentration(1.0E+14);
- }
-
- // Setters/Accessors
- //==================
- public void setTemperature(double temperature){_temperature = temperature;}
- public void setDopingConcentration(double doping_concentration)
- {
- _doping_concentration = doping_concentration;
- }
- public void setElectronConcentration(double electron_concentration)
- {
- _carrier_concentration.put(ChargeCarrier.ELECTRON,electron_concentration);
- }
- public void setHoleConcentration(double hole_concentration)
- {
- _carrier_concentration.put(ChargeCarrier.HOLE,hole_concentration);
- }
-
- public double getTemperature(){return _temperature;}
- public double getCarrierConcentration(ChargeCarrier charge_carrier)
- {
- return _carrier_concentration.get(charge_carrier);
- }
-
- // Methods
- //========
-
- // Lorentz angle calculation for silicon sensors
- public double tanLorentzAngle(double b_field, ChargeCarrier charge_carrier)
- {
- return b_field * mobility(charge_carrier) * 1.0E-4;
- }
-
- // Mobility calculation with correction for irradiated sensors
- public double mobility(ChargeCarrier charge_carrier)
- {
- return charge_carrier.muMin(_temperature) + charge_carrier.mu0(_temperature) /
- (1.0 + Math.pow(_carrier_concentration.get(charge_carrier)/charge_carrier.nRef(_temperature),
- charge_carrier.alpha(_temperature)));
- }
-
- // Silicon type
- public boolean isNtype(){return _doping_concentration > 0.0;}
-
-
-}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N SiliconReadoutDriver.java
--- SiliconReadoutDriver.java 20 Apr 2007 06:32:23 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,115 +0,0 @@
-/*
- * SiliconReadoutDriver.java
- *
- * Created on April 19, 2007, 4:28 PM
- *
- * To change this template, choose Tools | Template Manager
- * and open the template in the editor.
- */
-
-package org.lcsim.contrib.SiStripSim;
-
-import org.lcsim.util.Driver;
-import org.lcsim.event.EventHeader;
-import org.lcsim.geometry.Detector;
-import org.lcsim.detector.IDetectorElement;
-import org.lcsim.detector.ITransform3D;
-import org.lcsim.event.SimTrackerHit;
-import org.lcsim.event.EventHeader.LCMetaData;
-import org.lcsim.geometry.IDDecoder;
-import org.lcsim.util.aida.AIDA;
-import org.lcsim.detector.tracker.silicon.SiSensor;
-import org.lcsim.detector.tracker.silicon.TrackSegment;
-
-import hep.physics.vec.BasicHep3Vector;
-import hep.physics.vec.Hep3Vector;
-import hep.physics.vec.VecOp;
-
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-
-/**
- *
- * @author tknelson
- */
-public class SiliconReadoutDriver extends Driver
-{
-
- // Fields
- private String _input_hit_collection = "TkrBarrHits";
- private List<SimTrackerHit> _hits = null;
- private LCMetaData _metadata = null;
- private IDDecoder _decoder = null;
- private AIDA _aida = AIDA.defaultInstance();
- private boolean _make_histograms = false;
-
- /** Creates a new instance of SiliconReadoutDriver */
- public SiliconReadoutDriver()
- {
- }
-
-
- protected void process(EventHeader event)
- {
- // Get detector and print out tracking subdetector names
- Detector detector = event.getDetector();
-
- // Get the barrel tracker attributes
- IDetectorElement barrel = detector.getSubdetector("TrackerBarrel").getDetectorElement();
-
- // Get the SimTrackerHits and metadata
- _hits = event.getSimTrackerHits(_input_hit_collection);
-// _metadata = event.getMetaData(_hits);
-// _decoder = _metadata.getIDDecoder();
-
- // Print out number of hits
- if (_make_histograms) _aida.cloud1D("nHitsTotal").fill(_hits.size());
-
- // set of sensors with hits
- Set<SiSensor> hit_sensors = new HashSet<SiSensor>();
-
- for (SimTrackerHit hit : _hits)
- {
-// _decoder.setID(hit.getCellID());
-
- // Create track segment in global coordinates
- Hep3Vector midpoint = new BasicHep3Vector(hit.getPoint());
- Hep3Vector direction = VecOp.unit(new BasicHep3Vector(hit.getMomentum()));
- Hep3Vector half_length = VecOp.mult(hit.getPathLength()/2.0,direction);
-
- Hep3Vector p1 = VecOp.add(midpoint,VecOp.mult(-1.0,half_length));
- Hep3Vector p2 = VecOp.add(midpoint,half_length);
-
- double energy = hit.getdEdx();
-
- TrackSegment track_segment = new TrackSegment(p1,p2,energy);
-
- // Find the sensor for this hit, add to list of hit sensors
- SiSensor sensor = (SiSensor)barrel.findDetectorElement(midpoint);
- hit_sensors.add(sensor);
-
- // Transform track segment to sensor coordinates and assign to sensor
- ITransform3D global_to_sensor = sensor.getGeometry().getGlobalToLocal();
- track_segment.transform(global_to_sensor);
- sensor.addTrackSegment(track_segment);
- }
-
- // Loop over sensors
- for (SiSensor sensor : hit_sensors)
- {
- // deposit charge
- sensor.depositCharge();
-
- // readout
-// List<RawTrackerHit> raw_hits = readout_chip.readout(sensor);
-
-
- }
-
-
-
- }
-
-
-}
lcsim/src/org/lcsim/contrib/SiStripSim
diff -N SiStrips.java
--- SiStrips.java 3 Aug 2006 23:25:04 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,143 +0,0 @@
-package org.lcsim.contrib.SiStripSim;
-/*
- * SiStrips.java
- *
- * Created on July 22, 2005, 4:07 PM
- *
- * To change this template, choose Tools | Options and locate the template under
- * the Source Creation and Management node. Right-click the template and choose
- * Open. You can then make changes to the template in the Source Editor.
- */
-
-import java.util.SortedMap;
-import java.util.Arrays;
-
-/**
- *
- * @author tknelson
- */
-public class SiStrips
-{
-
- private double _pitch = 0.025; // 25 micron sense pitch
- private int _floating_strips = 1; // 50 micron readout
- private double _capacitance = 20.0; // 20 pF capacitance
- private int _nstrips = 100; // simulate 100 strips by default
-// private double _inactive_width = 0.0; // no inactive region
- private double _strip_charge[] = null;
-
-// private double _crosstalk_fraction = 0.0;
-// private double _integration_fraction = 1.0;
-// private SortedMap<Integer,Integer> _strip_adc;
-
-// private SortedMap<Integer,Double> _strip_charge;
-// private ArrayList<SiStripCluster> _clusters;
-
- // Constructors
- //=============
- public SiStrips()
- {
- _strip_charge = new double[_nstrips];
- }
-
- public SiStrips(int nstrips)
- {
- _nstrips = nstrips;
- _strip_charge = new double[_nstrips];
- }
-
- // Settors/Accessors
- //==================
- public void setPitch(double pitch)
- {
- _pitch = pitch;
- }
-
- public void setFloatingStrips(int floating_strips)
- {
- _floating_strips = floating_strips;
- }
-
- public void setCapacitance(double capacitance)
- {
- _capacitance = capacitance;
- }
-
-// public void setInactiveWidth(double inactive_width)
-// {
-// _inactive_width = inactive_width;
-// }
-
- public double getNstrips()
- {
- return _nstrips;
- }
-
- public double getPitch()
- {
- return _pitch;
- }
-
- public int getFloatingStrips()
- {
- return _floating_strips;
- }
-
- public double getCapacitance()
- {
- return _capacitance;
- }
-
-// public double getInactiveWidth()
-// {
-// return _inactive_width;
-// }
-
- // Operators
- //==========
- public int baseStrip(double position)
- {
- return (int)Math.floor(position/_pitch);
- }
-
- public double interstripPosition(double position)
- {
- return position - baseStrip(position)*_pitch;
- }
-
- public double stripPosition(int strip_number)
- {
- return strip_number*_pitch;
- }
-
- public double stripPosition(double strip_coordinate)
- {
- return strip_coordinate*_pitch;
- }
-
- public void clear()
- {
- Arrays.fill(_strip_charge,0.0);
- }
-
- public void addCharge(int strip, double charge)
- {
- _strip_charge[strip] += charge;
- }
-
-// public void generateReadout()
-// {
-//
-// }
-//
-// public void findClusters()
-// {
-//
-// }
-//
-// public void findTruthCluster()
-// {
-//
-// }
-
-}
CVSspam 0.2.8