]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testSt12ReadSector.C
In Mapping/macros:
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSt12ReadSector.C
CommitLineData
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
f05d3eb1 6#if !defined(__CINT__) || defined(__MAKECINT__)
e8c253a0 7
f05d3eb1 8#include "AliMpStation12Type.h"
9#include "AliMpPlaneType.h"
10#include "AliMpDataProcessor.h"
11#include "AliMpDataMap.h"
12#include "AliMpDataStreams.h"
13#include "AliMpSector.h"
14#include "AliMpSectorReader.h"
15#include "AliMpRow.h"
16#include "AliMpVRowSegment.h"
17#include "AliMpVMotif.h"
18#include "AliMpMotifMap.h"
19#include "AliMpConstants.h"
334be4b7 20
f05d3eb1 21#include <Riostream.h>
22#include <TCanvas.h>
23#include <TH2.h>
334be4b7 24
f05d3eb1 25#endif
334be4b7 26
f05d3eb1 27void testReadSector(AliMq::Station12Type station, AliMp::PlaneType plane)
28{
29 AliMpDataProcessor mp;
30 AliMpDataMap* dataMap = mp.CreateDataMap("data");
31 AliMpDataStreams dataStreams(dataMap);
66e0997c 32
f05d3eb1 33 AliMpSectorReader r(dataStreams, station, plane);
34 AliMpSector* sector = r.BuildSector();
66e0997c 35 // Sector geometry
36 sector->PrintGeometry();
37
38 cout << endl;
39
40 // Find row test
cddd101e 41 if (plane == AliMp::kBendingPlane)
a387ee7c 42 cout << "0th row low border " << sector->FindRow(TVector2(0., 0.))->GetID() << endl;
cddd101e 43 if (plane == AliMp::kNonBendingPlane)
a387ee7c 44 cout << "0th row low border " << sector->FindRow(TVector2(0., 0.215))->GetID() << endl;
0f54a452 45 cout << "in 0th row " << sector->FindRow(TVector2(0., 2.5))->GetID() << endl;
46 cout << "0th row up border " << sector->FindRow(TVector2(0., 6.72))->GetID() << endl;
47 cout << "in 4th row " << sector->FindRow(TVector2(0., 30.))->GetID() << endl;
cddd101e 48 if (plane == AliMp::kBendingPlane)
0f54a452 49 cout << "12th row up border " << sector->FindRow(TVector2(0., 89.46))->GetID() << endl;
cddd101e 50 if (plane == AliMp::kNonBendingPlane)
0f54a452 51 cout << "12th row up border " << sector->FindRow(TVector2(0., 84.84))->GetID() << endl;
66e0997c 52 cout << endl;
53
54 // Find motif position test
e8c253a0 55 Int_t ids[15] = { 19, 14, 9, 32, 36, 136, 187, 212, 207, 220, 1, 131, 239, 243, 250 };
56 for (Int_t i=0; i<15 ; i++) {
57 Int_t id = ids[i];
8a3e2481 58 id |= AliMpConstants::ManuMask(plane);
e8c253a0 59 cout << "Motif pos " << std::setw(3) << id;
60 if (!sector->FindRowSegment(id)) {
61 cout << " not found." << endl;
62 }
63 else {
64 cout << " found in : "
65 << sector->FindRow(id)->GetID() << " row, "
66 << " motif id: "
67 << sector->FindRowSegment(id)->GetMotif(0)->GetID().Data()
68 << endl;
69 }
66e0997c 70 }
66e0997c 71 cout << endl;
72
73 // Find motif by coordinates test
74 for (Int_t i=0; i<2 ; i++) {
0f54a452 75 TVector2 pos(0.5, 18.6 - i*2.); // i=0 in motif 1001,
66e0997c 76 // i=1 outside (below) motif 1001
f05d3eb1 77 AliMpVMotif* motif = sector->FindMotif(pos);
66e0997c 78 cout << "In the position " << pos.X() << " " << pos.Y();
79
80 if (motif)
81 cout << " found motif " << motif->GetID() << endl;
82 else
83 cout << " motif not found " << endl;
84 }
85
86 // Find special motif test
cddd101e 87 if (plane == AliMp::kNonBendingPlane) {
e8c253a0 88
89 Int_t ids[6] = { 20, 46, 47, 74, 75, 76 };
66e0997c 90 for (Int_t i=0; i<6 ; i++) {
e8c253a0 91
92 Int_t id = ids[i];
66e0997c 93 cout << "Motif pos " << id;
94 if (!sector->FindRowSegment(id)) {
95 cout << " not found." << endl;
96 }
97 else {
98 cout << " found in : "
99 << sector->FindRow(id)->GetID() << " row, "
100 << " position : "
101 << sector->FindPosition(id).X() << " " << sector->FindPosition(id).Y()
102 << endl;
103 }
e8c253a0 104 }
105 }
66e0997c 106 cout << endl;
107
108 // Motif map
109 sector->GetMotifMap()->Print();
110
111 delete sector;
112}
f05d3eb1 113
114void testReadSector()
115{
116 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
117 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
118
119 for ( Int_t is = 0; is < 2; is++ ) {
120 for ( Int_t ip = 0; ip < 2; ip++ ) {
121
122 cout << "Running testReadSector for "
123 << AliMq::Station12TypeName(station[is]) << " "
124 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
125
126 testReadSector(station[is], plane[ip]);
127
128 cout << "... end running " << endl << endl;
129 }
130 }
131}
132
66e0997c 133