Print

Print


Commit in lcsim-contrib/src/main/java/org/lcsim/contrib/SteveMagill on MAIN
STrJetLinkDriver.java+111added 1.1

lcsim-contrib/src/main/java/org/lcsim/contrib/SteveMagill
STrJetLinkDriver.java added at 1.1
diff -N STrJetLinkDriver.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ STrJetLinkDriver.java	14 Feb 2012 19:32:31 -0000	1.1
@@ -0,0 +1,111 @@
+package org.lcsim.contrib.SteveMagill;
+
+import java.util.*;
+import org.lcsim.event.*;
+import org.lcsim.util.Driver;
+import hep.physics.vec.Hep3Vector;
+import org.lcsim.util.aida.AIDA;
+import hep.aida.ITree;
+
+public class STrJetLinkDriver extends Driver
+{
+   private AIDA aida = AIDA.defaultInstance();
+   private double _clldis;
+   private ITree _tree;
+   private boolean linkD = false;
+   private String _sjetname;
+   private String _trjetname;
+   private String _olmapname;
+      
+   public STrJetLinkDriver(double clldis)
+   {
+       _clldis = clldis;
+   }
+   
+    protected void process(EventHeader event)
+    {
+        super.process(event);  // executes all added drivers
+        
+        //  loop over all Scin jets
+        Map<ReconstructedParticle, ReconstructedParticle> schmap = new HashMap<ReconstructedParticle, ReconstructedParticle>();
+        int nlink = 0;
+        try
+        {
+            List<ReconstructedParticle> Sjets = event.get(ReconstructedParticle.class,_sjetname);
+//            System.out.println("Number of S Jets" + Sjets.size());
+            for (ReconstructedParticle sjet : Sjets)
+            {
+                Hep3Vector ecp = sjet.getMomentum();
+                double ecpx = ecp.x();
+                double ecpy = ecp.y();
+                double ecpz = ecp.z();
+                double ecR = Math.sqrt(ecpx*ecpx+ecpy*ecpy);
+                double eclth = Math.atan(ecR/ecpz);
+                if (eclth<0) eclth+=Math.PI;
+                double eclph = Math.atan2(ecpy,ecpx);
+                if (eclph<0) eclph+=2*Math.PI;
+                if (linkD) aida.cloud1D("Theta of S jets").fill(eclth);
+                if (linkD) aida.cloud1D("Phi of S jets").fill(eclph);
+                
+                // now check with tr jets to make links
+                try
+                {
+                    List<ReconstructedParticle> TRjets = event.get(ReconstructedParticle.class,_trjetname);
+                    for (Iterator<ReconstructedParticle> trj = TRjets.iterator(); trj.hasNext();)
+                    {
+                        ReconstructedParticle ihj = trj.next();
+                        Hep3Vector hcp = ihj.getMomentum();
+                        double hcpx = hcp.x();
+                        double hcpy = hcp.y();
+                        double hcpz = hcp.z();
+                        double hcR = Math.sqrt(hcpx*hcpx+hcpy*hcpy);
+                        double hclth = Math.atan(hcR/hcpz);
+                        if (hclth<0) hclth+=Math.PI;
+                        double hclph = Math.atan2(hcpy,hcpx);
+                        if (hclph<0) hclph+=2*Math.PI;
+                        if (linkD) aida.cloud1D("Theta of TR jets").fill(hclth);
+                        if (linkD) aida.cloud1D("Phi of TR jets").fill(hclph);
+                        //  calculate distance in theta phi
+                        double dccth = Math.abs(eclth-hclth);
+                        double dccph = Math.abs(eclph-hclph);
+                        if (dccph>Math.PI) dccph = 2*Math.PI-dccph;
+                        double dist = Math.sqrt(dccth*dccth+dccph*dccph);
+                        if (linkD) aida.cloud1D("Distance between S and TR jets").fill(dist);
+                        //  test for distance and merge if close, removing merged hadclusters from list
+                        if (dist<_clldis)
+                        {
+                            schmap.put(sjet, ihj);
+                            nlink++;
+                        }
+                    }  // end of track jet loop
+                }
+                catch (java.lang.IllegalArgumentException ex)
+                {
+                    System.out.println("No TR jets in link");
+                }
+            }  // end of S jet loop
+        }
+        catch (java.lang.IllegalArgumentException ex)
+        {
+            System.out.println("No S jets in link");
+        }
+        if (linkD) aida.cloud1D("Number of STr jet links").fill(nlink);
+        event.put(_olmapname,schmap);
+
+    }  // end of event loop
+        
+    public void setInputScinJetName(String sjname)
+    {
+        _sjetname = sjname;
+    }
+    public void setInputTrackJetName(String trjname)
+    {
+        _trjetname = trjname;
+    }
+    public void setOutputLinkMapName(String olmapname)
+    {
+        _olmapname = olmapname;
+    }
+        
+}
+
CVSspam 0.2.12


Use REPLY-ALL to reply to list

To unsubscribe from the LCD-CVS list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=LCD-CVS&A=1