| 1 | //  Classes to compute 2D 
 | 
|---|
| 2 | // R. Ansari - Nov 2008, May 2010 
 | 
|---|
| 3 | 
 | 
|---|
| 4 | #include "mdish.h"
 | 
|---|
| 5 | 
 | 
|---|
| 6 | 
 | 
|---|
| 7 | //--------------------------------------------------
 | 
|---|
| 8 | // -- Four2DResponse class 
 | 
|---|
| 9 | //--------------------------------------------------
 | 
|---|
| 10 | // Constructor
 | 
|---|
| 11 | Four2DResponse::Four2DResponse(int typ, double dx, double dy, double lambda)
 | 
|---|
| 12 |   : typ_(typ), dx_((dx>1.e-3)?dx:1.), dy_((dy>1.e-3)?dy:1.)
 | 
|---|
| 13 | {
 | 
|---|
| 14 |   setLambdaRef(lambda);
 | 
|---|
| 15 |   setLambda(lambda);
 | 
|---|
| 16 | }
 | 
|---|
| 17 | 
 | 
|---|
| 18 | // Return the response for the wave vecteor (kx,ky)
 | 
|---|
| 19 | double Four2DResponse::Value(double kx, double ky)
 | 
|---|
| 20 | {
 | 
|---|
| 21 |   kx *= lambda_ratio_;
 | 
|---|
| 22 |   ky *= lambda_ratio_;
 | 
|---|
| 23 |   double wk,wkx,wky;
 | 
|---|
| 24 |   switch (typ_) 
 | 
|---|
| 25 |     {
 | 
|---|
| 26 |     case 1:   // Reponse gaussienne parabole diametre D exp[ - 0.5 (lambda  k_g / D )^2 ]
 | 
|---|
| 27 |       wk = sqrt(kx*kx+ky*ky)/dx_;
 | 
|---|
| 28 |       wk = 0.5*wk*wk;
 | 
|---|
| 29 |       return exp(-wk);
 | 
|---|
| 30 |       break;
 | 
|---|
| 31 |     case 2:   // Reponse parabole diametre D  Triangle <= kmax= 2 pi D / lambda   
 | 
|---|
| 32 |       wk = sqrt(kx*kx+ky*ky)/dx_/2./M_PI;
 | 
|---|
| 33 |       return ( (wk<1.)?(1.-wk):0.);
 | 
|---|
| 34 |       break;
 | 
|---|
| 35 |     case 22:   // Reponse parabole diametre D  Triangle <= kmax= 2 pi D / lambda + trou au centre
 | 
|---|
| 36 |       wk = sqrt(kx*kx+ky*ky)/dx_/2./M_PI;
 | 
|---|
| 37 |       if (wk<0.025) return 39.*wk;
 | 
|---|
| 38 |       else if (wk<1.) return (1.-wk);
 | 
|---|
| 39 |       else return 0.;
 | 
|---|
| 40 |       break;
 | 
|---|
| 41 |     case 3:   // Reponse rectangle Dx x Dy  Triangle (|kx|,|k_y|) <= (2 pi Dx / lambda, 2 pi Dx / lambda) 
 | 
|---|
| 42 |       wkx = fabs(kx)/2./M_PI/dx_; 
 | 
|---|
| 43 |       wky = fabs(ky)/2./M_PI/dy_; 
 | 
|---|
| 44 |       return ( ((wkx<1.)&&(wky<1.))?((1.-wkx)*(1-wky)):0.);
 | 
|---|
| 45 |       break;
 | 
|---|
| 46 |     default:
 | 
|---|
| 47 |       return 1.;
 | 
|---|
| 48 |     }
 | 
|---|
| 49 | }
 | 
|---|
| 50 | // Return a vector representing the power spectrum (for checking) 
 | 
|---|
| 51 | Histo2D Four2DResponse::GetResponse(int nx, int ny)
 | 
|---|
| 52 | {
 | 
|---|
| 53 |   double kxmx = 1.2*DeuxPI*dx_;
 | 
|---|
| 54 |   double kymx = 1.2*DeuxPI*dy_;
 | 
|---|
| 55 |   if (typ_<3) kymx=kxmx; 
 | 
|---|
| 56 |   Histo2D h2(-kxmx,kxmx,nx,-kymx,kymx,ny);
 | 
|---|
| 57 | 
 | 
|---|
| 58 |   double xbc,ybc;
 | 
|---|
| 59 |   for(int_4 j=0; j<h2.NBinY(); j++) 
 | 
|---|
| 60 |     for(int_4 i=0; i<h2.NBinX(); i++) {
 | 
|---|
| 61 |       h2.BinCenter(i,j,xbc,ybc);
 | 
|---|
| 62 |       h2(i,j) = Value(xbc,ybc);
 | 
|---|
| 63 |     }
 | 
|---|
| 64 |   return h2;    
 | 
|---|
| 65 | }
 | 
|---|
| 66 | 
 | 
|---|
| 67 | //---------------------------------------------------------------
 | 
|---|
| 68 | // -- Four2DRespTable : Reponse tabulee instrumentale ds le plan k_x,k_y (angles theta,phi) 
 | 
|---|
| 69 | //---------------------------------------------------------------
 | 
|---|
| 70 | Four2DRespTable::Four2DRespTable()
 | 
|---|
| 71 |   : Four2DResponse(0,1.,1.)
 | 
|---|
| 72 | {
 | 
|---|
| 73 | }
 | 
|---|
| 74 | 
 | 
|---|
| 75 | Four2DRespTable::Four2DRespTable(Histo2D const & hrep, double d, double lambda)
 | 
|---|
| 76 |   : Four2DResponse(0,d,d,lambda) , hrep_(hrep)
 | 
|---|
| 77 | {
 | 
|---|
| 78 | }
 | 
|---|
| 79 | 
 | 
|---|
| 80 | double Four2DRespTable::Value(double kx, double ky)
 | 
|---|
| 81 | {
 | 
|---|
| 82 |   kx *= lambda_ratio_;
 | 
|---|
| 83 |   ky *= lambda_ratio_;
 | 
|---|
| 84 |   int_4 i,j;
 | 
|---|
| 85 |   if ( (kx<=hrep_.XMin())||(kx>=hrep_.XMax()) || 
 | 
|---|
| 86 |        (ky<=hrep_.YMin())||(ky>=hrep_.YMax()) )  return 0.;
 | 
|---|
| 87 |   hrep_.FindBin(kx, ky, i, j);
 | 
|---|
| 88 |   return hrep_(i, j);
 | 
|---|
| 89 | }
 | 
|---|
| 90 | 
 | 
|---|
| 91 | double Four2DRespTable::renormalize(double max)
 | 
|---|
| 92 | {
 | 
|---|
| 93 |   double cmx = hrep_.VMax();
 | 
|---|
| 94 |   hrep_ *= (max/cmx);
 | 
|---|
| 95 |   return cmx;
 | 
|---|
| 96 | }
 | 
|---|
| 97 | 
 | 
|---|
| 98 | void Four2DRespTable::writeToPPF(string flnm)
 | 
|---|
| 99 | {
 | 
|---|
| 100 |   DVList dvinfo;
 | 
|---|
| 101 |   dvinfo["DoL"] = dx_;
 | 
|---|
| 102 |   dvinfo["LambdaRef"] = lambdaref_;
 | 
|---|
| 103 |   dvinfo["Lambda"] = lambda_;
 | 
|---|
| 104 |   POutPersist po(flnm);
 | 
|---|
| 105 |   po << hrep_;
 | 
|---|
| 106 |   po << dvinfo;
 | 
|---|
| 107 | }
 | 
|---|
| 108 | 
 | 
|---|
| 109 | void Four2DRespTable::readFromPPF(string flnm)
 | 
|---|
| 110 | {
 | 
|---|
| 111 |   PInPersist pin(flnm);
 | 
|---|
| 112 |   DVList dvinfo;
 | 
|---|
| 113 |   pin >> hrep_;
 | 
|---|
| 114 |   pin >> dvinfo;
 | 
|---|
| 115 |   dx_ = dy_ = dvinfo["DoL"];
 | 
|---|
| 116 |   setLambdaRef((double)dvinfo["LambdaRef"]);
 | 
|---|
| 117 |   setLambda((double)dvinfo["Lambda"]); 
 | 
|---|
| 118 | }
 | 
|---|
| 119 | 
 | 
|---|
| 120 | 
 | 
|---|
| 121 | 
 | 
|---|
| 122 | //---------------------------------------------------------------
 | 
|---|
| 123 | // -- Four2DRespRatio : rapport de la reponse entre deux objets Four2DResponse
 | 
|---|
| 124 | //---------------------------------------------------------------
 | 
|---|
| 125 | Four2DRespRatio::Four2DRespRatio(Four2DResponse& a, Four2DResponse& b, double divzthr)
 | 
|---|
| 126 |   : Four2DResponse(0, a.D(), a.D()), a_(a), b_(b), divzthr_(divzthr)
 | 
|---|
| 127 | {
 | 
|---|
| 128 | }
 | 
|---|
| 129 | 
 | 
|---|
| 130 | double Four2DRespRatio::Value(double kx, double ky)
 | 
|---|
| 131 | {
 | 
|---|
| 132 |   double ra = a_.Value(kx,ky);
 | 
|---|
| 133 |   double rb = b_.Value(kx,ky);
 | 
|---|
| 134 |   if (ra<rb) {
 | 
|---|
| 135 |     if (rb>1.e-39)  return(ra/rb);  
 | 
|---|
| 136 |     else return 0.;
 | 
|---|
| 137 |   }
 | 
|---|
| 138 |   if (rb<divzthr_)  rb=divzthr_;
 | 
|---|
| 139 |   return (ra/rb);
 | 
|---|
| 140 | }
 | 
|---|
| 141 | 
 | 
|---|
| 142 | //---------------------------------------------------------------
 | 
|---|
| 143 | //--- Classe simple pour le calcul de rotation 
 | 
|---|
| 144 | class Rotation {
 | 
|---|
| 145 | public:
 | 
|---|
| 146 |   Rotation(double tet, double phi)
 | 
|---|
| 147 |   {
 | 
|---|
| 148 | // (Teta,Phi) = Direction de visee 
 | 
|---|
| 149 | // Les angles d'Euler correspondants sont Teta, Phi+Pi/2
 | 
|---|
| 150 | // Le Pi/2 vient que les rotations d'euler se font dans l'ordre
 | 
|---|
| 151 | //  Autour de oZ d'angle Phi, autour de oN (nouvel axe X) d'angle Teta
 | 
|---|
| 152 | //  Autour du nouvel axe Z (x3) d'angle Psi  (Psi=0 -> cp=1, sp=0.;
 | 
|---|
| 153 |   double ct = cos(tet);
 | 
|---|
| 154 |   double st = sin(tet);
 | 
|---|
| 155 |   // Le Pi/2 echange les axes X<>Y pour theta=phi=0 !
 | 
|---|
| 156 |   //  double cf = cos(phi+M_PI/2);
 | 
|---|
| 157 |   //  double sf = sin(phi+M_PI/2);
 | 
|---|
| 158 |   double cf = cos(phi);
 | 
|---|
| 159 |   double sf = sin(phi);
 | 
|---|
| 160 |   double cp = 1.; // cos((double)pO);
 | 
|---|
| 161 |   double sp = 0.; // sin((double)pO);
 | 
|---|
| 162 |   RE[0][0] = cf*cp-sf*ct*sp;     RE[0][1] = sf*cp+cf*ct*sp;      RE[0][2] = st*sp;
 | 
|---|
| 163 |   RE[1][0] = -cf*sp-sf*ct*cp;    RE[1][1] = -sf*sp+cf*ct*cp;     RE[1][2] = st*cp;
 | 
|---|
| 164 |   RE[2][0] = sf*st;              RE[2][1] = -cf*st;              RE[2][2] = ct;
 | 
|---|
| 165 |   }
 | 
|---|
| 166 |   inline void Do(double& x, double& y)
 | 
|---|
| 167 |   {
 | 
|---|
| 168 |     double xx=x; 
 | 
|---|
| 169 |     double yy=y;
 | 
|---|
| 170 |     x = RE[0][0]*xx+RE[0][1]*yy;
 | 
|---|
| 171 |     y = RE[1][0]*xx+RE[1][1]*yy;
 | 
|---|
| 172 |   }
 | 
|---|
| 173 |   double RE[3][3];
 | 
|---|
| 174 | };
 | 
|---|
| 175 | 
 | 
|---|
| 176 | 
 | 
|---|
| 177 | //----------------------------------------------------------------------
 | 
|---|
| 178 | //  -- Pour calculer la reponse ds le plan kx,ky d'un system MultiDish 
 | 
|---|
| 179 | //----------------------------------------------------------------------
 | 
|---|
| 180 | MultiDish::MultiDish(double lambda, double dmax, vector<Dish>& dishes, bool fgnoauto)
 | 
|---|
| 181 |   : lambda_(lambda), dmax_(dmax), dishes_(dishes), fgnoauto_(fgnoauto)
 | 
|---|
| 182 | { 
 | 
|---|
| 183 |   SetThetaPhiRange();
 | 
|---|
| 184 |   SetRespHisNBins();
 | 
|---|
| 185 |   SetBeamNSamples();
 | 
|---|
| 186 |   SetPrtLevel();
 | 
|---|
| 187 |   mcnt_=0;
 | 
|---|
| 188 | }
 | 
|---|
| 189 | 
 | 
|---|
| 190 | Histo2D MultiDish::GetResponse()
 | 
|---|
| 191 | {
 | 
|---|
| 192 |   cout << " MultiDish::GetResponse() - NDishes=" << dishes_.size() << " nx=" << nx_ << " ny=" << ny_ << endl;
 | 
|---|
| 193 |   double kmx = 1.2*DeuxPI*dmax_/lambda_;
 | 
|---|
| 194 |   double dkmx = kmx/(double)nx_;
 | 
|---|
| 195 |   double dkmy = kmx/(double)ny_;
 | 
|---|
| 196 |   double kmxx = ((double)nx_+0.5)*dkmx;
 | 
|---|
| 197 |   double kmxy = ((double)ny_+0.5)*dkmy;
 | 
|---|
| 198 |   h2w_.Define(-kmxx,kmxx,2*nx_+1,-kmxy,kmxy,2*ny_+1);
 | 
|---|
| 199 |   h2w_.SetZeroBin(0.,0.);
 | 
|---|
| 200 | 
 | 
|---|
| 201 |   double dold = dishes_[0].Diameter()/lambda_;
 | 
|---|
| 202 |   double dolx = dishes_[0].DiameterX()/lambda_;
 | 
|---|
| 203 |   double doly = dishes_[0].DiameterY()/lambda_;
 | 
|---|
| 204 | 
 | 
|---|
| 205 |   Four2DResponse rd(2, dold, dold);
 | 
|---|
| 206 |   Four2DResponse rdr(3, dolx, doly);
 | 
|---|
| 207 | 
 | 
|---|
| 208 |   if (!dishes_[0].isCircular())  rd = rdr;
 | 
|---|
| 209 | 
 | 
|---|
| 210 |   double dtet = thetamax_/(double)ntet_;
 | 
|---|
| 211 |   double dphi = phimax_/(double)nphi_;
 | 
|---|
| 212 |   cout << " MultiDish::GetResponse() - ThetaMax=" << thetamax_ << " NTheta=" << ntet_ 
 | 
|---|
| 213 |        << " PhiMax=" <<  phimax_ << " NPhi=" << nphi_ << endl;
 | 
|---|
| 214 | 
 | 
|---|
| 215 |   double sumw = 0.;
 | 
|---|
| 216 |   for(int kt=0; kt<ntet_; kt++) {
 | 
|---|
| 217 |     double theta=(double)kt*dtet;
 | 
|---|
| 218 |     for(int jp=0; jp<nphi_; jp++) {
 | 
|---|
| 219 |       double phi=(double)jp*dphi;
 | 
|---|
| 220 |       sumw += CumulResp(rd, theta, phi);
 | 
|---|
| 221 |       if (theta<1.e-9) continue;
 | 
|---|
| 222 |       sumw += CumulResp(rd, theta, -phi);
 | 
|---|
| 223 |       sumw += CumulResp(rd, theta, phi+M_PI);
 | 
|---|
| 224 |       sumw += CumulResp(rd, theta, -(phi+M_PI));
 | 
|---|
| 225 |     }
 | 
|---|
| 226 |     if (prtlev_>0) cout << "  MultiDish::GetResponse() done ktheta=" << kt << " / MaxNTheta= " << ntet_ << endl; 
 | 
|---|
| 227 |   }
 | 
|---|
| 228 |   double kx1 = DeuxPI*(dishes_[0].DiameterX())/lambda_;
 | 
|---|
| 229 |   double ky1 = DeuxPI*(dishes_[0].DiameterY())/lambda_;
 | 
|---|
| 230 |   int_4 ib,jb;
 | 
|---|
| 231 |   //  h2w_ /= h2cnt_; 
 | 
|---|
| 232 |   Histo2D h2 = h2w_.Convert();
 | 
|---|
| 233 |   h2.FindBin(kx1, ky1, ib, jb);
 | 
|---|
| 234 |   if ((kx1<0)||(ky1<0)||(kx1>=h2.NBinX())||(ky1>=h2.NBinY())) {
 | 
|---|
| 235 |     cout << " MultiDish::GetResponse[1]/ERROR kx1,ky1=" << kx1 <<","<< ky1 << " --> ib,jb=" << ib <<","<< jb << endl;
 | 
|---|
| 236 |     ib=jb=0;
 | 
|---|
| 237 |   }
 | 
|---|
| 238 |   double vmax=h2.VMax();
 | 
|---|
| 239 |   cout << " MultiDish::GetResponse[1] VMin=" << h2.VMin() << " VMax= " << vmax  
 | 
|---|
| 240 |        << " h(0,0)=" << h2(0,0) << " kx1,ky1->h(" << ib <<"," << jb << ")=" << h2(ib,jb) <<endl;
 | 
|---|
| 241 |   //  double fnorm=sqrt((double)dishes_.size())/h2.VMax();
 | 
|---|
| 242 |   double fnorm=1.;
 | 
|---|
| 243 |   if (vmax > sumw) {
 | 
|---|
| 244 |     fnorm=(double)dishes_.size()/h2.VMax();
 | 
|---|
| 245 |     cout << " MultiDish::GetResponse[2]/Warning h2.VMax()=" << vmax << " >  sumw=" << sumw << endl;  
 | 
|---|
| 246 |     cout << "   ... NDishes=" << dishes_.size() << " sumw=" << sumw 
 | 
|---|
| 247 |          << " Renormalizing x NDishes/VMax  " << fnorm << endl;
 | 
|---|
| 248 |   }
 | 
|---|
| 249 |   else {
 | 
|---|
| 250 |     fnorm=(double)dishes_.size()/sumw;
 | 
|---|
| 251 |     cout << " MultiDish::GetResponse[3] NDishes=" << dishes_.size() << " sumw=" << sumw  
 | 
|---|
| 252 |          << " Renormalizing x NDishes/sumw   " << fnorm << endl;
 | 
|---|
| 253 |   }
 | 
|---|
| 254 |   h2 *= fnorm;
 | 
|---|
| 255 |   cout << " ---- MultiDish::GetResponse/[4] APRES VMin=" << h2.VMin() << " VMax= " << h2.VMax() << " h(0,0)=" 
 | 
|---|
| 256 |        << h2(0,0) << endl;
 | 
|---|
| 257 |   return h2;
 | 
|---|
| 258 | }
 | 
|---|
| 259 | 
 | 
|---|
| 260 | Histo2D MultiDish::PosDist(int nx, int ny, double dmax)
 | 
|---|
| 261 | {
 | 
|---|
| 262 |   if (dmax<1e-3)  dmax=nx*dishes_[0].Diameter();
 | 
|---|
| 263 |   double dd = dmax/nx/2.;
 | 
|---|
| 264 |   Histo2D hpos(-dd,dmax+dd,nx+1,-dd,dmax+dd,ny+1);
 | 
|---|
| 265 |   for(size_t i=0; i<NbDishes(); i++) {
 | 
|---|
| 266 |     hpos.Add(dishes_[i].X, dishes_[i].Y);
 | 
|---|
| 267 |   }
 | 
|---|
| 268 |   return hpos;
 | 
|---|
| 269 | }
 | 
|---|
| 270 | 
 | 
|---|
| 271 | double MultiDish::AddToHisto(double kx0, double ky0, double x, double y, double w, bool fgfh)
 | 
|---|
| 272 | {
 | 
|---|
| 273 |   double xxp = kx0+x;
 | 
|---|
| 274 |   double yyp = ky0+y;
 | 
|---|
| 275 |   double sumw=0.;
 | 
|---|
| 276 |   sumw += h2w_.Add(xxp, yyp, w, fgfh);
 | 
|---|
| 277 |   double xxm=kx0-x;
 | 
|---|
| 278 |   double yym=ky0-y;
 | 
|---|
| 279 |   //  if (xxm>0.)  {
 | 
|---|
| 280 |   sumw += h2w_.Add(xxm, yyp, w, fgfh);
 | 
|---|
| 281 |   // if (yym>0.)  
 | 
|---|
| 282 |   sumw += h2w_.Add(xxm, yym, w, fgfh);
 | 
|---|
| 283 |   //  }
 | 
|---|
| 284 |   // if (yym>0.)  
 | 
|---|
| 285 |   sumw += h2w_.Add(xxp, yym, w, fgfh);
 | 
|---|
| 286 |   return sumw; 
 | 
|---|
| 287 | }
 | 
|---|
| 288 | 
 | 
|---|
| 289 | double MultiDish::CumulResp(Four2DResponse& rd, double theta, double phi)
 | 
|---|
| 290 | {
 | 
|---|
| 291 |   //  cout << " MultiDish::CumulResp()  theta=" << theta << " phi=" << phi << endl;
 | 
|---|
| 292 |   /*
 | 
|---|
| 293 |   double dx = h2w_.WBinX()/5;
 | 
|---|
| 294 |   double dy = h2w_.WBinY()/5;
 | 
|---|
| 295 |   int nbx = DeuxPI*rd.Dx()/dx+1;
 | 
|---|
| 296 |   int nby = DeuxPI*rd.Dy()/dy+1;
 | 
|---|
| 297 |   */
 | 
|---|
| 298 |   double dx,dy;
 | 
|---|
| 299 |   int nbx=beamnx_; 
 | 
|---|
| 300 |   int nby=beamny_;
 | 
|---|
| 301 |   dx = DeuxPI*rd.Dx()/(double)nbx;
 | 
|---|
| 302 |   dy = DeuxPI*rd.Dy()/(double)nby;
 | 
|---|
| 303 |   if (mcnt_==0) 
 | 
|---|
| 304 |     cout << " CumulResp() nbx=" << nbx << " nby=" << nby << " dx=" << dx << " dy=" << dy << endl;
 | 
|---|
| 305 |   mcnt_++;
 | 
|---|
| 306 | 
 | 
|---|
| 307 |   double sumw = 0.;
 | 
|---|
| 308 |   Rotation rot(theta, phi);
 | 
|---|
| 309 | 
 | 
|---|
| 310 |   for(size_t i=0; i<dishes_.size(); i++) {
 | 
|---|
| 311 |     for(size_t j=i; j<dishes_.size(); j++) {
 | 
|---|
| 312 |       double kx0 = DeuxPI*(dishes_[i].X-dishes_[j].X)/lambda_;
 | 
|---|
| 313 |       double ky0 = DeuxPI*(dishes_[i].Y-dishes_[j].Y)/lambda_;
 | 
|---|
| 314 |       rot.Do(kx0, ky0);
 | 
|---|
| 315 |       //    if (kx0<0) kx0=-kx0;
 | 
|---|
| 316 |       //    if (ky0<0) ky0=-ky0;
 | 
|---|
| 317 |       bool fgfh= (!fgnoauto_ || (dishes_[i].ReflectorId()!=dishes_[j].ReflectorId()));
 | 
|---|
| 318 |       for(int ix=0; ix<nbx; ix++) 
 | 
|---|
| 319 |         for(int jy=0; jy<nby; jy++) { 
 | 
|---|
| 320 |           double x = ix*dx;  
 | 
|---|
| 321 |           double y = jy*dy;
 | 
|---|
| 322 |           if ((ix>0)&&(jy>0)) {
 | 
|---|
| 323 |             sumw += AddToHisto(kx0, ky0, x, y, rd(x,y), fgfh);
 | 
|---|
| 324 |             if (j!=i) sumw += AddToHisto(-kx0, -ky0, x, y, rd(x,y), fgfh);
 | 
|---|
| 325 |           }
 | 
|---|
| 326 |           else {
 | 
|---|
| 327 |             if ((ix==0)&&(jy==0)) {
 | 
|---|
| 328 |               sumw += h2w_.Add(kx0, ky0, rd(0.,0.), fgfh);
 | 
|---|
| 329 |               if (j!=i) sumw += h2w_.Add(-kx0, -ky0, rd(0.,0.), fgfh);
 | 
|---|
| 330 |             }
 | 
|---|
| 331 |             else {
 | 
|---|
| 332 |               double w = rd(x,y);
 | 
|---|
| 333 |               if (ix==0) {
 | 
|---|
| 334 |                 sumw += h2w_.Add(kx0, ky0+y, w, fgfh);
 | 
|---|
| 335 |                 sumw += h2w_.Add(kx0, ky0-y, w, fgfh);
 | 
|---|
| 336 |                 if (j!=i) {
 | 
|---|
| 337 |                   sumw += h2w_.Add(-kx0, -ky0+y, w, fgfh);
 | 
|---|
| 338 |                   sumw += h2w_.Add(-kx0, -ky0-y, w, fgfh);
 | 
|---|
| 339 |                 }
 | 
|---|
| 340 |               }
 | 
|---|
| 341 |               else {
 | 
|---|
| 342 |                 sumw += h2w_.Add(kx0+x, ky0, w, fgfh);
 | 
|---|
| 343 |                 sumw += h2w_.Add(kx0-x, ky0, w, fgfh);
 | 
|---|
| 344 |                 if (j!=i) {
 | 
|---|
| 345 |                   sumw += h2w_.Add(-kx0+x, -ky0, w, fgfh);
 | 
|---|
| 346 |                   sumw += h2w_.Add(-kx0-x, -ky0, w, fgfh);
 | 
|---|
| 347 |                 }               
 | 
|---|
| 348 |               }
 | 
|---|
| 349 |             }
 | 
|---|
| 350 |             //   
 | 
|---|
| 351 |           }
 | 
|---|
| 352 |         }
 | 
|---|
| 353 |     //    if (i%10==0) 
 | 
|---|
| 354 |     //      cout << " MultiDish::CumulResp() done i=" << i << " / imax=" << dishes_.size() 
 | 
|---|
| 355 |     //     << " theta=" << theta << " phi=" << phi << endl;
 | 
|---|
| 356 |     }
 | 
|---|
| 357 |   }
 | 
|---|
| 358 |   return sumw;
 | 
|---|
| 359 | }
 | 
|---|
| 360 | 
 | 
|---|