Universita' di GenovaINFN Sezione di Genova  
AIRWATCH / EUSO Genova

LightFactory - source file

// ESAF : Euso Simulation and Analysis Framework
// $Id: LightFactory.cc,v 1.3 2005/11/14 11:24:52 moreggia Exp $
// Marco Pallavicini created Mar, 13 2002

#include <string>
#include "LightFactory.hh"
#include "Config.hh"
#include "StandardLightToEuso.hh"
#include "FileUnisimLightToEuso.hh"
#include "TestLightToEuso.hh"
#include "SlastLightToEuso.hh"
#include "PhPRootFileLightToEuso.hh"
#include "BunchRadiativeTransfer.hh"
#include "MCRadiativeTransfer.hh"
#include "NoRadiativeTransfer.hh"
#include "TestLightSource.hh"
#include "FileShowerGenerator.hh"
#include "ShowerLightSource.hh"
#include "NoLightSource.hh"
#include "NoEventGenerator.hh"
#include "SlastShowerGenerator.hh"
#include "UnisimFileShowerGenerator.hh"
#include "CorsikaFileShowerGenerator.hh"

ClassImp(LightFactory)

LightFactory* LightFactory::fMe = NULL;

//______________________________________________________________________________
 LightFactory::LightFactory() {
    //
    // ctor
    //
}

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

//______________________________________________________________________________
 LightFactory* LightFactory::Get(){
    //
    // Instance
    // 
    
    if (fMe == NULL)
	fMe = new LightFactory();
    return fMe;
}

//______________________________________________________________________________
 LightToEuso *LightFactory::GetLightToEuso() {
    // 
    // Call ctor of appropriate LightToEuso object
    //

    ConfigFileParser *pConfig = Config::Get()->GetCF("General", "Euso");
    string name = pConfig->GetStr ("Euso.fLightToEuso");

    if (name == "standard")	// normal simulation 
        return new StandardLightToEuso();

    else if (name == "unisim")	// unisim file with photons on pupil
        return new FileUnisimLightToEuso();

    else if (name == "test")	// test photons on pupil with various shapes
        return new TestLightToEuso();

    else if (name == "slast")	// slast f77 generation of photons on pupil
        return new SlastLightToEuso();

    else if (name == "phprootfile")	// phproot file with photons on pupil
        return new PhPRootFileLightToEuso();

    else if (name == "none")	// no photons at all; electronic test
        return NULL;
    
    else
        throw invalid_argument("invalid LightToEuso object: " + name);

    return NULL;

}

//______________________________________________________________________________
 EventGenerator * LightFactory::GetGenerator( const string& name ) {
    // 
    // Call ctor of appropriate EventGenerator object
    //

    if (name == "file")
        return new FileShowerGenerator();

    else if (name == "noevent")
        return new NoEventGenerator();    

    else if (name == "slast++")
        return new SlastShowerGenerator();

    else if (name == "Unisimfile")
        return new UnisimFileShowerGenerator();

    else if (name == "Corsikafile")
        return new CorsikaFileShowerGenerator();

    else
        throw invalid_argument("invalid ShowerSource object: " + name);

    return NULL;
}


//______________________________________________________________________________
 LightSource * LightFactory::GetLightSource( const string& name ) {
    //
    // Call ctor of appropriate LightSource object
    //

    if (name == "test")
        return new TestLightSource();

    else if (name == "lighting")
        throw invalid_argument("LightingLS not yet implementedn");

    else if (name == "meteor")
        throw invalid_argument("MeteorLS not yet implementedn");

    else if (name == "lidar")
        throw invalid_argument("LidarLS not yet implementedn");

    else if (name == "file")
        throw invalid_argument("FileLS not yet implementedn");

    else if (name == "track")
        throw invalid_argument("TackLS not yet implementedn");

    else if (name == "shower")
        return new ShowerLightSource();

    else if (name == "nolight")
        return new NoLightSource();

    else
        throw invalid_argument("invalid LightSource object: " + name);

    return NULL;
}

//______________________________________________________________________________
 RadiativeTransfer * LightFactory::GetRadiative( const string& name ) {
    //
    // Call ctor of appropriate RadiativeTransfer object
    //

    if (name == "bunch")
        return new BunchRadiativeTransfer();

    else if (name == "MC")
        return new MCRadiativeTransfer();
    
    else if (name == "notransfer")
        return new NoRadiativeTransfer();
    
    else throw invalid_argument("invalid RadiativeTransfer object: " + name);
    
    return NULL;
}
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