]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Test script
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Jul 2009 20:45:52 +0000 (20:45 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 6 Jul 2009 20:45:52 +0000 (20:45 +0000)
FMD/scripts/TestMapAlgebra.C [new file with mode: 0644]

diff --git a/FMD/scripts/TestMapAlgebra.C b/FMD/scripts/TestMapAlgebra.C
new file mode 100644 (file)
index 0000000..3f0ec37
--- /dev/null
@@ -0,0 +1,52 @@
+#include <AliFMDFloatMap.h>
+
+struct SetIt : public AliFMDMap::ForOne
+{
+public:
+  SetIt(AliFMDFloatMap* m) : fMap(m) {}
+  Bool_t operator()(UShort_t d,Char_t r,UShort_t s,UShort_t t,Float_t)
+  {
+    UShort_t q = r == 'I' ? 0 : 1;
+    Float_t  v = d * 1000 + q * 100 + s + t * 0.001;
+    fMap->operator()(d, r, s, t) = v;
+    return kTRUE;
+  }
+  Bool_t operator()(UShort_t,Char_t,UShort_t,UShort_t,Int_t)
+  {
+    return kTRUE;
+  }
+  Bool_t operator()(UShort_t,Char_t,UShort_t,UShort_t,UShort_t)
+  {
+    return kTRUE;
+  }
+  Bool_t operator()(UShort_t,Char_t,UShort_t,UShort_t,Bool_t)
+  {
+    return kTRUE;
+  }
+  AliFMDFloatMap* fMap;
+};
+
+void
+TestMapAlgebra()
+{
+  AliFMDFloatMap a(0), b(0);
+  a.Reset(1);
+  b.Reset(2);
+  
+  AliFMDFloatMap c = a + b;
+  // c.Print();
+
+  SetIt s(&b);
+  b.ForEach(s);
+  
+  c = a * b;
+  c.Print("%7.3f ");
+
+  AliFMDFloatMap d(3, 2, 1, 3), e(2, 2, 1, 2);
+  d.Reset(1);
+  e.Reset(2);
+
+  AliFMDFloatMap f = d + e;
+  f.Print("%4.0f ");
+
+}