source: JEM-EUSO/esaf_cc_at_lal/packages/simulation/detector/electronics/include/PmtGeometry.hh @ 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: 6.2 KB
Line 
1// $Id: PmtGeometry.hh 1767 2005-04-19 22:33:30Z thea $
2// Author: D.Demarco, M.Pallavicini
3
4/*****************************************************************************
5 * ESAF: Euso Simulation and Analysis Framework                              *
6 *                                                                           *
7 *  Id: ParamOpticalSystem                                                   *
8 *  Package: Optics                                                          *
9 *  Coordinator: Marco.Pallavicini                                           *
10 *                                                                           *
11 *****************************************************************************/
12
13
14#ifndef __PMTGEOMETRY_H_
15#define __PMTGEOMETRY_H_
16
17#include <vector>
18#include "Photon.hh"
19#include "TVector3.h"
20#include "EsafConfigurable.hh"
21
22//#define PMT_TOLERANCE 0.0002
23#define PMT_TOLERANCE 1e-6
24enum OAFace {TOP, RIGHT, LEFT, FRONT, BACK, BOTTOM};
25
26class Photomultiplier;
27class OpticalAdaptor;
28
29typedef Int_t ChannelUniqueId;
30
31////////////////////////////////////////////////////////////////////////////////
32//                                                                            //
33//  PmtGeometry                                                               //
34//                                                                            //
35//  Geometrical description of any squared photomultiplier                    //
36//                                                                            //
37////////////////////////////////////////////////////////////////////////////////
38
39class PmtGeometry : public EsafConfigurable {
40public:
41    // ctor
42    PmtGeometry(TVector3, TVector3, TVector3);
43   
44    // dtor
45    virtual ~PmtGeometry();
46   
47    EsafConfigClass(Electronics,PmtGeometry);
48
49    // return parameters for this kind of pmt
50    static Int_t NumPads() {return fgNumPads;}
51    static Int_t Rows() {return fgNumRows;}
52    static Double_t Side() {return fgSide;}
53    static Double_t PadSide() {return fgPadSide;}
54    static Double_t DeadBorder() {return fgDeadBorder;}
55    static Double_t DeadInnerStrip() {return fgDeadInner;}
56
57    // static reset class variables
58    static void ResetClass();
59
60    // set pointers to nearest neighbors
61    void SetNearest(PmtGeometry*, PmtGeometry*, PmtGeometry*, PmtGeometry*);
62   
63    // set and get parent pmt
64    inline void SetPmt(Photomultiplier* pm) {pPmt = pm;}
65    Photomultiplier* Pmt() const {return pPmt;}
66 
67    // set and get optical adaptor
68    inline void SetOA( OpticalAdaptor *oa ){pOA = oa;}
69    OpticalAdaptor* GetOA() const { return pOA;}
70
71    void InsertOA( OpticalAdaptor* oa );
72    // insert oa in front of the pmt and displace geometry back of oa->GetHeight()
73   
74    // local coordinate origin position in local FS coordinates
75    inline const TVector3& Position() const {return fPosition;}
76   
77    // returns the position of the center of a pad (local FS coordinates)
78    TVector3 Position(Int_t,Int_t) const;  // row and col
79    TVector3 Position(Int_t) const;      // channel
80
81    // normal to the photocathode in EUSO coordinates
82    inline const TVector3& Normal() const {return fZAxis;}
83    inline const TVector3& GetX() const {return fXAxis;}
84    inline const TVector3& GetY() const {return fYAxis;}
85    inline const TVector3& GetZ() const {return fZAxis;}
86
87    // center
88    TVector3 Center() const;
89   
90    // returns pad number hit by a Photon
91    Int_t Pad(const Photon&) const;
92
93    // returns true if the photon is within geometrical acceptance
94    Bool_t IsInside(const Photon&) const;
95
96    // returns true if the photon is within geometrical acceptance
97    Double_t IsHit(const Photon&) const;
98
99    // nearest neighbors
100    const PmtGeometry* Nearest( OAFace ) const;
101
102    // unique id handlers
103    // set first unique id associated to this pmt
104    inline void SetStartUniqueId(ChannelUniqueId start) {fStartUniqueId = start;}
105   
106    // get unique id for a given channel
107    inline ChannelUniqueId GetUniqueId(Int_t ch) const {return (fStartUniqueId+ch);}
108   
109    // get first unique id belonging to this pmt
110    inline ChannelUniqueId GetStartUniqueId() const {return fStartUniqueId;}
111   
112    // get last unique id belonging to this pmt
113    inline ChannelUniqueId GetLastUniqueId() const {return (fStartUniqueId + NumPads()-1);}
114   
115    // get channel number (from 0 to pmtsize) given a unique id
116    // returns -1 does not exist
117    Int_t GetChannel(ChannelUniqueId id) const;
118
119    // theta and phi corresponding to this pixel in field of view (center value)
120    Double_t ThetaFOV(Int_t nch) const; 
121    Double_t PhiFOV(Int_t nch) const; 
122
123private:
124    // set geometry paramters of the pmt (class variables)
125    static void SetPmtGeometry();
126
127    // class variables with geometry parameters
128    static Int_t fgNumPads;                // number of active pads
129    static Int_t fgNumRows;                // number of rows and columns
130    static Double_t fgSide;                // physical total width of the pmt
131    static Double_t fgDeadBorder;          // thickness of external dead space
132    static Double_t fgDeadInner;           // thickness of internal space
133                                           // ( between pads )
134    static Double_t fgPadSide;             // width of one pad
135    static TVector3* fgCorners[10][10];    // map of 3D points with the corner of
136                                           // each pad (local coordinates)
137   
138    // convert from gloabl to local coordinate
139    TVector3 LocalCoord( const TVector3& ) const;
140    Int_t Pad( const TVector3&) const;   
141
142    // geometry position of this pmt
143    TVector3 fPosition;          // local coordinate origin position
144    TVector3 fZAxis;             // normal to the phocal surface
145    TVector3 fYAxis;             // y axis in global coordinate
146    TVector3 fXAxis;             // x axis in global coordinate
147
148    // pointer to optical adaptor
149    OpticalAdaptor *pOA;
150   
151    // pointers to nearest neighbors
152    PmtGeometry *fRight, *fLeft, *fFront, *fBack;
153
154    // parent pmt
155    Photomultiplier* pPmt;
156
157    // unique id
158    ChannelUniqueId fStartUniqueId;
159   
160    static TVector3& Corner(Int_t r,Int_t c) {return *(fgCorners[r][c]);}
161
162    ClassDef(PmtGeometry,0)
163};
164
165#endif
Note: See TracBrowser for help on using the repository browser.