]>
Commit | Line | Data |
---|---|---|
66e0997c | 1 | // $Id$ |
04728794 | 2 | // $MpId: testAnyPadIterators.C,v 1.17 2006/03/15 13:07:07 ivana Exp $ |
66e0997c | 3 | // |
4 | // Test macro for reading sector, and iterate over it | |
5 | ||
6 | class AliMpVPadIterator; | |
7 | void MarkPads(AliMpVPadIterator& it,Int_t xmax,Int_t ymax,Bool_t print=kTRUE) | |
8 | { | |
9 | // This function works with pad iterator, no matter which kind of iterator | |
72d8f376 | 10 | // it is. So it can be used for drawing all pad of the sector (AliMpSectorPadIterator) |
66e0997c | 11 | // or all pad around a given pad (AliMpNeighboursPadIterator), as with pads |
12 | // of a given motif type (AliMpMotifTypePadIterator) | |
13 | ||
14 | Int_t num=0; | |
15 | ||
16 | for (it.First(); ! it.IsDone(); it.Next()){ | |
17 | AliMpIntPair indices = it.CurrentItem().GetIndices(); | |
04728794 | 18 | if (print) cout<<"Iterator number "<< num << " at "<< indices <<endl; |
19 | num++; | |
66e0997c | 20 | TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax, |
21 | (Double_t)indices.GetSecond()/ymax, | |
22 | 2); | |
23 | marker->Draw(); | |
24 | } | |
25 | } | |
26 | ||
cddd101e | 27 | void testAnyPadIterators(AliMp::StationType station = AliMp::kStation1, |
28 | AliMp::PlaneType plane = AliMp::kBendingPlane, | |
334be4b7 | 29 | Bool_t rootInput = false, |
66e0997c | 30 | Int_t i=50, Int_t j=50) |
31 | { | |
334be4b7 | 32 | AliMpSector *sector = 0; |
33 | if (!rootInput) { | |
34 | AliMpSectorReader r(station, plane); | |
35 | sector=r.BuildSector(); | |
36 | } | |
37 | else { | |
0f54a452 | 38 | TString filePath = AliMpFiles::SectorFilePath(station,plane); |
334be4b7 | 39 | filePath.ReplaceAll("zones.dat", "sector.root"); |
40 | ||
41 | TFile f(filePath.Data(), "READ"); | |
42 | sector = (AliMpSector*)f.Get("Sector"); | |
43 | } | |
66e0997c | 44 | |
45 | TCanvas *canv = new TCanvas("canv"); | |
46 | canv->Divide(2,2); | |
47 | //canv_1->Divide(2); | |
48 | ||
49 | canv->cd(1); | |
334be4b7 | 50 | MarkPads(AliMpSectorPadIterator(sector), 150, 250, kFALSE); |
66e0997c | 51 | canv->cd(2); |
0f54a452 | 52 | AliMpVMotif* motif = sector->FindMotif(TVector2(30,3)); |
66e0997c | 53 | |
54 | if (motif) { | |
55 | AliMpMotifType* motifType = motif->GetMotifType(); | |
56 | MarkPads(AliMpMotifTypePadIterator(motifType),15,15); | |
e8c253a0 | 57 | cout<<"______________ MotifType " << motifType->GetID() |
58 | <<"__________________________"<<endl; | |
66e0997c | 59 | } else cout<<"No motif found at given position..."<<endl; |
60 | ||
61 | canv->cd(3); | |
334be4b7 | 62 | //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sector)->CreateIterator(AliMpIntPair(i,j))) |
63 | AliMpSectorSegmentation segm(sector); | |
66e0997c | 64 | AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j)); |
334be4b7 | 65 | MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sector),pad) |
66e0997c | 66 | ,i+8,j+8); |
67 | cout<<"________________ Neighbours __________________________"<<endl; | |
68 | canv->cd(4); | |
5c0de425 | 69 | Int_t motifPosId = 20 | AliMpConstants::ManuMask(plane); |
426706c1 | 70 | if (plane == AliMp::kNonBendingPlane) motifPosId = 19; |
334be4b7 | 71 | AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId); |
66e0997c | 72 | if (motifPos){ |
73 | //MarkPads(*AliMpPadIteratorPtr(motifPos->CreateIterator()),15,15); | |
74 | MarkPads(AliMpMotifPositionPadIterator(motifPos),15,15); | |
75 | cout<<"_________________ MotifPosition _________________________"<<endl; | |
76 | } | |
66e0997c | 77 | } |