]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/tests/TestMarkers.C
f142ffb176a099ecbc86d3f7a855542d91b0a08f
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / tests / TestMarkers.C
1 /** 
2  * 
3  * 
4  * @ingroup pwg2_forward_scripts_tests
5  */
6 namespace {
7   enum { 
8     kSolid        = 0x000, 
9     kHollow       = 0x001, 
10     kCircle       = 0x002,
11     kSquare       = 0x004, 
12     kUpTriangle   = 0x006, 
13     kDownTriangle = 0x008, 
14     kDiamond      = 0x00a,
15     kCross        = 0x00c,
16     kStar         = 0x00e
17   };
18   /** 
19    * 
20    * 
21    * @param bits 
22    * 
23    * @return 
24    * @ingroup pwg2_forward_scripts_tests
25    */
26   Int_t MarkerStyle(UInt_t bits)
27   {
28     Int_t  base   = bits & (0xFE);
29     Bool_t hollow = bits & kHollow;
30     switch (base) { 
31     case kCircle:       return (hollow ? 24 : 20);
32     case kSquare:       return (hollow ? 25 : 21);
33     case kUpTriangle:   return (hollow ? 26 : 22);
34     case kDownTriangle: return (hollow ? 32 : 23);
35     case kDiamond:      return (hollow ? 27 : 33); 
36     case kCross:        return (hollow ? 28 : 34); 
37     case kStar:         return (hollow ? 30 : 29); 
38     }
39     return 1;
40   }
41   /** 
42    * 
43    * 
44    * @param style 
45    * 
46    * @return 
47    * @ingroup pwg2_forward_scripts_tests
48    */
49   UShort_t MarkerBits(Int_t style) 
50   { 
51     UShort_t bits = 0;
52     switch (style) { 
53     case 24: case 25: case 26: case 27: case 28: case 30: case 32: 
54       bits |= kHollow; break;
55     }
56     switch (style) { 
57     case 20: case 24: bits |= kCircle;       break;
58     case 21: case 25: bits |= kSquare;       break;
59     case 22: case 26: bits |= kUpTriangle;   break;
60     case 23: case 32: bits |= kDownTriangle; break;
61     case 27: case 33: bits |= kDiamond;      break;
62     case 28: case 34: bits |= kCross;        break;
63     case 29: case 30: bits |= kStar;         break;
64     }
65     return bits;
66   }
67   /** 
68    * 
69    * 
70    * @param style 
71    * 
72    * @return 
73    * @ingroup pwg2_forward_scripts_tests
74    */
75   Int_t FlipHollow(Int_t style) 
76   {
77     UShort_t bits = MarkerBits(style);
78     Int_t ret = MarkerStyle(bits ^ kHollow);
79     Info("FlipHollow", "style=%2d -> bits=0x%02x -> mask=0x%02x -> ret=%02d", 
80          style, bits, (bits ^ kHollow), ret);
81     return ret;
82   }
83 }
84
85 /** 
86  * 
87  * 
88  * @param what 
89  * @param base 
90  * @param y 
91  * @ingroup pwg2_forward_scripts_tests
92  */
93 void DrawOne(const char* what, UShort_t base, Double_t y)
94 {
95   TLatex* l = new TLatex(.07, y, what);
96   l->SetTextSize(0.03);
97   l->Draw();
98
99   Int_t filled = MarkerStyle(base);
100   // Info("DrawOne", "%2d (%16s) -> %d", base, what, style);
101   TMarker* p = new TMarker(.35, y, filled);
102   p->SetMarkerSize(1.5);
103   p->Draw();
104
105   Int_t hollow = MarkerStyle(base|kHollow);
106   p = new TMarker(.60, y, hollow);
107   p->SetMarkerSize(1.5);
108   p->Draw();
109
110   p = new TMarker(.75, y, FlipHollow(filled));
111   p->SetMarkerSize(1.5);
112   p->Draw();
113
114   p = new TMarker(.85, y, FlipHollow(hollow));
115   p->SetMarkerSize(1.5);
116   p->Draw();
117     
118 }
119
120 //
121 // EOF
122 //