]>
Commit | Line | Data |
---|---|---|
66e0997c | 1 | // $Id$ |
a387ee7c | 2 | // $MpId: testAllIndices.C,v 1.7 2005/08/24 08:53:27 ivana Exp $ |
66e0997c | 3 | // |
4 | // Test macro for testing which pad is seen as "existing" by AliMpSector. | |
5 | ||
f05d3eb1 | 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 "AliMpSectorSegmentation.h" | |
16 | #include "AliMpVPainter.h" | |
17 | #include "AliMpRow.h" | |
18 | #include "AliMpVRowSegment.h" | |
19 | #include "AliMpMotifMap.h" | |
20 | #include "AliMpMotifPosition.h" | |
21 | #include "AliMpMotifType.h" | |
22 | ||
23 | #include <Riostream.h> | |
24 | #include <TCanvas.h> | |
6aa39548 | 25 | #include <TString.h> |
f05d3eb1 | 26 | #include <TH2.h> |
27 | ||
28 | #endif | |
29 | ||
6aa39548 | 30 | TCanvas* CreateTCanvas(const TString& name, const TString& title, |
31 | AliMq::Station12Type station, AliMp::PlaneType plane) | |
32 | { | |
33 | TString newName(name); | |
34 | TString newTitle(title); | |
35 | TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane); | |
36 | newName += unique; | |
37 | newTitle += unique; | |
38 | return new TCanvas(newName.Data(), newTitle.Data()); | |
39 | } | |
40 | ||
f05d3eb1 | 41 | void testAllIndices(AliMq::Station12Type station, AliMp::PlaneType plane) |
66e0997c | 42 | { |
f05d3eb1 | 43 | AliMpDataProcessor mp; |
44 | AliMpDataMap* dataMap = mp.CreateDataMap("data"); | |
45 | AliMpDataStreams dataStreams(dataMap); | |
46 | ||
47 | AliMpSectorReader r(dataStreams, station, plane); | |
66e0997c | 48 | |
49 | AliMpSector *sector=r.BuildSector(); | |
72d8f376 | 50 | AliMpSectorSegmentation segmentation(sector); |
66e0997c | 51 | AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector); |
52 | ||
6aa39548 | 53 | TCanvas* c1 = CreateTCanvas("view ", |
54 | "MSectorPainter::Draw() output (view per pad) ", | |
55 | station, plane); | |
66e0997c | 56 | painter->Draw("ZSSMP"); |
57 | c1->Update(); | |
58 | ||
72d8f376 | 59 | Int_t maxPadIndexX = segmentation.MaxPadIndexX(); |
60 | Int_t maxPadIndexY = segmentation.MaxPadIndexY(); | |
61 | ||
62 | // Define histogram limits | |
63 | Int_t nx = (maxPadIndexX/10 + 1)*10; | |
64 | Int_t ny = (maxPadIndexY/10 + 1)*10; | |
65 | TH2C* histo = new TH2C("histo","Existing pads", | |
66 | nx, -0.5, nx-0.5, ny, -0.5, ny-0.5); | |
67 | ||
f05d3eb1 | 68 | Int_t nx2 = 95/2; |
69 | Int_t ny2 = 95/2; | |
70 | if (station == AliMq::kStation2) { | |
71 | nx2 = 120/2; | |
72 | ny2 = 120/2; | |
72d8f376 | 73 | } |
74 | TH2F* histo2 = new TH2F("histo2","Existing positions", | |
75 | nx2, 0, nx2*2, ny2, 0, ny2*2); | |
76 | ||
77 | // Define canvas | |
6aa39548 | 78 | TCanvas* c2 = CreateTCanvas("c2 ", "Only existing pads are filled ", station, plane); |
79 | TCanvas* c3 = CreateTCanvas("c3 ", "Positions ", station, plane); | |
66e0997c | 80 | |
f05d3eb1 | 81 | for ( Int_t irow=0; irow<sector->GetNofRows(); irow++ ) { |
66e0997c | 82 | AliMpRow* row = sector->GetRow(irow); |
83 | ||
f05d3eb1 | 84 | for ( Int_t iseg=0; iseg<row->GetNofRowSegments(); iseg++ ) { |
66e0997c | 85 | AliMpVRowSegment* seg = row->GetRowSegment(iseg); |
86 | ||
f05d3eb1 | 87 | for ( Int_t imot=0; imot<seg->GetNofMotifs(); imot++) { |
66e0997c | 88 | AliMpMotifPosition* motifPos |
89 | = sector->GetMotifMap()->FindMotifPosition(seg->GetMotifPositionId(imot)); | |
90 | ||
f05d3eb1 | 91 | for ( Int_t gassNum=0; gassNum<64; gassNum++ ) { |
66e0997c | 92 | if (motifPos->GetMotif()->GetMotifType()->FindConnectionByGassiNum(gassNum)){ |
93 | ||
168e9c4d | 94 | AliMpPad pad = segmentation.PadByLocation(motifPos->GetID(),gassNum); |
66e0997c | 95 | if (pad != AliMpPad::Invalid()) { |
168e9c4d | 96 | histo->Fill(pad.GetIx(), pad.GetIy()); |
66e0997c | 97 | histo2->Fill(pad.Position().X(), |
98 | pad.Position().Y()); | |
99 | } | |
100 | } | |
101 | } | |
102 | } | |
103 | } | |
104 | } | |
105 | c2->cd(); | |
106 | histo->Draw("col"); | |
107 | c3->cd(); | |
108 | histo2->Draw("box"); | |
109 | } | |
f05d3eb1 | 110 | |
6aa39548 | 111 | void testSt12AllIndices() |
f05d3eb1 | 112 | { |
113 | AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 }; | |
114 | AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane }; | |
115 | ||
116 | for ( Int_t is = 0; is < 2; is++ ) { | |
117 | for ( Int_t ip = 0; ip < 2; ip++ ) { | |
118 | ||
119 | cout << "Running testAllIndices for " | |
120 | << AliMq::Station12TypeName(station[is]) << " " | |
121 | << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl; | |
122 | ||
123 | testAllIndices(station[is], plane[ip]); | |
124 | ||
125 | cout << "... end running " << endl << endl; | |
126 | } | |
127 | } | |
128 | } | |
129 |