Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

StandardLightToEuso - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: StandardLightToEuso.cc,v 1.5 2005/10/02 14:17:55 thea Exp $
// Marco Pallavicini created Mar, 13 2002

#include <string>
#include "StandardLightToEuso.hh"
#include "Config.hh"

#include "LightFactory.hh"
#include "EventGenerator.hh"
#include "LightSource.hh"
#include "RadiativeTransfer.hh"
#include "Atmosphere.hh"

#include "MCTruth.hh"
#include "PhotonsInAtmosphere.hh"
#include "PhotonsOnPupil.hh"
#include "PhysicsData.hh"

#include "EEvent.hh"
#include "EShower.hh"
#include "EEventTruthAdder.hh"
#include "EShowerFiller.hh"

ClassImp(StandardLightToEuso)

//______________________________________________________________________________
 StandardLightToEuso::StandardLightToEuso() : LightToEuso("STANDARD") {
    //
    // ctor
    //

    Configure();
}

//______________________________________________________________________________
 StandardLightToEuso::~StandardLightToEuso() {
    //
    // dtor
    //
}

//______________________________________________________________________________
 void StandardLightToEuso::Configure() {
    //
    // Configures this instance
    //
    
    string genname = Conf()->GetStr("StandardLightToEuso.fGenerator");
    fGenerator = LightFactory::Get()->GetGenerator( genname );
    string liname = Conf()->GetStr("StandardLightToEuso.fLightSource");
    fLight = LightFactory::Get()->GetLightSource( liname );
    string raname = Conf()->GetStr("StandardLightToEuso.fRadiativeTransfer");
    fRadiative = LightFactory::Get()->GetRadiative( raname );    
}

//______________________________________________________________________________
 PhotonsOnPupil* StandardLightToEuso::Get(const DetectorGeometry* dg) {
    //
    // Returns photons upon euso pupil, resulting from the physics simultaion in atmosphere
    //
    
    PhotonsInAtmosphere* p_in_atmo = 0;
    PhotonsOnPupil* p_on_pupil = 0;
    const PhysicsData* data = 0;
    
    data = GetGenerator()->Get();
    // save atmosphere truth
    const Clouds* clouds = Atmosphere::Get()->GetClouds();
    MCTruth* truth = GetTruth();
    if(truth) {
        truth->SetHclouds(clouds->GetTopAltitude());
        truth->SetCloudsthick(clouds->GetThickness());
        truth->SetCloudsOD(clouds->GetOD());
        truth->SetLatitude(Atmosphere::Get()->GetLatitude());
        truth->SetLongitude(Atmosphere::Get()->GetLongitude());
        truth->SetDate(Atmosphere::Get()->GetDate());
    }

    SaveEvent( data );
    
    p_in_atmo = GetLightSource()->Get(data);
    p_on_pupil = GetRadiative()->Get(p_in_atmo,dg);
    
    return p_on_pupil;
}

//______________________________________________________________________________
 MCTruth* StandardLightToEuso::GetTruth() {
    //
    // Returns the MCTruth object
    //
    return fGenerator->GetTruth();
}

//______________________________________________________________________________
 void StandardLightToEuso::SaveEvent( const PhysicsData* data ) {
    //
    // saves PhysicsData with the proper filler
    //
    
    EEvent* ev = EEvent::GetCurrent();

    // no std event defined. exit.
    if (!ev) return;
    
    // save the truth
    if ( GetTruth() ) {
        EEventTruthAdder a( GetTruth() );
        ev->Fill(a);
    }
    
    // save the shower
    if ( data->Type() == "shower" ) {
        EShowerFiller f( data );
        ev->Fill(f);
    }
}
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