]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testSt12PrintLimits.C
Replacement of AliMpIntPair object with algoritmic
[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 #include "AliMpEncodePair.h"
22
23 #include <Riostream.h>
24 #include <TCanvas.h>
25
26 #endif
27
28 TCanvas* CreateTCanvas(const TString& name, const TString& title,
29                        AliMq::Station12Type station, AliMp::PlaneType plane)
30 {
31   TString newName(name);
32   TString newTitle(title);
33   TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane);
34   newName += unique;
35   newTitle += unique;
36   return new TCanvas(newName.Data(), newTitle.Data());
37 }                     
38
39 void testPrintLimits(AliMq::Station12Type station, AliMp::PlaneType  plane,
40                      ostream& out=cout)
41 {
42   AliMpDataProcessor mp;
43   AliMpDataMap* dataMap = mp.CreateDataMap("data");
44   AliMpDataStreams dataStreams(dataMap);
45
46   AliMpSectorReader r(dataStreams, station, plane);
47   AliMpSector* sector = r.BuildSector();
48   
49   //new TCanvas(" ", " ", station, plane);  // BREAKS
50   new TCanvas();
51
52   AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
53   painter->Draw("ZSSMP");
54
55   Long_t low,high;
56   TVector2 rlow,rhigh;
57
58   for (Int_t irow=0;irow<sector->GetNofRows();irow++){
59     // For each row
60
61     AliMpRow* row = sector->GetRow(irow);
62     low  = row->GetLowIndicesLimit();
63     high = row->GetHighIndicesLimit();
64     rlow = TVector2(row->Position().X()-row->Dimensions().X(),
65                     row->Position().Y()-row->Dimensions().Y());
66     rhigh = TVector2(row->Position().X()+row->Dimensions().X(),
67                      row->Position().Y()+row->Dimensions().Y());
68     out<<"_______________________________________________________________"<<endl;
69     out<<"Row "<<irow<<" between ";
70     AliMp::PairPut(out, low)  <<  " and "; 
71     AliMp::PairPut(out, high) 
72        <<  "-->(" <<rlow.X()<<','<<rlow.Y()<<") and ("
73        <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
74     out<<"_______________________________________________________________"<<endl;
75   
76     for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){
77       // For each row segment  
78   
79       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
80       low  = seg->GetLowIndicesLimit();
81       high = seg->GetHighIndicesLimit();
82       rlow = TVector2(seg->Position().X()-seg->Dimensions().X(),
83                       seg->Position().Y()-seg->Dimensions().Y());
84       rhigh = TVector2(seg->Position().X()+seg->Dimensions().X(),
85                        seg->Position().Y()+seg->Dimensions().Y());
86       out<<"-----------------------------------------------------------"<<endl;
87       out<<"     Segment "<<iseg<<" between ";
88       AliMp::PairPut(out, low)  <<  " and "; 
89       AliMp::PairPut(out, high) 
90          <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
91          <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
92       out<<"-----------------------------------------------------------"<<endl;
93
94       for (Int_t imotif=0;imotif<seg->GetNofMotifs();imotif++){
95          // For each motif pos
96   
97         AliMpMotifPosition* motifPos 
98           = sector->GetMotifMap()
99               ->FindMotifPosition(seg->GetMotifPositionId(imotif));
100         AliMpVMotif* motif = motifPos->GetMotif();
101       
102         low  = motifPos->GetLowIndicesLimit();
103         high = motifPos->GetHighIndicesLimit();
104         rlow = TVector2(motifPos->Position().X()-motif->Dimensions().X(),
105                   motifPos->Position().Y()-motif->Dimensions().Y());
106         rhigh = TVector2(motifPos->Position().X()+motif->Dimensions().X(),
107                    motifPos->Position().Y()+motif->Dimensions().Y());
108         out<<"          Motif "<<imotif<<" between ";
109         AliMp::PairPut(out, low)  <<  " and "; 
110         AliMp::PairPut(out, high) 
111            <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
112            <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
113       }
114     }
115   }
116 }
117
118 void testSt12PrintLimits()
119 {
120   AliMq::Station12Type  station[2] = { AliMq::kStation1, AliMq::kStation2 }; 
121   AliMp::PlaneType      plane[2]   = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
122   
123   for ( Int_t is = 0; is < 2; is++ ) {
124     for ( Int_t ip = 0; ip < 2; ip++ ) {
125     
126       cout << "Running testPrintLimits for " 
127            << AliMq::Station12TypeName(station[is]) << "  "
128            << AliMp::PlaneTypeName(plane[ip])  << " ... " << endl;
129        
130       testPrintLimits(station[is], plane[ip]);
131     
132       cout << "... end running " << endl << endl;
133     }  
134   }   
135 }  
136