]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testSt12PrintLimits.C
In Mapping/macros:
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSt12PrintLimits.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 #if !defined(__CINT__) || defined(__MAKECINT__)
8
9 #include "AliMpStation12Type.h"
10 #include "AliMpPlaneType.h"
11 #include "AliMpDataProcessor.h"
12 #include "AliMpDataMap.h"
13 #include "AliMpDataStreams.h"
14 #include "AliMpSector.h"
15 #include "AliMpSectorReader.h"
16 #include "AliMpRow.h"
17 #include "AliMpVRowSegment.h"
18 #include "AliMpMotifMap.h"
19 #include "AliMpMotifPosition.h"
20 #include "AliMpVPainter.h"
21
22 #include <Riostream.h>
23 #include <TCanvas.h>
24
25 #endif
26
27 void testPrintLimits(AliMq::Station12Type station, AliMp::PlaneType  plane,
28                      ostream& out=cout)
29 {
30   AliMpDataProcessor mp;
31   AliMpDataMap* dataMap = mp.CreateDataMap("data");
32   AliMpDataStreams dataStreams(dataMap);
33
34   AliMpSectorReader r(dataStreams, station, plane);
35   AliMpSector* sector = r.BuildSector();
36   
37   new TCanvas();
38
39   AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
40   painter->Draw("ZSSMP");
41
42   AliMpIntPair low,high;
43   TVector2 rlow,rhigh;
44
45   for (Int_t irow=0;irow<sector->GetNofRows();irow++){
46     // For each row
47
48     AliMpRow* row = sector->GetRow(irow);
49     low  = row->GetLowIndicesLimit();
50     high = row->GetHighIndicesLimit();
51     rlow = TVector2(row->Position().X()-row->Dimensions().X(),
52                     row->Position().Y()-row->Dimensions().Y());
53     rhigh = TVector2(row->Position().X()+row->Dimensions().X(),
54                      row->Position().Y()+row->Dimensions().Y());
55     out<<"_______________________________________________________________"<<endl;
56     out<<"Row "<<irow<<" between "<<low<<" and "<<high
57        <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
58        <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
59     out<<"_______________________________________________________________"<<endl;
60   
61     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){
62       // For each row segment  
63   
64       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
65       low  = seg->GetLowIndicesLimit();
66       high = seg->GetHighIndicesLimit();
67       rlow = TVector2(seg->Position().X()-seg->Dimensions().X(),
68                       seg->Position().Y()-seg->Dimensions().Y());
69       rhigh = TVector2(seg->Position().X()+seg->Dimensions().X(),
70                        seg->Position().Y()+seg->Dimensions().Y());
71       out<<"-----------------------------------------------------------"<<endl;
72       out<<"     Segment "<<iseg<<" between "<<low<<" and "<<high
73          <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
74          <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
75       out<<"-----------------------------------------------------------"<<endl;
76
77       for (Int_t imotif=0;imotif<seg->GetNofMotifs();imotif++){
78          // For each motif pos
79   
80         AliMpMotifPosition* motifPos 
81           = sector->GetMotifMap()
82               ->FindMotifPosition(seg->GetMotifPositionId(imotif));
83         AliMpVMotif* motif = motifPos->GetMotif();
84       
85         low  = motifPos->GetLowIndicesLimit();
86         high = motifPos->GetHighIndicesLimit();
87         rlow = TVector2(motifPos->Position().X()-motif->Dimensions().X(),
88                   motifPos->Position().Y()-motif->Dimensions().Y());
89         rhigh = TVector2(motifPos->Position().X()+motif->Dimensions().X(),
90                    motifPos->Position().Y()+motif->Dimensions().Y());
91         out<<"          Motif "<<imotif<<" between "<<low<<" and "<<high
92            <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
93            <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
94       }
95     }
96   }
97 }
98
99 void testPrintLimits()
100 {
101   AliMq::Station12Type  station[2] = { AliMq::kStation1, AliMq::kStation2 }; 
102   AliMp::PlaneType      plane[2]   = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
103   
104   for ( Int_t is = 0; is < 2; is++ ) {
105     for ( Int_t ip = 0; ip < 2; ip++ ) {
106     
107       cout << "Running testPrintLimits for " 
108            << AliMq::Station12TypeName(station[is]) << "  "
109            << AliMp::PlaneTypeName(plane[ip])  << " ... " << endl;
110        
111       testPrintLimits(station[is], plane[ip]);
112     
113       cout << "... end running " << endl << endl;
114     }  
115   }   
116 }  
117