source: Sophya/trunk/Cosmo/RadioBeam/vnpairs.cc@ 3988

Last change on this file since 3988 was 3489, checked in by ansari, 17 years ago

Les differents scripts+prog de calcul P(k)/bruit, lobe, config interfero ajoute ds ce module - Reza 28/04/2008

File size: 3.7 KB
Line 
1#define NP 10
2#define ND 20
3
4#define DIAMETRE 5
5
6// Timer tm;
7
8Vector lesx(ND);
9
10/* int spos[NP] = {1,2,3,5,6,7,10,12,14,16};
11for(int i=0; i<NP; i++) lesx(i) = -spos[NP-i-1];
12for(int i=NP; i<2*NP; i++) lesx(i) = spos[i-NP];
13*/
14int spos[ND] = {-15,-13,-12,-10,-7,-6,-5,-3,-2,-1,1,2,3,5,6,7,10,12,14,15};
15for(int i=0; i<ND; i++) lesx(i) = spos[i];
16
17
18Matrix pos(2,ND*ND);
19
20int k = 0;
21for(int i=0; i<ND; i++) {
22 for(int j=0; j<ND; j++) {
23 pos(0,k) = lesx(i); pos(1,k) = lesx(j); k++;
24 }
25}
26
27
28Histo h(-0.5, 31.5, 32);
29
30for(int i=0; i<ND-1; i++)
31 for(int j=i+1; j<ND; j++)
32 h.Add(fabs(lesx(i)-lesx(j)),1.);
33
34KeepObj(h);
35KeepObj(lesx);
36
37
38Histo2D h2(-0.5, 31.5, 32, -0.5, 31.5, 32);
39for(int i=0; i<ND*ND-1; i++)
40 for(int j=i+1; j<ND*ND; j++)
41 h2.Add(fabs(pos(0,i)-pos(0,j)),fabs(pos(1,i)-pos(1,j)), 1.);
42
43KeepObj(h2);
44
45
46Histo2D h2f(-0.5, 31.5, 96, -0.5, 31.5, 96);
47for(int i=0; i<ND*ND-1; i++)
48 for(int j=i+1; j<ND*ND; j++) {
49 FillVis(h2f, fabs(pos(0,i)-pos(0,j)),fabs(pos(1,i)-pos(1,j)));
50 }
51KeepObj(h2f);
52
53cout << "h2f OK" << endl;
54
55//---------------------------------------------------------------------
56//----- Disposition compacte d'antennes circulaires -------------------
57//---------------------------------------------------------------------
58{
59double DIAM_FA = 5.;
60double L_FA = 100.;
61double DISTA_FA = DIAM_FA;
62
63int ND1_FA = L_FA/DISTA_FA;
64int ND_FA = ND1_FA*ND1_FA;
65
66Matrix pos_fa(2,ND_FA);
67int kk=0;
68for(int i=0; i<ND1_FA; i++) {
69 for(int j=0; j<ND1_FA; j++) {
70 pos_fa(0, kk) = i*DISTA_FA; pos_fa(1, kk) = j*DISTA_FA; kk++;
71 }
72}
73KeepObj(pos_fa);
74cout << "pos_fa OK" << endl;
75
76Histo2D h2_fa(0., 2*ND1_FA*DIAM_FA, 3*ND1_FA, 0., 2*ND1_FA*DIAM_FA, 3*ND1_FA);
77Histo2D h2ns_fa(0., 2*ND1_FA*DIAM_FA, 4*ND1_FA, 0., 2*ND1_FA*DIAM_FA, 4*ND1_FA);
78
79for(int i=0; i<pos_fa.NCols()-1; i++)
80 for(int j=i+1; j<pos_fa.NCols(); j++) {
81 h2ns_fa.Add(fabs(pos_fa(0,i)-pos_fa(0,j)),fabs(pos_fa(1,i)-pos_fa(1,j)),1.);
82 FillVis(h2_fa, fabs(pos_fa(0,i)-pos_fa(0,j)),fabs(pos_fa(1,i)-pos_fa(1,j)), DIAM_FA);
83 }
84KeepObj(h2_fa);
85KeepObj(h2ns_fa);
86cout << "h2_fa OK" << endl;
87
88}
89//---------------------------------------------------------------------
90//------------------ Disposition hexagonale ---------------------------
91//---------------------------------------------------------------------
92{
93int nlayer = 4;
94int nhex = 1;
95for(int i=1; i<=nlayer; i++) {
96 nhex += i*6;
97}
98int ndet = nhex*7;
99cout << " NLayer= " << nlayer << " NHex= " << nhex << " NDet= " << ndet << endl;
100
101Matrix posh(2,ndet);
102
103char * names[3] = {"xr", "yr", "sz"};
104NTuple recp(3, names);
105double xnt[5];
106xnt[0] = xnt[1] = xnt[2] = xnt[3] = xnt[4] = 0.;
107
108int kk = 0;
109for(int i=0; i<= nlayer; i++) {
110 double rlayer = i*4.5*DIAMETRE;
111// if (i == 1) rlayer = i*4.*DIAMETRE;
112 Matrix ph = couche(i,rlayer) ;
113 cout << " DEBUG - I=" << i << " / NLayer= " << nlayer << " ph.NCols= " << ph.NCols() << endl;
114 for(int j=0; j<ph.NCols(); j++) {
115 Matrix hex = hexagon(ph(0,j), ph(1,j), DIAMETRE, ph(2,i));
116 for(int k=0; k<hex.NCols(); k++) {
117 xnt[0] = posh(0, kk) = hex(0, k);
118 xnt[1] = posh(1, kk) = hex(1, k);
119 recp.Fill(xnt);
120 kk++;
121 }
122 }
123}
124
125KeepObj(posh);
126KeepObj(recp);
127
128cout << "posh/recp OK" << endl;
129
130Histo2D h2hex(0., 40.*DIAMETRE, 120, 0., 40.*DIAMETRE, 120);
131Histo2D h2nshex(0., 20.*DIAMETRE, 120, 0., 20.*DIAMETRE, 120);
132
133for(int i=0; i<posh.NCols()-1; i++)
134 for(int j=i+1; j<posh.NCols(); j++) {
135 h2nshex.Add(fabs(posh(0,i)-posh(0,j)),fabs(posh(1,i)-posh(1,j)), 1.);
136 FillVis(h2hex, fabs(posh(0,i)-posh(0,j)),fabs(posh(1,i)-posh(1,j)), DIAMETRE);
137 FillVis(h2hex, fabs(posh(0,i)-posh(0,j))*0.75,fabs(posh(1,i)-posh(1,j)), DIAMETRE);
138 FillVis(h2hex, fabs(posh(0,i)-posh(0,j)),fabs(posh(1,i)-posh(1,j))*0.75, DIAMETRE);
139 }
140KeepObj(h2hex);
141KeepObj(h2nshex);
142cout << "h2hex OK" << endl;
143}
144
Note: See TracBrowser for help on using the repository browser.