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  February 2015

HPS-SVN February 2015

Subject:

r2090 - /java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterDriver.java

From:

[log in to unmask]

Reply-To:

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

Date:

Tue, 10 Feb 2015 12:25:38 -0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (196 lines)

Author: [log in to unmask]
Date: Tue Feb 10 04:25:32 2015
New Revision: 2090

Log:
Use Driver logging.

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

Modified: java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterDriver.java
 =============================================================================
--- java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterDriver.java	(original)
+++ java/trunk/ecal-recon/src/main/java/org/hps/recon/ecal/cluster/ClusterDriver.java	Tue Feb 10 04:25:32 2015
@@ -2,7 +2,7 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Logger;
+import java.util.logging.Level;
 
 import org.lcsim.event.CalorimeterHit;
 import org.lcsim.event.Cluster;
@@ -13,30 +13,25 @@
 import org.lcsim.geometry.subdetector.HPSEcal3.NeighborMap;
 import org.lcsim.lcio.LCIOConstants;
 import org.lcsim.util.Driver;
-import org.lcsim.util.log.BasicFormatter;
-import org.lcsim.util.log.LogUtil;
 
 /**
  * <p>
- * This is a basic Driver that creates ECAL <code>Cluster</code> collections 
- * through the {@link Clusterer} interface.
+ * This is a {@link org.lcsim.util.Driver} that creates ECAL {@link org.lcsim.event.Cluster} 
+ * collections using the {@link Clusterer} interface.
  * <p>
  * A specific clustering engine can be created with the {@link #setClustererName(String)} method
  * which will use a factory to create it by name.  The cuts of the {@link Clusterer}
  * can be set generically with the {@link #setCuts(double[])} method.  
  * 
  * @see Clusterer
+ * @see NumericalCuts
  * @see org.lcsim.event.Cluster
+ * @see org.lcsim.util.Driver 
  * 
  * @author Jeremy McCormick <[log in to unmask]>
  */
 public class ClusterDriver extends Driver {
-    
-    static Logger logger;
-    static {
-        logger = LogUtil.create(ClusterDriver.class.getSimpleName(), new BasicFormatter(ClusterDriver.class.getSimpleName()));
-    }
-    
+        
     protected String ecalName = "Ecal";
     protected HPSEcal3 ecal;
     protected NeighborMap neighborMap;
@@ -156,7 +151,7 @@
      */
     public void setClustererName(String name) {
         clusterer = ClustererFactory.create(name);
-        this.getLogger().config("Clusterer was set to " + this.clusterer.getClass().getSimpleName());
+        getLogger().config("Clusterer was set to " + this.clusterer.getClass().getSimpleName());
     }
     
     /**
@@ -165,7 +160,7 @@
      */
     public void setClusterer(Clusterer clusterer) {
         this.clusterer = clusterer;
-        this.getLogger().config("Clusterer was set to " + this.clusterer.getClass().getSimpleName());
+        getLogger().config("Clusterer was set to " + this.clusterer.getClass().getSimpleName());
     }
     
     /**
@@ -196,7 +191,6 @@
      * Setup conditions specific configuration.
      */
     public void detectorChanged(Detector detector) {
-        logger.finer("detectorChanged - " + detector.getDetectorName());
         Subdetector subdetector = detector.getSubdetector("Ecal");
         if (subdetector == null) {
             throw new RuntimeException("There is no subdetector called " + ecalName + " in the detector.");
@@ -212,19 +206,17 @@
      * Perform start of job initialization.
      */
     public void startOfData() {
-        logger.finer("startOfData");
         if (this.clusterer == null) {
             throw new RuntimeException("The clusterer was never initialized.");
         }
         if (this.cuts != null) {
-            logger.config("setting cuts on clusterer");
             this.clusterer.getCuts().setValues(cuts);
         } 
-        logger.config("Clusterer has the following cuts ...");
+        getLogger().config("Clusterer has the following cuts ...");
         for (int cutIndex = 0; cutIndex < clusterer.getCuts().getValues().length; cutIndex++) {
-            logger.config("  " + this.clusterer.getCuts().getNames()[cutIndex] + " = " + this.clusterer.getCuts().getValue(cutIndex));
+            getLogger().config("  " + this.clusterer.getCuts().getNames()[cutIndex] + " = " + this.clusterer.getCuts().getValue(cutIndex));
         }            
-        logger.config("initializing clusterer " + clusterer.getClass().getName());
+        getLogger().config("initializing clusterer " + clusterer.getClass().getName());
         this.clusterer.initialize();
     }
     
@@ -234,7 +226,7 @@
     public void process(EventHeader event) {               
         if (event.hasCollection(CalorimeterHit.class, inputHitCollectionName)) {       
             List<CalorimeterHit> hits = event.get(CalorimeterHit.class, inputHitCollectionName);
-            logger.fine("input hit collection " + inputHitCollectionName + " has " + hits.size() + " hits");
+            getLogger().fine("input hit collection " + inputHitCollectionName + " has " + hits.size() + " hits");
             
             // Cluster the hits, copying the list from the event in case the clustering algorithm modifies it.
             List<Cluster> clusters = clusterer.createClusters(event, new ArrayList<CalorimeterHit>(hits));
@@ -243,7 +235,7 @@
                 throw new RuntimeException("The clusterer returned a null list from its createClusters method.");
             }
             if (clusters.isEmpty() && this.skipNoClusterEvents) {
-                logger.finer("skipping event with no clusters");
+                getLogger().finer("skipping event with no clusters");
                 throw new NextEventException();
             }
             if (event.hasCollection(Cluster.class, this.outputClusterCollectionName)) {
@@ -268,10 +260,10 @@
                     ClusterUtilities.applyCorrections(clusters);
                 }
                                                 
-                logger.finer("writing " + clusters.size() + " clusters to collection " + outputClusterCollectionName);
+                getLogger().finer("writing " + clusters.size() + " clusters to collection " + outputClusterCollectionName);
                 event.put(outputClusterCollectionName, clusters, Cluster.class, flags);
                 if (!this.writeClusterCollection) {
-                    logger.finer("Collection is set to transient and will not be persisted.");
+                    getLogger().finer("Collection is set to transient and will not be persisted.");
                     event.getMetaData(clusters).setTransient(true);
                 }
                 
@@ -286,17 +278,8 @@
                 throw new RuntimeException("The expected input hit collection is missing from the event.");
             }
         }
-        logger.getHandlers()[0].flush();
-    }
-    
-    /**
-     * Get the logger for this Driver.
-     * @return The logger.
-     */
-    public Logger getLogger() {
-       return logger;
-    }
-    
+    }
+  
     /**
      * Get a {@link Clusterer} using type inference for the concrete type.
      * @return The Clusterer object.
@@ -321,21 +304,21 @@
         List<Cluster> clusters = event.get(Cluster.class, outputClusterCollectionName);
         List<CalorimeterHit> inputHitCollection = event.get(CalorimeterHit.class, inputHitCollectionName);
         for (int clusterIndex = 0; clusterIndex < clusters.size(); clusterIndex++) {
-            logger.finest("checking cluster " + clusterIndex);
+            getLogger().finest("checking cluster " + clusterIndex);
             Cluster cluster = clusters.get(clusterIndex);
             if (clusters.get(clusterIndex) == null) {
                 throw new RuntimeException("The Cluster at index " + clusterIndex + " is null.");
             }
             List<CalorimeterHit> clusterHits = cluster.getCalorimeterHits();
-            logger.finest("cluster has " + clusterHits.size() + " hits");
+            getLogger().finest("cluster has " + clusterHits.size() + " hits");
             for (int hitIndex = 0; hitIndex < clusterHits.size(); hitIndex++) {
-                logger.finest("checking cluster hit " + hitIndex);                              
+                getLogger().finest("checking cluster hit " + hitIndex);                              
                 CalorimeterHit clusterHit = clusterHits.get(hitIndex);
                 if (clusterHit == null) {
                     throw new RuntimeException("The CalorimeterHit at index " + hitIndex + " in the cluster is null.");
                 }
                 if (!inputHitCollection.contains(clusterHit)) {
-                    logger.severe("The CalorimeterHit at index " + hitIndex + " with ID " + clusterHit.getIdentifier().toHexString() + " is missing from the input hit collection.");
+                    getLogger().severe("The CalorimeterHit at index " + hitIndex + " with ID " + clusterHit.getIdentifier().toHexString() + " is missing from the input hit collection.");
                     printHitIDs(inputHitCollection);
                     throw new RuntimeException("The CalorimeterHit at index " + hitIndex + " in the cluster is missing from the input hit collection.");
                 }
@@ -351,6 +334,6 @@
             buffer.append(hit.getIdentifier().toHexString());
             buffer.append('\n');
         }
-        logger.finest(buffer.toString());        
-    }
-}
+        getLogger().finest(buffer.toString());
+    }
+}

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