Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

FakeOpticalAdaptor - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: FakeOpticalAdaptor.cc,v 1.8 2005/10/02 14:17:55 thea Exp $
// A.Thea created Oct, 24 2003

#include "FakeOpticalAdaptor.hh"
#include "Photomultiplier.hh"

using namespace sou;

ClassImp(FakeOpticalAdaptor)

//______________________________________________________________________________
 FakeOpticalAdaptor::FakeOpticalAdaptor() {
    // 
    // Constructor
    // 

    fReflectivity = Conf()->GetNum("FakeOpticalAdaptor.fCathode.reflectivity");

    fSide=Conf()->GetNum("FakeOpticalAdaptor.fSide")*mm;
    fHeight=Conf()->GetNum("FakeOpticalAdaptor.fHeight")*mm;
}

//______________________________________________________________________________
 FakeOpticalAdaptor::~FakeOpticalAdaptor() {
    // 
    // Destructor
    // 

}

//______________________________________________________________________________
 Photon *FakeOpticalAdaptor::Transport(Photon *p) const {
    EVector lpos, ldir;
    lpos=p->pos-fPos;
    lpos=goLocal(lpos);
    ldir=goLocal(ldir);

    Int_t face=whichFace(p);
    if ( face == TOP ){

        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)) {
#ifdef DEBUG
            cout<<"photon rejected by PMT"<<endl;
#endif /* DEBUG */
            } else {
#ifdef DEBUG
            cout<<"photon accepted by PMT"<<endl;
#endif /* DEBUG */
            return 0;
        }
        
    } else if ( face == BOTTOM ) {
        return p;
    } else{
        throw runtime_error("FakeOpticalAdaptor: photon on a non-existent face.");
    }
    return 0;
}
About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update Wed Nov 16 16:57:39 2005 Wed Nov 16 16:29:22 2005