1 #ifndef __JPHYSICS__JPDF__ 
    2 #define __JPHYSICS__JPDF__ 
   30 namespace JPP { 
using namespace JPHYSICS; }
 
  300          const double epsilon        = 1e-12) :
 
  309       for (
double x = 0.5*dx; x < 
PI; x += dx) {
 
  331       const double xmin = 1.0 / 
wmax;
 
  332       const double xmax = 1.0 / 
wmin;
 
  336         const double x  = 0.5 * (xmax + xmin)  +  i->getX() * 0.5 * (xmax - xmin);
 
  337         const double dx = i->getY() * 0.5 * (xmax - xmin);
 
  339         const double w  = 1.0 / x;
 
  340         const double dw = dx * w*
w;
 
  361                                   const double phi)
 const 
  363       using namespace JTOOLS;
 
  367       const double R  =  std::max(R_m, 
getRmin());
 
  370       const double px =  sin(theta)*cos(phi);
 
  371       const double pz =  cos(theta);
 
  376         const double dw = m->getY() * 0.5 * (
wmax - 
wmin);
 
  385         const double ct0 = 1.0 / 
n;
 
  386         const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  388         const double d  = 
R / st0;                                 
 
  389         const double ct = st0*px + ct0*pz;                         
 
  392         const double V  = 
exp(-d/l_abs) * 
exp(-d/ls);              
 
  393         const double W  = 
A / (2.0*
PI*
R*st0);                      
 
  395         value += npe * U * V * W;
 
  414                                   const double t_ns)
 const 
  416       using namespace JTOOLS;
 
  418       static const int    N   = 100;                               
 
  419       static const double eps = 1.0e-6;                            
 
  421       const double R  =  std::max(R_m, 
getRmin());
 
  423       const double a  =  
C*t/
R;                                    
 
  426       const double px =  sin(theta)*cos(phi);
 
  427       const double pz =  cos(theta);
 
  431       for (
double buffer[] = { 
wmin, 
wmax, 0.0 }, *p = buffer; *p != 0.0; ++p) {
 
  436         const double ct0 = 1.0 / 
n;
 
  437         const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  439         const double b  = (ng - ct0) / st0;                        
 
  441         if (*p == 
wmin && b < 
a) { 
return 0.0; }
 
  442         if (*p == 
wmax && b > 
a) { 
return 0.0; }
 
  449       for (
int i = 0; i != 
N; ++i) {                               
 
  451         const double w  = 0.5 * (umin + umax);
 
  456         const double ct0 = 1.0 / 
n;
 
  457         const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  459         const double b  = (ng - ct0) / st0;                        
 
  461         if (fabs(b-
a) < 
a*eps) {
 
  469           const double d  = 
R / st0;                               
 
  470           const double ct = st0*px + ct0*pz;                       
 
  472           const double i3 = ct0*ct0*ct0 / (st0*st0*st0);
 
  475           const double V  = 
exp(-d/l_abs - d/ls);                  
 
  476           const double W  = 
A / (2.0*
PI*
R*st0);                    
 
  478           const double Ja = 
R * (ngp/st0 + np*(n-ng)*i3) / 
C;      
 
  505                                      const double t_ns)
 const 
  507       using namespace JTOOLS;
 
  509       static const double eps = 1.0e-10;
 
  513       const double R  =  std::max(R_m, 
getRmin());
 
  517       const double px =  sin(theta)*cos(phi);
 
  518       const double py =  sin(theta)*sin(phi);
 
  519       const double pz =  cos(theta);
 
  523       const double ni = sqrt(
R*
R + 
C*t*
C*t) / 
R;                   
 
  529       const double nj = std::min(ni,n1);
 
  535         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  536         const double dn = i->getY() * 0.5 * (nj - n0);
 
  549         if (npe <= 0) { 
continue; }
 
  551         const double Jc  = 1.0 / ls;                               
 
  553         const double ct0 = 1.0 / 
n;                                
 
  554         const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  560         const double zmin = rz.
first;
 
  561         const double zmax = rz.
second;
 
  563         const double zap  = 1.0 / l_abs;
 
  565         const double xmin = 
exp(zap*zmax);
 
  566         const double xmax = 
exp(zap*zmin);
 
  570           const double x  = 0.5 * (xmax + xmin)  +  
j->getX() * 0.5 * (xmax - xmin);
 
  571           const double dx = 
j->getY() * 0.5 * (xmax - xmin);
 
  573           const double z  = log(x) / zap;
 
  574           const double dz = -dx / (zap*x);
 
  576           const double D  = sqrt(z*z + 
R*
R);
 
  577           const double cd = -z / 
D;
 
  578           const double sd =  R / 
D;
 
  580           const double d  = (
C*t - z) / ng;                        
 
  584           const double cta  = cd*ct0 + sd*st0;
 
  585           const double dca  = d - 0.5*(d+
D)*(d-D) / (d - D*cta);
 
  586           const double tip  = -log(D*D/(dca*dca) + eps) / 
PI;
 
  588           const double ymin = 
exp(tip*
PI);
 
  589           const double ymax = 1.0;
 
  593             const double y  = 0.5 * (ymax + ymin)  +  
k->getX() * 0.5 * (ymax - ymin);
 
  594             const double dy = 
k->getY() * 0.5 * (ymax - ymin);
 
  596             const double phi = log(y) / tip;
 
  597             const double dp  = -dy / (tip*y);
 
  599             const double cp0 = cos(phi);
 
  600             const double sp0 = sin(phi);
 
  602             const double u  = (R*R + z*z - d*
d) / (2*R*st0*cp0 - 2*z*ct0 - 2*d);
 
  603             const double v  = d - 
u;
 
  605             if (u <= 0) { 
continue; }
 
  606             if (v <= 0) { 
continue; }
 
  608             const double vi  = 1.0 / 
v;
 
  609             const double cts = (R*st0*cp0 - z*ct0 - 
u)*vi;         
 
  613             if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
  615             const double vx  =   R - u*st0*cp0;
 
  616             const double vy  =     - u*st0*sp0;
 
  617             const double vz  =  -z - u*ct0;
 
  619             const double ct[]  = {                                 
 
  620               (vx*px + vy*py + vz*pz) * vi,
 
  621               (vx*px - vy*py + vz*pz) * vi
 
  627             const double W  = std::min(
A*vi*vi, 2.0*PI);           
 
  630             const double Jd = ng * (1.0 - cts) / 
C;                
 
  632             value += (npe * dz * dp / (2*
PI)) * U * V * W * Ja * Jc / fabs(Jd);
 
  653                                        const double t_ns)
 const 
  655       using namespace JTOOLS;
 
  659       const double R  =  std::max(R_m, 
getRmin());
 
  662       const double D  =  2.0*sqrt(
A/
PI);
 
  664       const double px =  sin(theta)*cos(phi);
 
  666       const double pz =  cos(theta);
 
  670       const double ni = sqrt(
R*
R + 
C*t*
C*t) / 
R;                   
 
  676       const double nj = std::min(n1, ni);
 
  682         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  683         const double dn = i->getY() * 0.5 * (nj - n0);
 
  700         for (
int j = 0; 
j != 2; ++
j) {
 
  702           const double z = rz[
j];
 
  704           if (
C*t <= z) 
continue;
 
  706           const double d  = sqrt(z*z + 
R*
R);                       
 
  708           const double ct0 = -z / 
d;
 
  709           const double st0 =  R / 
d;
 
  711           const double dz = 
D / st0;                               
 
  713           const double ct = st0*px + ct0*pz;                       
 
  716           const double V  = 
exp(-d/l_abs - d/ls);                  
 
  717           const double W  = 
A/(d*
d);                               
 
  719           const double Ja = 
geant(n,ct0);                          
 
  720           const double Jd = (1.0 - ng*ct0) / 
C;                    
 
  721           const double Je = ng*st0*st0*st0 / (R*
C);                
 
  723           value += 
gWater() * npe * U * V * W * Ja / (fabs(Jd) + 0.5*Je*dz);
 
  743                                           const double t_ns)
 const 
  745       using namespace JTOOLS;
 
  749       const double R  =  std::max(R_m, 
getRmin());
 
  753       const double px =  sin(theta)*cos(phi);
 
  754       const double py =  sin(theta)*sin(phi);
 
  755       const double pz =  cos(theta);
 
  759       const double ni = sqrt(
R*
R + 
C*t*
C*t) / 
R;                   
 
  765       const double nj = std::min(ni,n1);
 
  771         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  772         const double dn = i->getY() * 0.5 * (nj - n0);
 
  785         if (npe <= 0) { 
continue; }
 
  787         const double Jc = 1.0 / ls;                                
 
  793         const double zmin = rz.
first;
 
  794         const double zmax = rz.
second;
 
  796         const double zap  = 1.0 / l_abs;
 
  798         const double xmin = 
exp(zap*zmax);
 
  799         const double xmax = 
exp(zap*zmin);
 
  803           const double x  = 0.5 * (xmax + xmin)  +  
j->getX() * 0.5 * (xmax - xmin);
 
  804           const double dx = 
j->getY() * 0.5 * (xmax - xmin);
 
  806           const double z  = log(x) / zap;
 
  807           const double dz = -dx / (zap*x);
 
  809           const double D  = sqrt(z*z + 
R*
R);
 
  810           const double cd = -z / 
D;
 
  811           const double sd =  R / 
D;
 
  813           const double qx = cd*px +  0  - sd*pz;
 
  814           const double qy =         1*py;
 
  815           const double qz = sd*px +  0  + cd*pz;
 
  817           const double d = (
C*t - z) / ng;                         
 
  821           const double ds = 2.0 / (size() + 1);
 
  823           for (
double sb = 0.5*ds; sb < 1.0 - 0.25*ds; sb += ds) {
 
  825             for (
int buffer[] = { -1, +1, 0}, *
k = buffer; *
k != 0; ++
k) {
 
  827               const double cb  = (*k) * sqrt((1.0 + sb)*(1.0 - sb));
 
  828               const double dcb = (*k) * ds*sb/cb;
 
  830               const double v  = 0.5 * (d + 
D) * (d - D) / (d - D*cb);
 
  831               const double u  = d - 
v;
 
  833               if (u <= 0) { 
continue; }
 
  834               if (v <= 0) { 
continue; }
 
  836               const double cts = (D*cb - 
v) / u;                   
 
  840               if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
  842               const double W  = std::min(
A/(v*v), 2.0*
PI);         
 
  844               const double Jd = ng * (1.0 - cts) / 
C;              
 
  846               const double ca = (D - v*cb) / u;
 
  847               const double sa =      v*sb  / 
u;
 
  849               const double dp  = 
PI / 
phd.size();
 
  850               const double dom = dcb*dp * v*v / (u*
u);
 
  854                 const double cp  = l->getX();
 
  855                 const double sp  = l->getY();
 
  857                 const double ct0 = cd*ca - sd*sa*cp;
 
  859                 const double vx  = sb*cp * qx;
 
  860                 const double vy  = sb*sp * qy;
 
  861                 const double vz  = cb    * qz;
 
  867                 const double Jb = 
geant(n,ct0);                    
 
  869                 value += dom * 
gWater() * npe * dz * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
  894                                      const double t_ns)
 const 
  896       using namespace JTOOLS;
 
  898       static const double eps = 1.0e-10;
 
  902       const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
  903       const double D  =  std::max(D_m, 
getRmin());
 
  904       const double R  =  sd * 
D;                                   
 
  905       const double Z  = -cd * 
D;                                   
 
  910       const double px =  sin(theta)*cos(phi);
 
  911       const double py =  sin(theta)*sin(phi);
 
  912       const double pz =  cos(theta);
 
  917       const double ni = 
C*t / L;                                   
 
  923       const double nj = std::min(ni,n1);
 
  929         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
  930         const double dn = i->getY() * 0.5 * (nj - n0);
 
  943         if (npe <= 0) { 
continue; }
 
  945         const double Jc    = 1.0 / ls;                             
 
  947         const double ct0 = 1.0 / 
n;                                
 
  948         const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
  950         const double d =  
C*t / ng;                                
 
  954         const double cta  = cd*ct0 + sd*st0;
 
  955         const double dca  = d - 0.5*(d+L)*(d-L) / (d - L*cta);
 
  956         const double tip  = -log(L*L/(dca*dca) + eps) / 
PI;
 
  958         const double ymin = 
exp(tip*
PI);
 
  959         const double ymax = 1.0;
 
  963           const double y  = 0.5 * (ymax + ymin)  +  
j->getX() * 0.5 * (ymax - ymin);
 
  964           const double dy = 
j->getY() * 0.5 * (ymax - ymin);
 
  966           const double phi = log(y) / tip;
 
  967           const double dp  = -dy / (tip*y);
 
  969           const double cp0 = cos(phi);
 
  970           const double sp0 = sin(phi);
 
  972           const double u  = (
R*
R + Z*Z - d*
d) / (2*
R*st0*cp0 - 2*Z*ct0 - 2*d);
 
  973           const double v  = d - 
u;
 
  975           if (u <= 0) { 
continue; }
 
  976           if (v <= 0) { 
continue; }
 
  978           const double vi  = 1.0 / 
v;
 
  979           const double cts = (
R*st0*cp0 - Z*ct0 - 
u)*vi;         
 
  983           if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
  985           const double vx  =   
R - u*st0*cp0;
 
  986           const double vy  =     - u*st0*sp0;
 
  987           const double vz  =  -Z - u*ct0;
 
  989           const double ct[]  = {                                 
 
  990             (vx*px + vy*py + vz*pz) * vi,
 
  991             (vx*px - vy*py + vz*pz) * vi
 
  997           const double W  = std::min(
A*vi*vi, 2.0*PI);           
 
 1000           const double Jd = ng * (1.0 - cts) / 
C;                
 
 1002           value += (npe * dp / (2*
PI)) * U * V * W * Ja * Jc / fabs(Jd);
 
 1024                                       const double t_ns)
 const 
 1026       using namespace JTOOLS;
 
 1028       const double ct0 = cd;
 
 1029       const double st0 = sqrt((1.0 + ct0)*(1.0 - ct0));
 
 1031       const double D  =  std::max(D_m, 
getRmin());
 
 1035       const double px =  sin(theta)*cos(phi);
 
 1036       const double pz =  cos(theta);
 
 1040       const double ng = 
C*t/
D;                                     
 
 1042       if (n0 >= ng) { 
return 0.0; }
 
 1043       if (n1 <= ng) { 
return 0.0; }
 
 1053       const double ct = st0*px + ct0*pz;                           
 
 1056       const double V  = 
exp(-
D/l_abs - 
D/ls);                      
 
 1057       const double W  = 
A/(
D*
D);                                   
 
 1061       const double Ja = 
D * ngp / 
C;                               
 
 1062       const double Jb = 
geant(
n,ct0);                              
 
 1064       return npe * 
geanc() * U * V * W * Jb / fabs(Ja);
 
 1082                                          const double t_ns)
 const 
 1084       using namespace JTOOLS;
 
 1088       const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
 1089       const double D  =  std::max(D_m, 
getRmin());
 
 1095       const double px =  sin(theta)*cos(phi);
 
 1096       const double py =  sin(theta)*sin(phi);
 
 1097       const double pz =  cos(theta);
 
 1099       const double qx = cd*px +  0  - sd*pz;
 
 1100       const double qy =         1*py;
 
 1101       const double qz = sd*px +  0  + cd*pz;
 
 1106       const double ni = 
C*t / L;                                   
 
 1112       const double nj = std::min(ni,n1);
 
 1118         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1119         const double dn = i->getY() * 0.5 * (nj - n0);
 
 1132         if (npe <= 0) { 
continue; }
 
 1134         const double Jc    = 1.0 / ls;                             
 
 1136         const double d =  
C*t / ng;                                
 
 1140         const double ds = 2.0 / (size() + 1);
 
 1142         for (
double sb = 0.5*ds; sb < 1.0 - 0.25*ds; sb += ds) {
 
 1144           for (
int buffer[] = { -1, +1, 0}, *
k = buffer; *
k != 0; ++
k) {
 
 1146             const double cb  = (*k) * sqrt((1.0 + sb)*(1.0 - sb));
 
 1147             const double dcb = (*k) * ds*sb/cb;
 
 1149             const double v  = 0.5 * (d + L) * (d - L) / (d - L*cb);
 
 1150             const double u  = d - 
v;
 
 1152             if (u <= 0) { 
continue; }
 
 1153             if (v <= 0) { 
continue; }
 
 1155             const double cts = (L*cb - 
v) / u;                     
 
 1159             if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
 1161             const double W  = std::min(
A/(v*v), 2.0*
PI);           
 
 1163             const double Jd = ng * (1.0 - cts) / 
C;                
 
 1165             const double ca = (L - v*cb) / u;
 
 1166             const double sa =      v*sb  / 
u;
 
 1168             const double dp  = 
PI / 
phd.size();
 
 1169             const double dom = dcb*dp * v*v / (u*
u);
 
 1170             const double dos = sqrt(dom);
 
 1174               const double cp = l->getX();
 
 1175               const double sp = l->getY();
 
 1177               const double ct0 = cd*ca - sd*sa*cp;
 
 1179               const double vx  = -sb*cp * qx;
 
 1180               const double vy  = -sb*sp * qy;
 
 1181               const double vz  =  cb    * qz;
 
 1191               const double Jb = 
geant(n, 
 
 1195               value += npe * 
geanc() * dos * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 1221                                       const double t_ns)
 const 
 1223       using namespace JTOOLS;
 
 1227       const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
 1228       const double D  =  std::max(D_m, 
getRmin());
 
 1229       const double R  =  
D * sd;                                   
 
 1230       const double Z  = -
D * cd;
 
 1239       const double d  = sqrt((Z+zmax)*(Z+zmax) + 
R*
R);
 
 1241       if (
C*t > std::max(n1*
D, zmax + n1*
d)) {
 
 1247         JRoot rz(R, n0, t + Z/
C);                                  
 
 1259         JRoot rz(R, n1, t + Z/
C);                                  
 
 1269       if (
C*t < zmax + n0*d) {
 
 1271         JRoot rz(R, n0, t + Z/
C);                                  
 
 1289         const double dy    =  (ymax - ymin) / size();
 
 1291         if (dy > 2*std::numeric_limits<double>::epsilon()) {
 
 1293           for (
double y = ymin + 0.5*dy; y < ymax; y += dy) {
 
 1296             const double d   =  sqrt(R*R + z*z);
 
 1325                                          const double t_ns)
 const 
 1327       using namespace JTOOLS;
 
 1331       const double sd =  sqrt((1.0 + cd)*(1.0 - cd));
 
 1332       const double D  =  std::max(D_m, 
getRmin());
 
 1333       const double R  =  
D * sd;                                   
 
 1334       const double Z  = -
D * cd;
 
 1342       const double d  =  sqrt((Z+zmax)*(Z+zmax) + 
R*
R);
 
 1346         JRoot rz(R, n0, t + Z/
C);                                  
 
 1356       if (
C*t < zmax + n0*
d) {
 
 1358         JRoot rz(R, n0, t + Z/
C);                                  
 
 1370       const double dy    =  (ymax - ymin) / size();
 
 1372       if (dy > 2*std::numeric_limits<double>::epsilon()) {
 
 1374         for (
double y = ymin + 0.5*dy; y < ymax; y += dy) {
 
 1377           const double d  =  sqrt(R*R + z*z);
 
 1400                                        const double t_ns)
 const 
 1402       using namespace JTOOLS;
 
 1406       const double R  =  std::max(R_m, 
getRmin());
 
 1409       const double D  =  2.0*sqrt(
A/
PI);
 
 1411       const double px =  sin(theta)*cos(phi);
 
 1412       const double pz =  cos(theta);
 
 1416       const double ni = sqrt(
R*
R + 
C*t*
C*t) / 
R;                   
 
 1422       const double nj = std::min(n1, ni);
 
 1428         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1429         const double dn = i->getY() * 0.5 * (nj - n0);
 
 1446         for (
int j = 0; 
j != 2; ++
j) {
 
 1448           const double z = rz[
j];
 
 1450           if (
C*t <= z) 
continue;
 
 1452           const double d  = sqrt(z*z + 
R*
R);                       
 
 1454           const double ct0 = -z / 
d;
 
 1455           const double st0 =  R / 
d;
 
 1457           const double dz = 
D / st0;                               
 
 1458           const double ct = st0*px + ct0*pz;                       
 
 1461           const double V  = 
exp(-d/l_abs - d/ls);                  
 
 1462           const double W  = 
A/(d*
d);                               
 
 1464           const double Ja = 1.0/(4*
PI);                            
 
 1465           const double Jd = (1.0 - ng*ct0) / 
C;                    
 
 1466           const double Je = ng*st0*st0*st0 / (R*
C);                
 
 1468           value += npe * 
geanc() * U * V * W * Ja / (fabs(Jd) + 0.5*Je*dz);
 
 1488                                           const double t_ns)
 const 
 1490      using namespace JTOOLS;
 
 1494       const double R  =  std::max(R_m, 
getRmin());
 
 1498       const double px =  sin(theta)*cos(phi);
 
 1499       const double py =  sin(theta)*sin(phi);
 
 1500       const double pz =  cos(theta);
 
 1504       const double ni = sqrt(
R*
R + 
C*t*
C*t) / 
R;                   
 
 1510       const double nj = std::min(ni,n1);
 
 1516         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1517         const double dn = i->getY() * 0.5 * (nj - n0);
 
 1530         if (npe <= 0) { 
continue; }
 
 1532         const double Jc = 1.0 / ls;                                
 
 1538         const double zmin = rz.
first;
 
 1539         const double zmax = rz.
second;
 
 1541         const double zap  = 1.0 / l_abs;
 
 1543         const double xmin = 
exp(zap*zmax);
 
 1544         const double xmax = 
exp(zap*zmin);
 
 1548           const double x  = 0.5 * (xmax + xmin)  +  
j->getX() * 0.5 * (xmax - xmin);
 
 1549           const double dx = 
j->getY() * 0.5 * (xmax - xmin);
 
 1551           const double z  = log(x) / zap;
 
 1552           const double dz = -dx / (zap*x);
 
 1554           const double D  = sqrt(z*z + 
R*
R);
 
 1555           const double cd = -z / 
D;
 
 1556           const double sd =  R / 
D;
 
 1558           const double qx = cd*px +  0  - sd*pz;
 
 1559           const double qy =         1*py;
 
 1560           const double qz = sd*px +  0  + cd*pz;
 
 1562           const double d = (
C*t - z) / ng;                         
 
 1566           const double ds = 2.0 / (size() + 1);
 
 1568           for (
double sb = 0.5*ds; sb < 1.0 - 0.25*ds; sb += ds) {
 
 1570             for (
int buffer[] = { -1, +1, 0}, *
k = buffer; *
k != 0; ++
k) {
 
 1572               const double cb  = (*k) * sqrt((1.0 + sb)*(1.0 - sb));
 
 1573               const double dcb = (*k) * ds*sb/cb;
 
 1575               const double v  = 0.5 * (d + 
D) * (d - D) / (d - D*cb);
 
 1576               const double u  = d - 
v;
 
 1578               if (u <= 0) { 
continue; }
 
 1579               if (v <= 0) { 
continue; }
 
 1581               const double cts = (D*cb - 
v) / u;                   
 
 1585               if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
 1587               const double W  = std::min(
A/(v*v), 2.0*
PI);         
 
 1589               const double Jd = ng * (1.0 - cts) / 
C;              
 
 1591               const double dp  = 
PI / 
phd.size();
 
 1592               const double dom = dcb*dp * v*v / (u*
u);
 
 1596                 const double cp  = l->getX();
 
 1597                 const double sp  = l->getY();
 
 1599                 const double vx  = sb*cp * qx;
 
 1600                 const double vy  = sb*sp * qy;
 
 1601                 const double vz  = cb    * qz;
 
 1607                 const double Jb = 1.0/(4*
PI);                      
 
 1609                 value += dom * npe * 
geanc() * dz * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 1630                                          const double t_ns)
 const 
 1632       using namespace JTOOLS;
 
 1634       const double D  =  std::max(D_m, 
getRmin());
 
 1640       const double ng = 
C*t/
D;                                     
 
 1642       if (n0 >= ng) { 
return 0.0; }
 
 1643       if (n1 <= ng) { 
return 0.0; }
 
 1654       const double V  = 
exp(-
D/l_abs - 
D/ls);                      
 
 1655       const double W  = 
A/(
D*
D);                                   
 
 1659       const double Ja = 
D * ngp / 
C;                               
 
 1660       const double Jb = 1.0 / (4.0*
PI);                            
 
 1662       return npe * 
geanc() * U * V * W * Jb / fabs(Ja);
 
 1676                                             const double t_ns)
 const 
 1678       using namespace JTOOLS;
 
 1682       const double D  =  std::max(D_m, 
getRmin());
 
 1684       const double st =  sqrt((1.0 + ct)*(1.0 - ct));
 
 1691       const double ni = 
C*t / 
D;                                   
 
 1697       const double nj = std::min(ni,n1);
 
 1703         const double ng = 0.5 * (nj + n0)  +  i->getX() * 0.5 * (nj - n0);
 
 1704         const double dn = i->getY() * 0.5 * (nj - n0);
 
 1714         if (npe <= 0) { 
continue; }
 
 1719         const double Jc    = 1.0 / ls;                             
 
 1720         const double Jb    = 1.0 / (4.0*
PI);                       
 
 1722         const double d =  
C*t / ng;                                
 
 1724         const double dcb = 2.0 / (size() + 1);
 
 1726         for (
double cb = -1.0 + 0.5*dcb; cb < +1.0; cb += dcb) {
 
 1728           const double sb = sqrt((1.0 + cb)*(1.0 - cb));
 
 1730           const double v  = 0.5 * (d + 
D) * (d - 
D) / (d - 
D*cb);
 
 1731           const double u  = d - 
v;
 
 1733           if (u <= 0) { 
continue; }
 
 1734           if (v <= 0) { 
continue; }
 
 1736           const double cts = (
D*cb - 
v) / u;                     
 
 1740           if (cts < 0.0 && v * sqrt((1.0 + cts) * (1.0 - cts)) < 
MODULE_RADIUS_M) { 
continue; }
 
 1742           const double W  = std::min(
A/(v*v), 2.0*
PI);           
 
 1744           const double Jd = ng * (1.0 - cts) / 
C;                
 
 1746           const double dp  = 
PI / 
phd.size();
 
 1747           const double dom = dcb*dp * v*v / (u*
u);               
 
 1751             const double cp  = l->getX();
 
 1752             const double dot = cb*ct + sb*cp*st;
 
 1756             value += npe * 
geanc() * dom * U * V * W * Ja * Jb * Jc / fabs(Jd);
 
 1781                             const double t_ns)
 const 
 1823                             const double t_ns)
 const 
 1850                                 const double t_ns)
 const 
 1880                                 const double t_ns)
 const 
 1905                                 const double t_ns)
 const 
 1937                                 const double t_ns)
 const 
 1956                                    const double t_ns)
 const 
 1982                                    const double t_ns)
 const 
 2014         const double a  =  n*n        -  1.0;
 
 2015         const double b  =  2*
C*t;
 
 2016         const double c  =  R*n * R*n  -  
C*t * 
C*t;
 
 2018         const double q  =  b*b - 4*a*c;
 
 2022           first    = (-b - sqrt(q)) / (2*a);
 
 2023           second   = (-b + sqrt(q)) / (2*a);
 
 2047           throw JException(
"JRoot::operator[] invalid index");
 
 2066                                  const double eps = 1.0e-10)
 const 
 2073       for (
int i = 0; i != 1000; ++i) {
 
 2075         const double v = 0.5 * (vmin + vmax); 
 
 2078         if (fabs(y - n) < eps) {
 
 2088       return 0.5 * (vmin + vmax);
 
 2105                                  const double eps)
 const 
 2115         if (fabs(y - n) < eps) {
 
 2143         const int    nx   = 100000;
 
 2144         const double xmin =   -1.0;
 
 2145         const double xmax =   +1.0;
 
 2147         const double dx   = (xmax - xmin) / (nx - 1);
 
 2149         for (
double x = xmin, W = 0.0; x < xmax; x += dx) {
 
 2162       return 1.0/l_abs  +  f1(cts)/ls;
 
 2199                  const double epsilon        = 1e-12) :
 
 2233            double (*pF_qe)   (
const double),
 
 2234            double (*pF_pmt)  (
const double),
 
 2235            double (*pF_l_abs)(
const double),
 
 2236            double (*pF_ls)   (
const double),
 
 2237            double (*pF_ps)   (
const double),
 
 2245            const double epsilon        = 1e-12) :
 
 2273     virtual double getQE(
const double lambda)
 const  
 2299       return l_abs(lambda);
 
 2339     double (*qe)(
const double lambda);
 
 2347     double (*l_abs)(
const double lambda);
 
 2355     double (*ls)(
const double lambda);
 
 2363     double (*
pmt)(
const double ct);
 
 2371     double (*ps)(
const double ct);
 
*fatal Wrong number of arguments esac JCookie sh JRuns D $DETECTOR d sort n k
 
Photon emission profile EM-shower. 
 
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. 
 
do echo Generating $dir eval D
 
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 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 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. 
 
JTOOLS::JElement2D< double, double > element_type
 
double second
most downstream solution 
 
double getNumberOfPhotons() const 
Number of Cherenkov photons per unit track length. 
 
double geanc()
Equivalent muon track length per unit shower energy. 
 
Probability Density Functions of the time response of a PMT with an implementation for the JDispersio...
 
scattered light from EM shower 
 
Implementation of dispersion for water in deep sea. 
 
double getDirectLightFromMuon(const double R_m, const double theta, const double phi) const 
Number of photo-electrons from direct Cherenkov light from muon. 
 
virtual double getPhotocathodeArea() const 
Photo-cathode area of PMT. 
 
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. 
 
virtual double getScatteringProbability(const double ct) const 
Model specific function to describe light scattering in water (integral over full solid angle normali...
 
JRoot(const double R, const double n, const double t)
Determine solution(s) of quadratic equation. 
 
direct 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. 
 
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. 
 
virtual double getDispersionGroup(const double lambda) const =0
Dispersion of light for group velocity. 
 
static const JGeaneWater gWater
Function object for energy loss of muon in sea water. 
 
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 ~JPDF()
Virtual destructor. 
 
direct light from bright point 
 
fi JEventTimesliceWriter a
 
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle...
 
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. 
 
JAbstractPDF(const double P_atm, const double Wmin, const double Wmax, const int numberOfPoints=20, const double epsilon=1e-12)
Constructor. 
 
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
 
Numbering scheme for PDF types. 
 
double operator[](const int i) const 
Get result by index. 
 
Auxiliary class to find solution(s) to  of the square root expression:  where  is the index of refrac...
 
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 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. 
 
std::vector< element_type > phd
fast evaluation of phi integral 
 
scattered light from muon 
 
static double MODULE_RADIUS_M
Radius of optical module [m]. 
 
Compiler version dependent expressions, macros, etc. 
 
virtual double getQE(const double lambda) const 
Quantum efficiency of PMT (incl. 
 
virtual double getAngularAcceptance(const double ct) const 
Angular acceptence of PMT (normalised to one at cos() = -1). 
 
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. 
 
virtual double getScatteringLength(const double lambda) const =0
Scattering length. 
 
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile. 
 
then print_variable DETECTOR INPUT_FILE INTERMEDIATE_FILE check_input_file $DETECTOR $INPUT_FILE check_output_file $INTERMEDIATE_FILE $OUTPUT_FILE JMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
 
Probability Density Functions of the time response of a PMT with an implementation of the JAbstractPM...
 
scattered light from delta-rays 
 
virtual double getScatteringLength(const double lambda) const 
Scattering length. 
 
virtual double getAbsorptionLength(const double lambda) const =0
Absorption length. 
 
direct light from EM shower 
 
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. 
 
scattered light from EM showers 
 
virtual double getIndexOfRefractionPhase(const double lambda) const =0
Index of refraction for phase velocity. 
 
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. 
 
virtual double getPhotocathodeArea() const =0
Photo-cathode area of PMT. 
 
then usage $script[distance] fi case set_variable R
 
scattered light from bright point 
 
bool is_valid
validity of solutions 
 
direct light from delta-rays 
 
static double getRmin()
minimal distance of approach of muon to PMT [m] 
 
const double wmax
maximal wavelength for integration [nm] 
 
double cherenkov(const double lambda, const double n)
Number of Cherenkov photons per unit track length and per unit wavelength. 
 
Auxiliary classes for numerical integration. 
 
virtual double getIndexOfRefractionGroup(const double lambda) const 
Index of refraction for group velocity. 
 
double getIntegral(const double E, const double z) const 
Integral of PDF (starting from 0). 
 
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. 
 
alias put_queue eval echo n
 
virtual double getInverseAttenuationLength(const double l_abs, const double ls, const double cts) const 
Get the inverse of the attenuation length. 
 
double getScatteredLightFromBrightPoint(const double D_m, const double ct, const double t_ns) const 
Probability density function for scattered light from isotropic light source. 
 
const double wmin
Integration limits. 
 
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 getDeltaRaysFromMuon(const double E)
Equivalent EM-shower energy due to delta-rays per unit muon track length. 
 
virtual double getAngularAcceptance(const double ct) const =0
Angular acceptence of PMT. 
 
virtual double getAbsorptionLength(const double lambda) const 
Absorption length. 
 
double getScatteredLightFromDeltaRays(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 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 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. 
 
Longitudinal emission profile EM-shower. 
 
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 getLength(const double E, const double P, const double eps=1.0e-3) const 
Get shower length for a given integrated probability. 
 
virtual double getQE(const double lambda) const =0
Quantum efficiency of PMT (incl. 
 
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. 
 
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. 
 
Light dispersion inteface. 
 
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. 
 
then usage $script[input file[working directory[option]]] nWhere option can be N
 
virtual double getDispersionPhase(const double lambda) const =0
Dispersion of light for phase velocity. 
 
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A
 
virtual double getScatteringProbability(const double ct) const =0
Model specific function to describe light scattering in water (integral over full solid angle normali...
 
double first
most upstream solution 
 
JPDF(const double Wmin, const double Wmax, const int numberOfPoints=20, const double epsilon=1e-12)
Constructor. 
 
then usage $script[input file[working directory[option]]] nWhere option can be E
 
const double A
photo-cathode area [m2] 
 
Low level interface for the calculation of the Probability Density Functions (PDFs) of the arrival ti...
 
then set_variable FORMULA *[0] exp(-0.5 *(x-[1])*(x-[1])/([2]*[2]))" set_variable OUTPUT_FILE histogram.root JHistogram1D -o $WORKDIR/$OUTPUT_FILE -F "$FORMULA" -