Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

ParentPhoton - source file

// $Id: ParentPhoton.cc,v 1.31 2005/10/25 14:18:53 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, Double_t* x, Double_t* y, Double_t* d,
     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)
    // d: direction of the photon
    // w: wavelength in nm
    // t: entrance fTime in ns
    // typ: type 
    //

    Build(i,x,y,d,w,t,typ);
}

//______________________________________________________________________________
 ParentPhoton::ParentPhoton(Int_t i, const TVector3 spos, const 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)
    // spos: emission position in the shower
    // ppos: position of the photon
    // 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(Int_t i, const TVector3 spos, const TVector3 pos,
    const TVector3 dir, Double_t w, Double_t t, ParentPhotonType typ) {
    //
    // Constructor
    //
    // i: photon number (from 1 to number of photons in this event)
    // spos: emission position in the shower
    // ppos: position of the photon
    // dir: direction of the photon
    // w: wavelength in nm
    // t: entrance fTime in ns
    // typ: type 
    //

    Build(i,spos,pos,dir,w,t,typ);
}

//______________________________________________________________________________
 ParentPhoton::ParentPhoton( const SinglePhoton& p, const TVector3& pos, const TVector3& local_dir) {
    //
    // 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       = local_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 AeroScat : fType = CerenkovScattered;
                            break;
            case Direct   : fType = CerenkovScattered;
                            break;
			    
            default       : Msg(EsafMsg::Warning) << "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, Double_t* x, Double_t* y, Double_t* d,
    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[0] = d[0]; // direction in global frame
    fDir[1] = d[1]; 
    fDir[2] = d[2]; 
    fWl = w;
    fTime = t;
    fTheta = fDir.Theta();
    fPhi = fDir.Phi();
    fType = typ;
    
    CreatePhoton();
}

//______________________________________________________________________________
 void ParentPhoton::Build(Int_t i, const TVector3 spos, const 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)
    // spos: emission position in the shower
    // ppos: position of the photon
    // 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 
    //

    Double_t x[3], y[3];
    spos.GetXYZ(x);
    pos.GetXYZ(y);

    Build(i,x,y,th,ph,w,t,typ);

}

//______________________________________________________________________________
 void ParentPhoton::Build(Int_t i, const TVector3 spos, const TVector3 pos, 
    const TVector3 dir, 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)
    // spos: emission position in the shower
    // ppos: position of the photon
    // 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 
    //

    Double_t x[3], y[3], d[3];
    spos.GetXYZ(x);
    pos.GetXYZ(y);
    dir.GetXYZ(d);

    Build(i,x,y,d,w,t,typ);

}

//______________________________________________________________________________
 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;
}
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