- Timestamp:
- Mar 20, 2007, 11:48:15 AM (19 years ago)
- Location:
- trunk/Cosmo/RadioBeam
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Cosmo/RadioBeam/brsrc.cc
r3160 r3192 71 71 72 72 int j = 0; 73 for(int k=0; k< f.size(); k++) {73 for(int k=0; k<(int)f.size(); k++) { 74 74 if (f[k] >= 0.5) { 75 75 cout << "BRSourceGen::BRSourceGen() f[k=" << k << "]=" << f[k] << " >=0.5 ignored " << endl; -
trunk/Cosmo/RadioBeam/brsrc.h
r3165 r3192 49 49 NTuple Convert2Table(double freq0=0.); 50 50 51 //private: 51 52 //-------- Variables / objets membres 52 53 Vector freq; // frequence des sources -
trunk/Cosmo/RadioBeam/makefile
r3160 r3192 11 11 echo 'makefile : treccyl made' 12 12 13 testFFT : Objs/testFFT.o 13 14 ###### 14 15 … … 30 31 $(CXXCOMPILE) -o Objs/multicyl.o multicyl.cc 31 32 33 testFFT : Objs/testFFT.o 34 $(CXXLINK) -o testFFT \ 35 Objs/testFFT.o \ 36 $(SOPHYAEXTSLBLIST) 37 38 Objs/testFFT.o : testFFT.cc 39 $(CXXCOMPILE) -o Objs/testFFT.o testFFT.cc -
trunk/Cosmo/RadioBeam/mbeamcyl.cc
r3191 r3192 5 5 #include "srandgen.h" 6 6 7 static double cLight=0.3; // in 1E9 m/s 8 static double tClock = 2.; // should come from param file !!!! 9 //static double cLight=1; 10 //static double tClock = 1.; 11 7 12 //================================================= 8 13 9 14 MultiBeamCyl::MultiBeamCyl(int nr, int ns, double posx, double posy) 10 : texact (ns) , tjitt(ns) , toffset(nr) ,11 signal(ns), sigjitt(ns) , gain(nr)12 { 13 NR = nr;14 NS = ns;15 posY = posy;16 posX = posx;15 : texact_(ns) , tjitt_(ns) , toffset_(nr) , 16 gain_(nr), signal_(ns), sigjitt_(ns) 17 { 18 NR_ = nr; 19 NS_ = ns; 20 posY_ = posy; 21 posX_ = posx; 17 22 18 23 SetPrintLevel(0); … … 23 28 SetTimeOffsetSigma(0.); 24 29 SetGains(1., 0., 0); 25 adfg = false; src= NULL;30 adfg_ = false; src_ = NULL; 26 31 SetSources(new BRSourceGen, true); 27 32 } 28 33 34 //----------------------------------------------------------------------------- 29 35 MultiBeamCyl::~MultiBeamCyl() 30 36 { 31 if (adfg && src) delete src; 32 } 33 37 if (adfg_ && src_) delete src_; 38 } 39 40 //----------------------------------------------------------------------------- 34 41 void MultiBeamCyl::SetSources(BRSourceGen* brs, bool ad) 35 42 { 36 43 if (brs == NULL) return; 37 if (adfg && src) delete src;38 src = brs; adfg=ad;39 if (PrtLev > 1)44 if (adfg_ && src_) delete src_; 45 src_ = brs; adfg_=ad; 46 if (PrtLev_ > 1) 40 47 cout << " MultiBeamCyl::SetSources(brs=" << brs <<" ,bool) NbSrc=" 41 << src->NbSources() << endl; 42 43 } 44 48 << src_->NbSources() << endl; 49 50 } 51 52 //----------------------------------------------------------------------------- 45 53 void MultiBeamCyl::SetGains(double g, double sigg, int nzerogain) 46 54 { 47 if (sigg < 1.e-6) gain = g;48 else gain = RandomSequence(RandomSequence::Gaussian, g, sigg);55 if (sigg < 1.e-6) gain_ = g; 56 else gain_ = RandomSequence(RandomSequence::Gaussian, g, sigg); 49 57 int k; 50 for (k=0; k<NR ; k++) if (gain(k) < 0) gain(k) = 0.;58 for (k=0; k<NR_; k++) if (gain_(k) < 0) gain_(k) = 0.; 51 59 for(k=0; k<nzerogain; k++) { 52 int zg = random()%NR ;53 if ((zg >=0) && (zg < NR )) gain(zg) = 0.;54 } 55 if (PrtLev > 1)60 int zg = random()%NR_; 61 if ((zg >=0) && (zg < NR_)) gain_(zg) = 0.; 62 } 63 if (PrtLev_ > 1) 56 64 cout << " MultiBeamCyl::SetGains(g=" << g <<" ,sigg=" << sigg 57 65 << " ,nzg=" << nzerogain << " )" << endl; 58 66 } 59 67 68 //----------------------------------------------------------------------------- 60 69 void MultiBeamCyl::ComputeTimeVectors() 61 70 { 62 texact = RegularSequence(0., 1.); 63 toffset = RandomSequence(RandomSequence::Gaussian, 0., toffsig); 71 texact_ = RegularSequence(0., tClock); // 0, tClock, 2*tClock, ... 72 // for (int i=0;i<1024;i++) {cout << texact(i)<< endl;}; 73 toffset_ = RandomSequence(RandomSequence::Gaussian, 0., toffsig_); 64 74 NewTJitVector(); 65 75 } 66 76 77 //----------------------------------------------------------------------------- 67 78 void MultiBeamCyl::NewTJitVector(int num) 68 79 { 69 if (timejitter > 1.e-19) {70 tjitt = RandomSequence(RandomSequence::Gaussian, 0., timejitter);71 tjitt += texact;72 } 73 else tjitt = texact;74 if (num >= 0) tjitt += toffset(num);80 if (timejitter_ > 1.e-19) { 81 tjitt_ = RandomSequence(RandomSequence::Gaussian, 0., timejitter_); 82 tjitt_ += texact_; 83 } 84 else tjitt_ = texact_; 85 if (num >= 0) tjitt_ += toffset_(num); 75 86 76 87 } 77 88 89 //----------------------------------------------------------------------------- 78 90 int MultiBeamCyl::ComputeSignalVector(int num, bool fgsignojit) 79 91 { 80 92 int nok = 0; 81 signal = 0.;82 sigjitt = 0.;83 for(int is=0; is<src ->freq.Size(); is++) {84 double fr = src ->freq(is);93 signal_ = 0.; 94 sigjitt_ = 0.; 95 for(int is=0; is<src_->freq.Size(); is++) { 96 double fr = src_->freq(is); 85 97 if ((fr < 0.) || (fr > 0.5)) continue; 86 98 nok++; … … 88 100 // pas celle apres shift (freq-reduite) 89 101 // lambda = c T = c/freq avec c = 1, dephasage = 2*pi*num*Da*sin(ang)/lambda 90 double dephasage = (posX +num*Da)*sin(src->angX(is)) +91 posY*sin(src->angY(is)) ;92 dephasage *= (2*M_PI*(fr+freq0));102 double dephasage = (posX_+num*Da_)*sin(src_->angX(is)) 103 + posY_*sin(src_->angY(is)) ; 104 dephasage *= 2*M_PI*(fr+freq0_)/cLight; 93 105 // On ajoute alors la phase propre de chaque source 94 dephasage += src ->phase(is);95 double amprep = src ->amp(is)*AngResponse(src->angX(is), src->angY(is));96 for(int k=0; k<NS ; k++) {97 sigjitt (k) += amprep*sin(2.*M_PI*fr*tjitt(k)+dephasage);106 dephasage += src_->phase(is); 107 double amprep = src_->amp(is)*AngResponse(src_->angX(is), src_->angY(is)); 108 for(int k=0; k<NS_; k++) { 109 sigjitt_(k) += amprep*sin(2.*M_PI*fr*tjitt_(k)+dephasage); 98 110 if (fgsignojit) 99 signal (k) += amprep*sin(2.*M_PI*fr*texact(k)+dephasage);111 signal_(k) += amprep*sin(2.*M_PI*fr*texact_(k)+dephasage); 100 112 } 101 113 } 102 114 // Application du gain du detecteur 103 r_4 ga = gain (num);115 r_4 ga = gain_(num); 104 116 if (fabs(ga-1.) > 1.e-9) { 105 signal *= ga;106 sigjitt *= ga;117 signal_ *= ga; 118 sigjitt_ *= ga; 107 119 } 108 120 // Ajout de bruit (ampli ...) 109 if (signoise > 1.e-18) {110 for(int k=0; k<NS ; k++) {111 sigjitt (k) += GauRnd(0., signoise);112 if (fgsignojit) signal (k) += GauRnd(0., signoise);113 } 114 } 115 121 if (signoise_ > 1.e-18) { 122 for(int k=0; k<NS_; k++) { 123 sigjitt_(k) += GauRnd(0., signoise_); 124 if (fgsignojit) signal_(k) += GauRnd(0., signoise_); 125 } 126 } 127 //............ FFT in time 116 128 FFTPackServer ffts; 117 118 ffts.FFTForward(sigjitt, f_sigjit); 119 if (fgsignojit) ffts.FFTForward(signal, f_sig); 129 ffts.FFTForward(sigjitt_, f_sigjit_); 130 if (fgsignojit) ffts.FFTForward(signal_, f_sig_); 120 131 121 132 return nok; … … 123 134 124 135 136 //----------------------------------------------------------------------------- 125 137 /* --- a supprimer ? 126 138 inline float myZmodule(complex<r_4>& z) … … 130 142 ----- */ 131 143 144 //----------------------------------------------------------------------------- 132 145 void MultiBeamCyl::ReconstructSourcePlane(bool fgzerocentre) 133 146 { … … 135 148 int noksrc = ComputeSignalVector(0, false); 136 149 vector<TVector< complex<r_4> > > vvfc; 137 cout << "MultiBeamCyl::ReconstructSourcePlane() NR=" << NR 138 << " PosY=" << posY << " NFreq=" << f_sigjit.Size()-1 << " NOkSrc=" << noksrc << endl;139 if (PrtLev > 0) {140 cout << " ... posY= " << posY << " MeanGain=" << Mean(gain) << " MeanAmpSrc="141 << Mean(src ->amp) << endl;142 cout << " ...SigNoise=" << signoise << " TimeJitter=" << timejitter143 << " TOffSig=" << toffsig << " Da=" << Da << " Freq0=" << freq0<< endl;150 cout << "MultiBeamCyl::ReconstructSourcePlane() NR=" << NR_ 151 << " PosY=" << posY_ << " NFreq=" << f_sigjit_.Size()-1 << " NOkSrc=" << noksrc << endl; 152 if (PrtLev_ > 0) { 153 cout << " ... posY= " << posY_ << " MeanGain=" << Mean(gain_) << " MeanAmpSrc=" 154 << Mean(src_->amp) << endl; 155 cout << " ...SigNoise=" << signoise_ << " TimeJitter=" << timejitter_ 156 << " TOffSig=" << toffsig_ << " Da=" << Da_ << " Freq0=" << freq0_ << endl; 144 157 } 145 158 // On ne s'occupe pas de la composante continue 146 for(int jf=1; jf<f_sigjit .Size(); jf++) {147 TVector<complex<r_4> > cf(NR );159 for(int jf=1; jf<f_sigjit_.Size(); jf++) { 160 TVector<complex<r_4> > cf(NR_); 148 161 vvfc.push_back(cf); 149 162 } 150 163 cout << "ReconstructSourcePlane()/Info: computing s(t) for each receptor ..." << endl; 151 int pmod = NR /10;152 for(int ir=0; ir<NR ; ir++) {153 if (timejitter > 1.e-19) NewTJitVector(ir);164 int pmod = NR_/10; 165 for(int ir=0; ir<NR_; ir++) { 166 if (timejitter_ > 1.e-19) NewTJitVector(ir); 154 167 noksrc = ComputeSignalVector(ir, false); 155 for(int jf=1; jf<f_sigjit .Size(); jf++)156 vvfc[jf-1](ir) = f_sigjit (jf);157 if ( (PrtLev >0) && (ir%pmod == 0) )158 cout << " OK s(t) for ir=" << ir << " / NR=" << NR << " NOkSrc=" << noksrc << endl;168 for(int jf=1; jf<f_sigjit_.Size(); jf++) 169 vvfc[jf-1](ir) = f_sigjit_(jf); 170 if ( (PrtLev_>0) && (ir%pmod == 0) ) 171 cout << " OK s(t) for ir=" << ir << " / NR=" << NR_ << " NOkSrc=" << noksrc << endl; 159 172 } 160 173 161 174 cout << "ReconstructSourcePlane()/Info: computing s(ang) for each freq by FFT" << endl; 162 cmplx_srcplane .SetSize(f_sigjit.Size()-1, NR);163 // rec_srcplane.SetSize(f_sigjit .Size()-1, NR);175 cmplx_srcplane_.SetSize(f_sigjit_.Size()-1, NR_); 176 // rec_srcplane.SetSize(f_sigjit_.Size()-1, NR_); 164 177 FFTPackServer ffts; 165 178 TVector<complex<r_4> > fcf; 166 179 pmod = vvfc.size()/10; 167 for(int jf=0; jf< vvfc.size(); jf++) {168 ffts.FFTForward(vvfc[jf], fcf); 169 if (fcf.Size() != NR ) {180 for(int jf=0; jf<(int)vvfc.size(); jf++) { // loop over frequencies 181 ffts.FFTForward(vvfc[jf], fcf); // FFT alomg cylinder 182 if (fcf.Size() != NR_) { 170 183 cout << "ReconstructSourcePlane()/BUG jf=" << jf << " fcf.Size() != NR " 171 << fcf.Size() << " != " << NR << endl;184 << fcf.Size() << " != " << NR_ << endl; 172 185 continue; 173 186 } 174 187 if (fgzerocentre) { // On veut avoir la direction angle=0 au milieu de la matrice 175 int milieu = (NR -1)/2;176 if (NR %2 == 0) milieu++;177 int decal = NR - milieu - 1;188 int milieu = (NR_-1)/2; 189 if (NR_%2 == 0) milieu++; 190 int decal = NR_ - milieu - 1; 178 191 for (int ir=0; ir<=milieu; ir++) 179 cmplx_srcplane (jf, ir+decal) = fcf(ir);192 cmplx_srcplane_(jf, ir+decal) = fcf(ir); 180 193 // rec_srcplane(jf, ir+decal) = myZmodule(fcf(ir)); 181 194 182 for (int ir=milieu+1; ir<NR ; ir++)183 cmplx_srcplane (jf, decal-(NR-ir)) = fcf(ir);184 // rec_srcplane (jf, decal-(NR-ir)) = myZmodule(fcf(ir));195 for (int ir=milieu+1; ir<NR_; ir++) 196 cmplx_srcplane_(jf, decal-(NR_-ir)) = fcf(ir); 197 // rec_srcplane_(jf, decal-(NR_-ir)) = myZmodule(fcf(ir)); 185 198 186 199 } 187 else for (int ir=0; ir<NR ; ir++)188 cmplx_srcplane (jf, ir) = fcf(ir);200 else for (int ir=0; ir<NR_; ir++) 201 cmplx_srcplane_(jf, ir) = fcf(ir); 189 202 // rec_srcplane(jf, ir) = myZmodule(fcf(ir)); 190 203 191 if ( (PrtLev > 0) && (jf%pmod == 0))204 if ( (PrtLev_ > 0) && (jf%pmod == 0)) 192 205 cout << " OK rec_srcplane(jf, ir) for jf=" << jf << endl; 193 206 } -
trunk/Cosmo/RadioBeam/mbeamcyl.h
r3191 r3192 31 31 // ns = nb d'echantillons en temps de chaque paquet 32 32 // posy = position spatiale en Y pour chaque cylindre (unite ou lambda=1 pour f=1) 33 MultiBeamCyl(int nr=1024, int ns=4096, double posx=0., double posy=0.); 33 // posx = position spatiale en X pour chaque cylindre (unite ou lambda=1 pour f=1) 34 MultiBeamCyl(int nr=1024, int ns=4096, double posx=0., double posy=0. ); 34 35 ~MultiBeamCyl(); 35 36 36 37 // Niveau de print de debug 37 inline void SetPrintLevel(int prl=0) { PrtLev =prl; }38 inline void SetPrintLevel(int prl=0) { PrtLev_=prl; } 38 39 39 40 // Reponse angulaire pour un recepteur (cylindre+antenne) … … 41 42 inline double AngResponse(double angx, double angy) { return 1.; } 42 43 43 inline double getCylinderYPos() { return posY; } 44 inline double getCylinderXPos() { return posX; } 44 inline double getCylinderYPos() { return posY_; } 45 inline double getCylinderXPos() { return posX_; } 46 45 47 // Specification de la frequence de base f0 et espacement des recepteurs 46 48 // freq_vrai = freq_BRSourceGen + f0 47 49 // pour f_vrai = 2, lambda = 0.5 et lambda/2 = 0.25 48 50 inline void SetBaseFreqDa(double f0=2., double a=0.25) 49 { freq0 = f0; Da= a; }51 { freq0_ = f0; Da_ = a; } 50 52 51 53 // frequences reduites (entre 0 ... 0.5) , angle en radian, amp ~ 1 … … 55 57 56 58 // Definition du sigma du bruit gaussien sur les echantillons 57 inline void SetNoiseSigma(double sig=0.) { signoise = sig; }59 inline void SetNoiseSigma(double sig=0.) { signoise_ = sig; } 58 60 // Definition du sigma du jitter d'horloge (typ 0.01) 59 inline void SetTimeJitter(double tjit=0.) { timejitter = tjit; }61 inline void SetTimeJitter(double tjit=0.) { timejitter_ = tjit; } 60 62 // Definition du sigma des offsets d'horloge entre recepteurs (typ 0.02) 61 inline void SetTimeOffsetSigma(double tsig=0.) { toffsig = tsig; }63 inline void SetTimeOffsetSigma(double tsig=0.) { toffsig_ = tsig; } 62 64 63 65 // Definition du gain et sigma de fluctuations de gain … … 79 81 void ReconstructSourcePlane(bool fgzerocentre=true); 80 82 81 inline TMatrix< complex<r_4> > & getRecSrcPlane() { return cmplx_srcplane ; }83 inline TMatrix< complex<r_4> > & getRecSrcPlane() { return cmplx_srcplane_; } 82 84 83 85 //-------------- Variables membres ------------ 84 int NR , NS; // nb recepteurs, nb d'echantillons ds chaque paquet85 double pos Y; // Position selon Y (E-O) de la ligne de recepteurs86 double pos X; // Position selon X (N-S) de la ligne de recepteurs86 int NR_, NS_; // nb recepteurs, nb d'echantillons ds chaque paquet 87 double posX_; // Position selon X (N-S) du premier recepteur du cylindre 88 double posY_; // Position selon Y (E-O) de la ligne de recepteurs 87 89 88 int PrtLev ; // Niveau de print de debug90 int PrtLev_; // Niveau de print de debug 89 91 90 double Da ; // distance entre recepteurs91 double freq0 ; // frequence de base (freqvrai=f+freq0)92 double Da_; // distance entre recepteurs 93 double freq0_; // frequence de base (freqvrai=f+freq0) 92 94 93 Vector texact ; // les temps exact94 Vector tjitt ; // temps avec jitter95 Vector toffset ; // Offset en temps entre recepteurs96 double timejitter ; // le sigma du jitter en temps des coups d'horloge97 double toffsig ; // sigma des offsets en temps95 Vector texact_; // les temps exact 96 Vector tjitt_; // temps avec jitter 97 Vector toffset_; // Offset en temps entre recepteurs 98 double timejitter_; // le sigma du jitter en temps des coups d'horloge 99 double toffsig_; // sigma des offsets en temps 98 100 99 BRSourceGen* src ; // Les sources100 bool adfg ; // if true, delete src101 BRSourceGen* src_; // Les sources 102 bool adfg_; // if true, delete src 101 103 102 double signoise ; // sigma du bruit additif (bruit ampli ... )104 double signoise_; // sigma du bruit additif (bruit ampli ... ) 103 105 104 TVector<r_4> gain ; // Gain de chaque recepteur106 TVector<r_4> gain_; // Gain de chaque recepteur 105 107 106 TVector<r_4> signal ; // signal sans jitter en temps107 TVector<r_4> sigjitt ; // signal avec jitter en temps108 TVector<r_4> signal_; // signal sans jitter en temps 109 TVector<r_4> sigjitt_; // signal avec jitter en temps 108 110 109 TVector< complex<r_4> > f_sig , f_sigjit; // TF des vecteurs signal , sigjitt111 TVector< complex<r_4> > f_sig_, f_sigjit_; // TF des vecteurs signal , sigjitt 110 112 111 TMatrix< complex<r_4> > cmplx_srcplane ; // composantes complexe du plan-source reconstruit112 // TMatrix<r_4> rec_srcplane ; // Matrice plan source colonnes->angX, lignes->freq113 TMatrix< complex<r_4> > cmplx_srcplane_; // composantes complexe du plan-source reconstruit 114 // TMatrix<r_4> rec_srcplane_; // Matrice plan source colonnes->angX, lignes->freq 113 115 }; 114 116 -
trunk/Cosmo/RadioBeam/multicyl.cc
r3191 r3192 6 6 #include "ctimer.h" 7 7 #include "resusage.h" 8 #include "datacards.h" 9 10 static double cLight=0.3; // in 1E9 m/s 11 static double tClock = 2.; // should come from param file !!!! 12 //static double cLight=1; 13 //static double tClock = 1.; 8 14 9 15 … … 12 18 MultiCylinders::MultiCylinders(int nr, int ns) 13 19 { 14 NR = nr;15 NS = ns;20 NR_ = nr; 21 NS_ = ns; 16 22 17 23 SetPrintLevel(0); … … 22 28 SetTimeOffsetSigma(0.); 23 29 SetGains(1., 0., 0); 24 adfg = false; src= NULL;30 adfg_ = false; src_ = NULL; 25 31 SetSources(new BRSourceGen, true); 26 32 } 27 33 34 //----------------------------------------------------------------------------- 35 MultiCylinders::MultiCylinders(char* fileName) 36 { 37 adfg_ = false; src_ = NULL; 38 SetSources(new BRSourceGen, true); 39 40 // read telescope parameters and fill variable members 41 DataCards dc; 42 dc.ReadFile(fileName); 43 // in old versions frequences were in units of 1/T = 0.5 GHz 44 // and distances in units of cT =3E8 * 2E-9=0.60 m 45 // double fUnit=0.5; // 0.5 GHz <=> T = 2 ns 46 // double dUnit=0.6; // distance unit in m. 47 // now f and d in real units 48 double fUnit=1.; // 0.5 GHz <=> T = 2 ns 49 double dUnit=1.; // distance unit in m. 50 51 NR_=dc.IParam("nAntenna"); 52 NS_=dc.IParam("nSample"); 53 PrtLev_=dc.IParam("printLevel"); 54 Da_=dc.DParam("dAntenna")/dUnit; 55 freq0_=dc.DParam("freq0")/fUnit; 56 timejitter_=dc.DParam("sigmaTimeJitt"); 57 toffsig_=dc.DParam("sigmaClockJitt"); 58 signoise_=dc.DParam("noiseSigma"); 59 gain_=dc.DParam("meanGain"); 60 siggain_=dc.DParam("sigmaGain"); 61 ngainzero_=dc.IParam("nDeadAntenna"); 62 63 // tClock=dc.DParam("tClock"); 64 int nCyl=dc.IParam("nCyl"); 65 for (int i=0; i<nCyl; i++){ 66 double xCyl=dc.DParam("xCyl",i)/dUnit; 67 double yCyl=dc.DParam("yCyl",i)/dUnit; 68 AddCylinder(xCyl,yCyl); 69 } 70 // maxangX=dc.DParam("angMaxX"); 71 // double cylDiam=dc.DParam("cylinderDiam")/dUnit; 72 //// thetaMax = lambda_M/d = c/freq_min/d; freq_min = freq0 + 1/2T 73 // maxangY=cLight/(freq0+1./2./tClock)/cylDiam; 74 // halfNY=dc.IParam("halfNY"); 75 // NX=dc.IParam("NX"); 76 } 77 78 //----------------------------------------------------------------------------- 28 79 MultiCylinders::~MultiCylinders() 29 80 { 30 if (adfg && src) delete src; 31 for(int k=0; k<mCyl.size(); k++) delete mCyl[k]; 32 } 33 81 if (adfg_ && src_) delete src_; 82 for(int k=0; k<(int)mCyl_.size(); k++) delete mCyl_[k]; 83 } 84 85 //----------------------------------------------------------------------------- 34 86 MultiBeamCyl& MultiCylinders::GetCylinder(int k) 35 87 { 36 if ((k < 0) || (k >= mCyl.size())) 88 if ((k < 0) || (k >= (int)mCyl_.size())) { 89 cout <<"******************************************* k="<<k<<endl; 37 90 throw RangeCheckError("MultiCylinders::GetCylinder(k) k<0 OR k>=NCyl"); 38 return (*mCyl[k]); 39 } 40 91 } 92 return (*mCyl_[k]); 93 } 94 95 //----------------------------------------------------------------------------- 41 96 void MultiCylinders::SetSources(BRSourceGen* brs, bool ad) 42 97 { 43 98 if (brs == NULL) return; 44 if (adfg && src) delete src; 45 src = brs; adfg=ad; 46 } 47 48 99 if (adfg_ && src_) delete src_; 100 src_ = brs; adfg_=ad; 101 } 102 103 104 //----------------------------------------------------------------------------- 49 105 void MultiCylinders::ConfigureCylinders() 50 106 { 51 cout << " MultiCylinders::ConfigureCylinders() with NCyl= " << mCyl.size() << endl; 52 for(int k=0; k<mCyl.size(); k++) { 53 mCyl[k]->SetPrintLevel(PrtLev); 54 mCyl[k]->SetBaseFreqDa(freq0, Da); 55 mCyl[k]->SetNoiseSigma(signoise); 56 mCyl[k]->SetTimeJitter(timejitter); 57 mCyl[k]->SetTimeOffsetSigma(toffsig); 58 mCyl[k]->SetGains(gain, siggain, ngainzero); 59 mCyl[k]->SetSources(src, false); 60 } 61 } 62 63 107 cout << " MultiCylinders::ConfigureCylinders() with NCyl= " << mCyl_.size() << endl; 108 for(int k=0; k<(int)mCyl_.size(); k++) { 109 mCyl_[k]->SetPrintLevel(PrtLev_); 110 mCyl_[k]->SetBaseFreqDa(freq0_, Da_); 111 mCyl_[k]->SetNoiseSigma(signoise_); 112 mCyl_[k]->SetTimeJitter(timejitter_); 113 mCyl_[k]->SetTimeOffsetSigma(toffsig_); 114 mCyl_[k]->SetGains(gain_, siggain_, ngainzero_); 115 mCyl_[k]->SetSources(src_, false); 116 } 117 } 118 119 120 //----------------------------------------------------------------------------- 64 121 void MultiCylinders::ReconstructCylinderPlaneS(bool fgzerocentre) 65 122 { 66 123 Timer tm("RecCylPlaneS"); 67 124 ResourceUsage resu; 68 cout << " MultiCylinders::ReconstructCylinderPlaneS()/Info - NCyl= " << mCyl .size()125 cout << " MultiCylinders::ReconstructCylinderPlaneS()/Info - NCyl= " << mCyl_.size() 69 126 << " MemSize=" << resu.getMemorySize() << " kb" << endl; 70 127 ConfigureCylinders(); 71 128 72 129 char buff[128]; 73 for(int k=0; k< mCyl.size(); k++) {130 for(int k=0; k<(int)mCyl_.size(); k++) { 74 131 cout << "---- Cyl[" << k << "] Calling MultiBeamCyl.ReconstructSourcePlane() ..." << endl; 75 mCyl [k]->ReconstructSourcePlane(fgzerocentre);132 mCyl_[k]->ReconstructSourcePlane(fgzerocentre); 76 133 sprintf(buff,"Cyl[%d].RecSrcPlane()",k); 77 134 tm.Split(buff); … … 82 139 } 83 140 84 void MultiCylinders::ReconstructSourceBox(int halfny, double stepangy) 85 { 141 //----------------------------------------------------------------------------- 142 void MultiCylinders::ReconstructSourceBox(int halfny, double stepangy, 143 int nx, double stepangx) 144 { 145 nx=256; 86 146 ReconstructCylinderPlaneS(true); 87 147 TMatrix< complex<r_4> > & mtx = GetCylinder(0).getRecSrcPlane(); 88 // boite 3D X:angX, Y:angY , Z: freq 148 // boite 3D X:angX, Y:angY , Z: freq 149 // if all cylinders at same x position NX is set to zero 150 // => x-size = mtx.NCols() = numbers of receptors per cylinders 151 // move that to readParam() ? 89 152 sa_size_t sz[5] = {0,0,0,0,0}; 90 // int nx=mtx.NCols(); // uncomment to go back to nxbin = nantenna91 int nx=256;92 153 sz[0] = nx; 93 154 sz[1] = halfny*2+1; 94 155 sz[2] = mtx.NRows(); 95 156 TArray< complex<r_4> > & box = getRecSrcBox(); 96 box.ReSize(3, sz); 97 // box = complex< r_4 >( 0.f, 0.f ); 157 box.ReSize(3, sz); // values initialized to zero ? 98 158 cout << " MultiCylinders::ReconstructSourceBox(" << halfny << "," << stepangy 99 159 << "=" << Angle(stepangy).ToArcMin() << " ) srcbox:" << endl; … … 102 162 103 163 104 int pmod = mtx.NRows()/10; 105 106 double fstep = 1.0/(double)NS; // pas en frequence, attention, on a vire la composante continu 164 // int pmod = mtx.NRows()/10; 165 166 double fstep = 1.0/(double)NS_/tClock; // pas en frequence, 167 // attention, on a vire la composante continu 168 // bool first=true; 107 169 for(int kf=0; kf<mtx.NRows(); kf++) { // Loop over frequencies 108 double frq = (double)(kf+1.)*fstep + freq0; // + 1 car f=0 a ete vire 109 110 for(int lc=0; lc<mCyl.size(); lc++) { // Loop over cylinders 170 double frq = (double)(kf+1.)*fstep + freq0_; // + 1 car f=0 a ete vire 171 // then up to frq = (mtx.NRows() +1 ) * fstep !!? 172 // cout<<"************"<<mCyl.size() 173 for(int lc=0; lc<(int)mCyl_.size(); lc++) { // Loop over cylinders 111 174 MultiBeamCyl& cyl = GetCylinder(lc); 112 175 113 176 TMatrix< complex<r_4> > & recp = cyl.getRecSrcPlane(); 114 177 115 double facl = - 2*M_PI*frq*cyl.getCylinderYPos(); // attention au signe - 116 // double facl_x = - 2*M_PI*cyl.getCylinderXPos()/cyl.Da/(double)cyl.NR; 117 double facl_x = - 2*M_PI*cyl.getCylinderXPos()/cyl.Da; 118 double dphi; 178 double facl_y = - 2*M_PI*frq*cyl.getCylinderYPos()/cLight; // attention signe - 179 double facl_x = - 2*M_PI*cyl.getCylinderXPos()/cyl.Da_; 119 180 complex< r_4 > phasefactor; 120 181 int jyy = 0; 182 121 183 for(int jy=-halfny; jy<=halfny; jy++) { // Loop over Y angular steps 122 123 double dphi = facl* sin( (double)jy*stepangy )124 125 126 127 int ixx=(int)(ix*(double)cyl.NR/double(nx));128 129 130 184 for(int ix=0; ix<nx; ix++) { // Loop over AngX directions 185 double dphi = facl_y * sin( (double)jy*stepangy ) 186 + facl_x*(double(ix)/double(nx)-1./2.); 187 phasefactor = complex< r_4 > ((r_4) cos(dphi) , (r_4) sin(dphi)); 188 // sur recp : index ligne -> frequence , index colonne -> angX , 189 int ixx=(int)(ix*(double)cyl.NR_/double(nx)); 190 box(ix, jyy, kf) += recp(kf, ixx)*phasefactor; 191 } // 192 jyy++; 131 193 } // End of Loop over Y angles 132 194 } // End of loop over cylinders 195 133 196 tm.Nop(); 134 if ( (PrtLev>0) && (kf%pmod == 0) ) 197 // if ( (PrtLev_>0) && (kf%pmod == 0) ) 198 if ( (PrtLev_>0) && (kf%(mtx.NRows()/10) == 0) ) 135 199 cout << " OK box(angx,angy, freq=kf) done for kf=" << kf 136 200 << " / Max_kf=" << mtx.NRows() << endl; 137 201 } // End of loop over over frequencies 138 202 … … 140 204 } 141 205 206 //----------------------------------------------------------------------------- 142 207 inline float myZmodule(complex<r_4>& z) 143 208 { … … 145 210 } 146 211 212 //----------------------------------------------------------------------------- 147 213 TMatrix< r_4 > MultiCylinders::getRecXYSlice(int kfmin, int kfmax) 148 214 { … … 158 224 return(rmtx); 159 225 } 226 //----------------------------------------------------------------------------- 227 TMatrix< r_4 > MultiCylinders::getRecYXSlice(int kfmin, int kfmax) 228 { 229 TArray< complex<r_4> > & box = getRecSrcBox(); 230 if ((kfmin < 0) || (kfmin >= box.SizeZ()) || (kfmax < kfmin) || (kfmax >= box.SizeZ()) ) 231 throw RangeCheckError("MultiCylinders::getRecXYSlice(kfmin, kfmax)"); 232 TMatrix< r_4> rmtx(box.SizeX(), box.SizeY()); 233 for(int kf=kfmin; kf<=kfmax; kf++) { 234 for(int jy=0; jy<box.SizeY(); jy++) 235 for(int ix=0; ix<box.SizeX(); ix++) 236 rmtx(ix, jy) += myZmodule(box(ix, jy, kf)); 237 } 238 return(rmtx); 239 } -
trunk/Cosmo/RadioBeam/multicyl.h
r3191 r3192 28 28 // longueur @ f=2 ~ 64 (256*lambda/2 = 256*0.25) 29 29 MultiCylinders(int nr=256, int ns=1024); 30 MultiCylinders(char* filename); 30 31 ~MultiCylinders(); 31 32 32 33 // Niveau de print de debug 33 inline void SetPrintLevel(int prl=0) { PrtLev =prl; }34 inline void SetPrintLevel(int prl=0) { PrtLev_=prl; } 34 35 35 // Ajout d'un cylindre, en position pos Y36 // Ajout d'un cylindre, en position posX, posY 36 37 inline int AddCylinder(double posx, double posy) 37 { mCyl .push_back( new MultiBeamCyl(NR, NS, posx, posy) ); return mCyl.size(); }38 { mCyl_.push_back( new MultiBeamCyl(NR_, NS_, posx, posy) ); return mCyl_.size(); } 38 39 39 40 MultiBeamCyl & GetCylinder(int i); … … 41 42 // Specification de la frequence de base f0 et espacement des recepteurs 42 43 inline void SetBaseFreqDa(double f0=2., double a=0.25) 43 { freq0 = f0; Da= a; }44 { freq0_ = f0; Da_ = a; } 44 45 45 46 // frequences reduites (entre 0 ... 0.5) , angle en radian, amp ~ 1 … … 49 50 50 51 // Definition du sigma du bruit gaussien sur les echantillons 51 inline void SetNoiseSigma(double sig=0.) { signoise = sig; }52 inline void SetNoiseSigma(double sig=0.) { signoise_ = sig; } 52 53 // Definition du sigma du jitter d'horloge (typ 0.01) 53 inline void SetTimeJitter(double tjit=0.) { timejitter = tjit; }54 inline void SetTimeJitter(double tjit=0.) { timejitter_ = tjit; } 54 55 // Definition du sigma des offsets d'horloge entre recepteurs (typ 0.02) 55 inline void SetTimeOffsetSigma(double tsig=0.) { toffsig = tsig; }56 inline void SetTimeOffsetSigma(double tsig=0.) { toffsig_ = tsig; } 56 57 57 58 // Definition du gain et sigma de fluctuations de gain 58 59 // nzerogain: nb de recepteurs (choisis au hasard) avec gain mis a zero 59 60 inline void SetGains(double g=1., double sigg=0., int nzerogain=0) 60 { gain =g; siggain=sigg; ngainzero= nzerogain; }61 { gain_=g; siggain_=sigg; ngainzero_ = nzerogain; } 61 62 62 63 … … 72 73 // @f = 2 , lambda = 0.5 ===> posY <~ lambda/(2 sin resol) 73 74 // ===> posY < ~ 20 74 void ReconstructSourceBox(int halfny=10, double stepangy=M_PI/300); 75 // void ReconstructSourceBox(int halfny=10, double stepangy=M_PI/300); 76 void ReconstructSourceBox(int halfny, double stepangy, int ny, double stepangx); 75 77 76 78 … … 78 80 // avec la moyenne des modules entre kfmin <= k (selon z) <= kfmax 79 81 TMatrix< r_4 > getRecXYSlice(int kfmin, int kfmax); 82 TMatrix< r_4 > getRecYXSlice(int kfmin, int kfmax); 80 83 81 84 // Acces a la boite 3D de sources reconstruite 82 inline TArray< complex<r_4> > & getRecSrcBox() { return cmplx_srcbox ; }85 inline TArray< complex<r_4> > & getRecSrcBox() { return cmplx_srcbox_; } 83 86 84 87 // Configure chaque cylindre a partir des parametres de la classe … … 86 89 void ConfigureCylinders(); 87 90 91 private: 88 92 //-------------- Variables membres ------------ 89 int NR , NS; // nb recepteurs, nb d'echantillons ds chaque paquet93 int NR_, NS_; // nb recepteurs, nb d'echantillons ds chaque paquet 90 94 91 int PrtLev ; // Niveau de print de debug95 int PrtLev_; // Niveau de print de debug 92 96 93 double Da ; // distance entre recepteurs94 double freq0 ; // frequence de base (freqvrai=f+freq0)97 double Da_; // distance entre recepteurs 98 double freq0_; // frequence de base (freqvrai=f+freq0) 95 99 96 double timejitter ; // le sigma du jitter en temps des coups d'horloge97 double toffsig ; // sigma des offsets en temps100 double timejitter_; // le sigma du jitter en temps des coups d'horloge 101 double toffsig_; // sigma des offsets en temps 98 102 99 BRSourceGen* src ; // Les sources100 bool adfg ; // if true, delete src103 BRSourceGen* src_; // Les sources 104 bool adfg_; // if true, delete src 101 105 102 double signoise ; // sigma du bruit additif (bruit ampli ... )103 double gain , siggain;104 int ngainzero ;106 double signoise_; // sigma du bruit additif (bruit ampli ... ) 107 double gain_, siggain_; 108 int ngainzero_; 105 109 106 vector<MultiBeamCyl *> mCyl ; // Les differents cylindres110 vector<MultiBeamCyl *> mCyl_; // Les differents cylindres 107 111 108 TArray< complex<r_4> > cmplx_srcbox ; // boite3D des sources (angX,Y,freq) reconstruit112 TArray< complex<r_4> > cmplx_srcbox_; // boite3D des sources (angX,Y,freq) reconstruit 109 113 }; 110 114 -
trunk/Cosmo/RadioBeam/treccyl.cc
r3191 r3192 17 17 18 18 #include "timing.h" 19 #include "datacards.h" 20 #include <dvlist.h> 19 21 20 22 #include "multicyl.h" 21 23 #include "mbeamcyl.h" 24 #define LENGTH 1024 22 25 23 26 /* … … 32 35 // Declaration des fonctions de ce fichier 33 36 static int test1cyl(string& ppfname); 34 static int testmulticyl(string& ppfname, int ncyl=5); 37 static int testmulticyl(string& ppfname); 38 int ReadParam(char* fileName); 35 39 36 40 //----------------------------------------------------------- 37 41 // -------------- Parametres de simulation ----------------- 38 42 //----------------------------------------------------------- 43 static double tClock = 2.; // should come from param file !!!! 44 static double cLight=0.3; // in 1E9 m/s 45 //static double tClock = 1.; // should come from param file !!!! 46 //static double cLight=1.; // in 1E9 m/s 47 // 39 48 static int MR = 256; // Nombre de recepteur 40 static int NE = 1024; // Nombre d'echantillon en temps;49 static int NE = 64; // Nombre d'echantillon en temps; 41 50 static double freq0 = 2.; // frequence de base 42 51 static double da = 0.25; // pas des antennes le long du cylindre … … 44 53 static double maxangX = M_PI/3.; // angle max en X ( +/- ) 45 54 static double maxangY = M_PI/60.; // angle max en Y ( +/- ) 55 static int halfNY; 56 static int NX; 46 57 static int nsrcmax = 50; // Nb total de sources - en un plan 47 58 … … 53 64 static int nantgz = 0; // nb d'antennes morts (-> gain=0) 54 65 static int prtlevel = 0; // niveau de print 66 67 static int nCyl; 68 static double xCyl[1000]; 69 static double yCyl[1000]; 55 70 //----------------------------------------------------------- 56 71 … … 64 79 { 65 80 66 SophyaInit(); 67 InitTim(); // Initializing the CPU timer 68 69 string ppfname = "treccyl.ppf"; 70 int act = 1; 71 int ncyl = 5; 72 if (narg < 2) { 73 cout << "Usage: treccyl act ppfname [PrtLev=0] \n" 74 << " -act= X ou XY5 ou XY12 (5 ou 12 cylindres) \n" 81 SophyaInit(); 82 InitTim(); // Initializing the CPU timer 83 ReadParam("telescope.in"); 84 cout <<"MR="<< MR <<" NE="<<NE<<" freq0="<<freq0<<" "<<da<<" "<<maxangX <<endl; 85 cout << maxangY<<" "<<nsrcmax <<" "<< snoise<<" "<< tjit<<" "<< tos<<" "<<gmean <<endl; 86 cout << gsig<<" "<<nantgz <<" "<< prtlevel<<endl; 87 // return 1; 88 89 string ppfname = "treccyl.ppf"; 90 int act = 1; 91 // int ncyl = 5; 92 if (narg < 2) { 93 cout << "Usage: treccyl act ppfname \n" 94 << " -act= X ou XY \n" 75 95 << " -ppfname= treccyl.ppf par defaut" << endl; 76 return 1; 77 } 78 if (strcmp(arg[1],"XY5") == 0) { act = 2; ncyl = 5; } 79 else if (strcmp(arg[1],"XY12") == 0) { act = 2; ncyl = 12; } 80 if (narg > 2) ppfname = arg[2]; 81 if (narg > 3) prtlevel = atoi(arg[3]); 82 83 int rc = 0; 84 cout << ">>>> treccyl : " << arg[1] << " PPFName=" << ppfname << endl; 85 try { 86 if (act == 2) rc = testmulticyl(ppfname, ncyl); 87 else rc = test1cyl(ppfname); 88 } 96 return 1; 97 } 98 if (strcmp(arg[1],"XY") == 0) { act = 2 ;} 99 if (narg > 2) ppfname = arg[2]; 100 101 int rc = 0; 102 cout << ">>>> treccyl : " << arg[1] << " PPFName=" << ppfname << endl; 103 try { 104 if (act == 2) rc = testmulticyl(ppfname); 105 else rc = test1cyl(ppfname); 106 } 89 107 catch (PThrowable& exc) { 90 108 cerr << " treccyl.cc catched Exception " << exc.Msg() << endl; … … 101 119 } 102 120 103 cout << ">>>> treccyl ------- FIN ----------- Rc=" << rc << endl;104 return rc;121 cout << ">>>> treccyl ------- FIN ----------- Rc=" << rc << endl; 122 return rc; 105 123 } 106 124 107 125 126 //----------------------------------------------------------------------------- 108 127 //--- Fonction de test : reconstruction plan AngX-Frequence (1 cylindre) 109 128 int test1cyl(string& ppfname) … … 111 130 112 131 // BRSourceGen sg; 113 int nsrc = 60;132 // int nsrc = 60; 114 133 BRSourceGen sg(nsrcmax, maxangX, 0.); 115 134 // sg.WritePPF(string("brsrc1.ppf")); … … 140 159 141 160 POutPersist po(ppfname); 142 po << PPFNameTag("signal") << mb.signal; 143 po << PPFNameTag("sigjitt") << mb.sigjitt; 144 po << PPFNameTag("f_sig") << mb.f_sig; 145 po << PPFNameTag("f_sigjit") << mb.f_sigjit; 161 // direct access to variables members !!!! 162 po << PPFNameTag("signal") << mb.signal_; 163 po << PPFNameTag("sigjitt") << mb.sigjitt_; 164 po << PPFNameTag("f_sig") << mb.f_sig_; 165 po << PPFNameTag("f_sigjit") << mb.f_sigjit_; 146 166 147 167 NTuple ntsrc = sg.Convert2Table(freq0); … … 163 183 164 184 185 //----------------------------------------------------------------------------- 165 186 //--- Fonction de test : reconstruction cube AngX-AngY-Frequence (multi-cylindre) 166 int testmulticyl(string& ppfname , int ncyl)187 int testmulticyl(string& ppfname) 167 188 { 168 189 169 if ((ncyl != 5) && (ncyl != 12)) ncyl = 5; 170 190 //............. sources 171 191 // BRSourceGen sg; 172 192 int nsf = 6; 173 193 vector<double> frq; 174 frq.push_back(0.1 );175 frq.push_back(0.27 );176 frq.push_back(0.38 );194 frq.push_back(0.1/tClock); 195 frq.push_back(0.27/tClock); 196 frq.push_back(0.38/tClock); 177 197 178 198 … … 183 203 int is; 184 204 double fay[6] = {-0.7,-0.5,0.,0.,0.5,0.7}; 205 // double fay[6] = {-0.2,0.5,-0.3,0.6,-0.1,0.7}; 206 // double fax[6] = {0.6,-0.2,-0.5,0.4,-0.1,0.3}; 185 207 for(is=0; is<3*nsf; is++) { 186 208 int ism = is%nsf; 187 sg.angX(is) = maxangX*(ism-2.5)/3.; 188 sg.angY(is) = maxangY*fay[ism]; 209 sg.angX(is) = maxangX*(ism-2.5)/3.; // accessing data member 210 sg.angY(is) = maxangY*fay[ism]; // directly !!! 211 // sg.angX(is) = maxangX*fax[ism]; // accessing data member 189 212 } 190 213 // sg.WritePPF(string("brsrcm.ppf")); 191 214 // BRSourceGen sg(string("brsrcm.ppf")); 192 215 cout << "=== testmulticyl: NbSrc= " << sg.NbSources() 193 << " NbRecep=" << MR << " NSamples=" << NE << " NCyl=" << n cyl << endl;216 << " NbRecep=" << MR << " NSamples=" << NE << " NCyl=" << nCyl << endl; 194 217 if (prtlevel > 1) sg.Print(cout); 195 218 196 197 MultiCylinders mcyl (MR, NE); 198 mcyl.SetPrintLevel(prtlevel); 199 mcyl.SetBaseFreqDa(freq0, da); 200 mcyl.SetNoiseSigma(snoise); 201 mcyl.SetTimeJitter(tjit); 202 mcyl.SetTimeOffsetSigma(tos); 203 mcyl.SetGains(gmean, gsig, nantgz); 204 205 if (ncyl == 12) { 206 cout << " --- testmulticyl/ NCyl= " << ncyl << " posY=0 ... " << (ncyl-1)*5. 207 << " (EqualSpacing)" << endl; 208 for(int kkc=0; kkc<12; kkc++) { 209 cout << "..." << kkc << " - mcyl.AddCylinder(posY= " << 5.*kkc << " )" << endl; 210 mcyl.AddCylinder(5.*kkc,5.*kkc); 211 // mcyl.AddCylinder(0.,5.*kkc); 212 } 213 } 214 else { 215 cout << " --- testmulticyl/ NCyl= " << ncyl << " posY=0 ... 55 (IrregularSpacing)" << endl; 216 double posyc[5] = {0.,5.,15.,35.,55.}; 217 for(int kkc=0; kkc<5; kkc++) { 218 cout << "..." << kkc << " - mcyl.AddCylinder(posY= " << posyc[kkc] << " )" << endl; 219 mcyl.AddCylinder(posyc[kkc],posyc[kkc]); 220 } 221 } 219 //.......................... cylinders 220 MultiCylinders mcyl ("telescope.in"); 221 // MultiCylinders mcyl (MR, NE); 222 // mcyl.SetPrintLevel(prtlevel); 223 // mcyl.SetBaseFreqDa(freq0, da); 224 // mcyl.SetNoiseSigma(snoise); 225 // mcyl.SetTimeJitter(tjit); 226 // mcyl.SetTimeOffsetSigma(tos); 227 // mcyl.SetGains(gmean, gsig, nantgz); 228 229 // for (int iCyl=0; iCyl<nCyl; iCyl++) 230 // { 231 // mcyl.AddCylinder(xCyl[iCyl],yCyl[iCyl]); 232 // } 233 222 234 223 235 mcyl.SetSources(sg); … … 226 238 227 239 // mcyl.ReconstructCylinderPlaneS(true); 228 mcyl.ReconstructSourceBox( 10, maxangY/10.);240 mcyl.ReconstructSourceBox(halfNY, maxangY/halfNY, NX, maxangX/NX); 229 241 230 242 cout << "--- treccy/testmulticyl: Saving to PPF file " << ppfname << endl; 231 243 POutPersist po(ppfname); 232 244 245 DVList dvl; 246 dvl("Da") = da; 247 po << PPFNameTag("dvl") <<dvl; 248 233 249 NTuple ntsrc = sg.Convert2Table(freq0); 234 250 po << PPFNameTag("ntsrc") << ntsrc; 235 251 236 {237 252 // TMatrix<r_4> srcplane0 = module(mcyl.GetCylinder(0).getRecSrcPlane()); 238 253 TMatrix< complex<r_4> > srcplane0 = mcyl.GetCylinder(0).getRecSrcPlane(); 239 254 po << PPFNameTag("recsrcplane0") << srcplane0; 240 } 241 242 { 243 // TMatrix<r_4> srcplane2 = module(mcyl.GetCylinder(3).getRecSrcPlane()); 244 TMatrix< complex<r_4> > srcplane2 = mcyl.GetCylinder(2).getRecSrcPlane(); 245 po << PPFNameTag("recsrcplane2") << srcplane2; 246 } 247 248 { 249 // TMatrix<r_4> srcplane3 = module(mcyl.GetCylinder(3).getRecSrcPlane()); 250 TMatrix< complex<r_4> > srcplane3 = mcyl.GetCylinder(0).getRecSrcPlane(); 251 po << PPFNameTag("recsrcplane3") << srcplane3; 252 } 253 255 TMatrix< complex<r_4> > srcplane1 = mcyl.GetCylinder(1).getRecSrcPlane(); 256 po << PPFNameTag("recsrcplane1") << srcplane1; 257 // TMatrix< complex<r_4> > srcplane3 = mcyl.GetCylinder(3).getRecSrcPlane(); 258 // po << PPFNameTag("recsrcplane3") << srcplane3; 254 259 PrtTim("testmulticyl[2] "); 255 260 256 int kfmin, kfmax;257 261 po << PPFNameTag("recsrcbox") << mcyl.getRecSrcBox(); 258 kfmin = mcyl.getRecSrcBox().SizeZ()/0.5*frq[0] - 2; kfmax = kfmin+2; 262 263 // k= N T frq with N=2*SizeZ() 264 int kfmin = (int)(2.*frq[0]*tClock*(float)mcyl.getRecSrcBox().SizeZ() - 2.); 265 int kfmax = kfmin+2; 259 266 cout << "testmulticyl/Info: slice0 kfmin=" << kfmin << " kfmax=" << kfmax << endl; 260 {261 267 TMatrix<r_4> slice0 = mcyl.getRecXYSlice(kfmin, kfmax); 262 268 po << PPFNameTag("recXYf0") << slice0; 263 }264 kfm in = mcyl.getRecSrcBox().SizeZ()/0.5*frq[1] - 2; kfmax = kfmin+2;269 kfmin = (int)(2*frq[1]*tClock*(float)mcyl.getRecSrcBox().SizeZ() - 2.); 270 kfmax = kfmin+2; 265 271 cout << "testmulticyl/Info: slice1 kfmin=" << kfmin << " kfmax=" << kfmax << endl; 266 {267 272 TMatrix<r_4> slice1 = mcyl.getRecXYSlice(kfmin, kfmax); 268 273 po << PPFNameTag("recXYf1") << slice1; 269 }270 kfm in = mcyl.getRecSrcBox().SizeZ()/0.5*frq[2] - 2; kfmax = kfmin+2;274 kfmin = (int)(2*frq[2]*tClock*(float)mcyl.getRecSrcBox().SizeZ() - 2.); 275 kfmax = kfmin+2; 271 276 cout << "testmulticyl/Info: slice2 kfmin=" << kfmin << " kfmax=" << kfmax << endl; 272 {273 277 TMatrix<r_4> slice2 = mcyl.getRecXYSlice(kfmin, kfmax); 274 278 po << PPFNameTag("recXYf2") << slice2; 275 }276 279 277 280 PrtTim("testmulticyl[3] "); … … 280 283 281 284 } 285 286 //--------------------------------------------------------------------- 287 int ReadParam(char* fileName) 288 { 289 DataCards dc; 290 dc.ReadFile(fileName); 291 // frequences are in units of 1/T = 0.5 GHz 292 // distance are in units of cT =3E8 * 2E-9=0.60 m 293 // double fUnit=0.5; // 0.5 GHz <=> T = 2 ns 294 // double dUnit=0.6; // distance unit in m. 295 double fUnit=1.; // 0.5 GHz <=> T = 2 ns 296 double dUnit=1.; // distance unit in m. 297 298 NE=dc.IParam("nSample"); 299 freq0=dc.DParam("freq0")/fUnit; 300 // tClock=dc.DParam("tClock"); 301 nCyl=dc.IParam("nCyl"); 302 for (int i=0; i<nCyl; i++){ 303 xCyl[i]=dc.DParam("xCyl",i)/dUnit; 304 yCyl[i]=dc.DParam("yCyl",i)/dUnit; 305 } 306 MR=dc.IParam("nAntenna"); 307 da=dc.DParam("dAntenna")/dUnit; 308 maxangX=dc.DParam("angMaxX"); 309 double cylDiam=dc.DParam("cylinderDiam")/dUnit; 310 // thetaMax = lambda_M/d = c/freq_min/d; freq_min = freq0 + 1/2T 311 maxangY=cLight/(freq0+1./2./tClock)/cylDiam; 312 // cout << "*************** maxangY = " <<maxangY << endl; 313 // maxangY=dc.DParam("angMaxY"); 314 snoise=dc.DParam("noiseSigma"); 315 tjit=dc.DParam("sigmaTimeJitt"); 316 tos=dc.DParam("sigmaClockJitt"); 317 gmean=dc.DParam("meanGain"); 318 gsig=dc.DParam("sigmaGain"); 319 nantgz=dc.IParam("nDeadAntenna"); 320 prtlevel=dc.IParam("printLevel"); 321 halfNY=dc.IParam("halfNY"); 322 NX=dc.IParam("NX"); 323 return 1; 324 }
Note:
See TracChangeset
for help on using the changeset viewer.