]>
Commit | Line | Data |
---|---|---|
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 | ||
f05d3eb1 | 6 | #if !defined(__CINT__) || defined(__MAKECINT__) |
7 | ||
8 | #include "AliMpStation12Type.h" | |
9 | #include "AliMpPlaneType.h" | |
10 | #include "AliMpDataProcessor.h" | |
11 | #include "AliMpDataMap.h" | |
12 | #include "AliMpDataStreams.h" | |
13 | #include "AliMpSector.h" | |
14 | #include "AliMpSectorSegmentation.h" | |
15 | #include "AliMpSectorReader.h" | |
16 | #include "AliMpPad.h" | |
17 | #include "AliMpArea.h" | |
18 | #include "AliMpNeighboursPadIterator.h" | |
19 | ||
20 | #include <Riostream.h> | |
21 | #include <TCanvas.h> | |
22 | #include <TMarker.h> | |
23 | ||
24 | #endif | |
25 | ||
26 | void testNeighboursPadIterator(AliMq::Station12Type station, AliMp::PlaneType plane, | |
66e0997c | 27 | Int_t i=50, Int_t j=50) |
28 | { | |
f05d3eb1 | 29 | AliMpDataProcessor mp; |
30 | AliMpDataMap* dataMap = mp.CreateDataMap("data"); | |
31 | AliMpDataStreams dataStreams(dataMap); | |
66e0997c | 32 | |
f05d3eb1 | 33 | AliMpSectorReader r(dataStreams, station, plane); |
34 | AliMpSector* sector = r.BuildSector(); | |
8e38896c | 35 | AliMpSectorSegmentation segm(sector); |
66e0997c | 36 | |
f05d3eb1 | 37 | new TCanvas("canv"); |
66e0997c | 38 | |
39 | const Double_t xmax=75; | |
40 | const Double_t ymax=120; | |
41 | ||
42 | Int_t num=0; | |
43 | ||
44 | AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j)); | |
45 | AliMpNeighboursPadIterator it = AliMpNeighboursPadIterator(&segm, pad,kFALSE); | |
46 | ||
47 | for (it.First(); ! it.IsDone(); it.Next()) { | |
48 | AliMpIntPair indices = it.CurrentItem().GetIndices(); | |
49 | cout<<"Iterator number "<< num++ << " at "<< indices <<endl; | |
50 | TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax, | |
51 | (Double_t)indices.GetSecond()/ymax, | |
52 | 2); | |
53 | marker->Draw(); | |
54 | } | |
55 | ||
e8c253a0 | 56 | AliMpVPadIterator* iter2 |
57 | = segm.CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1)); | |
58 | ||
f05d3eb1 | 59 | Int_t counter = 0; |
e8c253a0 | 60 | for( iter2->First(); !iter2->IsDone() && i<10; iter2->Next()) { |
f05d3eb1 | 61 | //Int_t ix = iter2->CurrentItem().GetIndices().GetFirst(); |
62 | //Int_t iy = iter2->CurrentItem().GetIndices().GetSecond(); | |
63 | cout<<"Iterator number "<< counter++ << " at "<< iter2->CurrentItem().GetIndices() <<endl; | |
e8c253a0 | 64 | } |
65 | ||
66 | delete iter2; | |
8e38896c | 67 | delete sector; |
66e0997c | 68 | } |
f05d3eb1 | 69 | |
70 | void testNeighboursPadIterator() | |
71 | { | |
72 | AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 }; | |
73 | AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane }; | |
74 | ||
75 | for ( Int_t is = 0; is < 2; is++ ) { | |
76 | for ( Int_t ip = 0; ip < 2; ip++ ) { | |
77 | ||
78 | cout << "Running testNeighboursPadIterator for " | |
79 | << AliMq::Station12TypeName(station[is]) << " " | |
80 | << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl; | |
81 | ||
82 | testNeighboursPadIterator(station[is], plane[ip]); | |
83 | ||
84 | cout << "... end running " << endl << endl; | |
85 | } | |
86 | } | |
87 | } | |
88 |