Print

Print


Commit in SlicDiagnostics/src/org/lcsim/slic/diagnostics on MAIN
CommandLineProcessor.java+10-121.9 -> 1.10
MCParticleFlag.java+6-21.2 -> 1.3
MCParticleFlags.java+19-31.4 -> 1.5
MCParticlePlots.java+27-141.28 -> 1.29
MCParticleTypeInfo.java+10-21.4 -> 1.5
MCParticleUtil.java+27-21.3 -> 1.4
UserOptions.java+8-21.3 -> 1.4
+107-37
7 modified files
JM: Miscellaneous updates and additions to MCParticle handling.

SlicDiagnostics/src/org/lcsim/slic/diagnostics
CommandLineProcessor.java 1.9 -> 1.10
diff -u -r1.9 -r1.10
--- CommandLineProcessor.java	16 Oct 2006 19:04:42 -0000	1.9
+++ CommandLineProcessor.java	28 Nov 2006 00:53:17 -0000	1.10
@@ -28,7 +28,7 @@
  * Main.
  * 
  * @author Jeremy McCormick
- * @version $Id: CommandLineProcessor.java,v 1.9 2006/10/16 19:04:42 jeremy Exp $
+ * @version $Id: CommandLineProcessor.java,v 1.10 2006/11/28 00:53:17 jeremy Exp $
  */
 public class CommandLineProcessor
 {
@@ -37,7 +37,6 @@
     private Properties _properties = new Properties();
     private UserOptions _userOptions = null;
     private List<File> _infiles = new ArrayList<File>();
-    //private File _outfile = null;
     int _verbosity = 0;
 
     /** Create a CommandLineProcessor where parse will be called later. */
@@ -257,17 +256,14 @@
                 {
                     System.out.println("pattern=" + s);
                 }
-            }
-           
-            System.out.println("user options ...");
-            System.out.println(_userOptions.toString());
+            }           
         }
 
         // There should be some files to process at this point, or the command
         // line arguments did not find any input files.
         if (_infiles.size() == 0)
         {
-            System.err.println("ERROR: No input files were found from command line arguments.");
+            System.err.println("ERROR: No input files were found from arguments.");
             printUsage(true);
         }
 
@@ -294,19 +290,21 @@
         }
         
         // If neither of above 2 are selected for output filename,
-        // the user's outputFile option is kept or the default,
-        // e.g. hard-coded, filename is used.
+        // the user's outputFile option from properties is kept 
+        // or the default, e.g. hard-coded, filename is used.
 
+        // Print input files and user options after processing.
         if (_verbosity > 0)
         {
-            System.out.println("outputFile=" + _userOptions.getStringOption("outputFile"));
-            
+            System.out.println("--User Options--");
+            System.out.println(_userOptions.toString());
+                        
             int nfiles=0;
             for (File file : _infiles)
             {
                 System.out.println("inputFile["+ nfiles + "]=" + file.getAbsoluteFile());
                 ++nfiles;
-            }                      
+            }                                  
         }
     }
 

SlicDiagnostics/src/org/lcsim/slic/diagnostics
MCParticleFlag.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- MCParticleFlag.java	10 Nov 2006 22:29:15 -0000	1.2
+++ MCParticleFlag.java	28 Nov 2006 00:53:18 -0000	1.3
@@ -4,7 +4,7 @@
  * Combined set of flags for MCParticle statuses, including error conditions.
  * 
  * @author jeremym
- * @version $Id: MCParticleFlag.java,v 1.2 2006/11/10 22:29:15 jeremy Exp $
+ * @version $Id: MCParticleFlag.java,v 1.3 2006/11/28 00:53:18 jeremy Exp $
  */
 enum MCParticleFlag
 {
@@ -34,7 +34,11 @@
     BAD_STAT_DECAYED_CALORIMETER_AND_STOPPED("Bad: Decayed in Calorimeter and Stopped", 23),
     BAD_STAT_LEFT_AND_STOPPED("Bad: Left and Stopped", 24),
     BAD_STAT_SIM_NO_SIM_STATUS("Bad: Sim Particle with no Simulator Status", 25), 
-    BAD_STAT_CHARGE_NAN("Bad: Charge is NaN", 26);
+    BAD_STAT_CHARGE_NAN("Bad: Charge is NaN", 26),
+    ENDPOINT_AT_ORIGIN("Endpoint at (0,0,0)", 27),
+    NO_TRAVEL("Endpoint and Origin are equal", 28),
+    NO_TIME("Time is 0.0", 29),
+    ORIGIN_OUTSIDE_TRACKING_REGION("Bad: Origin Outside Of Tracking Region", 30);
 
     String _descr;
     int _flag;

SlicDiagnostics/src/org/lcsim/slic/diagnostics
MCParticleFlags.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- MCParticleFlags.java	10 Nov 2006 22:59:30 -0000	1.4
+++ MCParticleFlags.java	28 Nov 2006 00:53:18 -0000	1.5
@@ -2,24 +2,34 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 import org.lcsim.event.MCParticle;
 import org.lcsim.event.util.MCParticleClassifier;
 import org.lcsim.event.util.MCParticleClassifier.MCPClass;
+import org.lcsim.conditions.DetectorLocator;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.compact.Constant;
+import hep.physics.vec.Hep3Vector;
 
 /**
  * A set of MCParticleFlag objects representing the non-exclusive status(es) of
  * an individual MCParticle.
  * 
  * @author jeremym
- * @version $Id: MCParticleFlags.java,v 1.4 2006/11/10 22:59:30 jeremy Exp $
+ * @version $Id: MCParticleFlags.java,v 1.5 2006/11/28 00:53:18 jeremy Exp $
  */
 public class MCParticleFlags
 {
-    List<MCParticleFlag> _flags = new ArrayList<MCParticleFlag>();
+    private List<MCParticleFlag> _flags = new ArrayList<MCParticleFlag>();
 
     private static List<MCParticleFlag> _allFlags;
 
+    public static List<MCParticleFlag> getAllFlags()
+    {
+        return allFlags();
+    }
+    
     public MCParticleFlags(MCParticle particle)
     {
         setMCParticleFlags(particle);
@@ -209,7 +219,13 @@
         {
             add(MCParticleFlag.BAD_STAT_CHARGE_NAN);
         }        
-    }
+        
+        // Check if origin is outside tracking radius.
+        if(MCParticleUtil.isOriginOutsideTrackingRadius(particle)) 
+        {
+            add(MCParticleFlag.ORIGIN_OUTSIDE_TRACKING_REGION);
+        }       
+    }   
 
     /** Check if a particle has an end disposition */
     public boolean hasEndStatus(MCParticle.SimulatorStatus sstat)

SlicDiagnostics/src/org/lcsim/slic/diagnostics
MCParticlePlots.java 1.28 -> 1.29
diff -u -r1.28 -r1.29
--- MCParticlePlots.java	17 Oct 2006 22:23:52 -0000	1.28
+++ MCParticlePlots.java	28 Nov 2006 00:53:18 -0000	1.29
@@ -22,7 +22,7 @@
  * A set of MCParticle plots, including plots for each particle type by PDGID.
  * 
  * @author jeremym
- * @version $Id: MCParticlePlots.java,v 1.28 2006/10/17 22:23:52 jeremy Exp $
+ * @version $Id: MCParticlePlots.java,v 1.29 2006/11/28 00:53:18 jeremy Exp $
  */
 class MCParticlePlots extends AbstractPlots
 {
@@ -41,6 +41,7 @@
     ICloud1D _endpointDau;
     ICloud1D _prodTimelog10;
     ICloud1D _prodTime;
+    ICloud2D _originOutsideTracking;
 
     // Map of ParticleTypeInfo
     private Map<Integer, MCParticleTypeInfo> _mcpMap = new HashMap<Integer, MCParticleTypeInfo>();
@@ -111,8 +112,12 @@
         _prodTime = aida().cloud1D("Production Time");
         _prodTime.annotation().addItem("xAxisLabel", "Production Time (nanoseconds)");
         _prodTime.annotation().addItem("yAxisLabel", "Number of Particles");
-                
-        for (MCParticleFlag flag : MCParticleFlags.allFlags())
+        
+        _originOutsideTracking = aida().cloud2D("Origin XY (Origin Outside Tracking Region)");        
+        _originOutsideTracking.annotation().addItem("xAxisLabel","Origin X (mm)");
+        _originOutsideTracking.annotation().addItem("yAxisLabel","Origin Y (mm)");
+        
+        for (MCParticleFlag flag : MCParticleFlags.getAllFlags())
         {
             ICloud1D p = aida().cloud1D("Status: " + flag.toString());
             p.annotation().addItem("xAxisLabel", "Status Flag Count");
@@ -145,8 +150,8 @@
         {
             return;
         }
-
-        cd();
+        
+        cd();        
 
         // Charge counts
         int nPositive, nNeutral, nNegative;
@@ -257,7 +262,7 @@
 
             // Increment event flag stats
             flagStats.incrFlagCounts(flags);
-
+            
             // Check for endpoint daughters
             if (flags.isSet(MCParticleFlag.SIM_INTERACTED_OR_DECAYED))
             {
@@ -290,7 +295,7 @@
             String particleName = info.getName();
 
             // Status flag counts
-            info.incrFlagStats(particle);
+            info.incrFlagStats(particle);                        
 
             // Increment event energy
             info.addEventEnergy(particle.getEnergy());
@@ -300,6 +305,12 @@
 
             // Fill Energy
             _mcpEnergy.fill(particle.getEnergy());
+            
+            // FIXME: Duplicate call to this function.  Also called by status setter.
+            if (MCParticleUtil.isOriginOutsideTrackingRadius(particle))
+            {
+                _originOutsideTracking.fill(oX,oY);
+            }
 
             // vtx to EP distance for gen FS particles
             if (hasEndpoint && vtxEPdist > 0)
@@ -322,12 +333,13 @@
             // Setup a particle directory 
             try
             {
-                tree().mkdir(particleName);
+                tree().mkdir(particleName);                
             }
             catch (Exception e)
             {
-                // There is already a directory for this particle.
+                // There is already a directory for this particle.                
             }
+            
             tree().cd(particleName);
 
             // Get the RefinedCheatClusters from the recon cheater            
@@ -414,8 +426,8 @@
             aida().cloud1D(particleName + ": Origin Y").fill(oY);
             aida().cloud1D(particleName + ": Origin Z").fill(oZ);
             aida().cloud2D(particleName + ": Origin XY").fill(oX, oY);
-            aida().cloud2D(particleName + ": Origin XZ").fill(oX, oZ);
-
+            aida().cloud2D(particleName + ": Origin XZ").fill(oX, oZ); 
+            
             // Plot kE
             aida().cloud1D(particleName + ": kE").fill(kE);
 
@@ -462,7 +474,7 @@
         for (MCParticleTypeInfo info : _mcpMap.values())
         {
             String k = info.getName();
-
+            
             // Switch to particle dir
             tree().cd(k);
 
@@ -538,9 +550,10 @@
     protected void endEvents(int nevents)
     {
         super.endEvents(nevents);
-
+       
         // Set axis labels on dynamically generated plots
         cd();
+
         for (MCParticleTypeInfo info : _mcpMap.values())
         {
             String particleName = info.getName();
@@ -690,7 +703,7 @@
                 p2.annotation().addItem("xAxisLabel", "Particle Energy (GeV)");
                 p2.annotation().addItem("yAxisLabel", "Total Energy of End Point Daughters (GeV)");
                                
-                for (MCParticleFlag flag : flagStats.flags())
+                for (MCParticleFlag flag : MCParticleFlags.getAllFlags())
                 {
                     p1 = aida().cloud1D(particleName + ": Status: " + flag.toString());
                     p1.annotation().addItem("xAxisLabel", "Status Code Count");

SlicDiagnostics/src/org/lcsim/slic/diagnostics
MCParticleTypeInfo.java 1.4 -> 1.5
diff -u -r1.4 -r1.5
--- MCParticleTypeInfo.java	16 Mar 2006 02:35:22 -0000	1.4
+++ MCParticleTypeInfo.java	28 Nov 2006 00:53:20 -0000	1.5
@@ -9,7 +9,7 @@
  * Information about an MCParticle type, i.e. ones with different PDGIDs.
  * 
  * @author jeremym
- * @version $Id: MCParticleTypeInfo.java,v 1.4 2006/03/16 02:35:22 jeremy Exp $
+ * @version $Id: MCParticleTypeInfo.java,v 1.5 2006/11/28 00:53:20 jeremy Exp $
  */
 class MCParticleTypeInfo
 {
@@ -32,11 +32,19 @@
         
         try {
             _name = mcpLkp.get(pdgid).getName();
+
+            // Replace slashes because they screw
+            // up AIDA directory naming.
+            if (_name.contains("/"))
+            {
+                _name = _name.replaceAll("/","");
+            }
+            
             _charge = mcpLkp.get(pdgid).getCharge();
         }
         catch (Exception e)
         {
-            // Probably an ion, which we flag as Unknown            
+            // Probably an ion, which is flagged as unknown.            
         }
     }
     

SlicDiagnostics/src/org/lcsim/slic/diagnostics
MCParticleUtil.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- MCParticleUtil.java	1 Apr 2006 00:00:02 -0000	1.3
+++ MCParticleUtil.java	28 Nov 2006 00:53:20 -0000	1.4
@@ -6,17 +6,21 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
+import org.lcsim.conditions.DetectorLocator;
 import org.lcsim.event.EventHeader;
 import org.lcsim.event.MCParticle;
 import org.lcsim.event.SimCalorimeterHit;
 import org.lcsim.event.SimTrackerHit;
+import org.lcsim.geometry.Detector;
+import org.lcsim.geometry.compact.Constant;
 
 /**
  * MCParticle utilities. 
  * 
  * @author jeremym
- * @version $Id: MCParticleUtil.java,v 1.3 2006/04/01 00:00:02 jeremy Exp $
+ * @version $Id: MCParticleUtil.java,v 1.4 2006/11/28 00:53:20 jeremy Exp $
  */
 public final class MCParticleUtil
 {
@@ -93,4 +97,25 @@
         }
         return hits;
     }    
-}
+    
+    public static boolean isOriginOutsideTrackingRadius(MCParticle particle)
+    {                       
+        Detector det = DetectorLocator.getCurrentDetector();
+        Map<String,Constant> constants = det.getConstants();
+    
+        double tracking_radius = constants.get("tracking_region_radius").getValue();
+        double tracking_zmax = constants.get("tracking_region_zmax").getValue();
+    
+        Hep3Vector vtx = particle.getOrigin();
+        double vr = Math.sqrt(vtx.x()*vtx.x()+vtx.y()*vtx.y());
+        double vz = Math.abs(vtx.z());
+    
+        boolean outside=false;
+        if (vr > tracking_radius || vz > tracking_zmax)
+        {
+            outside=true;            
+        }
+        
+        return outside;
+    }    
+}
\ No newline at end of file

SlicDiagnostics/src/org/lcsim/slic/diagnostics
UserOptions.java 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- UserOptions.java	16 Oct 2006 19:04:44 -0000	1.3
+++ UserOptions.java	28 Nov 2006 00:53:20 -0000	1.4
@@ -10,7 +10,7 @@
  * Represents simple options set from properties file or command-line.
  * 
  * @author Jeremy McCormick
- * @version $Id: UserOptions.java,v 1.3 2006/10/16 19:04:44 jeremy Exp $
+ * @version $Id: UserOptions.java,v 1.4 2006/11/28 00:53:20 jeremy Exp $
  */
 public final class UserOptions
 {    
@@ -97,6 +97,9 @@
         setBooleanOption("genericHitPlots", true);
         setBooleanOption("eventPlots", true);
         
+        setBooleanOption("createGenParticles", true);
+        setBooleanOption("createSimParticles", true);
+        
         setBooleanOption("enableAutoname", true);
         
         // int options
@@ -118,7 +121,10 @@
         parseBooleanOption("calorimeterHitPlots");
         parseBooleanOption("genericHitPlots");
         parseBooleanOption("eventPlots");
-     
+        
+        parseBooleanOption("createGenParticles");
+        parseBooleanOption("createSimParticles");
+         
         parseBooleanOption("enableAutoname");
         
         // int options
CVSspam 0.2.8