1#ifndef __JPHYSICS__JPDF__ 
    2#define __JPHYSICS__JPDF__ 
  298         const double epsilon        = 1e-12) :
 
  307      for (
double x = 0.5*dx; x < PI; x += dx) {
 
 
  329      const double xmin = 1.0 / 
wmax;
 
  330      const double xmax = 1.0 / 
wmin;
 
  334        const double x  = 0.5 * (xmax + xmin)  +  i->getX() * 0.5 * (xmax - xmin);
 
  335        const double dx = i->getY() * 0.5 * (xmax - xmin);
 
  337        const double w  = 1.0 / x;
 
  338        const double dw = dx * w*w;
 
 
  359                                  const double phi)
 const 
  363      const double R  =  std::max(R_m, 
getRmin());
 
  366      const double px =  sin(theta)*cos(phi);
 
  367      const double pz =  cos(theta);
 
  372        const double dw = m->getY() * 0.5 * (
wmax - 
wmin);
 
  381        const double ct0 = 1.0 / n;
 
  382        const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  384        const double d  = R / st0;                                 
 
  385        const double ct = st0*px + ct0*pz;                         
 
  388        const double V  = exp(-d/l_abs) * exp(-d/ls);              
 
  389        const double W  = A / (2.0*PI*R*st0);                      
 
  391        value += npe * U * V * W;
 
 
  410                                  const double t_ns)
 const 
  412      static const int    N   = 100;                               
 
  413      static const double eps = 1.0e-6;                            
 
  415      const double R  =  std::max(R_m, 
getRmin());
 
  417      const double a  =  C*t/R;                                    
 
  420      const double px =  sin(theta)*cos(phi);
 
  421      const double pz =  cos(theta);
 
  425      for (
double buffer[] = { 
wmin, 
wmax, 0.0 }, *p = buffer; *p != 0.0; ++p) {
 
  430        const double ct0 = 1.0 / n;
 
  431        const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  433        const double b  = (ng - ct0) / st0;                        
 
  435        if (*p == 
wmin && b < a) { 
return 0.0; }
 
  436        if (*p == 
wmax && b > a) { 
return 0.0; }
 
  443      for (
int i = 0; i != N; ++i) {                               
 
  445        const double w  = 0.5 * (umin + umax);
 
  450        const double ct0 = 1.0 / n;
 
  451        const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  453        const double b  = (ng - ct0) / st0;                        
 
  455        if (fabs(b-a) < a*eps) {
 
  463          const double d  = R / st0;                               
 
  464          const double ct = st0*px + ct0*pz;                       
 
  466          const double i3 = ct0*ct0*ct0 / (st0*st0*st0);
 
  469          const double V  = exp(-d/l_abs - d/ls);                  
 
  470          const double W  = A / (2.0*PI*R*st0);                    
 
  472          const double Ja = R * (ngp/st0 + np*(n-ng)*i3) / C;      
 
 
  499                                     const double t_ns)
 const 
  501      static const double eps = 1.0e-10;
 
  505      const double R  =  std::max(R_m, 
getRmin());
 
  509      const double px =  sin(theta)*cos(phi);
 
  510      const double py =  sin(theta)*sin(phi);
 
  511      const double pz =  cos(theta);
 
  515      const double ni = sqrt(R*R + C*t*C*t) / R;                   
 
  521      const double nj = std::min(ni,n1);
 
  527        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  528        const double dn = i->getY() * 0.5 * (nj - n0);
 
  541        if (npe <= 0) { 
continue; }
 
  543        const double Jc  = 1.0 / ls;                               
 
  545        const double ct0 = 1.0 / n;                                
 
  546        const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  552        const double zmin = rz.
first;
 
  553        const double zmax = rz.
second;
 
  555        const double zap  = 1.0 / l_abs;
 
  557        const double xmin = exp(zap*zmax);
 
  558        const double xmax = exp(zap*zmin);
 
  562          const double x  = 0.5 * (xmax + xmin)  +  j->getX() * 0.5 * (xmax - xmin);
 
  563          const double dx = j->getY() * 0.5 * (xmax - xmin);
 
  565          const double z  = log(x) / zap;
 
  566          const double dz = -dx / (zap*x);
 
  568          const double D  = sqrt(z*z + R*R);
 
  569          const double cd = -z / D;
 
  570          const double sd =  R / D;
 
  572          const double d  = (C*t - z) / ng;                        
 
  576          const double cta  = cd*ct0 + sd*st0;
 
  577          const double dca  = d - 0.5*(d+D)*(d-D) / (d - D*cta);
 
  578          const double tip  = -log(D*D/(dca*dca) + eps) / PI;
 
  580          const double ymin = exp(tip*PI);
 
  581          const double ymax = 1.0;
 
  585            const double y  = 0.5 * (ymax + ymin)  +  k->getX() * 0.5 * (ymax - ymin);
 
  586            const double dy = k->getY() * 0.5 * (ymax - ymin);
 
  588            const double phi = log(y) / tip;
 
  589            const double dp  = -dy / (tip*y);
 
  591            const double cp0 = cos(phi);
 
  592            const double sp0 = sin(phi);
 
  594            const double u  = (R*R + z*z - d*d) / (2*R*st0*cp0 - 2*z*ct0 - 2*d);
 
  595            const double v  = d - u;
 
  597            if (u <= 0) { 
continue; }
 
  598            if (v <= 0) { 
continue; }
 
  600            const double vi  = 1.0 / v;
 
  601            const double cts = (R*st0*cp0 - z*ct0 - u)*vi;         
 
  605            if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
  607            const double vx  =   R - u*st0*cp0;
 
  608            const double vy  =     - u*st0*sp0;
 
  609            const double vz  =  -z - u*ct0;
 
  611            const double ct[]  = {                                 
 
  612              (vx*px + vy*py + vz*pz) * vi,
 
  613              (vx*px - vy*py + vz*pz) * vi
 
  619            const double W  = std::min(A*vi*vi, 2.0*PI);           
 
  622            const double Jd = ng * (1.0 - cts) / C;                
 
  624            value += (npe * dz * dp / (2*PI)) * U * V * W * Ja * Jc / fabs(Jd);
 
 
  645                                       const double t_ns)
 const 
  649      const double R  =  std::max(R_m, 
getRmin());
 
  652      const double D  =  2.0*sqrt(A/PI);
 
  654      const double px =  sin(theta)*cos(phi);
 
  656      const double pz =  cos(theta);
 
  660      const double ni = sqrt(R*R + C*t*C*t) / R;                   
 
  666      const double nj = std::min(n1, ni);
 
  672        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  673        const double dn = i->getY() * 0.5 * (nj - n0);
 
  690        for (
int j = 0; j != 2; ++j) {
 
  692          const double z = rz[j];
 
  694          if (C*t <= z) 
continue;
 
  696          const double d  = sqrt(z*z + R*R);                       
 
  698          const double ct0 = -z / d;
 
  699          const double st0 =  R / d;
 
  701          const double dz = D / st0;                               
 
  703          const double ct = st0*px + ct0*pz;                       
 
  706          const double V  = exp(-d/l_abs - d/ls);                  
 
  707          const double W  = A/(d*d);                               
 
  709          const double Ja = 
geant(n,ct0);                          
 
  710          const double Jd = (1.0 - ng*ct0) / C;                    
 
  711          const double Je = ng*st0*st0*st0 / (R*
C);                
 
  713          value += 
gWater() * npe * U * V * W * Ja / (fabs(Jd) + 0.5*Je*dz);
 
 
  733                                          const double t_ns)
 const 
  737      const double R  =  std::max(R_m, 
getRmin());
 
  741      const double px =  sin(theta)*cos(phi);
 
  742      const double py =  sin(theta)*sin(phi);
 
  743      const double pz =  cos(theta);
 
  747      const double ni = sqrt(R*R + C*t*C*t) / R;                   
 
  753      const double nj = std::min(ni,n1);
 
  759        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  760        const double dn = i->getY() * 0.5 * (nj - n0);
 
  773        if (npe <= 0) { 
continue; }
 
  775        const double Jc = 1.0 / ls;                                
 
  781        const double zmin = rz.
first;
 
  782        const double zmax = rz.
second;
 
  784        const double zap  = 1.0 / l_abs;
 
  786        const double xmin = exp(zap*zmax);
 
  787        const double xmax = exp(zap*zmin);
 
  791          const double x  = 0.5 * (xmax + xmin)  +  j->getX() * 0.5 * (xmax - xmin);
 
  792          const double dx = j->getY() * 0.5 * (xmax - xmin);
 
  794          const double z  = log(x) / zap;
 
  795          const double dz = -dx / (zap*x);
 
  797          const double D  = sqrt(z*z + R*R);
 
  798          const double cd = -z / D;
 
  799          const double sd =  R / D;
 
  801          const double qx = cd*px +  0  - sd*pz;
 
  802          const double qy =         1*py;
 
  803          const double qz = sd*px +  0  + cd*pz;
 
  805          const double d = (C*t - z) / ng;                         
 
  809          const double ds = 2.0 / (size() + 1);
 
  811          for (
double sb = 0.5*ds; sb < 1.0 - 0.25*ds; sb += ds) {
 
  813            for (
int buffer[] = { -1, +1, 0}, *k = buffer; *k != 0; ++k) {
 
  815              const double cb  = (*k) * sqrt((1.0 + sb)*(1.0 - sb));
 
  816              const double dcb = (*k) * ds*sb/cb;
 
  818              const double v  = 0.5 * (d + D) * (d - D) / (d - D*cb);
 
  819              const double u  = d - v;
 
  821              if (u <= 0) { 
continue; }
 
  822              if (v <= 0) { 
continue; }
 
  824              const double cts = (D*cb - v) / u;                   
 
  828              if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
  830              const double W  = std::min(A/(v*v), 2.0*PI);         
 
  832              const double Jd = ng * (1.0 - cts) / C;              
 
  834              const double ca = (D - v*cb) / u;
 
  835              const double sa =      v*sb  / u;
 
  837              const double dp  = PI / 
phd.size();
 
  838              const double dom = dcb*dp * v*v / (u*u);
 
  842                const double cp  = l->getX();
 
  843                const double sp  = l->getY();
 
  845                const double ct0 = cd*ca - sd*sa*cp;
 
  847                const double vx  = sb*cp * qx;
 
  848                const double vy  = sb*sp * qy;
 
  849                const double vz  = cb    * qz;
 
  855                const double Jb = 
geant(n,ct0);                    
 
  857                value += dom * 
gWater() * npe * dz * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 
  882                                     const double t_ns)
 const 
  884      static const double eps = 1.0e-10;
 
  888      const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
  889      const double D  =  std::max(D_m, 
getRmin());
 
  890      const double R  =  sd * D;                                   
 
  891      const double Z  = -cd * D;                                   
 
  896      const double px =  sin(theta)*cos(phi);
 
  897      const double py =  sin(theta)*sin(phi);
 
  898      const double pz =  cos(theta);
 
  903      const double ni = C*t / L;                                   
 
  909      const double nj = std::min(ni,n1);
 
  915        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  916        const double dn = i->getY() * 0.5 * (nj - n0);
 
  929        if (npe <= 0) { 
continue; }
 
  931        const double Jc    = 1.0 / ls;                             
 
  933        const double ct0 = 1.0 / n;                                
 
  934        const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  936        const double d =  C*t / ng;                                
 
  940        const double cta  = cd*ct0 + sd*st0;
 
  941        const double dca  = d - 0.5*(d+L)*(d-L) / (d - L*cta);
 
  942        const double tip  = -log(L*L/(dca*dca) + eps) / PI;
 
  944        const double ymin = exp(tip*PI);
 
  945        const double ymax = 1.0;
 
  949          const double y  = 0.5 * (ymax + ymin)  +  j->getX() * 0.5 * (ymax - ymin);
 
  950          const double dy = j->getY() * 0.5 * (ymax - ymin);
 
  952          const double phi = log(y) / tip;
 
  953          const double dp  = -dy / (tip*y);
 
  955          const double cp0 = cos(phi);
 
  956          const double sp0 = sin(phi);
 
  958          const double u  = (R*R + Z*Z - d*d) / (2*R*st0*cp0 - 2*Z*ct0 - 2*d);
 
  959          const double v  = d - u;
 
  961          if (u <= 0) { 
continue; }
 
  962          if (v <= 0) { 
continue; }
 
  964          const double vi  = 1.0 / v;
 
  965          const double cts = (R*st0*cp0 - Z*ct0 - u)*vi;         
 
  969          if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
  971          const double vx  =   R - u*st0*cp0;
 
  972          const double vy  =     - u*st0*sp0;
 
  973          const double vz  =  -Z - u*ct0;
 
  975          const double ct[]  = {                                 
 
  976            (vx*px + vy*py + vz*pz) * vi,
 
  977            (vx*px - vy*py + vz*pz) * vi
 
  983          const double W  = std::min(A*vi*vi, 2.0*PI);           
 
  986          const double Jd = ng * (1.0 - cts) / C;                
 
  988          value += (npe * dp / (2*PI)) * U * V * W * Ja * Jc / fabs(Jd);
 
 
 1010                                      const double t_ns)
 const 
 1012      const double ct0 = cd;
 
 1013      const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
 1015      const double D  =  std::max(D_m, 
getRmin());
 
 1019      const double px =  sin(theta)*cos(phi);
 
 1020      const double pz =  cos(theta);
 
 1024      const double ng = C*t/D;                                     
 
 1026      if (n0 >= ng) { 
return 0.0; }
 
 1027      if (n1 <= ng) { 
return 0.0; }
 
 1037      const double ct = st0*px + ct0*pz;                           
 
 1040      const double V  = exp(-D/l_abs - D/ls);                      
 
 1041      const double W  = A/(D*D);                                   
 
 1045      const double Ja = D * ngp / 
C;                               
 
 1046      const double Jb = 
geant(n,ct0);                              
 
 1048      return npe * 
geanc() * U * V * W * Jb / fabs(Ja);
 
 
 1066                                         const double t_ns)
 const 
 1070      const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
 1071      const double D  =  std::max(D_m, 
getRmin());
 
 1077      const double px =  sin(theta)*cos(phi);
 
 1078      const double py =  sin(theta)*sin(phi);
 
 1079      const double pz =  cos(theta);
 
 1081      const double qx = cd*px +  0  - sd*pz;
 
 1082      const double qy =         1*py;
 
 1083      const double qz = sd*px +  0  + cd*pz;
 
 1088      const double ni = C*t / L;                                   
 
 1094      const double nj = std::min(ni,n1);
 
 1100        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1101        const double dn = i->getY() * 0.5 * (nj - n0);
 
 1114        if (npe <= 0) { 
continue; }
 
 1116        const double Jc    = 1.0 / ls;                             
 
 1118        const double d =  C*t / ng;                                
 
 1122        const double ds = 2.0 / (size() + 1);
 
 1124        for (
double sb = 0.5*ds; sb < 1.0 - 0.25*ds; sb += ds) {
 
 1126          for (
int buffer[] = { -1, +1, 0}, *k = buffer; *k != 0; ++k) {
 
 1128            const double cb  = (*k) * sqrt((1.0 + sb)*(1.0 - sb));
 
 1129            const double dcb = (*k) * ds*sb/cb;
 
 1131            const double v  = 0.5 * (d + L) * (d - L) / (d - L*cb);
 
 1132            const double u  = d - v;
 
 1134            if (u <= 0) { 
continue; }
 
 1135            if (v <= 0) { 
continue; }
 
 1137            const double cts = (L*cb - v) / u;                     
 
 1141            if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
 1143            const double W  = std::min(A/(v*v), 2.0*PI);           
 
 1145            const double Jd = ng * (1.0 - cts) / C;                
 
 1147            const double ca = (L - v*cb) / u;
 
 1148            const double sa =      v*sb  / u;
 
 1150            const double dp  = PI / 
phd.size();
 
 1151            const double dom = dcb*dp * v*v / (u*u);
 
 1152            const double dos = sqrt(dom);
 
 1156              const double cp = l->getX();
 
 1157              const double sp = l->getY();
 
 1159              const double ct0 = cd*ca - sd*sa*cp;
 
 1161              const double vx  = -sb*cp * qx;
 
 1162              const double vy  = -sb*sp * qy;
 
 1163              const double vz  =  cb    * qz;
 
 1173              const double Jb = 
geant(n, 
 
 1177              value += npe * 
geanc() * dos * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 
 1203                                      const double t_ns)
 const 
 1207      const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
 1208      const double D  =  std::max(D_m, 
getRmin());
 
 1209      const double R  =  D * sd;                                   
 
 1210      const double Z  = -D * cd;
 
 1219      const double d  = sqrt((Z+zmax)*(Z+zmax) + R*R);
 
 1221      if (C*t > std::max(n1*D, zmax + n1*d)) {
 
 1227        JRoot rz(R, n0, t + Z/C);                                  
 
 1239        JRoot rz(R, n1, t + Z/C);                                  
 
 1249      if (C*t < zmax + n0*d) {
 
 1251        JRoot rz(R, n0, t + Z/C);                                  
 
 1269        const double dy    =  (ymax - ymin) / size();
 
 1271        if (dy > 2*std::numeric_limits<double>::epsilon()) {
 
 1273          for (
double y = ymin + 0.5*dy; y < ymax; y += dy) {
 
 1276            const double d   =  sqrt(R*R + z*z);
 
 
 1305                                         const double t_ns)
 const 
 1309      const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
 1310      const double D  =  std::max(D_m, 
getRmin());
 
 1311      const double R  =  D * sd;                                   
 
 1312      const double Z  = -D * cd;
 
 1320      const double d  =  sqrt((Z+zmax)*(Z+zmax) + R*R);
 
 1324        JRoot rz(R, n0, t + Z/C);                                  
 
 1334      if (C*t < zmax + n0*d) {
 
 1336        JRoot rz(R, n0, t + Z/C);                                  
 
 1348      const double dy    =  (ymax - ymin) / size();
 
 1350      if (dy > 2*std::numeric_limits<double>::epsilon()) {
 
 1352        for (
double y = ymin + 0.5*dy; y < ymax; y += dy) {
 
 1355          const double d  =  sqrt(R*R + z*z);
 
 
 1378                                       const double t_ns)
 const 
 1382      const double R  =  std::max(R_m, 
getRmin());
 
 1385      const double D  =  2.0*sqrt(A/PI);
 
 1387      const double px =  sin(theta)*cos(phi);
 
 1388      const double pz =  cos(theta);
 
 1392      const double ni = sqrt(R*R + C*t*C*t) / R;                   
 
 1398      const double nj = std::min(n1, ni);
 
 1404        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1405        const double dn = i->getY() * 0.5 * (nj - n0);
 
 1422        for (
int j = 0; j != 2; ++j) {
 
 1424          const double z = rz[j];
 
 1426          if (C*t <= z) 
continue;
 
 1428          const double d  = sqrt(z*z + R*R);                       
 
 1430          const double ct0 = -z / d;
 
 1431          const double st0 =  R / d;
 
 1433          const double dz = D / st0;                               
 
 1434          const double ct = st0*px + ct0*pz;                       
 
 1437          const double V  = exp(-d/l_abs - d/ls);                  
 
 1438          const double W  = A/(d*d);                               
 
 1441          const double Jd = (1.0 - ng*ct0) / C;                    
 
 1442          const double Je = ng*st0*st0*st0 / (R*
C);                
 
 1444          value += npe * 
geanc() * U * V * W * Ja / (fabs(Jd) + 0.5*Je*dz);
 
 
 1464                                          const double t_ns)
 const 
 1468      const double R  =  std::max(R_m, 
getRmin());
 
 1472      const double px =  sin(theta)*cos(phi);
 
 1473      const double py =  sin(theta)*sin(phi);
 
 1474      const double pz =  cos(theta);
 
 1478      const double ni = sqrt(R*R + C*t*C*t) / R;                   
 
 1484      const double nj = std::min(ni,n1);
 
 1490        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1491        const double dn = i->getY() * 0.5 * (nj - n0);
 
 1504        if (npe <= 0) { 
continue; }
 
 1506        const double Jc = 1.0 / ls;                                
 
 1512        const double zmin = rz.
first;
 
 1513        const double zmax = rz.
second;
 
 1515        const double zap  = 1.0 / l_abs;
 
 1517        const double xmin = exp(zap*zmax);
 
 1518        const double xmax = exp(zap*zmin);
 
 1522          const double x  = 0.5 * (xmax + xmin)  +  j->getX() * 0.5 * (xmax - xmin);
 
 1523          const double dx = j->getY() * 0.5 * (xmax - xmin);
 
 1525          const double z  = log(x) / zap;
 
 1526          const double dz = -dx / (zap*x);
 
 1528          const double D  = sqrt(z*z + R*R);
 
 1529          const double cd = -z / D;
 
 1530          const double sd =  R / D;
 
 1532          const double qx = cd*px +  0  - sd*pz;
 
 1533          const double qy =         1*py;
 
 1534          const double qz = sd*px +  0  + cd*pz;
 
 1536          const double d = (C*t - z) / ng;                         
 
 1540          const double ds = 2.0 / (size() + 1);
 
 1542          for (
double sb = 0.5*ds; sb < 1.0 - 0.25*ds; sb += ds) {
 
 1544            for (
int buffer[] = { -1, +1, 0}, *k = buffer; *k != 0; ++k) {
 
 1546              const double cb  = (*k) * sqrt((1.0 + sb)*(1.0 - sb));
 
 1547              const double dcb = (*k) * ds*sb/cb;
 
 1549              const double v  = 0.5 * (d + D) * (d - D) / (d - D*cb);
 
 1550              const double u  = d - v;
 
 1552              if (u <= 0) { 
continue; }
 
 1553              if (v <= 0) { 
continue; }
 
 1555              const double cts = (D*cb - v) / u;                   
 
 1559              if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
 1561              const double W  = std::min(A/(v*v), 2.0*PI);         
 
 1563              const double Jd = ng * (1.0 - cts) / C;              
 
 1565              const double ca = (D - v*cb) / u;
 
 1566              const double sa =      v*sb  / u;
 
 1568              const double dp  = PI / 
phd.size();
 
 1569              const double dom = dcb*dp * v*v / (u*u);
 
 1573                const double cp  = l->getX();
 
 1574                const double sp  = l->getY();
 
 1576                const double ct0 = cd*ca - sd*sa*cp;
 
 1578                const double vx  = sb*cp * qx;
 
 1579                const double vy  = sb*sp * qy;
 
 1580                const double vz  = cb    * qz;
 
 1588                value += dom * npe * 
geanc() * dz * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 
 1609                                         const double t_ns)
 const 
 1611      const double D  =  std::max(D_m, 
getRmin());
 
 1617      const double ng = C*t/D;                                     
 
 1619      if (n0 >= ng) { 
return 0.0; }
 
 1620      if (n1 <= ng) { 
return 0.0; }
 
 1631      const double V  = exp(-D/l_abs - D/ls);                      
 
 1632      const double W  = A/(D*D);                                   
 
 1636      const double Ja = D * ngp / 
C;                               
 
 1637      const double Jb = 1.0 / (4.0*PI);                            
 
 1639      return npe * 
geanc() * U * V * W * Jb / fabs(Ja);
 
 
 1653                                            const double t_ns)
 const 
 1657      const double D  =  std::max(D_m, 
getRmin());
 
 1659      const double st =  sqrt((1.0 + ct)*(1.0 - ct));
 
 1666      const double ni = C*t / D;                                   
 
 1672      const double nj = std::min(ni,n1);
 
 1678        const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1679        const double dn = i->getY() * 0.5 * (nj - n0);
 
 1689        if (npe <= 0) { 
continue; }
 
 1694        const double Jc    = 1.0 / ls;                             
 
 1695        const double Jb    = 1.0 / (4.0*PI);                       
 
 1697        const double d =  C*t / ng;                                
 
 1699        const double dcb = 2.0 / (size() + 1);
 
 1701        for (
double cb = -1.0 + 0.5*dcb; cb < +1.0; cb += dcb) {
 
 1703          const double sb = sqrt((1.0 + cb)*(1.0 - cb));
 
 1705          const double v  = 0.5 * (d + D) * (d - D) / (d - D*cb);
 
 1706          const double u  = d - v;
 
 1708          if (u <= 0) { 
continue; }
 
 1709          if (v <= 0) { 
continue; }
 
 1711          const double cts = (D*cb - v) / u;                     
 
 1715          if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
 1717          const double W  = std::min(A/(v*v), 2.0*PI);           
 
 1719          const double Jd = ng * (1.0 - cts) / C;                
 
 1721          const double dp  = PI / 
phd.size();
 
 1722          const double dom = dcb*dp * v*v / (u*u);               
 
 1726            const double cp  = l->getX();
 
 1727            const double dot = cb*ct + sb*cp*st;
 
 1731            value += npe * 
geanc() * dom * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 
 1756                            const double t_ns)
 const 
 
 1798                            const double t_ns)
 const 
 
 1825                                const double t_ns)
 const 
 
 1855                                const double t_ns)
 const 
 
 1880                                const double t_ns)
 const 
 
 1912                                const double t_ns)
 const 
 
 1931                                   const double t_ns)
 const 
 
 1957                                   const double t_ns)
 const 
 
 1987        const double a  =  n*n        -  1.0;
 
 1988        const double b  =  2*C*t;
 
 1989        const double c  =  R*n * R*n  -  C*t * C*t;
 
 1991        const double q  =  b*b - 4*a*c;
 
 1995          first    = (-b - sqrt(q)) / (2*a);
 
 1996          second   = (-b + sqrt(q)) / (2*a);
 
 
 
 2039                                 const double eps = 1.0e-10)
 const 
 2046      for (
int i = 0; i != 1000; ++i) {
 
 2048        const double v = 0.5 * (vmin + vmax); 
 
 2051        if (fabs(y - n) < eps) {
 
 2061      return 0.5 * (vmin + vmax);
 
 
 2078                                 const double eps)
 const 
 2088        if (fabs(y - n) < eps) {
 
 
 2116        const int    nx   = 100000;
 
 2117        const double xmin =   -1.0;
 
 2118        const double xmax =   +1.0;
 
 2120        const double dx   = (xmax - xmin) / (nx - 1);
 
 2122        for (
double x = xmin, W = 0.0; x < xmax; x += dx) {
 
 2135      return 1.0/l_abs  +  f1(cts)/ls;
 
 
 
 2172                 const double epsilon        = 1e-12) :
 
 
 
 2206           double (*pF_qe)   (
const double),
 
 2207           double (*pF_pmt)  (
const double),
 
 2208           double (*pF_l_abs)(
const double),
 
 2209           double (*pF_ls)   (
const double),
 
 2210           double (*pF_ps)   (
const double),
 
 2218           const double epsilon        = 1e-12) :
 
 
 2246    virtual double getQE(
const double lambda)
 const override  
 
 2272      return l_abs(lambda);
 
 
 2312    double (*
qe)(
const double lambda);
 
 2328    double (*
ls)(
const double lambda);
 
 2336    double (*
pmt)(
const double ct);
 
 2344    double (*
ps)(
const double ct);
 
 
Compiler version dependent expressions, macros, etc.
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
Photon emission profile EM-shower.
 
Longitudinal emission profile EM-shower.
 
Numbering scheme for PDF types.
 
Auxiliary classes for numerical integration.
 
virtual double getAbsorptionLength(const double lambda) const =0
Absorption length.
 
virtual double getScatteringLength(const double lambda) const =0
Scattering length.
 
virtual double getScatteringProbability(const double ct) const =0
Model specific function to describe light scattering in water (integral over full solid angle normali...
 
Probability Density Functions of the time response of a PMT with an implementation for the JDispersio...
 
JAbstractPDF(const double P_atm, const double Wmin, const double Wmax, const int numberOfPoints=20, const double epsilon=1e-12)
Constructor.
 
virtual double getPhotocathodeArea() const =0
Photo-cathode area of PMT.
 
virtual double getQE(const double lambda) const =0
Quantum efficiency of PMT (incl.
 
virtual double getAngularAcceptance(const double ct) const =0
Angular acceptence of PMT.
 
Light dispersion inteface.
 
virtual double getIndexOfRefractionGroup(const double lambda) const
Index of refraction for group velocity.
 
virtual double getDispersionGroup(const double lambda) const =0
Dispersion of light for group velocity.
 
virtual double getDispersionPhase(const double lambda) const =0
Dispersion of light for phase velocity.
 
Implementation of dispersion for water in deep sea.
 
double getLength(const double E, const double P, const double eps=1.0e-5) const
Get shower length for a given integrated probability.
 
double getIntegral(const double E, const double z) const
Integral of PDF (starting from 0).
 
Auxiliary class to find solution(s) to  of the square root expression:
 
double first
most upstream solution
 
bool is_valid
validity of solutions
 
double second
most downstream solution
 
double operator[](const int i) const
Get result by index.
 
JRoot(const double R, const double n, const double t)
Determine solution(s) of quadratic equation.
 
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
 
JPDF_C(const double Apmt, double(*pF_qe)(const double), double(*pF_pmt)(const double), double(*pF_l_abs)(const double), double(*pF_ls)(const double), double(*pF_ps)(const double), const double P_atm, const double Wmin, const double Wmax, const int numberOfPoints=20, const double epsilon=1e-12)
Constructor.
 
virtual double getScatteringProbability(const double ct) const override
Model specific function to describe light scattering in water (integral over full solid angle normali...
 
const double A
photo-cathode area [m2]
 
virtual double getQE(const double lambda) const override
Quantum efficiency of PMT (incl.
 
double(* ls)(const double lambda)
Scattering length.
 
double(* pmt)(const double ct)
Angular acceptance of PMT.
 
double(* qe)(const double lambda)
Quantum efficiency of PMT (incl.
 
virtual double getScatteringLength(const double lambda) const override
Scattering length.
 
virtual double getPhotocathodeArea() const override
Photo-cathode area of PMT.
 
virtual double getAbsorptionLength(const double lambda) const override
Absorption length.
 
virtual double getAngularAcceptance(const double ct) const override
Angular acceptance of PMT.
 
double(* l_abs)(const double lambda)
Absorption length.
 
double(* ps)(const double ct)
Model specific function to describe light scattering in water.
 
Low level interface for the calculation of the Probability Density Functions (PDFs) of the arrival ti...
 
double getScatteredLightFromMuon(const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from muon.
 
double getScatteredLightFromEMshower(const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from EM-shower.
 
double getLightFromEMshower(const double E_GeV, const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for light from EM-shower.
 
double getLightFromBrightPoint(const double D_m, const double ct, const double t_ns) const
Probability density function for direct light from isotropic light source.
 
double getLightFromEMshower(const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for light from EM-shower.
 
double getLightFromMuon(const int type, const double E_GeV, const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for light from muon.
 
double getLightFromMuon(const double E_GeV, const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for light from muon.
 
const double wmax
maximal wavelength for integration [nm]
 
double getScatteredLightFromBrightPoint(const double D_m, const double ct, const double t_ns) const
Probability density function for scattered light from isotropic light source.
 
double getLightFromBrightPoint(const int type, const double D_m, const double ct, const double t_ns) const
Probability density function for direct light from isotropic light source.
 
virtual ~JPDF()
Virtual destructor.
 
virtual double getWavelength(const double n, const double w, const double eps) const
Determine wavelength for a given index of refraction corresponding to the group velocity.
 
double getDirectLightFromMuon(const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for direct light from muon.
 
double getDirectLightFromEMshower(const double E, const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for direct light from EM-shower.
 
double getLightFromEMshower(const int type, const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for light from EM-shower.
 
double getScatteredLightFromDeltaRays(const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from delta-rays.
 
JTOOLS::JElement2D< double, double > element_type
 
virtual double getInverseAttenuationLength(const double l_abs, const double ls, const double cts) const
Get the inverse of the attenuation length.
 
static double getRmin()
minimal distance of approach of muon to PMT [m]
 
virtual double getWavelength(const double n, const double eps=1.0e-10) const
Determine wavelength for a given index of refraction corresponding to the group velocity.
 
std::vector< element_type > phd
fast evaluation of phi integral
 
double getScatteredLightFromEMshower(const double E, const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from EM-shower.
 
double getDirectLightFromMuon(const double R_m, const double theta, const double phi) const
Number of photo-electrons from direct Cherenkov light from muon.
 
JPDF(const double Wmin, const double Wmax, const int numberOfPoints=20, const double epsilon=1e-12)
Constructor.
 
double getNumberOfPhotons() const
Number of Cherenkov photons per unit track length.
 
double getDirectLightFromDeltaRays(const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for direct light from delta-rays.
 
double getDirectLightFromBrightPoint(const double D_m, const double ct, const double t_ns) const
Probability density function for direct light from isotropic light source.
 
double getScatteredLightFromEMshowers(const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from EM-showers.
 
double getLightFromEMshower(const int type, const double E_GeV, const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for light from EM-shower.
 
const double wmin
Integration limits.
 
double getDirectLightFromEMshower(const double D_m, const double cd, const double theta, const double phi, const double t_ns) const
Probability density function for direct light from EM-shower.
 
double getScatteredLightFromMuon(const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for scattered light from muon.
 
double getDirectLightFromEMshowers(const double R_m, const double theta, const double phi, const double t_ns) const
Probability density function for direct light from EM-showers.
 
Auxiliary methods for light properties of deep-sea water.
 
static double MODULE_RADIUS_M
Radius of optical module [m].
 
double getDeltaRaysFromMuon(const double E, const JRange< double > T_GeV=JRange< double >(DELTARAY_TMIN, DELTARAY_TMAX))
Equivalent EM-shower energy due to delta-rays per unit muon track length.
 
double getDeltaRayProbability(const double x)
Emission profile of photons from delta-rays.
 
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
 
double getIndexOfRefraction()
Get average index of refraction of water corresponding to group velocity.
 
double cherenkov(const double lambda, const double n)
Number of Cherenkov photons per unit track length and per unit wavelength.
 
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
 
double getTanThetaC()
Get average tangent of Cherenkov angle of water corresponding to group velocity.
 
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle.
 
@ SCATTERED_LIGHT_FROM_EMSHOWER
scattered light from EM shower
 
@ SCATTERED_LIGHT_FROM_BRIGHT_POINT
scattered light from bright point
 
@ SCATTERED_LIGHT_FROM_DELTARAYS
scattered light from delta-rays
 
@ DIRECT_LIGHT_FROM_EMSHOWERS
direct light from EM showers
 
@ SCATTERED_LIGHT_FROM_EMSHOWERS
scattered light from EM showers
 
@ DIRECT_LIGHT_FROM_BRIGHT_POINT
direct light from bright point
 
@ SCATTERED_LIGHT_FROM_MUON
scattered light from muon
 
@ DIRECT_LIGHT_FROM_EMSHOWER
direct light from EM shower
 
@ DIRECT_LIGHT_FROM_DELTARAYS
direct light from delta-rays
 
@ DIRECT_LIGHT_FROM_MUON
direct light from muon
 
double geanc()
Equivalent muon track length per unit shower energy.
 
double getIndexOfRefractionPhase()
Get average index of refraction of water corresponding to phase velocity.
 
static const double C
Physics constants.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).