]>
Commit | Line | Data |
---|---|---|
66e0997c | 1 | // $Id$ |
0f54a452 | 2 | // $MpId: testAnyPadIterators.C,v 1.14 2005/10/28 15:37:12 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(); | |
18 | if (print) cout<<"Iterator number "<< num++ << " at "<< indices <<endl; | |
19 | TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax, | |
20 | (Double_t)indices.GetSecond()/ymax, | |
21 | 2); | |
22 | marker->Draw(); | |
23 | } | |
24 | } | |
25 | ||
26 | void testAnyPadIterators(AliMpStationType station = kStation1, | |
27 | AliMpPlaneType plane = kBendingPlane, | |
334be4b7 | 28 | Bool_t rootInput = false, |
66e0997c | 29 | Int_t i=50, Int_t j=50) |
30 | { | |
334be4b7 | 31 | AliMpSector *sector = 0; |
32 | if (!rootInput) { | |
33 | AliMpSectorReader r(station, plane); | |
34 | sector=r.BuildSector(); | |
35 | } | |
36 | else { | |
0f54a452 | 37 | TString filePath = AliMpFiles::SectorFilePath(station,plane); |
334be4b7 | 38 | filePath.ReplaceAll("zones.dat", "sector.root"); |
39 | ||
40 | TFile f(filePath.Data(), "READ"); | |
41 | sector = (AliMpSector*)f.Get("Sector"); | |
42 | } | |
66e0997c | 43 | |
44 | TCanvas *canv = new TCanvas("canv"); | |
45 | canv->Divide(2,2); | |
46 | //canv_1->Divide(2); | |
47 | ||
48 | canv->cd(1); | |
334be4b7 | 49 | MarkPads(AliMpSectorPadIterator(sector), 150, 250, kFALSE); |
66e0997c | 50 | canv->cd(2); |
0f54a452 | 51 | AliMpVMotif* motif = sector->FindMotif(TVector2(30,3)); |
66e0997c | 52 | |
53 | if (motif) { | |
54 | AliMpMotifType* motifType = motif->GetMotifType(); | |
55 | MarkPads(AliMpMotifTypePadIterator(motifType),15,15); | |
e8c253a0 | 56 | cout<<"______________ MotifType " << motifType->GetID() |
57 | <<"__________________________"<<endl; | |
66e0997c | 58 | } else cout<<"No motif found at given position..."<<endl; |
59 | ||
60 | canv->cd(3); | |
334be4b7 | 61 | //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sector)->CreateIterator(AliMpIntPair(i,j))) |
62 | AliMpSectorSegmentation segm(sector); | |
66e0997c | 63 | AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j)); |
334be4b7 | 64 | MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sector),pad) |
66e0997c | 65 | ,i+8,j+8); |
66 | cout<<"________________ Neighbours __________________________"<<endl; | |
67 | canv->cd(4); | |
e8c253a0 | 68 | Int_t motifPosId = 20; |
69 | if (plane == kNonBendingPlane) motifPosId = 19; | |
334be4b7 | 70 | AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(motifPosId); |
66e0997c | 71 | if (motifPos){ |
72 | //MarkPads(*AliMpPadIteratorPtr(motifPos->CreateIterator()),15,15); | |
73 | MarkPads(AliMpMotifPositionPadIterator(motifPos),15,15); | |
74 | cout<<"_________________ MotifPosition _________________________"<<endl; | |
75 | } | |
66e0997c | 76 | } |