]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testSt12Graphics.C
Patch for the pointer to AOD event
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSt12Graphics.C
1 // $Id$
2 // $MpId: testGraphics.C,v 1.13 2005/10/28 15:36:08 ivana Exp $
3 //
4 // Test macro for drawing sector data.
5
6 #if !defined(__CINT__) || defined(__MAKECINT__)
7
8 #include "AliMpStation12Type.h"
9 #include "AliMpPlaneType.h"
10 #include "AliMpDataProcessor.h"
11 #include "AliMpDataMap.h"
12 #include "AliMpDataStreams.h"
13 #include "AliMpSector.h"
14 #include "AliMpSectorReader.h"
15 #include "AliMpRow.h"
16 #include "AliMpVRowSegment.h"
17 #include "AliMpMotifMap.h"
18 #include "AliMpMotifPosition.h"
19 #include "AliMpVPainter.h"
20
21 #include <Riostream.h>
22 #include <TCanvas.h>
23
24 #endif
25
26 TCanvas* CreateTCanvas(const TString& name, const TString& title,
27                        AliMq::Station12Type station, AliMp::PlaneType plane)
28 {
29   TString newName(name);
30   TString newTitle(title);
31   TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane);
32   newName += unique;
33   newTitle += unique;
34   return new TCanvas(newName.Data(), newTitle.Data());
35 }                     
36
37 void testGraphics(AliMq::Station12Type station, AliMp::PlaneType plane) 
38 {
39   AliMpDataProcessor mp;
40   AliMpDataMap* dataMap = mp.CreateDataMap("data");
41   AliMpDataStreams dataStreams(dataMap);
42
43   AliMpSectorReader r(dataStreams, station, plane);
44   AliMpSector* sector = r.BuildSector();
45     
46   AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
47
48   TCanvas* canvas  = new TCanvas();
49   TCanvas* canvas2 = new TCanvas();
50   TCanvas* c[4];
51   for (int i=0;i<4;++i) {
52     c[i] = new TCanvas();
53     c[i]->Divide(2,2);
54   }  
55
56   //first, paint the whole sector
57   canvas->cd();
58   painter->Draw("");
59   //now paint each rows
60   c[0]->cd(1);
61   painter->Draw("R");
62   //paint each row segments in each row
63   c[0]->cd(2);
64   painter->Draw("RS");
65   //paint each motifs, in each row segments in each row
66   c[0]->cd(3);
67   painter->Draw("RSMP");
68   //paint each pads, in each motifs, in each row segments in each row
69   c[0]->cd(4);
70   painter->Draw("RSMT");
71
72   ///////////////////////////////
73   //now paint each rows, wwith its name
74   c[1]->cd(1);
75   painter->Draw("RT");
76   //paint each row segments in each row, and its name
77   c[1]->cd(2);
78   painter->Draw("RST");
79   //paint each motifs, in each row segments in each row
80   c[1]->cd(3);
81   painter->Draw("RSMX");
82   c[1]->cd(4);
83   painter->Draw("RSMI");
84
85   ///////////////////////////////
86   //now paint each zones
87   c[2]->cd(1);
88   painter->Draw("Z");
89   //paint each sub-zones, in each zones
90   c[2]->cd(2);
91   painter->Draw("ZS");
92   //paint each row segments, in each sub-zone, ...
93   c[2]->cd(3);
94   painter->Draw("ZSS");
95   // each motifs, in each row segments, ...
96   c[2]->cd(4);
97   painter->Draw("ZSSM");
98
99   ///////////////////////////////
100   //now paint each zones with its name
101   c[3]->cd(1);
102   painter->Draw("ZT");
103   //paint each sub-zones, in each zones with its name
104   c[3]->cd(2);
105   painter->Draw("ZST");
106   //paint each row segments, in each sub-zone, ... with its name
107   c[3]->cd(3);
108   painter->Draw("ZSST");
109   // each motifs, in each row segments, ... with its name
110   c[3]->cd(4);
111   painter->Draw("ZSSMT");
112
113   // now, draw a specific motif, in a whole canvas, and
114   // print all its pad names
115   Int_t id = sector->GetRow(5)->GetRowSegment(0)->GetMotifPositionId(0);
116   AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(id);
117   AliMpVPainter* motifPainter = AliMpVPainter::CreatePainter(motifPos);
118   CreateTCanvas("onepad ","One motif ", station, plane);
119   motifPainter->Draw("PT");
120   
121   //////////////////////////////  
122   //now paint motifs with their real contours and mani Ids
123   canvas2->cd();
124   painter->Draw("RSMCI");
125 }
126
127 void testSt12Graphics()
128 {
129   AliMq::Station12Type  station[2] = { AliMq::kStation1, AliMq::kStation2 }; 
130   AliMp::PlaneType      plane[2]   = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
131   
132   for ( Int_t is = 0; is < 2; is++ ) {
133     for ( Int_t ip = 0; ip < 2; ip++ ) {
134     
135       cout << "Running testGraphics for " 
136            << AliMq::Station12TypeName(station[is]) << "  "
137            << AliMp::PlaneTypeName(plane[ip])  << " ... " << endl;
138        
139       testGraphics(station[is], plane[ip]);
140     
141       cout << "... end running " << endl << endl;
142     }  
143   }   
144 }  
145