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