Commit in lcsim/sandbox/NickSinev/Examples on MAIN
PixSimUseExample.java+43added 1.1
The simpliest example of using PixSim package

lcsim/sandbox/NickSinev/Examples
PixSimUseExample.java added at 1.1
diff -N PixSimUseExample.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ PixSimUseExample.java	1 Jul 2008 19:14:42 -0000	1.1
@@ -0,0 +1,43 @@
+import org.lcsim.event.EventHeader;
+import org.lcsim.event.*;
+import org.lcsim.util.Driver;
+import org.lcsim.contrib.NickSinev.PixSim.*;
+import java.util.*;
+
+public class PixSimUseExample extends Driver
+{
+   // here we are creating driver for particular sensor from the SensorOption enumeration
+   // and indicating that we want to use tables in the simulation (second argument).
+
+   PixilatedSensorManager psm = new PixilatedSensorManager(SensorOption.ClassicCCD,true);
+
+   int evnum = 0;
+
+   public PixSimUseExample()
+   {
+   }
+
+   public void process(EventHeader event) 
+   {
+    System.out.println("Processing event: "+evnum);
+
+    // this is the only line which need to be included in process(event)
+
+    psm.process(event);
+
+    // Just to see if it really jenerated TrackerHits
+
+    List<List<TrackerHit>> evthits = event.get(TrackerHit.class);
+    if(evthits != null)
+    {
+     System.out.println("Event has  "+evthits.size()+" TrackerHit collections: ");
+     for(List<TrackerHit> thits:evthits)
+     {
+       EventHeader.LCMetaData md = event.getMetaData(thits);
+       System.out.println(md.getName()+" size: "+thits.size());
+     }
+    }
+    evnum++;
+   }
+
+}
\ No newline at end of file
CVSspam 0.2.8