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