// ESAF : Euso Simulation and Analysis Framework
// $Id: SinglePhoton.cc,v 1.18 2005/04/14 15:52:45 moreggia Exp $
// S. Moreggia created 27 October 2003
#include "SinglePhoton.hh"
#include <stdexcept>
#include "EConst.hh"
#include "EsafRandom.hh"
#include "Ground.hh"
#include "RadiativeFactory.hh"
ClassImp(SinglePhoton)
using EConst::EarthRadius;
using EConst::C;
//_____________________________________________________________________________
SinglePhoton::SinglePhoton() {
//
// ctor
//
}
//_____________________________________________________________________________
SinglePhoton::SinglePhoton(Double_t date, Double_t wl, const EarthVector& pos,
const EarthVector& dir, PhotonType type,
PhotonStatus status, UInt_t bid) {
//
// ctor (photon in the shower)
//
fBunchId = bid;
fType = type;
fStatus = status;
fDate = date;
fWl = wl;
fPos = pos;
fShowerPos = fPos;
fDir = dir.Unit();
fTof = 0;
fAbsorbed = 0;
}
//_____________________________________________________________________________
SinglePhoton::SinglePhoton(PhotonType type, Double_t date, Double_t tof, Double_t wl, const EarthVector& showerpos,
const EarthVector& pos,const EarthVector& dir, PhotonStatus status, UInt_t bid) {
//
// ctor (out of the shower, during radiative transfer)
//
fBunchId = bid;
fType = type;
fStatus = status;
fDate = date;
fTof = tof;
fWl = wl;
fShowerPos = showerpos;
fPos = pos;
fDir = dir.Unit();
fAbsorbed = 0;
}
//_____________________________________________________________________________
SinglePhoton::SinglePhoton(const BunchOfPhotons& b,Double_t wl,const EarthVector& dir,PhotonStatus status) {
//
// ctor from a bunch
//
fType = b.GetType();
fBunchId = b.GetId();
fStatus = status;
fDate = b.GetDate();
fTof = b.GetTof();
fWl = wl;
fPos = b.GetPos();
fShowerPos = b.GetShowerPos();
fDir = dir.Unit();
fAbsorbed = 0;
}
//_____________________________________________________________________________
SinglePhoton::~SinglePhoton(){
//
// dtor
//
}
//_____________________________________________________________________________
void SinglePhoton::AddToPosTof(const EarthVector& v) {
//
// Increment the position AND the TOF
//
fTof += v.Mag() / C();
fPos += v;
}