lcsim/src/org/lcsim/event/base
diff -u -r1.7 -r1.8
--- BaseLCSimEvent.java 17 Nov 2009 20:10:31 -0000 1.7
+++ BaseLCSimEvent.java 17 Apr 2012 23:28:11 -0000 1.8
@@ -156,42 +156,13 @@
public void put(String name, List collection, Class type, int flags, String readoutName)
{
super.put(name,collection);
- // First check readout validity
- boolean isOriginal = false;
- boolean isValid = false;
- for(LCMetaData tmp : metaDataMap.values())
- {
- String[] names = tmp.getStringParameters().get(READOUT_NAME);
-
- if(tmp.getName().equals(readoutName))
- {
- // readoutName already exists as a collection
- // does it have a parent collection?
- if(names == null || names.length == 0)
- {
- // no parent, original collection
- isOriginal=true;
- break;
- }
- else
- {
- // yes, reset readoutName from its parent
- readoutName = names[0];
- isValid = true;
- break;
- }
- }
- }
-
- // not a valid readout name provided
- if(!isValid && !isOriginal) readoutName = null;
-
+
LCMetaData meta = new MetaData(name, type, flags, readoutName);
metaDataMap.put(collection,meta);
+ // Set MetaData on collection objects.
if (HasMetaData.class.isAssignableFrom(type))
{
- HasMetaData hmd;
for (Object o : collection)
{
if (o instanceof HasMetaData) {
@@ -330,7 +301,7 @@
if (names != null && names.length >= 1) readoutName = names[0];
}
- // 1) Find the IDDecoder using the Detector.
+ // Find the IDDecoder using the Detector.
org.lcsim.geometry.IDDecoder result=null;
try {
result = getDetector().getDecoder(readoutName);
@@ -338,12 +309,13 @@
catch (RuntimeException x)
{}
- // 2) Detector lookup failed. Attempt to use the CellIDEncoding collection parameter.
+ // Detector lookup failed. Attempt to use the CellIDEncoding collection parameter.
if (result == null)
result = createIDDecoderFromCellIDEncoding();
- // If both methods failed, then die.
- if (result == null) throw new RuntimeException("Could not find or create an IDDecoder for the collection: "+name+", readout: "+readoutName);
+ // If both methods failed, then there is a problem.
+ if (result == null)
+ throw new RuntimeException("Could not find or create an IDDecoder for the collection: "+name+", readout: "+readoutName);
return result;
}