// ESAF : Euso Simulation and Analysis Framework
// $Id: FastDetectorTransportManager.cc,v 1.12 2005/02/13 23:23:06 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->Get() ) {
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
}