]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testNeighboursPadIterator.C
Updated for changing units mm->cm
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testNeighboursPadIterator.C
CommitLineData
66e0997c 1// $Id$
57ff4119 2// $MpId: testNeighboursPadIterator.C,v 1.10 2005/10/28 15:36:08 ivana Exp $
66e0997c 3//
4// Test macro for reading sector, and iterate over it
5
6void testNeighboursPadIterator(AliMpStationType station = kStation1,
7 AliMpPlaneType plane = kBendingPlane,
334be4b7 8 Bool_t rootInput = false,
66e0997c 9 Int_t i=50, Int_t j=50)
10{
334be4b7 11 AliMpSector *sector = 0;
12 if (!rootInput) {
13 AliMpSectorReader r(station, plane);
14 sector=r.BuildSector();
15 }
16 else {
57ff4119 17 TString filePath = AliMpFiles::SectorFilePath(station,plane);
334be4b7 18 filePath.ReplaceAll("zones.dat", "sector.root");
19
20 TFile f(filePath.Data(), "READ");
21 sector = (AliMpSector*)f.Get("Sector");
66e0997c 22 }
23
66e0997c 24 AliMpSectorSegmentation segm(sect);
25
26 TCanvas *can = new TCanvas("canv");
27
28 const Double_t xmax=75;
29 const Double_t ymax=120;
30
31 Int_t num=0;
32
33 AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j));
34 AliMpNeighboursPadIterator it = AliMpNeighboursPadIterator(&segm, pad,kFALSE);
35
36 for (it.First(); ! it.IsDone(); it.Next()) {
37 AliMpIntPair indices = it.CurrentItem().GetIndices();
38 cout<<"Iterator number "<< num++ << " at "<< indices <<endl;
39 TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax,
40 (Double_t)indices.GetSecond()/ymax,
41 2);
42 marker->Draw();
43 }
44
e8c253a0 45 AliMpVPadIterator* iter2
46 = segm.CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1));
47
48 Int_t i=0;
49 for( iter2->First(); !iter2->IsDone() && i<10; iter2->Next()) {
50 Int_t ix = iter2->CurrentItem().GetIndices().GetFirst();
51 Int_t iy = iter2->CurrentItem().GetIndices().GetSecond();
52 cout<<"Iterator number "<< i << " at "<< iter2->CurrentItem().GetIndices() <<endl;
53 i++;
54 }
55
56 delete iter2;
66e0997c 57 delete sect;
58}