Commit in lcsim/sandbox/NickSinev/PixSim on MAIN
CCDChargeSpreadComputer.java+167added 1.1
CCDSpecifications.java+124added 1.1
ChargeSpreadComputer.java+44added 1.1
ChargeSpreadTable.java+413added 1.1
PixelatedSensorSpecs.java+27added 1.1
+775
5 added files
started new package PixSim to simulate any pixel detector

lcsim/sandbox/NickSinev/PixSim
CCDChargeSpreadComputer.java added at 1.1
diff -N CCDChargeSpreadComputer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CCDChargeSpreadComputer.java	10 Aug 2007 21:23:06 -0000	1.1
@@ -0,0 +1,167 @@
+package org.lcsim.mc.PixSim;
+import org.lcsim.mc.CCDSim.LorentzAngle;
+
+
+/**
+ * Charge spread computer for the CCDs (traditional type - charge is diffusing
+ * in the undepleted area of sensitive element, reaches deepleted area and
+ * travels here in the electric and magnetic field
+ *  
+ * @author sinev
+ * @version $Id: CCDChargeSpreadComputer.java,v 1.1 2007/08/10 21:23:06 sinev Exp $
+ */
+public class CCDChargeSpreadComputer implements ChargeSpreadComputer
+{
+    /**
+    * Returns the fraction of charge, generated at point xg,yg,zg and collected in 1 um**2
+    * area around collection point xc,yc (collection point z is 0.) All coordinates are in
+    * local system for the given sensor, the 0.,0.,0. point is the center of the pixel, under
+    * which charge was generated, while xc and yc may belong to another pixel.
+    */
+
+    private Hep3Vector Bfield = null;
+    private Hep3Vector Efield = null;
+    private Hep3Vector Lorentz = null;
+    private double lorentzangle = 0.;
+    private double temp = 190.;
+    private double Beff = 5.;
+    private double athick = 20.;
+    private double dthick = 4.;
+    private double celszx = 1.;
+    private double celszy = 1.;
+    private CCDSpecifications specs = null;
+    private double q = -1.;
+    private int ctyp = 0;
+    private final double[] Aref = {0.765,-0.14};
+    private final double[] Adir = {0.,0.97833,-0.805,0.21667}; 
+    private LorentzAngle la = new LorentzAngle();
+
+    public CCDChargeSpreadComputer()
+    {
+     Bfield = new BasicHep3Vector(0.,5.,0.);
+     Efield = new BasicHep3Vector(0.,0.,0.25E5);
+     calculateLorentzAngle();
+    }
+
+    /**
+    * Setting the value and direction of magnetic fiels in local
+    * coordinate system. For barrel CCDs it will be 0.,B,0. (as local Y is along global Z)
+    * and for endcap ccd it will be 0.,0.,+-B az local Z is in the direction of global Z
+    * Though sign of B will be different for endcaps on +Z and -Z, we, essantually, don't care,
+    * as in that case electrical and magnetic field have cross product equal to 0., so no Lorentz
+    * angle corrections are needed. E field is assumed always along local Z for electron collecting
+    * CCDs and opposite to Z for hole collecting CCDs (so charge is always moved in the direction
+    * of decreasing z, and, in general, is assumed to be collected at z=0.  
+    */
+ 
+    public void setBfield( Hep3Vector B)
+    {
+     ((BasicHep3Vector) Bfield).setV(B.x(),B.y(),B.z());
+     calculateLorentzAngle();
+    }
+
+    /**
+    *  Setting the value of electrival field. The field is always directed along local
+    *  Z axiz, and always have such sign, that charge is collected at Z=0.
+    *  So only magnitude of E field should be provided as argument E 
+    *
+    */
+    public void setEfield( double E )
+    {
+     ((BasicHep3Vector) Efield).setV(0.,0., -q*Math.abs(E));
+     calculateLorentzAngle();
+    }
+
+    /** 
+    * Setting the sensor parameters by providing Sensor Specifications
+    *
+    */
+
+    public void setSensor( CCDSpecifications sp)
+    {
+      athick = sp.getActiveThickness();
+      dthick = sp.getDepletedThickness();     
+      temp = sp.getOperatingTemperature();
+      double ef = 0.;
+      if(dthick > 0.01) ef = sp.getBiasVoltage()/(dthick*0.0001);
+      setEfield(ef);  
+    }
+
+    public void setCellSizeX(double csx)
+    {
+     celszx = csx;
+    }
+ 
+    public void setCellSizeY(double csy)
+    {
+     celszy = csy;
+    }
+
+    public double getChargeFractionAt(double xg, double yg, double zg, double xc, double yc)
+    {
+     double[] ce = calculateCentroid(xg,yg,zg);
+     double dx = xc - ce[0];
+     double dy = yc - ce[1];
+     double rsq = dx*dx+dy*dy;
+     double sigd = 0.;
+     double sigr = 0.;
+     double frr = 0.;
+     double frd = 1.;
+     double chd = 0.;
+     double difg = athick-dthick; 
+     if(zg < dthick)
+     {
+      if(celszx*celszy > sigd*sigd)
+      {
+       if((Math.abs(dx) < 0.5*celszx))&&(Math.abs(dy) < 0.5*celszy))
+        chd = 1./(celszx*celszy);
+      }
+      else
+      {
+       double nor = 1./(2.*Math.PI*sigd*sigd);
+       chd = nor * Math.exp(-rsq/(2.*sigd*sigd));
+      }
+     }
+     else
+     {
+      double ddf = (zg-dthick)/difg;
+      frr = ddf;
+      frd = 1.-frr;
+      sigd = 0.;
+      for(int i=0; i<Adir.length; i++)
+       sigd+=Adir[i]*Math.pow(ddf,(double) i);
+      sigd*=difg;
+      sigr=0.;
+      for(int i=0; i<Aref.length; i++)
+       sigr+=Aref[i]*Math.pow(ddf,(double) i);
+      sigr*=difg;  
+      double nor = 1./(2.*Math.PI*sigd*sigd);
+      chd = frd*nor * Math.exp(-rsq/(2.*sigd*sigd));
+      nor = 1./(2.*Math.PI*sigr*sigr);
+      chd+= frr*nor * Math.exp(-rsq/(2.*sigr*sigr));
+     } 
+     return chd;   
+    }
+
+    private double[] calculateCentroid(x,y,z)
+    {
+     double[] centr = new double[2];
+     double lof = 0.;
+     double dz = z;
+     if(z>dthick) dz = dthick;
+     Hep3Vector lu = VecOp.unit(Lorentz);
+     double ld = dz*Math.tan(lorentzangle);
+     centr[0]=x+ld*lu.x();
+     centr[1]=y+ld*lu.y();
+     return centr;
+    }
+    
+    private void calculateLorentzAngle()
+    {
+     if(q > 0.) ctyp=1; 
+     Lorentz = VecOp.cross(Bfield,Efield);
+     if(Efield.mag() > 1.) Beff = Lorentz.mag()/Efield.mag();
+     lorentzangle = q*la.getLorentzAngle(Beff,Efield.mag(),temp,ctyp);
+    } 
+
+}

lcsim/sandbox/NickSinev/PixSim
CCDSpecifications.java added at 1.1
diff -N CCDSpecifications.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CCDSpecifications.java	10 Aug 2007 21:23:06 -0000	1.1
@@ -0,0 +1,124 @@
+package org.lcsim.mc.PixSim;
+
+/**
+ * provides CCD specifications for simulation of CCD response to charge particle hit .
+ * Specifications defined by this class: epitaxial layer depth (thicknes), depleted layer depth
+ * pixel size in x direction and pixel size in y direction. Everything in micrometers
+ * @author Sinev   U of Oregon; [log in to unmask] ; SLAC x2970
+ * @version $Id: CCDSpecifications.java,v 1.1 2007/08/10 21:23:06 sinev Exp $
+ */
+public class CCDSpecifications implements PixelatedSensorSpecs
+{
+    // Everything is in micrometers here
+    public final int NSSPECS = 6;
+    public final int PSIZEXOF = 0;
+    public final int PSIZEYOF = 1;
+    public final int THICKNESSOF = 2;
+    public final int DEPLTHICKNESSOF = 3;
+    public final int OPTEMERATUREOF = 4;
+    public final int VOLTAGEOF = 5;
+    private double[] senspecs = new double[NSSPECS];  
+    private static CCDSpecifications theSpec;
+
+/**
+ * Default constructor.
+ * Specifies following parameters: <BR>
+ * Epi layer thickness (depth) 20 <i>micrometers</i> <BR>
+ * Deplition depth 4 <i>micrometers</i> <BR>
+ * Pixel size 20 x 20 <i>micrometers</i>
+ * 
+ */  
+    public CCDSpecifications()
+    {
+      theSpec = this;
+//
+//    seting default values
+//
+      senspecs[PSIZEXOF]=20.;
+      senspecs[PSIZEYOF]=20.;
+      senspecs[THICKNESSOF] = 20.;
+      senspecs[DEPLTHICKNESSOF]=4.;
+      senspecs[OPTEMPERATUREOF]=190.;
+      senspecs[VOLTAGEOF]=10.;
+    }
+
+/**
+ * Method to access instance of the CCDSpecifications class.
+ * Used to ensure that all part of the code are accessing the same
+ * instance of CCDSpec. This method should be used whenever CcdSpec is needed
+ * instead of building new instance. 
+ **/
+    public static CCDSpecifications instance()
+    {
+     if(theSpec == null) { theSpec = new CCDSpecifications(); }
+     return theSpec;      
+    }
+
+/**
+ * access to specifications as array of doubles
+ * 
+*/
+
+   public double[] getSensorSpecs() { return senspecs; }
+
+/**
+ * access to particular specifications: pixel size in X (microns, local x) 
+ *
+ */
+
+   public double getPixelSizeX()
+   {
+    return senspecs[PSIZEXOF];
+   }
+
+/**
+ * access to particular specifications: pixel size in Y (microns, local y) 
+ *
+ */
+
+   public double getPixelSizeX()
+   {
+    return senspecs[PSIZEYOF];
+   }
+
+/**
+ * access to particular specifications: actve layer thickness (microns) 
+ *
+ */
+
+   public double getActiveThickness()
+   {
+    return senspecs[THICKNESSOF];
+   }
+
+/**
+ * access to particular specifications: depleted layer thickness (microns) 
+ *
+ */
+
+   public double getDepletedThickness()
+   {
+    return senspecs[DEPLTHICKNESSOF];
+   }
+
+/**
+ * access to particular specifications: operating temperature (Kelvin) 
+ *
+ */
+
+   public double getOperatingTemperature()
+   {
+    return senspecs[OPTEMPERATUREOF];
+   }
+
+/**
+ * access to particular specifications: operating bias voltage (Volts) 
+ *
+ */
+
+   public double getBiasVoltage()
+   {
+    return senspecs[VOLTAGEOF];
+   }
+
+ 
\ No newline at end of file

lcsim/sandbox/NickSinev/PixSim
ChargeSpreadComputer.java added at 1.1
diff -N ChargeSpreadComputer.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ChargeSpreadComputer.java	10 Aug 2007 21:23:06 -0000	1.1
@@ -0,0 +1,44 @@
+package org.lcsim.mc.PixSim;
+import org.lcsim.mc.CCDSim.LorentzVector;
+
+/**
+ * A general interface for accessing software,
+ * calculating collected charge density for the
+ * given observation point and given charge generation
+ * point.
+ * Program, implementing this interface is supposed to take
+ * into account sensor parameters and B field (to correctly
+ * calculate Lorentz angle), and take into account diffusion
+ * (mainly in undepleted regions) and charge transport in the depleted regions.
+ * Different types of sensors may have completely different objects, implementing
+ * this interface.
+ * @author sinev
+ * @version $Id: ChargeSpreadComputer.java,v 1.1 2007/08/10 21:23:06 sinev Exp $
+ */
+public interface ChargeSpreadComputer
+{
+    /**
+    * Returns the fraction of charge, generated at point xg,yg,zg and collected in 1 um**2
+    * area around collection point xc,yc (collection point z is 0.) All coordinates are in
+    * local system for the given sensor, the 0.,0.,0. point is the center of the pixel, under
+    * which charge was generated, while xc and yc may belong to another pixel.
+    */
+ 
+    public double getChargeFractionAt(double xg, double yg, double zg, double xc, double yc);
+
+    /**
+    * Setting the value of the magnetic field in the detector (in general it
+    * is assumed that magnetic field is directed along z axis of the global coordinate
+    * system. 
+    *
+    */
+
+    public void setBfield( double B);
+
+    /** 
+    * Setting the sensor parameters by providing Sensor Specifications
+    *
+    */
+
+    public void setSensor( PixelatedSensorSpecs sp);
+}

lcsim/sandbox/NickSinev/PixSim
ChargeSpreadTable.java added at 1.1
diff -N ChargeSpreadTable.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ChargeSpreadTable.java	10 Aug 2007 21:23:06 -0000	1.1
@@ -0,0 +1,413 @@
+package org.lcsim.mc.PixSim;
+import java.util.*;
+
+/**
+ * A program which provides fractions of the charge, generated at 
+ * the given 3D point inside sensitive volume under center pixel
+ * collected in the surrunding pixels (including central one).
+ * It does it by table lookup
+ * The table may be pre-generated, and saved in the user cache.
+ * If the table with given sensor parameters is not found,
+ * it is generated and saved in cache.
+ *  
+ * 
+ * Modifications:  August 3, 2007 - C programs created <BR> 
+ * @author  sinev  U of Oregon, SLAC. x2970 <BR>
+ *
+ * @version $Id: ChargeSpreadTable.java,v 1.1 2007/08/10 21:23:06 sinev Exp $
+*    
+*/
+
+public class ChargeSpreadTable
+{
+   private boolean debug = false;
+   private boolean table_created = false;
+   private SensorSpec specs = null;
+   private int NDepths = 20;
+   private int NSPntsX = 20;
+   private int NSPntsY = 20;
+   private int NPixelsX = 11;
+   private int NPixelsY = 11;
+   private double _Bfield = 5.;
+   private double _bv = 10.;
+   private static float[][][][][] _table = null;
+   private string _sname = "ccd_classic";
+   private string _suffix = "";
+   PixelatedSensorSpecs specs;
+   ChargeSpreadComputer chscomp=null;
+   FileWriter ofw = null;
+   DigitalFormat df = new DigitalFormat();
+  
+    /** 
+     * Default constructor. Create table for default sensor type,
+     * which is ccd_classic, with default table dimensions:
+     * points in grid: 20 in depth, 20 in X and 20 in Y;
+     * number of pixels: 11 in X and 11 in Y (notice this numbers are better to be odd)
+     */
+
+    public ChargeSpreadTable()
+    {
+     System.out.println("Creating ChargeSpreadTable for sensor: "+_sname);
+     CreateTable();    
+    }
+
+    public ChargeSpreadTable(String sensor)
+    {
+     _sname = sensor;
+     CreateTable(); 
+    }
+
+    public ChargeSpreadTable(String sensor, String suffix);
+    {
+     _sname = sensor;
+     _suffix = suffix;
+     CreateTable();
+    }
+
+    public ChargeSpreadTable(String sensor, int nd, int nspx, int nspy, int npxx, int npxy)
+    {
+     _sname = sensor;
+     NDepths = nd;
+     NSPntsX = nspx;
+     NSPntsY = nspy;
+     NPixelsX = npxx;
+     NPixelsY = npxy;
+     CreateTable();
+    }
+
+    public ChargeSpreadTable(String sensor, String suffix, int nd, int nspx, int nspy, int npxx, int npxy)
+    {
+     _sname = sensor;
+     _suffix = suffix;
+     NDepths = nd;
+     NSPntsX = nspx;
+     NSPntsY = nspy;
+     NPixelsX = npxx;
+     NPixelsY = npxy;
+     CreateTable();
+    }
+ 
+
+
+    public void setBField(double B)
+    {
+     _Bfield = B;
+    }
+
+    public void setBiasVolt(double V)
+    {
+     _bV = V;
+    }
+
+    
+    private void CreateTable()
+    {
+        _table = new float[NDepths][NSPntsX][NSPntsY][NPixelsX][NPixelsY];
+        int[] _tabDimPar = null;
+        int nip = 20; 
+
+        if(_sname.compareTo("ccd_classic") == 0)
+        { 
+          specs = CCDSpecifications.instanse();
+          chscomp = new CCDChargeSpreadComputer();
+          chscomp.setBfield(_Bfield);
+          chscomp.setSensor(specs);
+        }  
+        
+        String cacheDir = System.getProperty("user.home");
+        File cachedir = new File(cacheDir);
+        table_created = false;
+        if(cachedir == null)
+        {
+          System.out.println("ChargeSpreadTable is unable to find user home directory!"); 
+        }
+        else
+        {
+         File home = new File(cachedir,".cache");
+         String fname = _sname + _suffix + "_CST.dat";
+         File cache = new File(home,fname);
+         if(cache.exists())
+         {
+          table_created = true;
+          System.out.println("Found ChargeSpreadTable file "+cache.getAbsolutePath());
+          boolean pmatch = true;
+          FileInputStream fins = new FileInputStream(cache);
+          BufferedReader r = new BufferedReader(new InputStreamReader(fins));
+          String rstr;
+          if((rstr = readNextNonCommentLine(r)) != null)
+          {
+           String[] tokens = rstr.split("\\s+");
+           int ntp = tokens.length;
+           _tabDimPar = new int[ntp];
+           for(int i=0; i<ntp; i++)
+           {
+            try
+            {
+             int ival = Integer.parseInt(tokens[i],10);
+             System.out.println("Read: "+ival);
+             _tabDimPar[i]=ival;
+            }
+            catch(NumberFormatException e)
+            {
+             System.out.println("string: "+tokens[i]+" cannot be parsed to int!");
+            }
+            finally
+            {
+            }
+           }
+          }
+          if(_tabDimPar[0] != NDepths) table_created = false;
+          if(_tabDimPar[1] != NSPntsX) table_created = false;
+          if(_tabDimPar[2] != NSPntsY) table_created = false;
+          if(_tabDimPar[3] != NPixelsX) table_created = false;
+          if(_tabDimPar[4] != NPixelsY) table_created = false;
+          if(table_created)
+          {
+           double[] senspcs = specs.getSensorSpecs();
+           int nsp = senspcs.length;
+           double[] readspcs = new double[nsp];
+           int sprd = 0;
+           while(sprd < nsp)
+           {
+            rstr = readNextNonCommentLine(r);
+            if(rstr == null)
+            {
+             System.out.println("Unexpected end of file! Not all sensor specs are read!");
+             break;
+            }
+            String[] tokens = rstr.split("\\s+");
+            int ntps = tokens.length;
+            for(int i=0; i<ntps; i++)
+            {
+             try
+             {
+              double val = Double.parseDouble(tokens[i]);
+              System.out.println("Read: "+val);
+              readspcs[sprd]=val;
+              sprd++;
+             }
+             catch(NumberFormatException e)
+             {
+              System.out.println("string: "+tokens[i]+" cannot be parsed to double!");
+             }
+             finally
+             {
+             }
+            } 
+           }
+           if(sprd != nsp) table_created = false;
+           if(table_created)
+           {   
+            for(int i=0; i<nsp; i++)
+             if(Math.abs(readspcs[i]/senspcs[i] - 1.) > 0.001) table_created = false;
+           }
+          }
+          if(table_created)
+          {
+           int nvalues = NDepths * NSPntsX * NSPntsY * NPixelsX * NPixelsY;
+           System.out.println("Reading "+nvalues+" elements from table file");
+           int nrd=0;
+           int nd = 0;
+           int npx = 0;
+           int npy = 0;
+           int npxx = 0;
+           int npxy = 0;
+           while((rstr = readNextNonCommentLine(r)) != null)
+           {
+            String[] tokens = rstr.split("\\s+");
+            int ntps = tokens.length;
+            for(int i=0; i<ntps; i++)
+            {
+             try
+             {
+              double val = Double.parseDouble(tokens[i]);
+              float fv = (float) val;
+              if(nrd < nvalues)
+               _table[nd][npx][npy][npxx][npxy]=fv;
+              nrd++;
+              npxy++;
+              if(npxy == NPixelsY)
+              {
+               npxy = 0;
+               npxx++;
+               if(npxx == NPixelsX)
+               {
+                npxx=0;
+                npy++;
+                if(npy==NSPntsY)
+                {
+                 npy=0;
+                 npx++;
+                 if(npx == NSPntsX)
+                 {
+                  npx=0;
+                  nd++; 
+                 }
+                }  
+               } 
+              } 
+             }
+             catch(NumberFormatException e)
+             {
+              System.out.println("string: "+tokens[i]+" cannot be parsed to double!");
+             }
+             finally
+             {
+             }
+            }
+            if(nrd >= nvalues) break; 
+           }      
+          } 
+         }
+         else
+         {
+          System.out.println("Table file does not exist. Creating new table");
+          cache.createNewFile();
+          df.setFractionDigits(6);
+          try
+          { 
+           ofw = new FileWriter(cache);
+           ofw.write("//  Charge Spread Table for sensor "+_sname+_suffix+"\n");
+           Date date = new Date();
+           DateFormat daf = new SimpleDateFormat();
+           ofw.write("// Table was created: "+daf.format(date)+"\n");
+           ofw.write(" "+NDepths+" "+NSPntsX+" "+NSPntsY+" "+NPixelsX+" "+NPixelsY+"\n");
+           double[] senspcs = specs.getSensorSpecs();
+           int nsp = senspcs.length;
+           for(int i=0; i<nsp; i++)
+            ofw.write(df.format(senspcs[i])+" ");
+           ofw.write("/n");
+           int cpixx = (NPixelsX-1)/2 - 1;
+           int cpixy = (NPixelsY-1)/2 - 1;
+           double xps = senspcs[0];
+           double yps = senspcs[1];
+           double thickn = senspcs[2];
+           double dx = xps/NSPntsX;
+           double dy = yps/NSPntsy;
+           double dz = thickn/NDepths;
+           double xd = 0.;
+           double yd = 0.;
+           double xs = 0.;
+           double ys = 0.;
+           double zd = 0.;     
+           double dxi = xps/nip;
+           double dyi = yps/nip;
+           chscomp.setCellSizeX(dxi);
+           chscomp.setCellSizeY(dyi);
+           int nvalues = NDepths * NSPntsX * NSPntsY * NPixelsX * NPixelsY;
+           System.out.println("Calculating and recording "+nvalues+" elements into table file");
+           int nwr=0;
+           int nd = 0;
+           int npx = 0;
+           int npy = 0;
+           int npxx = 0;
+           int npxy = 0;
+           while(nwr < nvalues)
+           {
+            int ntps = NDepths;
+            if(NDepths > 10)
+            {
+             if((NDepths%2) == 0)
+              ntps = NDepths/2;
+             if(NDepths > 20)
+             {
+              if((NDepths%3)==0)
+               ntps = NDepths/3;
+              if((ntps>10) && ((NDepths%5)==0))
+               ntps = NDepths/5;
+             }                
+            } 
+            for(int i=0; i<ntps; i++)
+            {
+             xd = dx*npx + dx/2. - xps/2;
+             yd = dy*npy + dy/2. - yps/2;
+             zd = dz*nd + dz/2.;
+             double aop = xps * yps; 
+             double schf = 0.;
+             double xof = (npxx - cpixx) * xps;
+             double yof = (npxy - cpixy) * yps;
+             for(int j=0; j<nip; j++)
+             {
+              ys = j*dyi + dyi/2 - yps/2 + yof;
+              for int k=0; k<nip; k++)
+              {
+               xs = k*dxi+dxi/2-xps/2+xof;
+               schf = schf + chscomp.getChargeFractionAt(xs,ys,xd,yd,zd);
+              }
+             }
+             schf*=aop;
+             _table[nd][npx][npy][npxx][npxy] = (float) schf;
+             ofw.write(" "+df.format(schf));
+             nwr++;
+             npxy++;
+             if(npxy == NPixelsY)
+             {
+              npxy = 0;
+              npxx++;
+              if(npxx == NPixelsX)
+              {
+               npxx=0;
+               npy++;
+               if(npy==NSPntsY)
+               {
+                npy=0;
+                npx++;
+                if(npx == NSPntsX)
+                {
+                 npx=0;
+                 nd++; 
+                }  
+               } 
+              } 
+             }
+             if(nwr >= nvalues) break; 
+            }
+            ofw.write("\n");
+           }                  
+          }
+          catch(IOException e)
+          {
+           System.out.println("IOException caught: "+e.getMessage());
+          }
+          finally
+          {
+          } 
+         }          
+        } 
+    }
+
+    private String readNextNonCommentLine(BufferedReader r)
+    {
+      boolean comfl = false;
+      String readstr = r.readLine();
+      if(readstr != null)
+      { 
+       if(readstr.contains("/*")) comfl = true;
+       while(comfl)
+       { 
+        readstr = r.readLine();
+        if(readstr.contains("*/") comfl=false;
+        if(!comfl) readstr = r.readLine(); 
+       }
+       if(readstr!= null)
+       {
+        int cind = readstr.indexOf("//");
+        while (cind != -1)
+        { 
+         if(cind > 0)
+         {
+          String clstr = readstr.substring(0,cind-1);
+          readstr = clstr;
+         }
+         if(cind == 0)
+         { 
+          readstr = r.readLine();
+          cind = readstr.indexOf("//");
+         }            
+        } 
+       }       
+      }
+      return readstr;
+    } 
+    
+}
\ No newline at end of file

lcsim/sandbox/NickSinev/PixSim
PixelatedSensorSpecs.java added at 1.1
diff -N PixelatedSensorSpecs.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PixelatedSensorSpecs.java	10 Aug 2007 21:23:06 -0000	1.1
@@ -0,0 +1,27 @@
+package org.lcsim.mc.PixSim;
+
+
+/**
+ * A general interface for Pixelated detector specification
+ * All such specification should implement it.
+ * @author sinev
+ * @version $Id: PixelatedSensorSpecs.java,v 1.1 2007/08/10 21:23:06 sinev Exp $
+ */
+public interface PixelatedDetectorSpecs
+{
+    public double[] getSensorSpecs();
+    /** 
+     * Returns the detector specific cell id.
+     */
+
+    public double getPixelSizeX();
+
+    public double getPixelSizeY();
+ 
+    public double getActiveThickness();
+
+    public double getDepletedThickness();
+
+    public double getOperatingTemperature();
+ 
+}
CVSspam 0.2.8