Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

NightGlowPhotonsOnPupil - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: NightGlowPhotonsOnPupil.cc,v 1.7 2005/02/13 12:58:21 thea Exp $
// Marco Pallavicini created May, 19 2003

#include "NightGlowPhotonsOnPupil.hh"
#include "Config.hh"
#include "euso.hh"
#include "EsafRandom.hh"
#include "Photon.hh"

ClassImp(NightGlowPhotonsOnPupil)

//______________________________________________________________________________
NightGlowPhotonsOnPupil::NightGlowPhotonsOnPupil(double d, double th1, 
    double th2, double ph1, double ph2) : PhotonsOnPupil() , 
    fDuration(d), fThMin(th1), fThMax(th2), fPhMin(ph1), fPhMax(ph2) {
    // 
    // Constructor
    // 

        // get night glow intensity in natural units (m-2 ns-1 str-1)
        fNightGlowIntensity = 
            Conf()->GetNum("NightGlowPhotonsOnPupil.NightGlowRate");

        // get pupil radius
        fPupilRadius = Config::Get()->GetCF("","")->GetNum(""); 

        // compute number of photons to be generated
        double temp = fNightGlowIntensity;                    // rate
        temp *= pi * fPupilRadius * fPupilRadius;  // area
        temp *= fDuration;                             // time duration
        temp *= twopi / (fabs(fPhMin-fPhMax));  // solid angle
        temp *= cos(fThMin) - cos(fThMax);   // solid angle
        fNphotons = (int)temp;

        fDeltaPhi = fPhMax - fPhMin;
        fDeltaCosTheta = cos(fThMax) - cos(fThMin);

        fBufferPhoton = new Photon();
    }

//______________________________________________________________________________
NightGlowPhotonsOnPupil::~NightGlowPhotonsOnPupil() {
    //
    // Destructor
    //
    delete fBufferPhoton;
}

//______________________________________________________________________________
 Photon *NightGlowPhotonsOnPupil::Get() {
    // 
    // Main method
    //
    fBufferPhoton->wl = 357.;
    fBufferPhoton->time = 0.;
    fBufferPhoton->iterations=0;
    fBufferPhoton->hit = false;
    fBufferPhoton->hitIfs = false;
    fBufferPhoton->MChit = false;
    fBufferPhoton->madeSignal = false;
    if ( fCurrent++ < fNphotons ) {
        double phi = EsafRandom::Get()->Rndm();
        phi *= fDeltaPhi;
        double cth = EsafRandom::Get()->Rndm();
        cth *= fDeltaCosTheta;
        double sth = sqrt(1. - cth*cth);
        fBufferPhoton->dir[X] = cos(phi)*sth;
        fBufferPhoton->dir[Y] = sin(phi)*cth;
        fBufferPhoton->dir[Z] = cth;
        double phipupil = twopi*EsafRandom::Get()->Rndm();
        double rpupil = fPupilRadius*EsafRandom::Get()->Rndm();
        fBufferPhoton->pos[X] = rpupil*cos(phipupil);
        fBufferPhoton->pos[Y] = rpupil*cos(phipupil);
        fBufferPhoton->pos[Z] = 0.;
        return fBufferPhoton;
    }
    return (Photon*)0;
}
About Us | EUSO Official Website | Web pages created by Roberto Pesce and Alessandro Thea - Last Update 14-May-2005 21:31