Commit in lcsim/sandbox/NickSinev/Examples on MAIN
ChronoPixFieldMove.java+163added 1.1
CarrierPropagatorTraceExample.java+28-161.1 -> 1.2
+191-16
1 added + 1 modified, total 2 files


lcsim/sandbox/NickSinev/Examples
ChronoPixFieldMove.java added at 1.1
diff -N ChronoPixFieldMove.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ ChronoPixFieldMove.java	17 Dec 2010 21:47:11 -0000	1.1
@@ -0,0 +1,163 @@
+import java.util.*;
+import hep.aida.*;
+import org.lcsim.recon.vertexing.pixsim.*;
+import java.io.*;
+import org.lcsim.geometry.FieldMap;
+import hep.physics.vec.*;
+
+/**
+ *
+ * @author Nick Sinev
+ */
+public class ChronoPixFieldMove 
+{
+
+   public static void main(String[] args)  throws IOException
+    {
+     double cesz = 1.;  // half of charge collection electrode
+     double psz = 15.;
+     double ethick=12.; 
+     int nzplanes = 48; 
+     double zs=17.; 
+     double[] efield = new double[3];
+
+     TCADFieldMap Efield = new TCADFieldMap();
+     String fname = "C:\\org_lcsim_cvstop\\lcsim\\sandbox\\NickSinev\\Examples\\thick3d_8_hr_33_emap_coarse.txt";
+     boolean map_found = Efield.readMap(fname);
+     if(!map_found)
+     {  
+      System.out.println("Could not find "+fname);
+      return;
+     }
+      
+     Hep3Vector B = new BasicHep3Vector(0.,5.,0.);    // B field is in lokal pixel coordinates system, where axis Y is directed along global Z
+     NamedFieldMap Bfield = new UniformFieldMap(B);
+
+     Medium bulk=new Silicon();
+
+     double[] flims = Efield.getMapLimits();   // dimensions in the map are in mm
+     psz = flims[1]-flims[0]; 
+     double pszx=psz;
+     double pszy = flims[3]-flims[2];
+     double pszz = flims[5]-flims[4];
+    ethick=pszz*1000.; // to express it in microns 
+     System.out.println("field map extends in x: "+pszx+" in y: "+pszy+" in z: "+pszz);
+     PixelConfiguration pcf = new PixelConfiguration(bulk,Efield,Bfield,pszx,pszy,pszz);
+
+     pcf.setBFieldIsUniform(true);
+
+     List<SensorRegion> collectors = new ArrayList<SensorRegion>();
+     List<SensorRegion> absorbers = new ArrayList<SensorRegion>();
+     List<SensorRegion>  reflectors = new ArrayList<SensorRegion>();
+   /*
+     To understand how  dimensions and shapes of sensor regions are defined see comments 
+      in CarrierPropagatorUseExample 
+  */
+    SensorRegion collector = new SensorRegion();
+    collector.setBox(0.,0.,0.,0.5*pszx,0.5*pszy,0.004);
+    collectors.add(collector);
+    SensorRegion refl = new SensorRegion();
+    refl.setBoxLimits(-pszx/2.,pszx/2.,-pszy/2.,pszy/2.,pszz-0.002,pszz+0.002);
+    reflectors.add(refl);
+    SensorRegion absorber = new SensorRegion();
+    absorber.setBox(0.,0.,0.,pszx,pszy,0.001);
+    absorbers.add(absorber);
+    pcf.setCollectors(collectors);
+    pcf.setAbsorbers(absorbers);
+    pcf.setReflectors(reflectors);
+
+    CarrierPropagator cpr = new CarrierPropagator(pcf);
+    cpr.setDiffusionSteps(0.0003);
+    cpr.setDriftSteps(0.0001); 
+    cpr.setTrace(true);
+/*
+     If we want to clearly see electric field flood lines (direction of charge movement) ,
+     we can turn off charge diffusion simulation. This is not realistic (unless temerature
+     is zero Kelvin), but give us clear view of electric field.
+*/
+    cpr.setIgnoreDiffusion(true);
+
+     TransportState stat = new TransportState();
+     TransportStatus status;
+
+      IAnalysisFactory af = IAnalysisFactory.create();
+      ITree tree=af.createTreeFactory().create("C:\\analysis\\Chronopix\\thick_hr_charge_move_nodiff.aida","xml",false,true);
+      IHistogramFactory hf = af.createHistogramFactory(tree);
+       nzplanes = 80;
+       zs = ethick-2.;     // distance from the surface of highly dopped layer next to substrate (in microns)
+      IHistogram2D hxz = hf.createHistogram2D("movement of charge",400,-20.,5.,192,0.,ethick);
+      IHistogram2D hfld = hf.createHistogram2D("Abs value of E-field",200,-20.,5.,2*nzplanes,0.,ethick);
+ 
+    for(int n=0; n<40; n++)
+    {
+      System.out.println("Track # "+n);
+      int k = n;
+      if(n>19) k=n-20;
+     double ym = 0.;                       // xm,ym,zm - coordinates in microns
+     double xm =-18.87 + 1.137* k;
+     double zm = zs;
+     if(n>19) zm = 3.;
+     double xc=0.001*xm;       
+     double yc=0.001*ym;
+     double zc=0.001*zm;
+     hxz.fill(xc,zc);
+     hxz.fill(xc,zc);
+     hxz.fill(xc,zc);
+     hxz.fill(xc,zc);  // make start point fatter
+
+      Hep3Vector gpnt = new BasicHep3Vector(xc,yc,zc);
+      Hep3Vector fp = cpr.transport(gpnt,stat);
+      status=stat.status;
+      int nst = stat.nsteps;
+      if(status == TransportStatus.TRAPPED) System.out.println("Carrier trapped!!!");
+      if(status == TransportStatus.TOOLONG) System.out.println("Too many steps!!");
+      if((status==TransportStatus.COLLECTED) || (status==TransportStatus.ABSORBED))
+      {
+       List<Hep3Vector> track = cpr.getTrace();
+       int npit = track.size();
+       System.out.println("trace has "+npit+" points");
+       int j=0;
+       for(Hep3Vector point:track)
+       {
+        xm=1000.*point.x();
+        ym=1000.*point.y();
+        zm=1000.*point.z();
+       hxz.fill(xm,zm);
+       }
+     }
+    }
+    double[] epos = new double[3];
+     for(int i=0; i<200; i++)
+     {
+      double y = 0.;
+      double x = -20.+0.125*i+0.0625;
+      for(int j=0; j<2*nzplanes; j++)
+      {
+       double z = 0.125*j + 0.0625;
+       epos[0]=0.001*x;
+       epos[1]=0.001*y;
+       epos[2]=0.001*z;
+       while(epos[0]<-pszx/2.) epos[0]+=pszx;
+       while(epos[0]>pszx/2.) epos[0]-=pszx;
+       Efield.getField(epos,efield);
+       double E = Math.sqrt(efield[0]*efield[0]+efield[1]*efield[1]+efield[2]*efield[2]);
+       hfld.fill(x,z,E);
+      }
+     }
+    IPlotterFactory pf = af.createPlotterFactory();
+    IPlotter plotter = pf.create("Plot");
+    plotter.createRegions(1,1);
+    IPlotterStyle style =pf.createPlotterStyle();
+    style.statisticsBoxStyle().setVisible(false);
+    style.legendBoxStyle().setVisible(false);
+    style.setParameter("hist2DStyle","colorMap");
+    plotter.region(0).plot(hfld,style);
+    style.setParameter("hist2DStyle","ellips");
+    style.dataStyle().markerStyle().setParameter("color","Blue");
+    plotter.region(0).plot(hxz,style);
+
+    plotter.show();
+
+//     tree.commit();
+  }  // end main
+ }
\ No newline at end of file

lcsim/sandbox/NickSinev/Examples
CarrierPropagatorTraceExample.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- CarrierPropagatorTraceExample.java	26 Jul 2008 01:28:46 -0000	1.1
+++ CarrierPropagatorTraceExample.java	17 Dec 2010 21:47:11 -0000	1.2
@@ -3,7 +3,7 @@
 import org.lcsim.util.aida.AIDA;
 import hep.aida.ITree;
 import java.util.Random;
-import org.lcsim.contrib.NickSinev.PixSim.*;
+import org.lcsim.recon.vertexing.pixsim.*;
 import org.lcsim.geometry.FieldMap;
 import hep.physics.vec.*;
 import hep.aida.*;
@@ -41,7 +41,7 @@
      *  For CCDs, for example, I would use DepletionFieldMap, which provides the way
      *  to calculate field map in flat, partially depleted silicon layer.
      */
-
+     boolean ignore_diffusion = true; // if we want to see carrier movement only due  E and B filed, set it true 
      TCADFieldMap Efield = new TCADFieldMap();
 
      /*
@@ -50,8 +50,12 @@
      * path to it as fname
      */
 
-     String fname = "thin3dhr_33_emap_coarse.txt";
-//       String fname = "thick3d_8_hr_33_emap_coarse.txt";   // You can try this field. It is very weak, so you will see a lot of diffusion!
+//     String fname = "chrono_sarn_b0_emap_noin.dat";
+//       String fname = "thick3d_8_hr_33_emap_coarse.txt";   
+     String fname = "C:\\org_lcsim_cvstop\\lcsim\\sandbox\\NickSinev\\Examples\\thick3d_8_hr_33_emap_coarse.txt";
+//     String fname = "C:\\org_lcsim_cvstop\\lcsim\\sandbox\\NickSinev\\Examples\\thin3dhr_33_emap_coarse.txt";
+// You can try this field. It is very weak, so you will see a lot of diffusion!
+// of cource you will need to change org_lcsim_cvstop directory name to what your cvs checkout directory is
 
      /*
      * Now we are going to read file, and can continue only if it was successful
@@ -71,7 +75,8 @@
      * to set B field along Y axis
      */
       
-     Hep3Vector B = new BasicHep3Vector(0.,5.,0.);
+     Hep3Vector B = new BasicHep3Vector(0.,3.,0.);
+//     Hep3Vector B = new BasicHep3Vector(0.,0.,0.);
      NamedFieldMap Bfield = new UniformFieldMap(B);
 
      /*
@@ -204,6 +209,7 @@
      cpr.setDiffusionSteps(0.0003);
      cpr.setDriftSteps(0.0001); 
      cpr.setTrace(true);
+     cpr.setIgnoreDiffusion(ignore_diffusion);
     
      /*
      *   to see final result of carrier propagation through the sensor 
@@ -292,15 +298,14 @@
       IDataPointSet pmove11 = dpsf.create("pmove11","particle 6 path in x,z",2);
       IDataPointSet pmove12 = dpsf.create("pmove12","particle 6a path in x,z",2);
       IHistogram2D hfld = hf.createHistogram2D("E-field z component vs x,z coordinate",150,plxmin,plxmax,100,0.,pszz);
-      IHistogram2D ptra1 = hf.createHistogram2D("particle 1 track",400,grxm[0]*pszx,grxm[8]*pszx,200,0.,pszz);
-      IHistogram2D ptra2 = hf.createHistogram2D("particle 3 track",400,grxm[0]*pszx,grxm[8]*pszx,200,0.,pszz);
-      IHistogram2D ptra3 = hf.createHistogram2D("particle 6 track",400,grxm[0]*pszx,grxm[8]*pszx,200,0.,pszz);
+      IHistogram2D ptrac = hf.createHistogram2D("tracks",400,grxm[0]*pszx,grxm[8]*pszx,200,0.,pszz);
 
 
      for(int tr=0; tr<ntry; tr++)
      {
-      int k = (tr - tr%2)/2;
-      double xg = -0.5*pszx+0.2*pszx*k;
+//      int k = (tr - tr%2)/2;
+      int k = tr;
+      double xg = -1.5*pszx+0.25*pszx*k+0.125*pszx;
       double yg = 0.;
       double zg = pszz-0.003;
       Hep3Vector gpnt = new BasicHep3Vector(xg,yg,zg);
@@ -318,75 +323,84 @@
        {
         if(tr==0)
         {
-         ptra1.fill(point.x(),point.z());
+         ptrac.fill(point.x(),point.z());
          pmove1.addPoint();
          pmove1.point(j).coordinate(0).setValue( point.x() );
          pmove1.point(j).coordinate(1).setValue( point.z() );
         }
         if(tr==1)
         {
+         ptrac.fill(point.x(),point.z());
          pmove2.addPoint();
          pmove2.point(j).coordinate(0).setValue( point.x() );
          pmove2.point(j).coordinate(1).setValue( point.z() );
         } 
         if(tr==2)
         {
+         ptrac.fill(point.x(),point.z());
          pmove3.addPoint();
          pmove3.point(j).coordinate(0).setValue( point.x() );
          pmove3.point(j).coordinate(1).setValue( point.z() );
         }
         if(tr==3)
         {
+         ptrac.fill(point.x(),point.z());
          pmove4.addPoint();
          pmove4.point(j).coordinate(0).setValue( point.x() );
          pmove4.point(j).coordinate(1).setValue( point.z() );
        }
        if(tr==4)
        {
-        ptra2.fill(point.x(),point.z());
+        ptrac.fill(point.x(),point.z());
         pmove5.addPoint();
         pmove5.point(j).coordinate(0).setValue( point.x() );
         pmove5.point(j).coordinate(1).setValue( point.z() );
        }
         if(tr==5)
         {
+         ptrac.fill(point.x(),point.z());
          pmove6.addPoint();
          pmove6.point(j).coordinate(0).setValue( point.x() );
          pmove6.point(j).coordinate(1).setValue( point.z() );
         }
         if(tr==6)
         {
+         ptrac.fill(point.x(),point.z());
          pmove7.addPoint();
          pmove7.point(j).coordinate(0).setValue( point.x() );
          pmove7.point(j).coordinate(1).setValue( point.z() );
         } 
         if(tr==7)
         {
+         ptrac.fill(point.x(),point.z());
          pmove8.addPoint();
          pmove8.point(j).coordinate(0).setValue( point.x() );
          pmove8.point(j).coordinate(1).setValue( point.z() );
         }
         if(tr==8)
         {
+         ptrac.fill(point.x(),point.z());
          pmove9.addPoint();
          pmove9.point(j).coordinate(0).setValue( point.x() );
          pmove9.point(j).coordinate(1).setValue( point.z() );
        }
        if(tr==9)
        {
+         ptrac.fill(point.x(),point.z());
         pmove10.addPoint();
         pmove10.point(j).coordinate(0).setValue( point.x() );
         pmove10.point(j).coordinate(1).setValue( point.z() );
        }
        if(tr==10)
        {
-        ptra3.fill(point.x(),point.z());
+        ptrac.fill(point.x(),point.z());
         pmove11.addPoint();
         pmove11.point(j).coordinate(0).setValue( point.x() );
         pmove11.point(j).coordinate(1).setValue( point.z() );
        }
         if(tr==11)
        {
+         ptrac.fill(point.x(),point.z());
         pmove12.addPoint();
         pmove12.point(j).coordinate(0).setValue( point.x() );
         pmove12.point(j).coordinate(1).setValue( point.z() );
@@ -475,10 +489,8 @@
     style.setParameter("hist2DStyle","colorMap");
     plotter.region(1).plot(hfld,style);
     style.setParameter("hist2DStyle","ellips");
-    plotter.region(1).plot(ptra1,style);
     style.dataStyle().markerStyle().setParameter("color","Blue");
-    plotter.region(1).plot(ptra2,style);
-    plotter.region(1).plot(ptra3,style);
+    plotter.region(1).plot(ptrac,style);
 
     plotter.show();
   
CVSspam 0.2.8