]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/mapping/macros/testNeighboursPadIterator.C
Updated for new numbering of motif positions in mapping.
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testNeighboursPadIterator.C
... / ...
CommitLineData
1// $Id$
2//
3// Test macro for reading sector, and iterate over it
4
5void testNeighboursPadIterator(AliMpStationType station = kStation1,
6 AliMpPlaneType plane = kBendingPlane,
7 Int_t i=50, Int_t j=50)
8{
9 if (!gInterpreter->IsLoaded("mlibs.C")){
10 gROOT->LoadMacro("mlibs.C");
11 gInterpreter->ProcessLine("mlibs()");
12 }
13
14 AliMpReader r(station, plane);
15 AliMpSector* sect = r.BuildSector();
16 AliMpSectorSegmentation segm(sect);
17
18 TCanvas *can = new TCanvas("canv");
19
20 const Double_t xmax=75;
21 const Double_t ymax=120;
22
23 Int_t num=0;
24
25 AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j));
26 AliMpNeighboursPadIterator it = AliMpNeighboursPadIterator(&segm, pad,kFALSE);
27
28 for (it.First(); ! it.IsDone(); it.Next()) {
29 AliMpIntPair indices = it.CurrentItem().GetIndices();
30 cout<<"Iterator number "<< num++ << " at "<< indices <<endl;
31 TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax,
32 (Double_t)indices.GetSecond()/ymax,
33 2);
34 marker->Draw();
35 }
36
37 AliMpVPadIterator* iter2
38 = segm.CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1));
39
40 Int_t i=0;
41 for( iter2->First(); !iter2->IsDone() && i<10; iter2->Next()) {
42 Int_t ix = iter2->CurrentItem().GetIndices().GetFirst();
43 Int_t iy = iter2->CurrentItem().GetIndices().GetSecond();
44 cout<<"Iterator number "<< i << " at "<< iter2->CurrentItem().GetIndices() <<endl;
45 i++;
46 }
47
48 delete iter2;
49 delete sect;
50}