// $Id: ParentPhoton.cc,v 1.24 2005/04/14 15:57:46 moreggia Exp $
// M. Pallavicini created Jul, 3 2002
/*****************************************************************************
* ESAF: Euso Simulation and Analysis Framework *
* *
* Id: ParentPhoton *
* Package: RadiativeTransfer *
* Coordinator: Sylvain.Moreggia *
* *
*****************************************************************************/
//_____________________________________________________________________________
//
// ParentPhoton
//
// Note on reference frame:
// Z axis is axis of Euso and also zenith-nadir direction
// Z positive in Zenith
// X and Y not important so far.
#include "Photon.hh"
#include "ParentPhoton.hh"
#include "SinglePhoton.hh"
#include "EPhoton.hh"
#include "Config.hh"
#include "EsafRandom.hh"
ClassImp(ParentPhoton)
//______________________________________________________________________________
ParentPhoton::ParentPhoton() {
//
// empty ctor
//
Double_t pos[3] = {0,0,0};
Double_t spos[3] = {0,0,0};
Build(-1, spos, pos, 0., 0., 0., 0, Fluorescence);
}
//______________________________________________________________________________
ParentPhoton::ParentPhoton(Int_t i, Double_t* x, Double_t* y, Double_t th,
Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) {
//
// Constructor
//
// i: photon number (from 1 to number of photons in this event)
// x: 3 dim. array with position in the shower
// y: 3 dim. array with position on the pupil (mm)
// th: theta direction of the photon (rad, theta=0 enter along axis)
// ph: phi direction of the photon (rad)
// w: wavelength in nm
// t: entrance fTime in ns
// typ: type
//
Build(i,x,y,th,ph,w,t,typ);
}
//______________________________________________________________________________
ParentPhoton::ParentPhoton(Int_t i, TVector3 spos, TVector3 pos, Double_t th,
Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) {
//
// Constructor
//
// i: photon number (from 1 to number of photons in this event)
// x: 3 dim. array with position in the shower
// y: 3 dim. array with position on the pupil (mm)
// th: theta direction of the photon (rad, theta=0 enter along axis)
// ph: phi direction of the photon (rad)
// w: wavelength in nm
// t: entrance fTime in ns
// typ: type
//
Build(i,spos,pos,th,ph,w,t,typ);
}
//______________________________________________________________________________
ParentPhoton::ParentPhoton( const SinglePhoton& p, const TVector3& pos) {
//
// convert a SinglePhoton to a ParentPhoton
//
static Int_t i = 0;
fId = i++;
fTime = p.Date() + p.Tof();
fWl = p.Wl();
fShowerPos = p.ShowerPos();
fDir = p.Dir();
fTheta = p.Dir().Theta();
fPhi = p.Dir().Phi();
fPupilPos.SetXYZ(pos.X(),pos.Y(),pos.Z());
if (p.Type() == Fluo)
fType = Fluorescence;
else if(p.Type() == Cerenkov) {
switch(p.Status()) {
case Reflected: fType = CerenkovReflected;
break;
case RaylScat: fType = CerenkovScattered;
break;
case CloudScat: fType = CerenkovScattered;
break;
case Direct : Msg(EsafMsg::Panic) << "direct cerenkov not allowed by ParentPhoton so far" << MsgDispatch;
break;
default : Msg(EsafMsg::Panic) << "Wrong SinglePhoton status given to ParentPhoton" << MsgDispatch;
}
}
CreatePhoton();
}
//______________________________________________________________________________
void ParentPhoton::Build(Int_t i, Double_t* x, Double_t* y, Double_t th,
Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) {
//
// Set all parameters of the ParentPhoton
//
// i: photon number (from 1 to number of photons in this event)
// x: 3 dim. array with position in the shower
// y: 3 dim. array with position on the pupil (mm)
// th: theta direction of the photon (rad, theta=0 enter along axis)
// ph: phi direction of the photon (rad)
// w: wavelength in nm
// t: entrance fTime in ns
// typ: type
//
fId = i;
fShowerPos[0] = x[0]; // position in shower
fShowerPos[1] = x[1];
fShowerPos[2] = x[2];
fPupilPos[0] = y[0]; // position in pupil
fPupilPos[1] = y[1];
fPupilPos[2] = y[2];
fDir.SetMagThetaPhi(1,th,ph); // direction in global frame
fWl = w;
fTime = t;
fTheta = th;
fPhi = ph;
fType = typ;
CreatePhoton();
}
//______________________________________________________________________________
void ParentPhoton::Build(Int_t i, TVector3 spos, TVector3 pos, Double_t th,
Double_t ph, Double_t w, Double_t t, ParentPhotonType typ) {
//
// Set all parameters of the ParentPhoton
//
// i: photon number (from 1 to number of photons in this event)
// x: 3 dim. array with position in the shower
// y: 3 dim. array with position on the pupil (mm)
// th: theta direction of the photon (rad, theta=0 enter along axis)
// ph: phi direction of the photon (rad)
// w: wavelength in nm
// t: entrance fTime in ns
// typ: type
//
fId = i;
fShowerPos = spos; // position in shower
fPupilPos = pos; // position in pupil
fDir.SetMagThetaPhi(1,th,ph); // direction in global frame
fWl = w;
fTime = t;
fTheta = th;
fPhi = ph;
fType = typ;
CreatePhoton();
}
//______________________________________________________________________________
ParentPhoton::~ParentPhoton() {
//
// Destructor
//
}
//______________________________________________________________________________
void ParentPhoton::CreatePhoton() {
//
// create a photon object from this parent photon
//
fChild.time = fTime;
fChild.wl = fWl;
fChild.pos = fPupilPos;
fChild.dir = fDir;
fChild.iterations = 0;
fChild.hit = false;
fChild.hitIfs = false;
fChild.MChit = false;
fChild.madeSignal = false;
fChild.pixelUid = -1;
fChild.fate = 0;
fChild.parent = this;
}