GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.10 -r1.11
--- MultiLayerTrackerConverter.java 28 Aug 2007 22:26:34 -0000 1.10
+++ MultiLayerTrackerConverter.java 7 Nov 2007 21:57:29 -0000 1.11
@@ -8,6 +8,7 @@
import org.lcsim.detector.identifier.ExpandedIdentifier;
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.IIdentifierDictionary;
+import org.lcsim.detector.identifier.IdentifierContext;
import org.lcsim.detector.identifier.IdentifierDictionaryManager;
import org.lcsim.detector.identifier.IdentifierUtil;
import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
@@ -31,11 +32,18 @@
{
public void convert( Subdetector subdet, Detector detector)
{
- MultiLayerTracker tracker = (MultiLayerTracker)subdet;
-
- ILogicalVolume trackingVolume =
- detector.getTrackingVolume().getLogicalVolume();
+ ILogicalVolume mother = null;
+ if (subdet.isInsideTrackingVolume())
+ {
+ mother = detector.getTrackingVolume().getLogicalVolume();
+ }
+ else
+ {
+ mother = detector.getWorldVolume().getLogicalVolume();
+ }
+ MultiLayerTracker tracker = (MultiLayerTracker)subdet;
+
tracker.setDetectorElement( new DeSubdetector( detector, subdet ) );
Layering layering = tracker.getLayering();
@@ -69,7 +77,7 @@
null,
name + "_layer" +i,
layerLV,
- trackingVolume,
+ mother,
i);
double sliceInnerR=layerInnerR;
@@ -155,6 +163,23 @@
}
return id;
}
+
+ public void makeIdentifierContext(Subdetector subdet) throws Exception
+ {
+ IIdentifierDictionary iddict = subdet.getDetectorElement().getIdentifierHelper().getIdentifierDictionary();
+
+ int systemIndex = iddict.getFieldIndex("system");
+ int barrelIndex = iddict.getFieldIndex("barrel");
+ int layerIndex = iddict.getFieldIndex("layer");
+
+ IdentifierContext systemContext = new IdentifierContext(new int[] {systemIndex});
+ IdentifierContext subdetContext = new IdentifierContext(new int[] {systemIndex,barrelIndex});
+ IdentifierContext layerContext = new IdentifierContext(new int[] {systemIndex,barrelIndex,layerIndex});
+
+ iddict.addIdentifierContext("system", systemContext);
+ iddict.addIdentifierContext("subdetector", subdetContext);
+ iddict.addIdentifierContext("layer", layerContext);
+ }
public Class getSubdetectorType()
{
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.14 -r1.15
--- DiskTrackerConverter.java 11 Sep 2007 20:18:13 -0000 1.14
+++ DiskTrackerConverter.java 7 Nov 2007 21:57:30 -0000 1.15
@@ -12,8 +12,10 @@
import org.lcsim.detector.identifier.ExpandedIdentifier;
import org.lcsim.detector.identifier.IIdentifier;
import org.lcsim.detector.identifier.IIdentifierDictionary;
+import org.lcsim.detector.identifier.IdentifierContext;
import org.lcsim.detector.identifier.IdentifierDictionaryManager;
import org.lcsim.detector.identifier.IdentifierUtil;
+import org.lcsim.detector.identifier.IIdentifierDictionary.FieldNotFoundException;
import org.lcsim.detector.identifier.IIdentifierDictionary.InvalidIndexException;
import org.lcsim.detector.material.IMaterial;
import org.lcsim.detector.material.MaterialStore;
@@ -36,9 +38,17 @@
implements ISubdetectorConverter
{
public void convert( Subdetector subdet, Detector detector)
- {
- ILogicalVolume trackingVolume = detector.getTrackingVolume().getLogicalVolume();
-
+ {
+ ILogicalVolume mother = null;
+ if (subdet.isInsideTrackingVolume())
+ {
+ mother = detector.getTrackingVolume().getLogicalVolume();
+ }
+ else
+ {
+ mother = detector.getWorldVolume().getLogicalVolume();
+ }
+
DiskTracker tracker = (DiskTracker)subdet;
// Some DiskTracker subdetectors are used for support material
@@ -108,7 +118,7 @@
layerInnerZ + layer.getThickness()/2 )),
name + "_positive_layer" + i,
layerLV,
- trackingVolume,
+ mother,
i);
// Reflected layer in negative z.
@@ -125,7 +135,7 @@
),
name + "_negative_layer" + i,
layerLV,
- trackingVolume,
+ mother,
i);
}
@@ -238,6 +248,30 @@
}
return id;
}
+
+ public void makeIdentifierContext(Subdetector subdet)
+ {
+ IIdentifierDictionary iddict = subdet.getDetectorElement().getIdentifierHelper().getIdentifierDictionary();
+
+ int systemIndex, barrelIndex, layerIndex;
+ try {
+ systemIndex = iddict.getFieldIndex("system");
+ barrelIndex = iddict.getFieldIndex("barrel");
+ layerIndex = iddict.getFieldIndex("layer");
+ }
+ catch (FieldNotFoundException x)
+ {
+ throw new RuntimeException(x);
+ }
+
+ IdentifierContext systemContext = new IdentifierContext(new int[] {systemIndex});
+ IdentifierContext subdetContext = new IdentifierContext(new int[] {systemIndex,barrelIndex});
+ IdentifierContext layerContext = new IdentifierContext(new int[] {systemIndex,barrelIndex,layerIndex});
+
+ iddict.addIdentifierContext("system", systemContext);
+ iddict.addIdentifierContext("subdetector", subdetContext);
+ iddict.addIdentifierContext("layer", layerContext);
+ }
public Class getSubdetectorType()
{