source: fact/tools/pixelmap_test/PixelMapTest.cc@ 16858

Last change on this file since 16858 was 10116, checked in by weitzel, 14 years ago
new version of pixelmap class
File size: 2.4 KB
Line 
1//simple test program to check the PixelMap class
2//Q. Weitzel, ETH Zurich, December 14, 2010
3
4#include "../../pixelmap/PixelMap.h"
5#include <iostream>
6
7using namespace std;
8
9int main(){
10
11 cout << endl;
12 cout << "==============================" << endl;
13 cout << "PixelMap Test Program" << endl;
14 cout << "==============================" << endl;
15 cout << endl;
16
17 cout << "Return value when asking for a non-existing pixel: " << PixelMap::PM_ERROR_CODE << endl;
18 cout << endl;
19
20 //PixelMap* pm = new PixelMap("", true);
21 PixelMap* pm = new PixelMap("0: 0 0 0 0 0 2 0 0 0; 1: 0 0 0 1 0 0 1 -1 -1; 237: 0 0 0 2 0 0 1 0 -1;", true);
22
23 pm->Print();
24
25 unsigned int fpa;
26 fpa = pm->FPA_to_Pixel(0,0,0,0,true);
27 cout << "PixelID: " << fpa << endl;
28 fpa = pm->FPA_to_Pixel(0,1,0,0,true);
29 cout << "PixelID: " << fpa << endl;
30 fpa = pm->FPA_to_Pixel(0,0,0,0,true);
31 cout << "PixelID: " << fpa << endl;
32
33 vector<unsigned int> hv;
34 hv = pm->HV_to_Pixel(6,1,8,true);
35 cout << hv.size() << " PixelIDs found: ";
36 for (unsigned int i=0; i < hv.size(); i++){cout << hv[i] << " ";}
37 cout << endl;
38 hv = pm->HV_to_Pixel(6,9,1,true);
39 cout << hv.size() << " PixelIDs found: ";
40 for (unsigned int i=0; i < hv.size(); i++){cout << hv[i] << " ";}
41 cout << endl;
42 hv = pm->HV_to_Pixel(0,0,1,true);
43 cout << hv.size() << " PixelIDs found: ";
44 for (unsigned int i=0; i < hv.size(); i++){cout << hv[i] << " ";}
45 cout << endl;
46 hv = pm->HV_to_Pixel(0,0,1,true);
47 cout << hv.size() << " PixelIDs found: ";
48 for (unsigned int i=0; i < hv.size(); i++){cout << hv[i] << " ";}
49 cout << endl;
50
51 unsigned int pos;
52 pos = pm->POS_to_Pixel(-1,-1,true);
53 cout << "PixelID: " << pos << endl;
54 pos = pm->POS_to_Pixel(-10,1,true);
55 cout << "PixelID: " << pos << endl;
56
57 unsigned int fpab;
58 fpab = pm->Pixel_to_FPAboard(0,true);
59 cout << "Board: " << fpab << endl;
60 fpab = pm->Pixel_to_FPAboard(5,true);
61 cout << "Board: " << fpab << endl;
62
63 unsigned int hvboard;
64 hvboard = pm->Pixel_to_HVboard(0,true);
65 cout << "Board: " << hvboard << endl;
66 hvboard = pm->Pixel_to_HVboard(5,true);
67 cout << "Board: " << hvboard << endl;
68
69 int posy;
70 posy = pm->Pixel_to_POSy(1,true);
71 cout << "POSy: " << posy << endl;
72 posy = pm->Pixel_to_POSy(15,true);
73 cout << "POSy: " << posy << endl;
74
75 delete pm;
76
77 return 0;
78
79}
Note: See TracBrowser for help on using the repository browser.