Added AliMpExMap class
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSectorAreaIterator.C
CommitLineData
d8afa711 1// $Id$
a387ee7c 2// $MpId: testSectorAreaIterator.C,v 1.3 2005/08/24 08:53:27 ivana Exp $
d8afa711 3//
a387ee7c 4// Test macro for iterating over the whole sector
d8afa711 5
6#include <iomanip>
7
8class AliMpVPadIterator;
9
10void MarkPads(AliMpVPadIterator& it, Double_t xmax, Double_t ymax,
11 Bool_t print = kTRUE)
12{
13// Marks pads according their position.
14// Fills histogram with pad indices.
15// Measures time that takes processing of full quadrant
16// ---
17
18 Int_t num=0;
19
20 TH2C* histo = new TH2C("pads", "pads", 201, 0, 200, 251, 0, 250);
21
22 TStopwatch timer;
23 timer.Start();
24
25 for (it.First(); ! it.IsDone(); it.Next()){
26
27 if (print) cout << endl
28 << setw(5) << ++num
29 << " " << it.CurrentItem() << endl;
30
31 // mark pads positions
32 TVector2 posi = it.CurrentItem().Position();
33 TMarker* marker = new TMarker( posi.X()/xmax, posi.Y()/ymax, 2);
34 marker->Draw();
35
36 // fill pads indices in the histogram
37 histo->Fill(it.CurrentItem().GetIndices().GetFirst(),
38 it.CurrentItem().GetIndices().GetSecond());
39 }
40
41 TCanvas *canv2 = new TCanvas("canv2");
42 canv2->cd();
43 //histo->SetMinimum(1.5);
44 histo->Draw("box");
45
46 timer.Stop();
47 //timer.Print();
48}
49
50void testSectorAreaIterator(AliMpStationType station = kStation1,
51 AliMpPlaneType planeType = kBendingPlane)
52{
a387ee7c 53 AliMpSectorReader reader(station, planeType);
d8afa711 54 AliMpSector* sector = reader.BuildSector();
55 AliMpSectorSegmentation segmentation(sector);
56
57 AliMpArea area;
58 if ( station == kStation1 )
59 area = AliMpArea(TVector2(450.,450.),TVector2(450.,450.));
60 else
61 area = AliMpArea(TVector2(600.,600.),TVector2(600.,600.));
62 AliMpVPadIterator* iter = segmentation.CreateIterator(area);
63
64 TCanvas* graph = new TCanvas("Graph");
65 AliMpVPainter::CreatePainter(sector)->Draw("ZSSMP");
66
67 TCanvas *canv = new TCanvas("canv");
68 canv->Range(-1,-1,1,1);
69 MarkPads(*iter, TMath::Abs(area.Position().X())+area.Dimensions().X(),
70 TMath::Abs(area.Position().Y())+area.Dimensions().Y(), kTRUE);
71}