lcsim/src/org/lcsim/recon/cluster/util
diff -u -r1.2 -r1.3
--- BothCalorimetersDecision.java 25 May 2007 23:59:32 -0000 1.2
+++ BothCalorimetersDecision.java 7 May 2010 19:03:59 -0000 1.3
@@ -1,19 +1,21 @@
package org.lcsim.recon.cluster.util;
import org.lcsim.util.decision.*;
-import org.lcsim.util.*;
import org.lcsim.event.*;
+import org.lcsim.recon.util.CalorimeterInformation;
+import org.lcsim.geometry.Calorimeter.CalorimeterType;
/**
* Require one cluster to be in the ECAL and one to be in the HCAL
*
- * @version $Id: BothCalorimetersDecision.java,v 1.2 2007/05/25 23:59:32 mcharles Exp $
+ * @version $Id: BothCalorimetersDecision.java,v 1.3 2010/05/07 19:03:59 cassell Exp $
*/
public class BothCalorimetersDecision implements DecisionMakerPair<Cluster,Cluster>
{
/**
* Constructor.
*/
+ CalorimeterInformation ci;
public BothCalorimetersDecision() {
// empty
}
@@ -25,6 +27,7 @@
*/
public boolean valid(Cluster clus1, Cluster clus2)
{
+ if(ci == null)ci = CalorimeterInformation.instance();
// Require at least one hit in each
if (clus1.getCalorimeterHits().size()<1 || clus2.getCalorimeterHits().size()<1 ) {
return false;
@@ -66,14 +69,16 @@
// Inefficient, not general.
private boolean isHCAL(CalorimeterHit hit) {
- org.lcsim.geometry.Subdetector subdet = hit.getSubdetector();
- String name = subdet.getName();
- return (name.compareTo("HADBarrel") == 0 || name.compareTo("HADEndcap") == 0);
+ if( (hit.getSubdetector() == ci.getSubdetector(CalorimeterType.HAD_BARREL))||
+ (hit.getSubdetector() == ci.getSubdetector(CalorimeterType.HAD_ENDCAP)) )
+ return true;
+ return false;
}
// Inefficient, not general.
private boolean isECAL(CalorimeterHit hit) {
- org.lcsim.geometry.Subdetector subdet = hit.getSubdetector();
- String name = subdet.getName();
- return (name.compareTo("EMBarrel") == 0 || name.compareTo("EMEndcap") == 0);
+ if( (hit.getSubdetector() == ci.getSubdetector(CalorimeterType.EM_BARREL))||
+ (hit.getSubdetector() == ci.getSubdetector(CalorimeterType.EM_ENDCAP)) )
+ return true;
+ return false;
}
}