50f88f201fab5f26070bde022c73aed7afe87f28
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testPrintLimits.C
1 // $Id$
2 // $MpId: testPrintLimits.C,v 1.7 2005/08/24 08:53:27 ivana Exp $
3 //
4 // Test macro for making an output file, where all mapping elements
5 // indices & positions are written.
6
7 void testPrintLimits(AliMpStationType station = kStation1,
8                     AliMpPlaneType plane = kBendingPlane, ostream& out=cout)
9 {
10   AliMpSectorReader r(station, plane);
11
12   AliMpSector *sector=r.BuildSector();
13
14   AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
15   painter->Draw("ZSSMP");
16
17   AliMpIntPair low,high;
18   TVector2 rlow,rhigh;
19
20   for (Int_t irow=0;irow<sector->GetNofRows();irow++){
21     // For each row
22
23     AliMpRow* row = sector->GetRow(irow);
24     low  = row->GetLowIndicesLimit();
25     high = row->GetHighIndicesLimit();
26     rlow = TVector2(row->Position().X()-row->Dimensions().X(),
27                     row->Position().Y()-row->Dimensions().Y());
28     rhigh = TVector2(row->Position().X()+row->Dimensions().X(),
29                      row->Position().Y()+row->Dimensions().Y());
30     out<<"_______________________________________________________________"<<endl;
31     out<<"Row "<<irow<<" between "<<low<<" and "<<high
32        <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
33        <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
34     out<<"_______________________________________________________________"<<endl;
35   
36     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){
37       // For each row segment  
38   
39       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
40       low  = seg->GetLowIndicesLimit();
41       high = seg->GetHighIndicesLimit();
42       rlow = TVector2(seg->Position().X()-seg->Dimensions().X(),
43                       seg->Position().Y()-seg->Dimensions().Y());
44       rhigh = TVector2(seg->Position().X()+seg->Dimensions().X(),
45                        seg->Position().Y()+seg->Dimensions().Y());
46       out<<"-----------------------------------------------------------"<<endl;
47       out<<"     Segment "<<iseg<<" between "<<low<<" and "<<high
48          <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
49          <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
50       out<<"-----------------------------------------------------------"<<endl;
51
52       for (Int_t imotif=0;imotif<seg->GetNofMotifs();imotif++){
53          // For each motif pos
54   
55         AliMpMotifPosition* motifPos 
56           = sector->GetMotifMap()
57               ->FindMotifPosition(seg->GetMotifPositionId(imotif));
58         AliMpVMotif* motif = motifPos->GetMotif();
59       
60         low  = motifPos->GetLowIndicesLimit();
61         high = motifPos->GetHighIndicesLimit();
62         rlow = TVector2(motifPos->Position().X()-motif->Dimensions().X(),
63                   motifPos->Position().Y()-motif->Dimensions().Y());
64         rhigh = TVector2(motifPos->Position().X()+motif->Dimensions().X(),
65                    motifPos->Position().Y()+motif->Dimensions().Y());
66         out<<"          Motif "<<imotif<<" between "<<low<<" and "<<high
67            <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
68            <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
69       }
70     }
71   }
72 }