]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/scripts/TestMapAlgebra.C
Added scripts
[u/mrichter/AliRoot.git] / FMD / scripts / TestMapAlgebra.C
CommitLineData
3fa32df4 1#include <AliFMDFloatMap.h>
2
3struct SetIt : public AliFMDMap::ForOne
4{
5public:
6 SetIt(AliFMDFloatMap* m) : fMap(m) {}
7 Bool_t operator()(UShort_t d,Char_t r,UShort_t s,UShort_t t,Float_t)
8 {
9 UShort_t q = r == 'I' ? 0 : 1;
10 Float_t v = d * 1000 + q * 100 + s + t * 0.001;
11 fMap->operator()(d, r, s, t) = v;
12 return kTRUE;
13 }
14 Bool_t operator()(UShort_t,Char_t,UShort_t,UShort_t,Int_t)
15 {
16 return kTRUE;
17 }
18 Bool_t operator()(UShort_t,Char_t,UShort_t,UShort_t,UShort_t)
19 {
20 return kTRUE;
21 }
22 Bool_t operator()(UShort_t,Char_t,UShort_t,UShort_t,Bool_t)
23 {
24 return kTRUE;
25 }
26 AliFMDFloatMap* fMap;
27};
28
29void
30TestMapAlgebra()
31{
32 AliFMDFloatMap a(0), b(0);
33 a.Reset(1);
34 b.Reset(2);
35
36 AliFMDFloatMap c = a + b;
37 // c.Print();
38
39 SetIt s(&b);
40 b.ForEach(s);
41
42 c = a * b;
43 c.Print("%7.3f ");
44
45 AliFMDFloatMap d(3, 2, 1, 3), e(2, 2, 1, 2);
46 d.Reset(1);
47 e.Reset(2);
48
49 AliFMDFloatMap f = d + e;
50 f.Print("%4.0f ");
51
52}