source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/simulation/detector/optics/src/IdealOpticalAdaptor.cc @ 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: 4.0 KB
Line 
1// $Id: IdealOpticalAdaptor.cc 2952 2011-06-28 17:12:29Z mabl $
2// Author: A.Thea    22/10/2002
3
4//______________________________________________________________________________
5//
6//  IdealOpticalAdaptor
7//  ===================
8//
9//  Simple implementation of an ideal optical adaptor:
10//  Compresses the image it gets on its top surface in order to fit the
11//  sensitive area of the pmt (i.e. without external dead borders).
12//
13//  Config file parameters
14//  ======================
15//
16//  fSmallSide [mm]: Side of the exit face.
17//
18//  fRadiomEff : Radiometric efficiency of the adapter.
19//
20//  fFilter : Filter to apply to the incident radiation
21//  - options
22//      BG3: Plain BG3 filter. [EUSO-FS-REP-012-1.pdf]
23//      multilayer: MgF2/HfO2 + AR coating applied to a BG3Filter
24//                  [EUSO-FS-REP-012-1.pdf]
25//
26//  fFilterThikness [mm] : effective thikness of the filter
27//
28
29#include "IdealOpticalAdaptor.hh"
30#include "OpticsFactory.hh"
31#include "Photomultiplier.hh"
32#include "Etypes.hh"
33#include "EConst.hh"
34
35#include <TRotMatrix.h>
36#include <TFile.h>
37
38using namespace sou;
39using namespace EConst;
40
41ClassImp(IdealOpticalAdaptor)
42
43//______________________________________________________________________________
44IdealOpticalAdaptor::IdealOpticalAdaptor() {
45    //
46    // Constructor
47    //
48
49    fReflectivity = Conf()->GetNum("IdealOpticalAdaptor.fCathode.reflectivity");
50
51    fSide=Conf()->GetNum("IdealOpticalAdaptor.fSide")*mm;
52    fHeight=Conf()->GetNum("IdealOpticalAdaptor.fHeight")*mm;
53    fSmallSide = Conf()->GetNum("IdealOpticalAdaptor.fSmallSide")*mm;
54    fScale = fSmallSide/fSide;
55    fRadiomEff = Conf()->GetNum("IdealOpticalAdaptor.fRadiomEff")*mm;
56
57    string filter = Conf()->GetStr("IdealOpticalAdaptor.fFilter");
58
59    if ( filter=="square" ) {
60        fFilterThickness = 0;
61        fFilterType = kSquare;
62    } else if ( filter=="BG3" ) {
63        fFilterType = kBG3;
64        fFilterThickness = Conf()->GetNum("IdealOpticalAdaptor.fFilterThickness")*mm;
65    } else if ( filter=="multilayer" ) {
66        fFilterType = kMultilayer;
67        fFilterThickness = Conf()->GetNum("IdealOpticalAdaptor.fFilterThickness")*mm;
68    } else {
69        Msg(EsafMsg::Panic) << "Unknown filter in OpticalAdaptor.cfg" << MsgDispatch;
70    }
71}
72
73//______________________________________________________________________________
74Photon *IdealOpticalAdaptor::Transport(Photon *p) const {
75
76    // check if the photon gets through the adapter
77    if ( IsAbsorbed( p ) ) {
78        p->fate = kOpticalAdapter;
79        return 0;
80    }
81
82    EVector dummy=p->pos;
83    EVector lpos=p->pos;
84    lpos-=fPos;
85    lpos=goLocal(lpos);
86
87    // check hitface,
88    int face=whichFace(p);
89
90    if (face!=TOP && face!=BOTTOM) {
91        MsgForm(EsafMsg::Warning,"IdealOpticalAdaptor error: hit face neither TOP nor BOTTOM");
92        return 0;
93    }
94
95    if (face==TOP) {
96
97        // bottom face border length
98        double deltaside=(fSide-fSmallSide)/2;
99
100        // new photon position on the bottom side.
101        lpos[X]=lpos[X]*fScale+deltaside;
102        lpos[Y]=lpos[Y]*fScale-deltaside;  // y axis is negative
103        lpos[Z]=lpos[Z]-fHeight;
104        p->pos=goGlobal(lpos);
105        p->pos+=fPos;                // new photon position
106
107        p->time+=(p->pos-dummy).Mag()/Clight();
108
109        if (isReflectedByCathode()) {
110            EVector ldir=goLocal(p->dir);
111            ldir[Z]*=-1;
112            p->dir=goGlobal(ldir);
113            p->MChit=false;
114            p->hit=false;
115            return Transport(p);
116        }
117
118        // Add photon to PMT
119        if(!pmt->Pmt()->Add(*p)) {
120            return 0;
121        }
122    }
123
124    if (face==BOTTOM)  {
125        // bottom face border length
126        double deltaside=(fSide-fSmallSide)/2;
127
128        // new photon position on the bottom side.
129        lpos[X]=(lpos[X]-deltaside)/fScale;
130        lpos[Y]=(lpos[Y]+deltaside)/fScale;  // y axis is negative
131        lpos[Z]=lpos[Z]+fHeight;
132        p->pos=goGlobal(lpos);
133        p->pos+=fPos;                // new photon position
134
135
136        p->time+=(p->pos-dummy).Mag()/Clight();
137
138        return p;
139
140    }
141    return 0;
142}
Note: See TracBrowser for help on using the repository browser.