]>
Commit | Line | Data |
---|---|---|
d8afa711 | 1 | // $Id$ |
0f54a452 | 2 | // $MpId: testSectorAreaIterator.C,v 1.5 2005/10/28 15:37:12 ivana Exp $ |
d8afa711 | 3 | // |
a387ee7c | 4 | // Test macro for iterating over the whole sector |
d8afa711 | 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 "AliMpSectorSegmentation.h" | |
15 | #include "AliMpSectorReader.h" | |
16 | #include "AliMpArea.h" | |
17 | #include "AliMpVPadIterator.h" | |
18 | #include "AliMpVPainter.h" | |
19 | ||
20 | #include <Riostream.h> | |
21 | #include <TCanvas.h> | |
22 | #include <TMarker.h> | |
23 | #include <TH2.h> | |
24 | #include <TStopwatch.h> | |
25 | ||
26 | #endif | |
d8afa711 | 27 | |
28 | class AliMpVPadIterator; | |
29 | ||
30 | void MarkPads(AliMpVPadIterator& it, Double_t xmax, Double_t ymax, | |
31 | Bool_t print = kTRUE) | |
32 | { | |
33 | // Marks pads according their position. | |
34 | // Fills histogram with pad indices. | |
35 | // Measures time that takes processing of full quadrant | |
36 | // --- | |
37 | ||
38 | Int_t num=0; | |
39 | ||
40 | TH2C* histo = new TH2C("pads", "pads", 201, 0, 200, 251, 0, 250); | |
41 | ||
42 | TStopwatch timer; | |
43 | timer.Start(); | |
44 | ||
45 | for (it.First(); ! it.IsDone(); it.Next()){ | |
46 | ||
47 | if (print) cout << endl | |
48 | << setw(5) << ++num | |
49 | << " " << it.CurrentItem() << endl; | |
50 | ||
51 | // mark pads positions | |
52 | TVector2 posi = it.CurrentItem().Position(); | |
53 | TMarker* marker = new TMarker( posi.X()/xmax, posi.Y()/ymax, 2); | |
54 | marker->Draw(); | |
55 | ||
56 | // fill pads indices in the histogram | |
57 | histo->Fill(it.CurrentItem().GetIndices().GetFirst(), | |
58 | it.CurrentItem().GetIndices().GetSecond()); | |
59 | } | |
60 | ||
61 | TCanvas *canv2 = new TCanvas("canv2"); | |
62 | canv2->cd(); | |
63 | //histo->SetMinimum(1.5); | |
64 | histo->Draw("box"); | |
65 | ||
66 | timer.Stop(); | |
67 | //timer.Print(); | |
68 | } | |
69 | ||
f05d3eb1 | 70 | void testSectorAreaIterator(AliMq::Station12Type station, AliMp::PlaneType plane) |
d8afa711 | 71 | { |
f05d3eb1 | 72 | AliMpDataProcessor mp; |
73 | AliMpDataMap* dataMap = mp.CreateDataMap("data"); | |
74 | AliMpDataStreams dataStreams(dataMap); | |
334be4b7 | 75 | |
f05d3eb1 | 76 | AliMpSectorReader r(dataStreams, station, plane); |
77 | AliMpSector* sector = r.BuildSector(); | |
d8afa711 | 78 | AliMpSectorSegmentation segmentation(sector); |
79 | ||
80 | AliMpArea area; | |
f05d3eb1 | 81 | if ( station == AliMq::kStation1 ) |
0f54a452 | 82 | area = AliMpArea(TVector2(45.,45.),TVector2(45.,45.)); |
d8afa711 | 83 | else |
0f54a452 | 84 | area = AliMpArea(TVector2(60.,60.),TVector2(60.,60.)); |
d8afa711 | 85 | AliMpVPadIterator* iter = segmentation.CreateIterator(area); |
86 | ||
f05d3eb1 | 87 | new TCanvas("Graph"); |
d8afa711 | 88 | AliMpVPainter::CreatePainter(sector)->Draw("ZSSMP"); |
89 | ||
f05d3eb1 | 90 | TCanvas* canv = new TCanvas("canv"); |
d8afa711 | 91 | canv->Range(-1,-1,1,1); |
92 | MarkPads(*iter, TMath::Abs(area.Position().X())+area.Dimensions().X(), | |
93 | TMath::Abs(area.Position().Y())+area.Dimensions().Y(), kTRUE); | |
94 | } | |
f05d3eb1 | 95 | |
96 | void testSectorAreaIterator() | |
97 | { | |
98 | AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 }; | |
99 | AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane }; | |
100 | ||
101 | for ( Int_t is = 0; is < 2; is++ ) { | |
102 | for ( Int_t ip = 0; ip < 2; ip++ ) { | |
103 | ||
104 | cout << "Running testSectorAreaIterator for " | |
105 | << AliMq::Station12TypeName(station[is]) << " " | |
106 | << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl; | |
107 | ||
108 | testSectorAreaIterator(station[is], plane[ip]); | |
109 | ||
110 | cout << "... end running " << endl << endl; | |
111 | } | |
112 | } | |
113 | } | |
114 |