Print

Print


Commit in lcsim/src/org/lcsim/contrib/Cassell/recon/Cheat on MAIN
CheatClusterIDDriver.java+86added 1.1
Driver to make map of MCParticle to all cluster assigned to it with cheatID

lcsim/src/org/lcsim/contrib/Cassell/recon/Cheat
CheatClusterIDDriver.java added at 1.1
diff -N CheatClusterIDDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ CheatClusterIDDriver.java	8 Nov 2007 23:33:43 -0000	1.1
@@ -0,0 +1,86 @@
+/*
+ * CheatClusterIDDriver.java
+ *
+ * Created on March 27, 2007, 8:18 AM
+ *
+ * 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.
+ */
+
+package org.lcsim.contrib.Cassell.recon.Cheat;
+import org.lcsim.recon.cluster.util.ClusterIDCheater;
+import org.lcsim.util.Driver;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
+import org.lcsim.event.Cluster;
+import org.lcsim.event.MCParticle;
+import org.lcsim.event.EventHeader;
+
+/**
+ *
+ * @author cassell
+ */
+public class CheatClusterIDDriver extends Driver
+{
+    ClusterIDCheater clid;
+    String[] clcollections;
+    String FSname;
+    Map<MCParticle,List<Cluster>> FScllistmap;
+    Map<MCParticle,List<Cluster>> Extracllistmap;
+    /** Creates a new instance of CheatClusterIDDriver */
+    public CheatClusterIDDriver(String[] clnames, String fsname)
+    {
+        clcollections = clnames;
+        FSname = fsname;
+        clid = new ClusterIDCheater();
+    }
+    protected void process(EventHeader event)
+    {
+       FScllistmap = new HashMap<MCParticle,List<Cluster>>();
+       Extracllistmap = new HashMap<MCParticle,List<Cluster>>();
+       List<MCParticle> fslist = event.get(MCParticle.class,FSname);
+       for(MCParticle p:fslist)
+       {
+//
+// Ignore neutrinos
+//
+           int pdg = Math.abs(p.getPDGID());
+           if( (pdg == 12)||(pdg == 14)||(pdg == 16))continue;
+           List<Cluster> cll = new ArrayList<Cluster>();
+           FScllistmap.put(p,cll);
+       }
+       List<List<Cluster>> lists = event.get(Cluster.class);
+       for(List<Cluster> list:lists)
+       {
+          for(int i=0;i<clcollections.length;i++)
+          {
+             if(event.getMetaData(list).getName().compareTo(clcollections[i]) == 0)
+             {
+                for(Cluster c:list)
+                {
+                    MCParticle p = clid.getMCID(fslist,c);
+                    if(FScllistmap.containsKey(p))
+                    {
+                        FScllistmap.get(p).add(c);
+                    }
+                    else
+                    {
+                        if(Extracllistmap.containsKey(p))Extracllistmap.get(p).add(c);
+                        else
+                        {
+                            List<Cluster> el = new ArrayList<Cluster>();
+                            el.add(c);
+                            Extracllistmap.put(p,el);
+                        }
+                    }
+                }
+             }
+          }
+       }
+    }
+    public Map<MCParticle,List<Cluster>> getFSmap(){return FScllistmap;}
+    public Map<MCParticle,List<Cluster>> getExtramap(){return Extracllistmap;}
+}
CVSspam 0.2.8