Print

Print


Commit in GeomConverter/src/org/lcsim/detector/converter/compact on MAIN
SiTrackerBarrelConverter.java+33-331.22 -> 1.23
JM: Correct the name of the sensor DetectorElement to use the correct module number.

GeomConverter/src/org/lcsim/detector/converter/compact
SiTrackerBarrelConverter.java 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- SiTrackerBarrelConverter.java	28 Aug 2007 22:26:34 -0000	1.22
+++ SiTrackerBarrelConverter.java	25 Sep 2007 23:43:07 -0000	1.23
@@ -26,6 +26,7 @@
 import org.lcsim.detector.identifier.IIdentifierDictionary;
 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;
@@ -488,38 +489,36 @@
                 int sensorId=0;
                 for ( IPhysicalVolume pv : modulePhysVol.getLogicalVolume().getDaughters())
                 {
+                	// Create the identifier for this sensor.
                     if ( pv.isSensitive() )
-                    {                        
-                        // Create the identifier for this sensor.
-                        ExpandedIdentifier expId = new ExpandedIdentifier();
-                        
-                        // Set the System ID.
-                        expId.addValue(subdet.getSystemID());
-                        
-                        // Set the barrel-endcap flag.
-                        expId.addValue(0);
-                        
-                        // Set the layer number.
-                        expId.addValue(layer.getGeometry().getPath().getLeafVolume().getCopyNumber());
-                        
-                        // Set the module id from the DetectorElement.
-                        expId.addValue(((SiTrackerBarrelModule)module).getModuleId());
-                        
-                        // Set the sensor id for double-sided.
-                        expId.addValue(sensorId);
-                        
-                        // Dummy value for side.
-                        expId.addValue(0);
-                        
-                        // Dummy value for strip.
-                        expId.addValue(0);
-                     
-                        // Get the identifier dictionary from the manager.  
-                        // Subdetector doesn't have this reference setup yet.
-                        IIdentifierDictionary iddict = 
-                            IdentifierDictionaryManager.getInstance().
-                            getIdentifierDictionary( subdet.getReadout().getName() );
-                        
+                    {        
+                		IIdentifierDictionary iddict = 
+                			IdentifierDictionaryManager.getInstance().
+                			getIdentifierDictionary( subdet.getReadout().getName() );
+                    	
+                		ExpandedIdentifier expId = new ExpandedIdentifier(iddict.getNumberOfFields());
+                		
+                    	try {                    		                    		                    		
+                    		// Set the System ID.                        
+                    		expId.setValue(iddict.getFieldIndex("system"), subdet.getSystemID());
+
+                    		// Set the barrel-endcap flag.
+                    		expId.setValue(iddict.getFieldIndex("barrel"), 0);
+
+                    		// Set the layer number.
+                    		expId.setValue(iddict.getFieldIndex("layer"), layer.getGeometry().getPath().getLeafVolume().getCopyNumber());
+
+                    		// Set the module id from the DetectorElement.
+                    		expId.setValue(iddict.getFieldIndex("module"),((SiTrackerBarrelModule)module).getModuleId());
+
+                    		// Set the sensor id for double-sided.
+                    		expId.setValue(iddict.getFieldIndex("sensor"),sensorId);
+                    	}
+                    	catch (FieldNotFoundException x)
+                    	{
+                    		throw new RuntimeException(x);
+                    	}
+                                             
                         // Create the packed id using util method.  
                         // No IdentifierHelper is available yet.
                         IIdentifier id = null;
@@ -534,8 +533,9 @@
                         //System.out.println(pv.getName() + " is sens");
                         //System.out.println("path : " + modulePath.toString() + "/" + pv.getName());
                         String sensorPath = modulePath.toString() + "/" + pv.getName();
-                        String sensorName = subdet.getName() + "_layer" + layer.getGeometry().getPhysicalVolume().getCopyNumber() + "_module" + moduleId + "_sensor" + sensorId;
-                        
+                        //String sensorName = subdet.getName() + "_layer" + layer.getGeometry().getPhysicalVolume().getCopyNumber() + "_module" + moduleId + "_sensor" + sensorId;
+                        String sensorName = subdet.getName() + "_layer" + layer.getGeometry().getPhysicalVolume().getCopyNumber() + "_module" + ((SiTrackerBarrelModule)module).getModuleId() + "_sensor" + sensorId;
+                                                                        
 //                        SiSensor sensor = new SiSensor(sensorId, sensorName, module, sensorPath, id);
 //                        sensor.setIdentifier( id );
 //                        sensor.setElectrodes(ChargeCarrier.HOLE,new SiStrips(3679,0.025,1));
CVSspam 0.2.8