]>
Commit | Line | Data |
---|---|---|
66e0997c | 1 | // $Id$ |
0f54a452 | 2 | // $MpId: testReadSector.C,v 1.16 2006/01/11 10:00:50 ivana Exp $ |
66e0997c | 3 | // |
4 | // Test macro for reading sector data. | |
5 | ||
e8c253a0 | 6 | #include <iomanip> |
7 | ||
cddd101e | 8 | void testReadSector(AliMp::StationType station = AliMp::kStation1, |
9 | AliMp::PlaneType plane = AliMp::kBendingPlane, | |
334be4b7 | 10 | Bool_t rootInput = false) |
66e0997c | 11 | { |
334be4b7 | 12 | AliMpSector *sector = 0; |
13 | if (!rootInput) { | |
14 | AliMpSectorReader r(station, plane); | |
15 | //reader.SetVerboseLevel(1); | |
16 | sector=r.BuildSector(); | |
17 | ||
18 | // Write sector on Root file | |
0f54a452 | 19 | TString filePath = AliMpFiles::SectorFilePath(station,plane); |
334be4b7 | 20 | filePath.ReplaceAll("zones.dat", "sector.root"); |
66e0997c | 21 | |
334be4b7 | 22 | TFile f(filePath.Data(), "RECREATE"); |
23 | sector->Write(); | |
24 | f.Close(); | |
25 | } | |
26 | else { | |
0f54a452 | 27 | TString filePath = AliMpFiles::SectorFilePath(station,plane); |
334be4b7 | 28 | filePath.ReplaceAll("zones.dat", "sector.root"); |
29 | ||
30 | TFile f(filePath.Data(), "READ"); | |
31 | sector = (AliMpSector*)f.Get("Sector"); | |
32 | } | |
33 | ||
66e0997c | 34 | cout << endl; |
35 | ||
36 | // Sector geometry | |
37 | sector->PrintGeometry(); | |
38 | ||
39 | cout << endl; | |
40 | ||
41 | // Find row test | |
cddd101e | 42 | if (plane == AliMp::kBendingPlane) |
a387ee7c | 43 | cout << "0th row low border " << sector->FindRow(TVector2(0., 0.))->GetID() << endl; |
cddd101e | 44 | if (plane == AliMp::kNonBendingPlane) |
a387ee7c | 45 | cout << "0th row low border " << sector->FindRow(TVector2(0., 0.215))->GetID() << endl; |
0f54a452 | 46 | cout << "in 0th row " << sector->FindRow(TVector2(0., 2.5))->GetID() << endl; |
47 | cout << "0th row up border " << sector->FindRow(TVector2(0., 6.72))->GetID() << endl; | |
48 | cout << "in 4th row " << sector->FindRow(TVector2(0., 30.))->GetID() << endl; | |
cddd101e | 49 | if (plane == AliMp::kBendingPlane) |
0f54a452 | 50 | cout << "12th row up border " << sector->FindRow(TVector2(0., 89.46))->GetID() << endl; |
cddd101e | 51 | if (plane == AliMp::kNonBendingPlane) |
0f54a452 | 52 | cout << "12th row up border " << sector->FindRow(TVector2(0., 84.84))->GetID() << endl; |
66e0997c | 53 | cout << endl; |
54 | ||
55 | // Find motif position test | |
e8c253a0 | 56 | Int_t ids[15] = { 19, 14, 9, 32, 36, 136, 187, 212, 207, 220, 1, 131, 239, 243, 250 }; |
57 | for (Int_t i=0; i<15 ; i++) { | |
58 | Int_t id = ids[i]; | |
8a3e2481 | 59 | id |= AliMpConstants::ManuMask(plane); |
e8c253a0 | 60 | cout << "Motif pos " << std::setw(3) << id; |
61 | if (!sector->FindRowSegment(id)) { | |
62 | cout << " not found." << endl; | |
63 | } | |
64 | else { | |
65 | cout << " found in : " | |
66 | << sector->FindRow(id)->GetID() << " row, " | |
67 | << " motif id: " | |
68 | << sector->FindRowSegment(id)->GetMotif(0)->GetID().Data() | |
69 | << endl; | |
70 | } | |
66e0997c | 71 | } |
66e0997c | 72 | cout << endl; |
73 | ||
74 | // Find motif by coordinates test | |
75 | for (Int_t i=0; i<2 ; i++) { | |
0f54a452 | 76 | TVector2 pos(0.5, 18.6 - i*2.); // i=0 in motif 1001, |
66e0997c | 77 | // i=1 outside (below) motif 1001 |
78 | AliMpMotif* motif = sector->FindMotif(pos); | |
79 | cout << "In the position " << pos.X() << " " << pos.Y(); | |
80 | ||
81 | if (motif) | |
82 | cout << " found motif " << motif->GetID() << endl; | |
83 | else | |
84 | cout << " motif not found " << endl; | |
85 | } | |
86 | ||
87 | // Find special motif test | |
cddd101e | 88 | if (plane == AliMp::kNonBendingPlane) { |
e8c253a0 | 89 | |
90 | Int_t ids[6] = { 20, 46, 47, 74, 75, 76 }; | |
66e0997c | 91 | for (Int_t i=0; i<6 ; i++) { |
e8c253a0 | 92 | |
93 | Int_t id = ids[i]; | |
66e0997c | 94 | cout << "Motif pos " << id; |
95 | if (!sector->FindRowSegment(id)) { | |
96 | cout << " not found." << endl; | |
97 | } | |
98 | else { | |
99 | cout << " found in : " | |
100 | << sector->FindRow(id)->GetID() << " row, " | |
101 | << " position : " | |
102 | << sector->FindPosition(id).X() << " " << sector->FindPosition(id).Y() | |
103 | << endl; | |
104 | } | |
e8c253a0 | 105 | } |
106 | } | |
66e0997c | 107 | cout << endl; |
108 | ||
109 | // Motif map | |
110 | sector->GetMotifMap()->Print(); | |
111 | ||
112 | delete sector; | |
113 | } | |
114 | ||
115 | ||
116 |