66e0997c |
1 | // $Id$ |
2 | // |
3 | // Test macro for reading sector, and iterate over it |
4 | |
5 | class AliMpVPadIterator; |
6 | void MarkPads(AliMpVPadIterator& it,Int_t xmax,Int_t ymax,Bool_t print=kTRUE) |
7 | { |
8 | // This function works with pad iterator, no matter which kind of iterator |
9 | // it is. So it can be uses for drawing all pad of the sector (AliMpSectorPadIterator) |
10 | // or all pad around a given pad (AliMpNeighboursPadIterator), as with pads |
11 | // of a given motif type (AliMpMotifTypePadIterator) |
12 | |
13 | Int_t num=0; |
14 | |
15 | for (it.First(); ! it.IsDone(); it.Next()){ |
16 | AliMpIntPair indices = it.CurrentItem().GetIndices(); |
17 | if (print) cout<<"Iterator number "<< num++ << " at "<< indices <<endl; |
18 | TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax, |
19 | (Double_t)indices.GetSecond()/ymax, |
20 | 2); |
21 | marker->Draw(); |
22 | } |
23 | } |
24 | |
25 | void testAnyPadIterators(AliMpStationType station = kStation1, |
26 | AliMpPlaneType plane = kBendingPlane, |
27 | Int_t i=50, Int_t j=50) |
28 | { |
29 | AliMpReader r(station, plane); |
30 | AliMpSector* sect = r.BuildSector(); |
31 | |
32 | TCanvas *canv = new TCanvas("canv"); |
33 | canv->Divide(2,2); |
34 | //canv_1->Divide(2); |
35 | |
36 | canv->cd(1); |
37 | MarkPads(AliMpSectorPadIterator(sect), 150,250,kFALSE); |
38 | canv->cd(2); |
39 | AliMpVMotif* motif = sect->FindMotif(TVector2(200,30)); |
40 | |
41 | if (motif) { |
42 | AliMpMotifType* motifType = motif->GetMotifType(); |
43 | MarkPads(AliMpMotifTypePadIterator(motifType),15,15); |
44 | cout<<"______________ MotifType ____________________________"<<endl; |
45 | } else cout<<"No motif found at given position..."<<endl; |
46 | |
47 | canv->cd(3); |
48 | //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sect)->CreateIterator(AliMpIntPair(i,j))) |
49 | AliMpSectorSegmentation segm(sect); |
50 | AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j)); |
51 | MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sect),pad) |
52 | ,i+8,j+8); |
53 | cout<<"________________ Neighbours __________________________"<<endl; |
54 | canv->cd(4); |
55 | Int_t motifPosId = 1010; |
56 | if (plane == kNonBendingPlane) motifPosId = 4010; |
57 | AliMpMotifPosition* motifPos = sect->GetMotifMap()->FindMotifPosition(motifPosId); |
58 | if (motifPos){ |
59 | //MarkPads(*AliMpPadIteratorPtr(motifPos->CreateIterator()),15,15); |
60 | MarkPads(AliMpMotifPositionPadIterator(motifPos),15,15); |
61 | cout<<"_________________ MotifPosition _________________________"<<endl; |
62 | } |
63 | |
64 | } |