]>
Commit | Line | Data |
---|---|---|
1 | // $Id$ | |
2 | // $MpId: testSectorPadIterators.C,v 1.11 2006/03/15 13:07:07 ivana Exp $ | |
3 | // | |
4 | // Test macro for reading sector, and iterate over it | |
5 | ||
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 "AliMpSectorPadIterator.h" | |
15 | #include "AliMpSectorReader.h" | |
16 | #include "AliMpArea.h" | |
17 | #include "AliMpVPadIterator.h" | |
18 | #include "AliMpVPainter.h" | |
19 | #include "AliMpEncodePair.h" | |
20 | ||
21 | #include <Riostream.h> | |
22 | #include <TCanvas.h> | |
23 | #include <TMarker.h> | |
24 | ||
25 | #endif | |
26 | ||
27 | TCanvas* CreateTCanvas(const TString& name, const TString& title, | |
28 | AliMq::Station12Type station, AliMp::PlaneType plane) | |
29 | { | |
30 | TString newName(name); | |
31 | TString newTitle(title); | |
32 | TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane); | |
33 | newName += unique; | |
34 | newTitle += unique; | |
35 | return new TCanvas(newName.Data(), newTitle.Data()); | |
36 | } | |
37 | ||
38 | void testSectorPadIterators(AliMq::Station12Type station, AliMp::PlaneType plane) | |
39 | { | |
40 | AliMpDataProcessor mp; | |
41 | AliMpDataMap* dataMap = mp.CreateDataMap("data"); | |
42 | AliMpDataStreams dataStreams(dataMap); | |
43 | ||
44 | AliMpSectorReader r(dataStreams, station, plane); | |
45 | AliMpSector* sector = r.BuildSector(); | |
46 | ||
47 | Int_t num=0; | |
48 | ||
49 | //new TCanvas("canv"); | |
50 | CreateTCanvas("", "", station, plane); | |
51 | ||
52 | const Double_t xmax=150; | |
53 | const Double_t ymax=250; | |
54 | ||
55 | AliMpSectorPadIterator it = AliMpSectorPadIterator(sector); | |
56 | ||
57 | for (it.First(); ! it.IsDone(); it.Next()) { | |
58 | Long_t indices = it.CurrentItem().GetIndices(); | |
59 | cout<<"Iterator number "<< num << " at "; | |
60 | AliMp::PairPut(cout, indices) << endl; | |
61 | num++; | |
62 | TMarker* marker = new TMarker( (Double_t)AliMp::PairFirst(indices) /xmax, | |
63 | (Double_t)AliMp::PairSecond(indices)/ymax, | |
64 | 2); | |
65 | marker->Draw(); | |
66 | } | |
67 | ||
68 | delete sector; | |
69 | } | |
70 | ||
71 | void testSt12SectorPadIterators() | |
72 | { | |
73 | AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 }; | |
74 | AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane }; | |
75 | ||
76 | for ( Int_t is = 0; is < 2; is++ ) { | |
77 | for ( Int_t ip = 0; ip < 2; ip++ ) { | |
78 | ||
79 | cout << "Running testSectorPadIterators for " | |
80 | << AliMq::Station12TypeName(station[is]) << " " | |
81 | << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl; | |
82 | ||
83 | testSectorPadIterators(station[is], plane[ip]); | |
84 | ||
85 | cout << "... end running " << endl << endl; | |
86 | } | |
87 | } | |
88 | } | |
89 |