GeomConverter/src/org/lcsim/detector
diff -N SubdetectorType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ SubdetectorType.java 2 Jul 2008 22:52:18 -0000 1.1
@@ -0,0 +1,93 @@
+package org.lcsim.detector;
+
+public class SubdetectorType
+{
+ SystemType systemType = SystemType.UNKNOWN;
+ BarrelType barrelType = BarrelType.UNKNOWN;
+ GenericType genericType = GenericType.UNKNOWN;
+
+ SubdetectorType(SystemType systemType, BarrelType barrelType)
+ {
+ this.systemType = systemType;
+ this.barrelType = barrelType;
+ if (systemType == SystemType.VERTEX_DETECTOR || systemType == SystemType.SILICON_TRACKER || systemType == SystemType.TPC)
+ genericType = GenericType.TRACKER;
+ else if (systemType == SystemType.ECAL || systemType == SystemType.HCAL || systemType == SystemType.MUON || systemType == SystemType.FORWARD)
+ genericType = GenericType.CALORIMETER;
+ }
+
+ public enum GenericType
+ {
+ TRACKER,
+ CALORIMETER,
+ UNKNOWN
+ }
+
+ public enum SystemType
+ {
+ VERTEX_DETECTOR,
+ SILICON_TRACKER,
+ TPC,
+ ECAL,
+ HCAL,
+ MUON,
+ FORWARD,
+ UNKNOWN
+ }
+
+ public enum BarrelType
+ {
+ BARREL,
+ ENDCAP,
+ UNKNOWN
+ }
+
+ public SystemType getSystemType()
+ {
+ return systemType;
+ }
+
+ public BarrelType getBarrelType()
+ {
+ return barrelType;
+ }
+
+ public GenericType getGenericType()
+ {
+ return genericType;
+ }
+
+ /**
+ * FIXME: This is rather fragile as it depends on names in the compact description
+ * which may not follow these conventions.
+ */
+ public static SubdetectorType convert(String subdetectorName)
+ {
+ SystemType system = SystemType.UNKNOWN;
+ BarrelType barrel = BarrelType.UNKNOWN;
+
+ subdetectorName = subdetectorName.toLowerCase();
+
+ if (subdetectorName.contains("endcap"))
+ barrel = BarrelType.ENDCAP;
+ else if (subdetectorName.contains("barrel"))
+ barrel = BarrelType.BARREL;
+
+ if (subdetectorName.startsWith("vtx") || subdetectorName.startsWith("vertex"))
+ system = SystemType.VERTEX_DETECTOR;
+ else if (subdetectorName.contains("tracker"))
+ system = SystemType.SILICON_TRACKER;
+ else if (subdetectorName.startsWith("tpc"))
+ system = SystemType.TPC;
+ else if (subdetectorName.startsWith("ecal") || subdetectorName.startsWith("emcal"))
+ system = SystemType.ECAL;
+ else if (subdetectorName.startsWith("hcal") || subdetectorName.startsWith("had"))
+ system = SystemType.HCAL;
+ else if (subdetectorName.startsWith("muon"))
+ system = SystemType.MUON;
+ else if (subdetectorName.contains("forward") || subdetectorName.startsWith("lumi"))
+ system = SystemType.FORWARD;
+
+ return new SubdetectorType(system, barrel);
+ }
+}
\ No newline at end of file
GeomConverter/src/org/lcsim/detector
diff -u -r1.5 -r1.6
--- DetectorIdentifierHelper.java 2 Jul 2008 21:28:34 -0000 1.5
+++ DetectorIdentifierHelper.java 2 Jul 2008 22:52:18 -0000 1.6
@@ -141,6 +141,7 @@
private IDetectorElement subdetectorDetectorElement = null;
private int subdetectorSystemNumber = -1;
+ SubdetectorType subdetectorType;
// LDC si tracking...
// inner = sit
@@ -297,7 +298,7 @@
lumiEndcapPositiveId = makeSubsysId(lumiValue,endcapPositiveValue);
lumiEndcapNegativeId = makeSubsysId(lumiValue,endcapNegativeValue);
}
-
+
// Public ctor.
public DetectorIdentifierHelper(
IDetectorElement subdetectorDetectorElement,
@@ -318,6 +319,8 @@
// Make assocation to a subdetector's system value.
this.subdetectorSystemNumber = this.getSystemValue(this.subdetectorDetectorElement.getIdentifier());
+
+ subdetectorType = SubdetectorType.convert(subdetectorDetectorElement.getName());
}
private IIdentifier makeSubsysId(int system)
@@ -872,5 +875,10 @@
public IDetectorElement getSubdetectorDetectorElement()
{
return subdetectorDetectorElement;
+ }
+
+ public SubdetectorType getSubdetectorType()
+ {
+ return subdetectorType;
}
}
\ No newline at end of file