66e0997c |
1 | // $Id$ |
2 | // |
3 | // Test macro for reading sector data. |
4 | |
5 | void testReadSector(AliMpStationType station = kStation1, |
6 | AliMpPlaneType plane = kBendingPlane) |
7 | { |
8 | AliMpReader reader(station, plane); |
9 | //reader.SetVerboseLevel(1); |
10 | |
11 | // Read data |
12 | AliMpSector* sector = reader.BuildSector(); |
13 | |
14 | cout << endl; |
15 | |
16 | // Sector geometry |
17 | sector->PrintGeometry(); |
18 | |
19 | cout << endl; |
20 | |
21 | // Find row test |
22 | cout << "0th row low border " << sector->FindRow(TVector2(0., 0.))->GetID() << endl; |
23 | cout << "in 0th row " << sector->FindRow(TVector2(0., 25.))->GetID() << endl; |
24 | cout << "0th row up border " << sector->FindRow(TVector2(0., 67.2))->GetID() << endl; |
25 | cout << "in 4th row " << sector->FindRow(TVector2(0., 300.))->GetID() << endl; |
26 | if (plane == kBendingPlane) |
27 | cout << "12th row up border " << sector->FindRow(TVector2(0., 894.6))->GetID() << endl; |
28 | if (plane == kNonBendingPlane) |
29 | cout << "12th row up border " << sector->FindRow(TVector2(0., 848.4))->GetID() << endl; |
30 | cout << endl; |
31 | |
32 | // Find motif position test |
33 | for (Int_t i=1; i<4 ; i++) { |
34 | for (Int_t j=0; j<5; j++) { |
35 | |
36 | Int_t start = 0; |
37 | if (plane == kBendingPlane) start = 0; |
38 | if (plane == kNonBendingPlane) start = 3000; |
39 | |
40 | Int_t id = start + i*1010 + 5*j; |
41 | |
42 | cout << "Motif pos " << id; |
43 | if (!sector->FindRowSegment(id)) { |
44 | cout << " not found." << endl; |
45 | } |
46 | else { |
47 | cout << " found in : " |
48 | << sector->FindRow(id)->GetID() << " row, " |
49 | << " motif id: " |
50 | << sector->FindRowSegment(id)->GetMotif(0)->GetID().Data() |
51 | << endl; |
52 | } |
53 | } |
54 | } |
55 | |
56 | cout << endl; |
57 | |
58 | // Find motif by coordinates test |
59 | for (Int_t i=0; i<2 ; i++) { |
60 | TVector2 pos(5., 186. - i*20.); // i=0 in motif 1001, |
61 | // i=1 outside (below) motif 1001 |
62 | AliMpMotif* motif = sector->FindMotif(pos); |
63 | cout << "In the position " << pos.X() << " " << pos.Y(); |
64 | |
65 | if (motif) |
66 | cout << " found motif " << motif->GetID() << endl; |
67 | else |
68 | cout << " motif not found " << endl; |
69 | } |
70 | |
71 | // Find special motif test |
72 | if (plane == kNonBendingPlane) |
73 | for (Int_t i=0; i<6 ; i++) { |
74 | Int_t id = 4001 + i; |
75 | cout << "Motif pos " << id; |
76 | if (!sector->FindRowSegment(id)) { |
77 | cout << " not found." << endl; |
78 | } |
79 | else { |
80 | cout << " found in : " |
81 | << sector->FindRow(id)->GetID() << " row, " |
82 | << " position : " |
83 | << sector->FindPosition(id).X() << " " << sector->FindPosition(id).Y() |
84 | << endl; |
85 | } |
86 | } |
87 | cout << endl; |
88 | |
89 | // Motif map |
90 | sector->GetMotifMap()->Print(); |
91 | |
92 | delete sector; |
93 | } |
94 | |
95 | |
96 | |