projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd
--- projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Builder.java 2014-09-02 05:01:09 UTC (rev 3287)
+++ projects/lcsim/trunk/detector-framework/src/main/java/org/lcsim/geometry/compact/converter/lcdd/HPSTestRunTracker2014Builder.java 2014-09-02 05:03:43 UTC (rev 3288)
@@ -243,7 +243,11 @@
String volName = mother.getName() + "_hybrid";
// Build the half-module
- HPSTestRunTracker2014GeometryDefinition.Hybrid hybrid = new HPSTestRunTracker2014GeometryDefinition.Hybrid(volName,mother);
+
+ // id is hard coded
+ int component_number = 3;
+
+ HPSTestRunTracker2014GeometryDefinition.Hybrid hybrid = new HPSTestRunTracker2014GeometryDefinition.Hybrid(volName,mother,component_number);
hybrid.setMaterial("G10");
HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
@@ -264,7 +268,11 @@
String volName = mother.getName() + "_cf";
// Build the half-module
- HPSTestRunTracker2014GeometryDefinition.CarbonFiber cf = new HPSTestRunTracker2014GeometryDefinition.CarbonFiber(volName,mother);
+
+ // id is hard coded
+ int component_number = 1;
+
+ HPSTestRunTracker2014GeometryDefinition.CarbonFiber cf = new HPSTestRunTracker2014GeometryDefinition.CarbonFiber(volName,mother,component_number);
cf.setMaterial("CarbonFiber");
HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
@@ -282,7 +290,11 @@
String volName = mother.getName() + "_lamination";
// Build the half-module
- HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination lamination = new HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination(volName,mother);
+
+ // id is hard coded
+ int component_number = 2;
+
+ HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination lamination = new HPSTestRunTracker2014GeometryDefinition.HalfModuleLamination(volName,mother,component_number);
lamination.setMaterial("Kapton");
@@ -298,11 +310,11 @@
String volName = mother.getName() + "_sensor";
- // sensor if
- int sensor_number = 0;
+ // sensor id is hard coded in old geometry to be zero by counting over the components of the module
+ int component_number = 0;
//
- HPSTestRunTracker2014GeometryDefinition.Sensor sensor = new HPSTestRunTracker2014GeometryDefinition.Sensor(volName, mother, sensor_number);
+ HPSTestRunTracker2014GeometryDefinition.Sensor sensor = new HPSTestRunTracker2014GeometryDefinition.Sensor(volName, mother, component_number);
sensor.setMaterial("Silicon");
HalfModuleBundle hm = getHalfModuleBundle((HPSTestRunTracker2014GeometryDefinition.TestRunModule) mother.getMother(), mother.getName());
@@ -330,8 +342,43 @@
}
+ /**
+ * Get the layer number consistent with the old geometry definition.
+ * @param module name that contains layer and half information.
+ * @return the layer.
+ */
+ public static int getOldGeomDefLayerFromVolumeName(String name) {
+ String half = getHalfFromName(name);
+ boolean isTopLayer = false;
+ if(half=="top") isTopLayer=true;
+ else if(half=="bottom") isTopLayer = false;
+ else throw new RuntimeException("no half found from " + name);
+ boolean isAxial = false;
+ if(name.contains("axial")) isAxial=true;
+ else if(name.contains("stereo")) isAxial=false;
+ else throw new RuntimeException("no axial or stereo name found from " + name);
+ int l = getLayerFromVolumeName(name);
+ int layer=-1;
+ // convert to old definition
+ if(isAxial) {
+ if(isTopLayer) {
+ layer = 2*l-1;
+ }
+ else {
+ layer = 2*l;
+ }
+ } else {
+ if(isTopLayer) {
+ layer = 2*l;
+ } else {
+ layer = 2*l-1;
+ }
+ }
+ return layer;
+ }
+
public static String getHalfFromName(String name) {
String half = "";
if(name.contains("bottom")) {