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