source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/simulation/detector/G4Detector/G4fresnellens/include/ParabolicSurface.h @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 2.0 KB
Line 
1#ifndef __PARABOLICSURFACE__
2#define __PARABOLICSURFACE__
3
4#include "ParametricSurface.h"
5
6namespace G4FresnelLens{
7
8class ParabolicSurface : public ParametricSurface
9{
10public:
11    ParabolicSurface(double k=DBL_MAX, double z=0., double rhomax=0.);
12   ~ParabolicSurface();
13
14    void Configure();
15    double PointOnSurf(double x);
16    double PointOnSurf2(double x);
17    double DistanceToSurf(const G4ThreeVector& p, const G4ThreeVector& v);
18    double DistanceToSurfSafe(const G4ThreeVector& p);
19    void FillSegment(double rho, FSIntersectedSegment *intSeg);
20    double Derivative(double rho);
21    bool Normal(FSIntersectedSegment* ints, const G4ThreeVector& p, double up, G4ThreeVector* norm);
22
23    void print();
24protected:
25    void GuessParameters(int n, int tn, int* idx, double* rho, double* z, bool minimum);
26    void GuessParameters(const std::vector<SSurface*>& surfaces, bool minimum);
27
28private:
29    double fK;
30};
31
32//__________________________________________________________________________________
33inline void ParabolicSurface::FillSegment(double rho, FSIntersectedSegment *intSeg){
34    intSeg->surf=this;
35    intSeg->perp=rho;
36}
37
38//__________________________________________________________________________________
39inline double ParabolicSurface::PointOnSurf(double x){
40    return fZpos+fK*x*x;
41}
42
43//__________________________________________________________________________________
44inline double ParabolicSurface::PointOnSurf2(double x2){
45    return fZpos+fK*x2;
46}
47
48//__________________________________________________________________________________
49inline double ParabolicSurface::Derivative(double x){
50    return 2.*fK*x;
51}
52
53//______________________________________________________________________________
54inline bool ParabolicSurface::Normal(FSIntersectedSegment* ints, const G4ThreeVector& p, double out, G4ThreeVector* norm){
55    double perp=p.perp();
56    double tgth=Derivative(perp);
57    double c=out/sqrt(1.+tgth*tgth);
58    double s=tgth*c;
59    double iperp=-1./perp;
60    norm->set(p.x()*iperp*s,p.y()*iperp*s,c);
61    return true;
62}
63
64};
65
66#endif
Note: See TracBrowser for help on using the repository browser.