]>
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 | ||
6aa39548 | 26 | TCanvas* CreateTCanvas(const TString& name, const TString& title, |
27 | AliMq::Station12Type station, AliMp::PlaneType plane) | |
28 | { | |
29 | TString newName(name); | |
30 | TString newTitle(title); | |
31 | TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane); | |
32 | newName += unique; | |
33 | newTitle += unique; | |
34 | return new TCanvas(newName.Data(), newTitle.Data()); | |
35 | } | |
36 | ||
f05d3eb1 | 37 | void testNeighboursPadIterator(AliMq::Station12Type station, AliMp::PlaneType plane, |
66e0997c | 38 | Int_t i=50, Int_t j=50) |
39 | { | |
f05d3eb1 | 40 | AliMpDataProcessor mp; |
41 | AliMpDataMap* dataMap = mp.CreateDataMap("data"); | |
42 | AliMpDataStreams dataStreams(dataMap); | |
66e0997c | 43 | |
f05d3eb1 | 44 | AliMpSectorReader r(dataStreams, station, plane); |
45 | AliMpSector* sector = r.BuildSector(); | |
8e38896c | 46 | AliMpSectorSegmentation segm(sector); |
66e0997c | 47 | |
6aa39548 | 48 | CreateTCanvas("canv ", "", station, plane); |
66e0997c | 49 | |
50 | const Double_t xmax=75; | |
51 | const Double_t ymax=120; | |
52 | ||
53 | Int_t num=0; | |
54 | ||
55 | AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j)); | |
56 | AliMpNeighboursPadIterator it = AliMpNeighboursPadIterator(&segm, pad,kFALSE); | |
57 | ||
58 | for (it.First(); ! it.IsDone(); it.Next()) { | |
59 | AliMpIntPair indices = it.CurrentItem().GetIndices(); | |
60 | cout<<"Iterator number "<< num++ << " at "<< indices <<endl; | |
61 | TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax, | |
62 | (Double_t)indices.GetSecond()/ymax, | |
63 | 2); | |
64 | marker->Draw(); | |
65 | } | |
66 | ||
e8c253a0 | 67 | AliMpVPadIterator* iter2 |
68 | = segm.CreateIterator(AliMpArea(pad.Position(),2.*pad.Dimensions()*1.1)); | |
69 | ||
f05d3eb1 | 70 | Int_t counter = 0; |
e8c253a0 | 71 | for( iter2->First(); !iter2->IsDone() && i<10; iter2->Next()) { |
f05d3eb1 | 72 | //Int_t ix = iter2->CurrentItem().GetIndices().GetFirst(); |
73 | //Int_t iy = iter2->CurrentItem().GetIndices().GetSecond(); | |
74 | cout<<"Iterator number "<< counter++ << " at "<< iter2->CurrentItem().GetIndices() <<endl; | |
e8c253a0 | 75 | } |
76 | ||
77 | delete iter2; | |
8e38896c | 78 | delete sector; |
66e0997c | 79 | } |
f05d3eb1 | 80 | |
6aa39548 | 81 | void testSt12NeighboursPadIterator() |
f05d3eb1 | 82 | { |
83 | AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 }; | |
84 | AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane }; | |
85 | ||
86 | for ( Int_t is = 0; is < 2; is++ ) { | |
87 | for ( Int_t ip = 0; ip < 2; ip++ ) { | |
88 | ||
89 | cout << "Running testNeighboursPadIterator for " | |
90 | << AliMq::Station12TypeName(station[is]) << " " | |
91 | << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl; | |
92 | ||
93 | testNeighboursPadIterator(station[is], plane[ip]); | |
94 | ||
95 | cout << "... end running " << endl << endl; | |
96 | } | |
97 | } | |
98 | } | |
99 |