Commit in lcsim on MAIN
src/org/lcsim/util/aida/AIDA.java+14-21.2 -> 1.3
test/org/lcsim/util/aida/AIDATest.java+5-11.1 -> 1.2
+19-3
2 modified files
Make it easier to create AIDA histos/clouds inside folders (requested by Ron)

lcsim/src/org/lcsim/util/aida
AIDA.java 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- AIDA.java	8 Aug 2005 05:22:31 -0000	1.2
+++ AIDA.java	8 Aug 2005 07:10:23 -0000	1.3
@@ -71,6 +71,11 @@
          throw new AIDAException("IOException creating temporary store",x);
       }
    }
+   private void checkPath(String path)
+   {
+      int pos = path.lastIndexOf('/');
+      if (pos > 0) tree.mkdirs(path.substring(0, pos));
+   }
    
    public ICloud1D cloud1D(String path)
    {
@@ -87,6 +92,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createCloud1D(path, path, nMax);
       }
    }
@@ -106,6 +112,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createCloud2D(path, path, nMax);
       }
    }
@@ -125,6 +132,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createCloud3D(path, path, nMax);
       }
    }
@@ -146,6 +154,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createHistogram1D(path, bins, lowerEdge, upperEdge);
       }
    }
@@ -167,6 +176,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createHistogram2D(path, nBinsX, lowerEdgeX, upperEdgeX, nBinsY, lowerEdgeY, upperEdgeY);
       }
    }
@@ -188,6 +198,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createHistogram3D(path, nBinsX, lowerEdgeX, upperEdgeX, nBinsY, lowerEdgeY, upperEdgeY, nBinsZ, lowerEdgeZ, upperEdgeZ);
       }
       
@@ -215,6 +226,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createProfile1D(path, nBins, lowerEdge, upperEdge);
       }
    }
@@ -236,6 +248,7 @@
       }
       catch (IllegalArgumentException x)
       {
+         checkPath(path);
          return hf.createProfile2D(path, nBinsX, lowerEdgeX, upperEdgeX, nBinsY, lowerEdgeY, upperEdgeY);
       }
    }
@@ -290,7 +303,6 @@
       String[] type = tree.listObjectNames("/",true);
       for (int i=0; i<type.length; i++)
       {
-         System.out.println(type[i]);
          if (type[i].endsWith("/")) continue;
          IManagedObject obj = tree.find(type[i]);
          if (obj instanceof IBaseHistogram) ((IBaseHistogram) obj).reset();
@@ -313,7 +325,7 @@
          else
          {
             SequentialRecordLoop loop = (SequentialRecordLoop) loopEvent.getSource();
-            loop.removeRecordLoopListener(this);   
+            loop.removeRecordLoopListener(this);
          }
       }
    }

lcsim/test/org/lcsim/util/aida
AIDATest.java 1.1 -> 1.2
diff -u -r1.1 -r1.2
--- AIDATest.java	8 Aug 2005 05:22:30 -0000	1.1
+++ AIDATest.java	8 Aug 2005 07:10:24 -0000	1.2
@@ -38,13 +38,17 @@
       for (int i=0; i<10000; i++) c1.fill(r.nextGaussian());
       assertEquals(10000,c1.entries());
       
-      aida.tree().mkdir("xyz");
       ICloud1D c2 = aida.cloud1D("xyz/cloud");
       for (int i=0; i<10000; i++) c2.fill(r.nextGaussian());
       assertEquals(10000,c2.entries());
       
+      ICloud1D c3 = aida.cloud1D("xyz/cloud2");
+      for (int i=0; i<10000; i++) c3.fill(r.nextGaussian());
+      assertEquals(10000,c3.entries());
+      
       aida.clearAll();
       assertEquals(0,c1.entries());
       assertEquals(0,c2.entries());
+      assertEquals(0,c3.entries());
    }
 }
CVSspam 0.2.8