Updated for modifs in AliMpFiles
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testPrintLimits.C
1 // $Id$
2 // $MpId: testPrintLimits.C,v 1.9 2005/10/28 15:36:08 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, 
9                     Bool_t rootInput = false,
10                     ostream& out=cout)
11 {
12   AliMpSector *sector = 0;
13   if (!rootInput) {
14     AliMpSectorReader r(station, plane);
15     sector=r.BuildSector();
16   }
17   else  {
18     TString filePath = AliMpFiles::SectorFilePath(station,plane);
19     filePath.ReplaceAll("zones.dat", "sector.root"); 
20
21     TFile f(filePath.Data(), "READ");
22     sector = (AliMpSector*)f.Get("Sector");
23   }  
24
25   AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
26   painter->Draw("ZSSMP");
27
28   AliMpIntPair low,high;
29   TVector2 rlow,rhigh;
30
31   for (Int_t irow=0;irow<sector->GetNofRows();irow++){
32     // For each row
33
34     AliMpRow* row = sector->GetRow(irow);
35     low  = row->GetLowIndicesLimit();
36     high = row->GetHighIndicesLimit();
37     rlow = TVector2(row->Position().X()-row->Dimensions().X(),
38                     row->Position().Y()-row->Dimensions().Y());
39     rhigh = TVector2(row->Position().X()+row->Dimensions().X(),
40                      row->Position().Y()+row->Dimensions().Y());
41     out<<"_______________________________________________________________"<<endl;
42     out<<"Row "<<irow<<" between "<<low<<" and "<<high
43        <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
44        <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
45     out<<"_______________________________________________________________"<<endl;
46   
47     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){
48       // For each row segment  
49   
50       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
51       low  = seg->GetLowIndicesLimit();
52       high = seg->GetHighIndicesLimit();
53       rlow = TVector2(seg->Position().X()-seg->Dimensions().X(),
54                       seg->Position().Y()-seg->Dimensions().Y());
55       rhigh = TVector2(seg->Position().X()+seg->Dimensions().X(),
56                        seg->Position().Y()+seg->Dimensions().Y());
57       out<<"-----------------------------------------------------------"<<endl;
58       out<<"     Segment "<<iseg<<" between "<<low<<" and "<<high
59          <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
60          <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
61       out<<"-----------------------------------------------------------"<<endl;
62
63       for (Int_t imotif=0;imotif<seg->GetNofMotifs();imotif++){
64          // For each motif pos
65   
66         AliMpMotifPosition* motifPos 
67           = sector->GetMotifMap()
68               ->FindMotifPosition(seg->GetMotifPositionId(imotif));
69         AliMpVMotif* motif = motifPos->GetMotif();
70       
71         low  = motifPos->GetLowIndicesLimit();
72         high = motifPos->GetHighIndicesLimit();
73         rlow = TVector2(motifPos->Position().X()-motif->Dimensions().X(),
74                   motifPos->Position().Y()-motif->Dimensions().Y());
75         rhigh = TVector2(motifPos->Position().X()+motif->Dimensions().X(),
76                    motifPos->Position().Y()+motif->Dimensions().Y());
77         out<<"          Motif "<<imotif<<" between "<<low<<" and "<<high
78            <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
79            <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
80       }
81     }
82   }
83 }