Added AliMpExMap class
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testAnyPadIterators.C
CommitLineData
66e0997c 1// $Id$
a387ee7c 2// $MpId: testAnyPadIterators.C,v 1.12 2005/08/24 08:53:27 ivana Exp $
66e0997c 3//
4// Test macro for reading sector, and iterate over it
5
6class AliMpVPadIterator;
7void 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
26void testAnyPadIterators(AliMpStationType station = kStation1,
27 AliMpPlaneType plane = kBendingPlane,
28 Int_t i=50, Int_t j=50)
29{
a387ee7c 30 AliMpSectorReader r(station, plane);
66e0997c 31 AliMpSector* sect = r.BuildSector();
32
33 TCanvas *canv = new TCanvas("canv");
34 canv->Divide(2,2);
35 //canv_1->Divide(2);
36
37 canv->cd(1);
72d8f376 38 MarkPads(AliMpSectorPadIterator(sect), 150, 250, kFALSE);
66e0997c 39 canv->cd(2);
72d8f376 40 AliMpVMotif* motif = sect->FindMotif(TVector2(300,30));
66e0997c 41
42 if (motif) {
43 AliMpMotifType* motifType = motif->GetMotifType();
44 MarkPads(AliMpMotifTypePadIterator(motifType),15,15);
e8c253a0 45 cout<<"______________ MotifType " << motifType->GetID()
46 <<"__________________________"<<endl;
66e0997c 47 } else cout<<"No motif found at given position..."<<endl;
48
49 canv->cd(3);
50 //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sect)->CreateIterator(AliMpIntPair(i,j)))
51 AliMpSectorSegmentation segm(sect);
52 AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j));
53 MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sect),pad)
54 ,i+8,j+8);
55 cout<<"________________ Neighbours __________________________"<<endl;
56 canv->cd(4);
e8c253a0 57 Int_t motifPosId = 20;
58 if (plane == kNonBendingPlane) motifPosId = 19;
66e0997c 59 AliMpMotifPosition* motifPos = sect->GetMotifMap()->FindMotifPosition(motifPosId);
60 if (motifPos){
61 //MarkPads(*AliMpPadIteratorPtr(motifPos->CreateIterator()),15,15);
62 MarkPads(AliMpMotifPositionPadIterator(motifPos),15,15);
63 cout<<"_________________ MotifPosition _________________________"<<endl;
64 }
66e0997c 65}