Updated for modifs in AliMpFiles
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testPrintLimits.C
CommitLineData
66e0997c 1// $Id$
57ff4119 2// $MpId: testPrintLimits.C,v 1.9 2005/10/28 15:36:08 ivana Exp $
66e0997c 3//
4// Test macro for making an output file, where all mapping elements
5// indices & positions are written.
6
7void testPrintLimits(AliMpStationType station = kStation1,
334be4b7 8 AliMpPlaneType plane = kBendingPlane,
9 Bool_t rootInput = false,
10 ostream& out=cout)
66e0997c 11{
334be4b7 12 AliMpSector *sector = 0;
13 if (!rootInput) {
14 AliMpSectorReader r(station, plane);
15 sector=r.BuildSector();
16 }
17 else {
57ff4119 18 TString filePath = AliMpFiles::SectorFilePath(station,plane);
334be4b7 19 filePath.ReplaceAll("zones.dat", "sector.root");
66e0997c 20
334be4b7 21 TFile f(filePath.Data(), "READ");
22 sector = (AliMpSector*)f.Get("Sector");
23 }
66e0997c 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}