LISTSERV mailing list manager LISTSERV 16.5

Help for HPS-SVN Archives


HPS-SVN Archives

HPS-SVN Archives


HPS-SVN@LISTSERV.SLAC.STANFORD.EDU


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

HPS-SVN Home

HPS-SVN Home

HPS-SVN  May 2015

HPS-SVN May 2015

Subject:

r3020 - /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/CopyClusterCollectionDriver.java

From:

[log in to unmask]

Reply-To:

Notification of commits to the hps svn repository <[log in to unmask]>

Date:

Tue, 26 May 2015 20:10:20 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (227 lines)

Author: [log in to unmask]
Date: Tue May 26 13:10:11 2015
New Revision: 3020

Log:
Turn off property calculation for copied clusters.

Modified:
    java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/CopyClusterCollectionDriver.java

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/CopyClusterCollectionDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/CopyClusterCollectionDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/CopyClusterCollectionDriver.java	Tue May 26 13:10:11 2015
@@ -10,120 +10,127 @@
 import org.lcsim.util.Driver;
 
 /**
- * Copy a {@link org.lcsim.event.Cluster} collection to a new collection via the {@link org.lcsim.event.base.BaseCluster} class's
- * copy constructor.
- * 
+ * Copy a {@link org.lcsim.event.Cluster} collection to a new collection via the {@link org.lcsim.event.base.BaseCluster} class's copy constructor.
+ *
  * @author Jeremy McCormick
  */
 public class CopyClusterCollectionDriver extends Driver {
-    
+
     /**
      * The input collection name.
      */
     private String inputCollectionName = null;
-    
+
     /**
      * The output collection name.
      */
     private String outputCollectionName = null;
-    
+
     /**
      * Set to <code>true</code> to store hits in the output clusters.
      */
     private boolean storeHits = true;
-    
+
     /**
      * Basic no argument constructor.
      */
-    public CopyClusterCollectionDriver() {        
+    public CopyClusterCollectionDriver() {
     }
-    
+
+    /**
+     * Copy clusters to a new collection (list).
+     *
+     * @param clusters the input cluster list
+     * @return the output cluster collection from copying the input list
+     */
+    public List<Cluster> copyClusters(final List<Cluster> clusters) {
+        final List<Cluster> newCollection = new ArrayList<Cluster>();
+        for (final Cluster cluster : clusters) {
+            // Use the base class's copy constructor to make a new cluster from the input.
+            final BaseCluster newCluster = new BaseCluster(cluster);
+
+            // Turn off automatic property calculation.
+            newCluster.setNeedsPropertyCalculation(false);
+
+            // Add new cluster to output collection.
+            newCollection.add(newCluster);
+        }
+        return newCollection;
+    }
+
+    /**
+     * Process an event, copying the input collection to the output collection.
+     *
+     * @param event the LCSim event
+     */
+    @Override
+    public void process(final EventHeader event) {
+
+        // Check if output collection already exists in event which is an error.
+        if (event.hasItem(outputCollectionName)) {
+            throw new RuntimeException("collection " + outputCollectionName + " already exists in event");
+        }
+
+        // Get the input collection.
+        final List<Cluster> inputClusterCollection = event.get(Cluster.class, inputCollectionName);
+
+        // Copy to the output collection.
+        final List<Cluster> outputClusterCollection = this.copyClusters(inputClusterCollection);
+
+        // Copy input collection's flags.
+        int flags = event.getMetaData(inputClusterCollection).getFlags();
+
+        // Set the store hits bit from this Driver's settings.
+        if (storeHits) {
+            flags = flags | 1 << LCIOConstants.CLBIT_HITS;
+        } else {
+            flags = flags & 0 << LCIOConstants.CLBIT_HITS;
+        }
+
+        // Put the copied collection into the event.
+        event.put(outputCollectionName, outputClusterCollection, Cluster.class, flags);
+    }
+
+    /**
+     * Set the input collection name (source).
+     *
+     * @param inputCollectionName the input collection name
+     */
+    public void setInputCollectionName(final String inputCollectionName) {
+        this.inputCollectionName = inputCollectionName;
+    }
+
+    /**
+     * Set the output collection name (target).
+     *
+     * @param outputCollectionName the output collection name
+     */
+    public void setOutputCollectionName(final String outputCollectionName) {
+        this.outputCollectionName = outputCollectionName;
+    }
+
+    /**
+     * Set to <code>true</code> to store hits in the output clusters.
+     *
+     * @return <code>true</code> to store hits in the output clusters
+     */
+    public void setStoreHits(final boolean storeHits) {
+        this.storeHits = storeHits;
+    }
+
     /**
      * Start of data hook which will make sure required arguments are set properly.
      */
+    @Override
     public void startOfData() {
         if (inputCollectionName == null) {
             throw new RuntimeException("inputCollectionName was never set");
         }
         if (outputCollectionName == null) {
             throw new RuntimeException("outputCollectionName was never set");
-        }        
+        }
         if (inputCollectionName.equals(outputCollectionName)) {
             throw new IllegalArgumentException("inputCollectionName and outputCollectionName are the same");
         }
     }
-    
-    /**
-     * Set the input collection name (source).
-     * 
-     * @param inputCollectionName the input collection name
-     */
-    public void setInputCollectionName(String inputCollectionName) {
-        this.inputCollectionName = inputCollectionName;
-    }
-    
-    /**
-     * Set the output collection name (target).
-     * 
-     * @param outputCollectionName the output collection name
-     */
-    public void setOutputCollectionName(String outputCollectionName) {
-        this.outputCollectionName = outputCollectionName;
-    }
-    
-    /**
-     * Set to <code>true</code> to store hits in the output clusters.
-     * 
-     * @return <code>true</code> to store hits in the output clusters
-     */
-    public void setStoreHits(boolean storeHits) {
-        this.storeHits = storeHits;
-    }
-        
-    /**
-     * Process an event, copying the input collection to the output collection.
-     * 
-     * @param event the LCSim event
-     */
-    public void process(EventHeader event) {
-        
-        // Check if output collection already exists in event which is an error.
-        if (event.hasItem(outputCollectionName)) {
-            throw new RuntimeException("collection " + outputCollectionName + " already exists in event");
-        }
-        
-        // Get the input collection.
-        List<Cluster> inputClusterCollection = event.get(Cluster.class, inputCollectionName);
-        
-        // Copy to the output collection.
-        List<Cluster> outputClusterCollection = copyClusters(inputClusterCollection);
-        
-        // Copy input collection's flags.
-        int flags = event.getMetaData(inputClusterCollection).getFlags();
-        
-        // Set the store hits bit from this Driver's settings.
-        if (storeHits) {
-            flags = flags | (1 << LCIOConstants.CLBIT_HITS);
-        } else {
-            flags = flags & (0 << LCIOConstants.CLBIT_HITS);
-        }
-        
-        // Put the copied collection into the event.
-        event.put(outputCollectionName, outputClusterCollection, Cluster.class, flags);
-    }
-    
-    /**
-     * Copy clusters to a new collection (list).
-     * 
-     * @param clusters the input cluster list
-     * @return the output cluster collection from copying the input list
-     */
-    public List<Cluster> copyClusters(List<Cluster> clusters) {
-        List<Cluster> newCollection = new ArrayList<Cluster>();
-        for (Cluster cluster : clusters) {
-            // Use the base class's copy constructor to make a new cluster from the input.
-            newCollection.add(new BaseCluster(cluster));
-        }
-        return newCollection;
-    }
 }

Top of Message | Previous Page | Permalink

Advanced Options


Options

Log In

Log In

Get Password

Get Password


Search Archives

Search Archives


Subscribe or Unsubscribe

Subscribe or Unsubscribe


Archives

November 2017
August 2017
July 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013

ATOM RSS1 RSS2



LISTSERV.SLAC.STANFORD.EDU

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager

Privacy Notice, Security Notice and Terms of Use