]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testReadSector.C
e07909a3c5beddb2c0fb0ce64186d21d87aab1e8
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testReadSector.C
1 // $Id$
2 // $MpId: testReadSector.C,v 1.16 2006/01/11 10:00:50 ivana Exp $
3 //
4 // Test macro for reading sector data.
5
6 #if !defined(__CINT__) || defined(__MAKECINT__)
7
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"
20
21 #include <Riostream.h>
22 #include <TCanvas.h>
23 #include <TH2.h>
24
25 #endif
26
27 void testReadSector(AliMq::Station12Type station, AliMp::PlaneType plane)
28 {
29   AliMpDataProcessor mp;
30   AliMpDataMap* dataMap = mp.CreateDataMap("data");
31   AliMpDataStreams dataStreams(dataMap);
32
33   AliMpSectorReader r(dataStreams, station, plane);
34   AliMpSector* sector = r.BuildSector();
35   // Sector geometry
36   sector->PrintGeometry();
37
38   cout << endl;
39
40   // Find row test
41   if (plane == AliMp::kBendingPlane)
42     cout << "0th row low border " << sector->FindRow(TVector2(0., 0.))->GetID() << endl;
43   if (plane == AliMp::kNonBendingPlane)
44     cout << "0th row low border " << sector->FindRow(TVector2(0., 0.215))->GetID() << endl;
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;
48   if (plane == AliMp::kBendingPlane)
49     cout << "12th row up border " << sector->FindRow(TVector2(0., 89.46))->GetID() << endl;
50   if (plane == AliMp::kNonBendingPlane)
51     cout << "12th row up border " << sector->FindRow(TVector2(0., 84.84))->GetID() << endl;
52   cout << endl;
53   
54   // Find motif position test
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];
58     id |= AliMpConstants::ManuMask(plane);
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     }      
70   }
71   cout << endl;
72
73   // Find motif by coordinates test
74   for (Int_t i=0; i<2 ; i++) {
75     TVector2 pos(0.5, 18.6 - i*2.);  // i=0 in motif 1001,
76                                      // i=1 outside (below) motif 1001
77     AliMpVMotif* motif = sector->FindMotif(pos);
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
87   if (plane == AliMp::kNonBendingPlane) {
88   
89     Int_t ids[6] = { 20, 46, 47, 74, 75, 76 };
90     for (Int_t i=0; i<6 ; i++) {
91       
92       Int_t id = ids[i];
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       }
104     }
105   }             
106   cout << endl;
107
108   // Motif map
109   sector->GetMotifMap()->Print();    
110   
111   delete sector;
112 }                              
113      
114 void 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   
133