| [3489] | 1 | #define NP 10 | 
|---|
|  | 2 | #define ND 20 | 
|---|
|  | 3 |  | 
|---|
|  | 4 | #define DIAMETRE 5 | 
|---|
|  | 5 |  | 
|---|
|  | 6 | // Timer tm; | 
|---|
|  | 7 |  | 
|---|
|  | 8 | Vector lesx(ND); | 
|---|
|  | 9 |  | 
|---|
|  | 10 | /* int spos[NP] = {1,2,3,5,6,7,10,12,14,16}; | 
|---|
|  | 11 | for(int i=0; i<NP; i++)  lesx(i) = -spos[NP-i-1]; | 
|---|
|  | 12 | for(int i=NP; i<2*NP; i++)  lesx(i) = spos[i-NP]; | 
|---|
|  | 13 | */ | 
|---|
|  | 14 | int spos[ND] = {-15,-13,-12,-10,-7,-6,-5,-3,-2,-1,1,2,3,5,6,7,10,12,14,15}; | 
|---|
|  | 15 | for(int i=0; i<ND; i++)  lesx(i) = spos[i]; | 
|---|
|  | 16 |  | 
|---|
|  | 17 |  | 
|---|
|  | 18 | Matrix pos(2,ND*ND); | 
|---|
|  | 19 |  | 
|---|
|  | 20 | int k = 0; | 
|---|
|  | 21 | for(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 |  | 
|---|
|  | 28 | Histo h(-0.5, 31.5, 32); | 
|---|
|  | 29 |  | 
|---|
|  | 30 | for(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 |  | 
|---|
|  | 34 | KeepObj(h); | 
|---|
|  | 35 | KeepObj(lesx); | 
|---|
|  | 36 |  | 
|---|
|  | 37 |  | 
|---|
|  | 38 | Histo2D h2(-0.5, 31.5, 32, -0.5, 31.5, 32); | 
|---|
|  | 39 | for(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 |  | 
|---|
|  | 43 | KeepObj(h2); | 
|---|
|  | 44 |  | 
|---|
|  | 45 |  | 
|---|
|  | 46 | Histo2D h2f(-0.5, 31.5, 96, -0.5, 31.5, 96); | 
|---|
|  | 47 | for(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 | } | 
|---|
|  | 51 | KeepObj(h2f); | 
|---|
|  | 52 |  | 
|---|
|  | 53 | cout << "h2f OK" << endl; | 
|---|
|  | 54 |  | 
|---|
|  | 55 | //--------------------------------------------------------------------- | 
|---|
|  | 56 | //----- Disposition compacte d'antennes circulaires ------------------- | 
|---|
|  | 57 | //--------------------------------------------------------------------- | 
|---|
|  | 58 | { | 
|---|
|  | 59 | double DIAM_FA = 5.; | 
|---|
|  | 60 | double L_FA = 100.; | 
|---|
|  | 61 | double DISTA_FA = DIAM_FA; | 
|---|
|  | 62 |  | 
|---|
|  | 63 | int ND1_FA = L_FA/DISTA_FA; | 
|---|
|  | 64 | int ND_FA = ND1_FA*ND1_FA; | 
|---|
|  | 65 |  | 
|---|
|  | 66 | Matrix pos_fa(2,ND_FA); | 
|---|
|  | 67 | int kk=0; | 
|---|
|  | 68 | for(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 | } | 
|---|
|  | 73 | KeepObj(pos_fa); | 
|---|
|  | 74 | cout << "pos_fa OK" << endl; | 
|---|
|  | 75 |  | 
|---|
|  | 76 | Histo2D h2_fa(0., 2*ND1_FA*DIAM_FA, 3*ND1_FA, 0., 2*ND1_FA*DIAM_FA, 3*ND1_FA); | 
|---|
|  | 77 | Histo2D h2ns_fa(0., 2*ND1_FA*DIAM_FA, 4*ND1_FA, 0., 2*ND1_FA*DIAM_FA, 4*ND1_FA); | 
|---|
|  | 78 |  | 
|---|
|  | 79 | for(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 | } | 
|---|
|  | 84 | KeepObj(h2_fa); | 
|---|
|  | 85 | KeepObj(h2ns_fa); | 
|---|
|  | 86 | cout << "h2_fa OK" << endl; | 
|---|
|  | 87 |  | 
|---|
|  | 88 | } | 
|---|
|  | 89 | //--------------------------------------------------------------------- | 
|---|
|  | 90 | //------------------ Disposition hexagonale --------------------------- | 
|---|
|  | 91 | //--------------------------------------------------------------------- | 
|---|
|  | 92 | { | 
|---|
|  | 93 | int nlayer = 4; | 
|---|
|  | 94 | int nhex = 1; | 
|---|
|  | 95 | for(int i=1; i<=nlayer; i++) { | 
|---|
|  | 96 | nhex += i*6; | 
|---|
|  | 97 | } | 
|---|
|  | 98 | int ndet = nhex*7; | 
|---|
|  | 99 | cout << " NLayer= " << nlayer << " NHex= " << nhex << " NDet= " << ndet << endl; | 
|---|
|  | 100 |  | 
|---|
|  | 101 | Matrix posh(2,ndet); | 
|---|
|  | 102 |  | 
|---|
|  | 103 | char * names[3] = {"xr", "yr", "sz"}; | 
|---|
|  | 104 | NTuple recp(3, names); | 
|---|
|  | 105 | double xnt[5]; | 
|---|
|  | 106 | xnt[0] = xnt[1] = xnt[2] = xnt[3] = xnt[4] = 0.; | 
|---|
|  | 107 |  | 
|---|
|  | 108 | int kk = 0; | 
|---|
|  | 109 | for(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 |  | 
|---|
|  | 125 | KeepObj(posh); | 
|---|
|  | 126 | KeepObj(recp); | 
|---|
|  | 127 |  | 
|---|
|  | 128 | cout << "posh/recp OK" << endl; | 
|---|
|  | 129 |  | 
|---|
|  | 130 | Histo2D h2hex(0., 40.*DIAMETRE, 120, 0., 40.*DIAMETRE, 120); | 
|---|
|  | 131 | Histo2D h2nshex(0., 20.*DIAMETRE, 120, 0., 20.*DIAMETRE, 120); | 
|---|
|  | 132 |  | 
|---|
|  | 133 | for(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 | } | 
|---|
|  | 140 | KeepObj(h2hex); | 
|---|
|  | 141 | KeepObj(h2nshex); | 
|---|
|  | 142 | cout << "h2hex OK" << endl; | 
|---|
|  | 143 | } | 
|---|
|  | 144 |  | 
|---|