Commit in GeomConverter/src/org/lcsim/detector/tracker/silicon on MAIN
SiSensor.java+2-3481.10 -> 1.11
SiSensorElectrodes.java-81.5 -> 1.6
SiStrips.java+18-2431.8 -> 1.9
+20-599
3 modified files
Stripped out all function now placed in org.lcsim.contrib.SiStripSim

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiSensor.java 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- SiSensor.java	3 Jul 2007 23:35:34 -0000	1.10
+++ SiSensor.java	10 Jul 2007 23:42:42 -0000	1.11
@@ -14,7 +14,6 @@
 import hep.physics.vec.VecOp;
 import hep.physics.matrix.BasicMatrix;
 
-import java.util.ArrayList;
 import java.util.EnumMap;
 import java.util.List;
 import java.util.Map;
@@ -34,10 +33,7 @@
  * @author tknelson
  */
 public class SiSensor extends DetectorElement {
-    
-//    _pside_direction?
- //   center at zero!!!
-    
+
     // Enumerated types
     //=================
     public enum Orientation { PSIDE_NEGATIVE_Z, PSIDE_POSITIVE_Z };
@@ -49,9 +45,6 @@
     private static double _DEPLETION_VOLTAGE_DEFAULT = 100;// * volt;
     private static double _BIAS_VOLTAGE_DEFAULT = 110;// * volt;
     
-    // Static parameters - not intended to be user modifiable
-    private static double _DEPOSITION_GRANULARITY = 0.10; // 10% of pitch or depleted thickness
-    
     // primary properties
     //-------------------
     
@@ -77,10 +70,6 @@
     //-------------------
     // measured coordinates in local coordinates
     private EnumMap<ChargeCarrier, Hep3Vector[]> _measured_coordinates = new EnumMap<ChargeCarrier,Hep3Vector[]>(ChargeCarrier.class);
-    // direction of Lorentz drift in local coordinates
-    private EnumMap<ChargeCarrier, Hep3Vector> _drift_direction = new EnumMap<ChargeCarrier,Hep3Vector>(ChargeCarrier.class);
-    // list of charge depositions to be distributed onto the electrodes
-    private List<TrackSegment> _track_list = new ArrayList<TrackSegment>();
     
     // Constructors
     //=============
@@ -157,11 +146,6 @@
         _bias_voltage = bias_voltage;
     }
     
-    public void addTrackSegment(TrackSegment track_segment)
-    {
-        _track_list.add(track_segment);
-    }
-    
     // Getters
     public int getSensorID()
     {
@@ -221,8 +205,6 @@
     public Hep3Vector getBField(Hep3Vector local_position)
     {
         
-//        System.out.println("Beginning getBField");                
-        
         IDetectorElement ancestor = this.getParent();
         while (!(ancestor instanceof DeDetector) && !(ancestor==null))
         {
@@ -232,8 +214,6 @@
 
         Hep3Vector global_position = getGeometry().getLocalToGlobal().transformed(local_position);
         Hep3Vector field_global = ((DeDetector)ancestor).getBField(global_position);
-
-//        return new BasicHep3Vector(0.0,-5.0,0.0);
         
         // FIXME - This is silly!!!!!
         return VecOp.mult(getGeometry().getGlobalToLocal().getRotation().getRotationMatrix(),field_global);
@@ -250,7 +230,6 @@
     //==========
     public void initialize()
     {
-//        System.out.println("Beginning initialize");                
 
         // Cache thickness of bulk
         _thickness = 2.0*((Box)getGeometry().getLogicalVolume().getSolid()).getZHalfLength();
@@ -258,33 +237,18 @@
         // Store various important directions
         for (ChargeCarrier carrier : ChargeCarrier.values())
         {
-            if (hasElectrodesOnSide(carrier)) {
-
-//                System.out.println("init: Carrier: "+carrier);                        
-                
-                // cache drift direction for electrodes on each side
-                _drift_direction.put(carrier,driftDirection(carrier, new BasicHep3Vector(0.0,0.0,0.0)));
-//                System.out.println("init: Drift direction: "+_drift_direction);                        
+            if (hasElectrodesOnSide(carrier)) {  
                 
                 // cache coordinates measured by the pattern of electrodes on each side
                 double electrode_angle = getElectrodeAngle(carrier); 
-//                System.out.println("Electrode angle: "+electrode_angle);                                        
-               
                 int naxes = _sense_electrodes.get(carrier).getNAxes();
-//                System.out.println("# axes "+naxes);                                        
-
                 Hep3Vector[] measured_coordinates = new Hep3Vector[naxes];
                 
                 for (int iaxis = 0; iaxis < naxes ; iaxis++)
                 {
-//                    System.out.println("Axis number: "+iaxis);                                                            
                     measured_coordinates[iaxis] = measuredCoordinate(electrode_angle + iaxis*Math.PI/naxes);
-//                    System.out.println("Measured coordinate: "+measured_coordinates[iaxis]);                                        
                 }
                 _measured_coordinates.put(carrier,measured_coordinates);
-                
-                // strip direction... deprecated
-//                _strip_direction.put(carrier,stripDirection(electrode_angle));
             }
         }
 
@@ -292,7 +256,6 @@
     
     private double zOfSide(ChargeCarrier carrier)
     {   
-//        System.out.println("_thickness: "+_thickness);
         if ( (carrier == ChargeCarrier.HOLE) == (_orientation == Orientation.PSIDE_POSITIVE_Z) ) return _thickness/2.0;
         else return -_thickness/2.0;
     }
@@ -304,11 +267,7 @@
     
     public double distanceFromSide(Hep3Vector point, ChargeCarrier carrier)
     {
-//        System.out.println("Beginning distanceFromSide");        
         double distance =  Math.abs(point.z() - zOfSide(carrier));
-//        System.out.println("point.z(): "+point.z());
-//        System.out.println("side z: "+zOfSide(carrier));        
-//        System.out.println("Distance from side is: "+distance);
         return distance;
     }
     
@@ -318,217 +277,23 @@
         else return true;
     }
     
-    private Hep3Vector driftVector(Hep3Vector origin, ChargeCarrier carrier)
-    {
-//        System.out.println("Beginning driftVector");        
-        double drift_vector_scale = distanceFromSide(origin,carrier)/_drift_direction.get(carrier).z();
-        return VecOp.mult(drift_vector_scale,_drift_direction.get(carrier));
-    }
-    
-    private Hep3Vector driftDestination(Hep3Vector origin, ChargeCarrier carrier)
-    {
-//        System.out.println("Beginning driftDestination");        
-        return VecOp.add(origin,driftVector(origin, carrier));
-    }
-    
-    private ErrorEllipse2D diffusionEllipse(Hep3Vector point, ChargeCarrier carrier)
-    {
-        
-        // Common factors
-        double difference_V = _bias_voltage - _depletion_voltage;
-        double sum_V = _bias_voltage + _depletion_voltage;
-        double common_factor = 2.0*distanceFromSide(point,carrier)*_depletion_voltage/_thickness;
-
-//        System.out.println("sum_V: "+sum_V);  
-//        System.out.println("common_factor: "+common_factor);  
-        
-        // Calculate charge spreading without magnetic field
-        double sigmasq = _bulk.K_BOLTZMANN * _bulk.getTemperature() * _thickness*_thickness / _depletion_voltage;
-        if (_bulk.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 = 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);
-        
-    }
-
-    
     private Hep3Vector measuredCoordinate(double electrode_angle)
     {
         return new BasicHep3Vector(Math.cos(electrode_angle),Math.sin(electrode_angle),0.0);
     }
     
-
-    private Hep3Vector driftDirection(ChargeCarrier carrier, Hep3Vector local_position)
-    {
-//        System.out.println("Beginning driftDirection");  
-        
-//        System.out.println("Position: "+local_position);
-        
-        double carrier_mobility = _bulk.mobility(carrier);
-//        System.out.println("Carrier: "+carrier);
-        
-        Hep3Vector b_field = this.getBField(local_position);
-//        System.out.println("B field: "+b_field);
-        
-        Hep3Vector e_field = this.electricField(local_position);
-//        System.out.println("E field: "+e_field);
-        
-        double tan_lorentz = _bulk.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;
-        
-    }
-    
     public Hep3Vector electricField(Hep3Vector position)
     {
         Hep3Vector electric_field_direction = (this._orientation == Orientation.PSIDE_POSITIVE_Z) ?
             new BasicHep3Vector(0.0,0.0,1.0) : new BasicHep3Vector(0.0,0.0,-1.0);
         
-//        System.out.println("E field direction: "+electric_field_direction);
-        
         double electric_field_magnitude = (_bias_voltage-_depletion_voltage)/_thickness + 
                 (2.0*_depletion_voltage)/_thickness * (1.0 - this.distanceFromSide(position,ChargeCarrier.ELECTRON));
         
-//        System.out.println("E field magnitude: "+electric_field_magnitude);
-        
         return VecOp.mult(electric_field_magnitude,electric_field_direction);
         
     }
     
-    public void clearElectrodes()
-    {
-        for (ChargeCarrier carrier : ChargeCarrier.values())
-        {
-            if (hasElectrodesOnSide(carrier)) _sense_electrodes.get(carrier).clear();
-        }        
-    }
-   
-
-    private int nSegments(TrackSegment track, ChargeCarrier carrier, double deposition_granularity)
-    {
-        // Decide how to cut track into pieces as a fraction of strip pitch        
-        int nsegments = 0;
-        if (!hasElectrodesOnSide(carrier)) return nsegments;
-        
-//        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(track.getVector().z()/(_thickness*deposition_granularity));
-        
-        Hep3Vector deposition_line = VecOp.sub( driftDestination(track.getP2(),carrier),
-                driftDestination(track.getP1(),carrier) );
-       
-        int naxes = _sense_electrodes.get(carrier).getNAxes();                        
-        for (int iaxis = 0; iaxis < naxes; iaxis++)
-        {
-            double projected_deposition_length = Math.abs(VecOp.dot(deposition_line,_measured_coordinates.get(carrier)[iaxis]));
-
-//            System.out.println("Projected deposition Length: " + projected_deposition_length);
-            
-            int required_segments = (int)Math.ceil(projected_deposition_length/(deposition_granularity*_sense_electrodes.get(carrier).getPitch(iaxis)));
-            nsegments = Math.max(nsegments,required_segments);
-        }   
-        return nsegments;
-    }
-    
-    
-    public void depositCharge()
-    {
-                
-        for (TrackSegment track : _track_list)
-        {  
-            
-//            System.out.println("New TrackSegment... ");
-            
-            // Decide how to cut track into pieces - use 5% of pitch
-            int nsegments = 0;
-//            System.out.println("Number of charge carriers: " + ChargeCarrier.values().length);                        
-            for (ChargeCarrier carrier : ChargeCarrier.values())
-            {
-//                System.out.println("Charge carrier: " + carrier);
-//                System.out.println("Has strips on side: "+hasElectrodesOnSide(carrier));
-                if (!hasElectrodesOnSide(carrier)) continue;
-                
-                nsegments = Math.max(nsegments,nSegments(track,carrier, _DEPOSITION_GRANULARITY));
-            }
-            
-//            System.out.println("Number of subsegments: " + nsegments);
-            
-            // Set up segments
-            double segment_length = track.getLength()/nsegments;
-            double segment_charge = track.getEloss()/nsegments/_bulk.ENERGY_EHPAIR;
-            
-//            System.out.println("length of subsegments: " + segment_length);
-//            System.out.println("total charge: " + segment_charge);
-            
-            Hep3Vector segment_step = VecOp.mult(segment_length,track.getDirection());
-            Hep3Vector segment_center = VecOp.add( track.getP1(),VecOp.mult(0.5,segment_step) );
-            
-//            System.out.println("Segment step: " + segment_step);
-//            System.out.println("Segment center: " + segment_center);
-            
-            // 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 (hasElectrodesOnSide(carrier))
-                     {
-                        Rotation3D sensor_to_electrodes = new Rotation3D();
-                        sensor_to_electrodes.setPassiveXYZ(0.0,0.0,-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(-getElectrodeAngle(carrier));
-                       _sense_electrodes.get(carrier).depositCharge(segment_charge,electrode_drift_destination,electrode_charge_distribution);
-                    }
-                }
-                
-                // step to next segment
-                segment_center = VecOp.add(segment_center, segment_step);
-            }
-              
-        }
-        
-        _track_list.clear();
-        
-    }
-    
     public String toString()
     {
         String newline = System.getProperty("line.separator");
@@ -562,116 +327,5 @@
         id.addValue(stripNumber);
         return helper.pack( id );
     }
-   
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-    
-//    private void depositCharge(double charge, Hep3Vector origin, ChargeCarrier carrier)
-//    {
-//        if (!hasStripsOnSide(carrier)) return;
-//        
-//        // find center of charge deposition
-//        double drift_destination = VecOp.dot( driftDestination(origin,carrier),
-//                _measured_coordinate.get(carrier) );
-//        double diffusion_sigma = diffusionSigma(origin,carrier);
-//        
-//        _sense_electrodes.get(carrier).depositCharge(new BasicHep3Vector(drift_destination,0.0,0.0),charge,diffusion_sigma);
-//      
-//    }    
-    
-//    private double diffusionSigma(Hep3Vector point, ChargeCarrier carrier)
-//    {
-//        
-//        // Common factors
-//        double difference_V = _bias_voltage - _depletion_voltage;
-//        double sum_V = _bias_voltage + _depletion_voltage;
-//        double common_factor = 2.0*distanceFromSide(point,carrier)*_depletion_voltage/_thickness;
-//
-//        // Calculate charge spreading without magnetic field
-//        double sigmasq = k_Boltzmann * _bulk.getTemperature() * _thickness*_thickness / _depletion_voltage;
-//        if (_bulk.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);
-//        
-//        // Corrections for magnetic field -- this is an approximation, may have to be done better for high fields
-//        double cos_theta_lorentz_sq = Math.pow(VecOp.cosTheta(_drift_direction.get(carrier)),2);
-//        double phi_lorentz = VecOp.phi(_drift_direction.get(carrier));
-//        double phi_measured = VecOp.phi(_measured_coordinate.get(carrier));
-//        double cos_phi_diff_sq = Math.pow(Math.cos(phi_measured - phi_lorentz),2);
-//        
-//        sigma *= (1.0/cos_theta_lorentz_sq) *
-//                Math.sqrt(cos_theta_lorentz_sq + cos_phi_diff_sq - cos_theta_lorentz_sq*cos_phi_diff_sq);
-//        
-//        return sigma;
-//        
-//    }
-
-    
-// Delta-ray code was deprecated in favor of letting GEANT do the work    
-//
-//    public void generateDeltaRays()
-//    {
-//        for (TrackSegment track : _track_list)
-//        {
-//            // Uncommitted standalone code exists to do this, which...
-//            // retrieves track from _track_list and calculates delta ray production
-//            // modifies original track in _track_list
-//            // adds delta rays to _track_list
-//        }
-//        return;
-//    }
-
-//    private int nSegments(TrackSegment track, ChargeCarrier carrier, double deposition_granularity)
-//    {
-//        // Decide how to cut track into pieces as a fraction of strip pitch
-//        if (!hasElectrodesOnSide(carrier)) return 0;
-//        Hep3Vector deposition_line = VecOp.sub( driftDestination(track.getP2(),carrier),
-//                driftDestination(track.getP1(),carrier) );
-//
-//        double projected_deposition_length = VecOp.dot(deposition_line,_measured_coordinate.get(carrier));
-//        
-//        return (int)Math.ceil(projected_deposition_length/(deposition_granularity*_sense_electrodes.get(carrier).getPitch()));
-//    }
-    
-    
     
 }

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiSensorElectrodes.java 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- SiSensorElectrodes.java	3 Jul 2007 23:35:34 -0000	1.5
+++ SiSensorElectrodes.java	10 Jul 2007 23:42:42 -0000	1.6
@@ -73,12 +73,4 @@
     // Compute Gaussian-distributed charge on electrodes
     public SortedMap<Integer,Integer> computeElectrodeData(double charge, Hep3Vector position, ErrorEllipse2D distribution);
     
-    // Deposit Gaussian-distributed charge on electrodes - deprecated
-    public void depositCharge(double charge, Hep3Vector position, ErrorEllipse2D distribution);
-    
-    // Get map of charge deposition on electrodes - deprecated
-    public SortedMap<Integer,Integer> getChargeMap();
-    
-    // Clear charge from electrodes - deprecated
-    public void clear();
 }

GeomConverter/src/org/lcsim/detector/tracker/silicon
SiStrips.java 1.8 -> 1.9
diff -u -r1.8 -r1.9
--- SiStrips.java	3 Jul 2007 23:35:34 -0000	1.8
+++ SiStrips.java	10 Jul 2007 23:42:43 -0000	1.9
@@ -30,12 +30,7 @@
     // Fields
     private int _nstrips; // number of strips
     private double _pitch; // sense pitch
-    private int _floating_strips; // number of floating strips between readout strips
-    private SortedMap<Integer,Integer> _strip_charge = new TreeMap<Integer,Integer>();
 
-    private double _capacitance_total = 16.0; // 15 pF
-    private double _capacitance_interstrip = 13.0; // 11 pF
-    
     // Constructors
     //=============
     
@@ -43,7 +38,6 @@
     {
         setNStrips(nstrips);
         setPitch(pitch);
-        setFloatingStrips(floating_strips);
     }
     
     // Setters
@@ -57,107 +51,9 @@
     {
         _pitch = pitch;
     }
-    
-    public void setFloatingStrips(int floating_strips)
-    {
-        _floating_strips = floating_strips;
-    }
-    
-//    public void setCapacitance(double capacitance)
-//    {
-//        _capacitance = capacitance;
-//    }
-
  
     // Getters
     //===================
-    private int getFloatingStrips()
-    {
-        return _floating_strips;
-    }
-    
-    private boolean isFloatingStrip(int sense_strip)
-    {
-//        System.out.println("    Sense strip: "+sense_strip);
-//        System.out.println("    Remainder: "+Math.IEEEremainder(sense_strip,_floating_strips+1));
-//        System.out.println("Math.IEEEremainder(sense_strip,_floating_strips+1) != 0: " + (Math.IEEEremainder(sense_strip,_floating_strips+1) != 0));
-        return ( Math.IEEEremainder(sense_strip,_floating_strips+1) != 0 );
-    }
-    
-    private int senseIDToReadoutID(int sense_strip_number)
-    {
-        return sense_strip_number/(_floating_strips+1);
-    }
-   
-    private double getSensePitch()
-    {
-        return _pitch;
-    }
-    
-    private double getReadoutPitch()
-    {
-        return _pitch*(1+getFloatingStrips());
-    }   
-    
-    private int getNSenseStrips()
-    {
-        return _nstrips;
-    }
-    
-    private int getNReadoutStrips()
-    {
-       return (_nstrips-1)/(_floating_strips+1) + 1;
-    }
-
-    private int getSenseStripID(Hep3Vector position)
-    {
-        return (int)Math.round((position.x()+getSenseStripOffset())/getSensePitch());
-    }
-    
-    private double getSenseStripOffset()
-    {
-        return (getNSenseStrips()-1)*getSensePitch()/2.;
-    }
-    
-    private int getReadoutStripID(Hep3Vector position)
-    {
-        return (int)Math.round((position.x()+getReadoutStripOffset())/getReadoutPitch());
-    }
-    
-    private double getReadoutStripOffset()
-    {
-        return (getNReadoutStrips()-1)*getReadoutPitch()/2.;
-    }
-    
-    private Hep3Vector getPositionInSenseCell(Hep3Vector position)
-    {
-        return VecOp.sub(position,getSenseStripPosition(getSenseStripID(position)));
-    }
-    
-    private Hep3Vector getPositionInReadoutCell(Hep3Vector position)
-    {
-        return VecOp.sub(position,getReadoutStripPosition(getReadoutStripID(position)));
-    }
-    
-    private Hep3Vector getSenseStripPosition(int sense_strip_number)
-    {
-        return new BasicHep3Vector(sense_strip_number*getSensePitch()-getSenseStripOffset(),0.0,0.0);
-    }
-    
-    private Hep3Vector getReadoutStripPosition(int readout_strip_number)
-    {
-        return new BasicHep3Vector(readout_strip_number*getReadoutPitch()-getReadoutStripOffset(),0.0,0.0);
-    }
-    
-    
-    
-//    public double getCapacitance()
-//    {
-//        return _capacitance;
-//    }
-    
-    // Operators
-    //==========
     public int getNAxes()
     {
         return 1;
@@ -199,27 +95,27 @@
     
     public int getNCells()
     {
-        return getNReadoutStrips();
+        return _nstrips;
     }
     
     public int getNCells(int axis)
     {
         if (axis == 0)
         {
-            return getNReadoutStrips();
+            return _nstrips;
         }
         else return 1;
-    }
+    }    
     
     public double getPitch(int axis)
     {
-        return getReadoutPitch();
-    }
-     
-    public int getCellID(Hep3Vector position)
+        return _pitch;
+    }    
+        public int getCellID(Hep3Vector position)
     {
-        return getReadoutStripID(position);
+        return (int)Math.round((position.x()+getStripOffset())/_pitch);
     }
+    
 
     public int getRowNumber(Hep3Vector position)
     {
@@ -228,7 +124,7 @@
     
     public int getColumnNumber(Hep3Vector position)
     {
-        return getReadoutStripID(position);
+        return getCellID(position);
     }
     
     public int getCellID(int row_number, int column_number)
@@ -248,30 +144,25 @@
     
     public Hep3Vector getPositionInCell(Hep3Vector position)
     {
-        return getPositionInReadoutCell(position);
+        return VecOp.sub(position,getCellPosition(getCellID(position)));
     }
    
     public Hep3Vector getCellPosition(int strip_number)
     {
-        return getReadoutStripPosition(strip_number);
+        return new BasicHep3Vector(strip_number*_pitch-getStripOffset(),0.0,0.0);
     }
     
-    public SortedMap<Integer,Integer> getChargeMap()
-    {
-        return _strip_charge;
-    }
-        
     public SortedMap<Integer,Integer> computeElectrodeData(double charge, Hep3Vector position, ErrorEllipse2D distribution)
     {
 
         SortedMap<Integer,Integer> electrode_data = new TreeMap<Integer,Integer>();
         
-        int base_strip = getSenseStripID(position);
+        int base_strip = getCellID(position);
 
-        Hep3Vector interstrip_position = getPositionInSenseCell(position);
+        Hep3Vector interstrip_position = getPositionInCell(position);
 
         // put charge on strips in window 3-sigma strips on each side of base strip
-        double pitch = getSensePitch();
+        double pitch = _pitch;
         double axis_angle = 0.0;
         
         int window_size = (int)Math.ceil(3.0*distribution.sigma1D(axis_angle)/pitch);
@@ -282,7 +173,7 @@
         for (int istrip = base_strip-window_size; istrip <= base_strip+window_size; istrip++)
         {
             
-            double cell_edge_upper = getSenseStripPosition(istrip).x() + pitch/2.0;
+            double cell_edge_upper = getCellPosition(istrip).x() + pitch/2.0;
           
             double erfc_limit = cell_edge_upper-position.x();
             
@@ -303,126 +194,10 @@
         return electrode_data;
     }
     
-    
-    public void depositCharge(double charge, Hep3Vector position, ErrorEllipse2D distribution)
-    {
-//        System.out.println("Beginning depositCharge");
-//        System.out.println("    Charge: "+charge);        
-//        System.out.println("    Position: "+position);       
-        
-        int base_strip = getSenseStripID(position);
-        
-//        System.out.println("    Base Strip: "+base_strip);        
-        
-        Hep3Vector interstrip_position = getPositionInSenseCell(position);
-
-//        System.out.println("    Interstrip position: "+interstrip_position);        
-        
-        // put charge on strips in window 3-sigma strips on each side of base strip
-        double pitch = getSensePitch();
-        double axis_angle = 0.0;
-        
-//        System.out.println("    Pitch: "+pitch);                
-        
-        int window_size = (int)Math.ceil(3.0*distribution.sigma1D(axis_angle)/pitch);
-        
-//        System.out.println("    Sigma: "+distribution.sigma1D(axis_angle));
-//        System.out.println("    Window Size: "+window_size);        
-                
-        double erfc_lower = 1.0;
-        double erfc_upper = 1.0;
-    
-        for (int istrip = base_strip-window_size; istrip <= base_strip+window_size; istrip++)
-        {
-//            System.out.println("    istrip: "+istrip);                    
-            
-            double cell_edge_upper = getSenseStripPosition(istrip).x() + pitch/2.0;
-//            System.out.println("    Cell upper edge: "+cell_edge_upper);                                
-            
-            double erfc_limit = cell_edge_upper-position.x();
-            
-//            System.out.println("    erfc_limit: "+erfc_limit);                                            
-            
-            erfc_upper = distribution.erfc1D(erfc_limit,axis_angle);
-
-//            System.out.println("    erfc_lower: "+erfc_lower);
-//            System.out.println("    erfc_upper: "+erfc_upper);
-            
-            if (erfc_lower<erfc_upper) System.out.println("SQUEAL LIKE A PIG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-            
-            int strip_charge = (int)Math.round( (erfc_lower-erfc_upper) * charge);
-                        
-            if (strip_charge != 0)
-            {
-                addChargeToSense(istrip,strip_charge);
-            }
-            
-            erfc_lower = erfc_upper;
-            
-        }
-        return;
-    }
-        
-    public void clear()
-    {
-       _strip_charge.clear();
-    }
-    
-    
-    // Actions
-    //==================
-    private void addChargeToSense(int sense_strip, int charge)
+    // Private
+    private double getStripOffset()
     {
-        
-//        System.out.println(" Adding charge to sense strip: "+sense_strip);
-        
-        if (!isFloatingStrip(sense_strip))
-        {    
-//            System.out.println(" Found central readout strip: "+sense_strip);
-            addChargeToReadout(senseIDToReadoutID(sense_strip),charge);
-        }
-        else
-        {
-            
-//            System.out.println(" NOT central readout strip: "+sense_strip);
-            
-            int ileft = sense_strip-1;
-            int charge_left = charge/2;
-            while (isFloatingStrip(ileft))
-            {
-//                System.out.println(" NOT left readout strip: "+ileft);
-                charge_left *= (_capacitance_interstrip/_capacitance_total);
-                ileft--;
-            }
-//            System.out.println(" Found left readout strip: "+ileft);
-            addChargeToReadout(senseIDToReadoutID(ileft),charge_left);
-            
-            int iright = sense_strip+1;
-            int charge_right = charge/2;
-            while (isFloatingStrip(iright))
-            {
-//                System.out.println(" NOT right readout strip: "+iright);
-                charge_right *= (_capacitance_interstrip/_capacitance_total);
-                iright++;
-            }
-//            System.out.println(" Found right readout strip: "+iright);
-            addChargeToReadout(senseIDToReadoutID(iright),charge_right);
-        } 
+        return (_nstrips-1)*_pitch/2.;
     }
     
-        
-    private void addChargeToReadout(int readout_strip, int charge)
-    {
-        if (charge == 0) return;
-
-        if (readout_strip < 0 || readout_strip >= getNReadoutStrips()) return; // System.out.println(" Illegal readout strip: "+readout_strip);
-        
-        if (_strip_charge.containsKey(readout_strip)) {
-            charge += _strip_charge.get(readout_strip);            
-        }   
-        _strip_charge.put(readout_strip,charge);
-        return;
-    }    
-    
-
 }
CVSspam 0.2.8