Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

FastDetectorTransportManager - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: FastDetectorTransportManager.cc,v 1.13 2005/09/27 20:19:08 thea Exp $
// M. Pallavicini created Apr, 27 2003

#include "FastDetectorTransportManager.hh"
#include "EEvent.hh"
#include "PhotonsOnPupil.hh"
#include "Photomultiplier.hh"
#include "EusoDetector.hh"
#include "EusoElectronics.hh"
#include "EDetectorPhotonAdder.hh"
 
ClassImp(FastDetectorTransportManager)

// ctor
 FastDetectorTransportManager::FastDetectorTransportManager() : DetectorTransportManager() {
}

// dtor
 FastDetectorTransportManager::~FastDetectorTransportManager() {
}
   
// nothing to draw in this case
void 
 FastDetectorTransportManager::Draw() const {
}
  
// fast transport
// each photon is brought directly to the chief ray pixel of the optics
// no tracking inside detector
// it behaves like an ideal optics module
void 
 FastDetectorTransportManager::Go( PhotonsOnPupil* pupil ) {
    while ( Photon *p = pupil->GetPhoton() ) {
        Transport( p );
    }
}

 Photon* FastDetectorTransportManager::Transport( Photon* p ) const {

    EEvent *ev = EEvent::GetCurrent();
    if ( p && ev ) {
        EDetectorPhotonAdder a(p,0,true); // fill root event with initial infos
        ev->Fill( a );
    }
    // search for right Pmt and fill it 
    FillPmt( *p );

    return 0;
}

// mapping photon to the right PMT
 void FastDetectorTransportManager::FillPmt( Photon& photon ) const {
    
    // get photon theta
    double th = photon.dir.Theta();
    
    // compute theta bin
    int iTheta = (int) (GetNumThBins() * ( 6.* th / 3.14159265359 ));
    
    // get photon Phi
    double ph = photon.dir.Phi();
    
    // compute phi bin
    int iPhi = (int) (GetNumPhBins(iTheta) * ( ph / 2.*3.14159265359 ));

    // get channel id
    int chid = GetUId( iTheta, iPhi );

    if ( GetEusoDetector() ) {
        Photomultiplier *pPmt = GetEusoDetector()->GetEusoElectronics()->PmtId( chid );
	if ( pPmt ) {
	    pPmt->Add( photon );
	}
    } 
    else {
        throw runtime_error("Undefined Euso Detector");
    }
    // FIXME: need to get position from pmt and fill root file with final photon position
}
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