source: JEM-EUSO/esaf_cc_at_lal/packages/simulation/detector/G4Detector/G4fresnellens/include/CylindricSurface.h @ 114

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

actual version of ESAF at CCin2p3

File size: 3.2 KB
Line 
1#ifndef __CYLINDRICSURFACE__
2#define __CYLINDRICSURFACE__
3
4#include "ParametricSurface.h"
5
6namespace G4FresnelLens{
7
8class CylindricSurface : public ParametricSurface
9{
10public:
11    CylindricSurface(double z1=0., double z2=0., double rmax=0.);
12   ~CylindricSurface();
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    double Derivative(double x);
20    EInside Inside(double rho, double z, FSIntersectedSegment *intSeg=0);
21    virtual void FillSegment(double rho, FSIntersectedSegment *intS);
22    bool Normal(FSIntersectedSegment* ints, const G4ThreeVector& p, double up, G4ThreeVector* norm);
23    bool operator==(SSurface&);
24
25    void SetZ(double zmin, double zmax); //keeps direction
26    void print();
27protected:
28    void GuessParameters(int n, int tn, int* idx, double* rho, double* z, bool minimum){};
29
30private:
31    int fDirection; // +1 up of -1 for down
32};
33
34//__________________________________________________________________________________
35inline double CylindricSurface::PointOnSurf(double x){
36    printf("should not be called\n");
37    return fZmin;
38}
39
40//__________________________________________________________________________________
41inline double CylindricSurface::PointOnSurf2(double x2){
42    printf("should not be called\n");
43    return fZmin;
44}
45
46//__________________________________________________________________________________
47inline double CylindricSurface::Derivative(double x){
48    return fDirection*DBL_MAX;
49}
50
51//______________________________________________________________________________________________________________________
52inline void CylindricSurface::FillSegment(double rho, FSIntersectedSegment *intSeg){
53    intSeg->surf=this;
54    intSeg->perp=rho;
55}
56
57//______________________________________________________________________________________________________________________
58inline EInside CylindricSurface::Inside(double rho, double z, FSIntersectedSegment *intSeg){
59    if ( z>(fZmax+kHalfTolerance) || rho>fR+kHalfTolerance ) return kOutside;
60    if ( rho<fR-kHalfTolerance || z<(fZmin-kHalfTolerance) ) return kInside;
61    if (intSeg) FillSegment(rho, intSeg);
62    return kSurface;
63}
64
65//______________________________________________________________________________________________________________________
66inline void CylindricSurface::SetZ(double zmin, double zmax){
67    fZmin=zmin;
68    fZmax=zmax;
69    if (fDirection>0){
70        fZ1=fZmin;
71        fZ2=fZmax;
72    }
73    else {
74        fZ1=fZmax;
75        fZ2=fZmin;
76    }
77}
78
79//______________________________________________________________________________________________________________________
80inline void CylindricSurface::print(){
81    printf("cyl surface\tr=%g    \tz(%g, %g)\tup=%i\tmin/max=%g/%g\n", fR, fZ1, fZ2, fDirection, fZmin, fZmax);
82}
83
84//______________________________________________________________________________
85inline bool CylindricSurface::Normal(FSIntersectedSegment* ints, const G4ThreeVector& p, double out, G4ThreeVector* norm){
86    double invperp=-fDirection*out/p.perp();
87    norm->set(p.x()*invperp,p.y()*invperp,0.);
88    return true;
89}
90
91};
92
93#endif
Note: See TracBrowser for help on using the repository browser.