AliPhysics  64f4410 (64f4410)
TestMarkers.C
Go to the documentation of this file.
1 
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  };
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  }
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  }
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 
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 //
double Double_t
Definition: External.C:58
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
void DrawOne(const char *what, UShort_t base, Double_t y)
Definition: TestMarkers.C:93
unsigned short UShort_t
Definition: External.C:28
bool Bool_t
Definition: External.C:53