AliRoot Core  3dc7879 (3dc7879)
TestMap.C
Go to the documentation of this file.
1 //____________________________________________________________________
2 //
3 // $Id$
4 //
5 // Test I/O of ALiFMDMap
6 //
13 #include "STEER/AliFMDFloatMap.h"
14 #include <TArrayI.h>
15 #include <iostream>
16 #include <iomanip>
17 #include <map>
18 
19 struct Check
20 {
21  UShort_t d;
22  Char_t r;
23  UShort_t s;
24  UShort_t t;
25  Float_t v;
26 };
27 
28 std::ostream& operator<<(std::ostream& o, const Check& c)
29 {
30  UShort_t v = UShort_t(c.v);
31  o << "FMD" << c.d << c.r << '['
32  << std::setw(2) << c.s << ','
33  << std::setw(3) << c.t << "] ("
34  << std::setw(6) << v << ')';
35  return o;
36 }
37 
38 Check Name(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t v)
39 {
40  Check c;
41  c.d = d;
42  c.r = r;
43  c.s = s;
44  c.t = t;
45  c.v = v;
46  return c;
47 }
48 
49 
50 void
52 {
54  // m.SetBit(AliFMDMap::kNeedUShort);
55  typedef std::map<Int_t, Check> CheckMap;
56  CheckMap c;
57 
58  for (UShort_t d = 1; d <= 3; d++) {
59  Char_t rings[] = { 'I', 'O', '\0' };
60  for (Char_t* rp = rings; *rp; rp++) {
61  Char_t r = *rp;
62  std::cout << "FMD" << d << r << " " << std::flush;
63  for (UShort_t s = 0; s < 40; s++) {
64  std::cout << "." << std::flush;
65  for (UShort_t t = 0; t < 512; t++) {
66  Int_t i = m.CheckIndex(d, r, s, t);
67  CheckMap::iterator z = c.find(i);
68  Float_t v = (t + 512 * (s + 40 * ((r=='I'? 0 : 1) + 2 * d)));
69  if (z != c.end())
70  std::cout << '\n' << Name(d,r,s,t,v) << " but aleady seen "
71  << z->second << std::flush;
72  else {
73  m(d,r,s,t) = v;
74  c[i] = Name(d,r,s,t,v);
75  } // else
76  } // for t
77  } // for s
78  std::cout << "done" << std::endl;
79  }
80  }
81 }
82 
83 
84 
Check Name(UShort_t d, Char_t r, UShort_t s, UShort_t t, Float_t v)
Definition: TestMap.C:38
Int_t CheckIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
Definition: AliFMDMap.cxx:178
UShort_t t
Definition: TestMap.C:24
Float_t v
Definition: TestMap.C:25
std::ostream & operator<<(std::ostream &o, const Check &c)
Definition: TestMap.C:28
Char_t r
Definition: TestMap.C:22
UShort_t d
Definition: TestMap.C:21
UShort_t s
Definition: TestMap.C:23
Bool_t CheckMap(const char *path, const AliFMDMap *map)
void TestMap()
Definition: TestMap.C:51
Definition: TestMap.C:19