ROOT logo
#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 ");

}
 TestMapAlgebra.C:1
 TestMapAlgebra.C:2
 TestMapAlgebra.C:3
 TestMapAlgebra.C:4
 TestMapAlgebra.C:5
 TestMapAlgebra.C:6
 TestMapAlgebra.C:7
 TestMapAlgebra.C:8
 TestMapAlgebra.C:9
 TestMapAlgebra.C:10
 TestMapAlgebra.C:11
 TestMapAlgebra.C:12
 TestMapAlgebra.C:13
 TestMapAlgebra.C:14
 TestMapAlgebra.C:15
 TestMapAlgebra.C:16
 TestMapAlgebra.C:17
 TestMapAlgebra.C:18
 TestMapAlgebra.C:19
 TestMapAlgebra.C:20
 TestMapAlgebra.C:21
 TestMapAlgebra.C:22
 TestMapAlgebra.C:23
 TestMapAlgebra.C:24
 TestMapAlgebra.C:25
 TestMapAlgebra.C:26
 TestMapAlgebra.C:27
 TestMapAlgebra.C:28
 TestMapAlgebra.C:29
 TestMapAlgebra.C:30
 TestMapAlgebra.C:31
 TestMapAlgebra.C:32
 TestMapAlgebra.C:33
 TestMapAlgebra.C:34
 TestMapAlgebra.C:35
 TestMapAlgebra.C:36
 TestMapAlgebra.C:37
 TestMapAlgebra.C:38
 TestMapAlgebra.C:39
 TestMapAlgebra.C:40
 TestMapAlgebra.C:41
 TestMapAlgebra.C:42
 TestMapAlgebra.C:43
 TestMapAlgebra.C:44
 TestMapAlgebra.C:45
 TestMapAlgebra.C:46
 TestMapAlgebra.C:47
 TestMapAlgebra.C:48
 TestMapAlgebra.C:49
 TestMapAlgebra.C:50
 TestMapAlgebra.C:51
 TestMapAlgebra.C:52
 TestMapAlgebra.C:53