// ESAF : Euso Simulation and Analysis Framework
// $Id: LightFactory.cc,v 1.1 2005/04/09 17:25:56 thea 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 "TestLightSource.hh"
#include "FileShowerGenerator.hh"
#include "ShowerLightSource.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
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
throw invalid_argument("invalid RadiativeTransfer object: " + name);
return NULL;
}