// $Id: IdealOpticalAdaptor.cc,v 1.22 2005/04/24 13:12:43 thea Exp $
// Author: A.Thea 22/10/2002
//______________________________________________________________________________
//
// IdealOpticalAdaptor
// ===================
//
// Simple implementation of an ideal optical adaptor:
// Compresses the image it gets on its top surface in order to fit the
// sensitive area of the pmt (i.e. without external dead borders).
//
// Config file parameters
// ======================
//
// fSmallSide [mm]: Side of the exit face.
//
// fRadiomEff : Radiometric efficiency of the adapter.
//
// fFilter : Filter to apply to the incident radiation
// - options
// BG3: Plain BG3 filter. [EUSO-FS-REP-012-1.pdf]
// multilayer: MgF2/HfO2 + AR coating applied to a BG3Filter
// [EUSO-FS-REP-012-1.pdf]
//
// fFilterThikness [mm] : effective thikness of the filter
//
#include "IdealOpticalAdaptor.hh"
#include "OpticsFactory.hh"
#include "Photomultiplier.hh"
#include "Etypes.hh"
#include <TRotMatrix.h>
#include <TFile.h>
ClassImp(IdealOpticalAdaptor)
//______________________________________________________________________________
IdealOpticalAdaptor::IdealOpticalAdaptor() {
//
// Constructor
//
fReflectivity = Conf()->GetNum("IdealOpticalAdaptor.fCathode.reflectivity");
fSide=Conf()->GetNum("IdealOpticalAdaptor.fSide")*mm;
fHeight=Conf()->GetNum("IdealOpticalAdaptor.fHeight")*mm;
fSmallSide = Conf()->GetNum("IdealOpticalAdaptor.fSmallSide")*mm;
fScale = fSmallSide/fSide;
fRadiomEff = Conf()->GetNum("IdealOpticalAdaptor.fRadiomEff")*mm;
string filter = Conf()->GetStr("IdealOpticalAdaptor.fFilter");
if ( filter=="square" ) {
fFilterThickness = 0;
fFilterType = kSquare;
} else if ( filter=="BG3" ) {
fFilterType = kBG3;
fFilterThickness = Conf()->GetNum("IdealOpticalAdaptor.fFilterThickness")*mm;
} else if ( filter=="multilayer" ) {
fFilterType = kMultilayer;
fFilterThickness = Conf()->GetNum("IdealOpticalAdaptor.fFilterThickness")*mm;
} else {
Msg(EsafMsg::Panic) << "Unknown filter in OpticalAdaptor.cfg" << MsgDispatch;
}
}
//______________________________________________________________________________
Photon *IdealOpticalAdaptor::Transport(Photon *p) const {
// check if the photon gets through the adapter
if ( IsAbsorbed( p ) ) {
p->fate = kOpticalAdapter;
return 0;
}
EVector dummy=p->pos;
EVector lpos=p->pos;
lpos-=fPos;
lpos=goLocal(lpos);
// check hitface,
int face=whichFace(p);
if (face!=TOP && face!=BOTTOM) {
//FIXME waiting MsgForm to become const
// MsgForm(EsafMsg::Warning,"IdealOpticalAdaptor error: hit face neither TOP nor BOTTOM");
return 0;
}
if (face==TOP) {
// bottom face border length
double deltaside=(fSide-fSmallSide)/2;
// new photon position on the bottom side.
lpos[X]=lpos[X]*fScale+deltaside;
lpos[Y]=lpos[Y]*fScale-deltaside; // y axis is negative
lpos[Z]=lpos[Z]-fHeight;
p->pos=goGlobal(lpos);
p->pos+=fPos; // new photon position
p->time+=(p->pos-dummy).Mag()/c_light;
if (isReflectedByCathode()) {
EVector ldir=goLocal(p->dir);
ldir[Z]*=-1;
p->dir=goGlobal(ldir);
p->MChit=false;
p->hit=false;
return Transport(p);
}
// Add photon to PMT
if(!pmt->Pmt()->Add(*p)) {
return 0;
}
}
if (face==BOTTOM) {
// bottom face border length
double deltaside=(fSide-fSmallSide)/2;
// new photon position on the bottom side.
lpos[X]=(lpos[X]-deltaside)/fScale;
lpos[Y]=(lpos[Y]+deltaside)/fScale; // y axis is negative
lpos[Z]=lpos[Z]+fHeight;
p->pos=goGlobal(lpos);
p->pos+=fPos; // new photon position
p->time+=(p->pos-dummy).Mag()/c_light;
return p;
}
return 0;
}