// ESAF : Euso Simulation and Analysis Framework
// $Id: RadiativeFactory.cc,v 1.16 2005/04/14 16:39:27 moreggia Exp $
// S. Moreggia created 27 October 2003
#include <stdexcept>
#include "RadiativeFactory.hh"
#include "Config.hh"
#include "TestGround.hh"
#include "LowtranRadiativeProcessesCalculator.hh"
#include "FastRadiativeProcessesCalculator.hh"
#include "O1_ClearSkyPropagator.hh"
#include "O2_ClearSkyPropagator.hh"
#include "AlongTrack_CSPropagator.hh"
#include "TestCloudsPropagator.hh"
#include "UniformLayersCloudsPropagator.hh"
#include "NoCloudsPropagator.hh"
ClassImp(RadiativeFactory)
RadiativeFactory* RadiativeFactory::fMe = NULL;
//______________________________________________________________________________
RadiativeFactory::RadiativeFactory() : EsafConfigurable(), EsafMsgSource() {
//
// ctor
//
}
//______________________________________________________________________________
RadiativeFactory::~RadiativeFactory() {
//
// dtor
//
}
//______________________________________________________________________________
RadiativeFactory* RadiativeFactory::Get() {
//
// get the instance
//
if (fMe == NULL) {
fMe = new RadiativeFactory();
if (fMe == NULL)
cout << "PANIC : No new RadiativeFactory, memory pb" << MsgDispatch;
}
return fMe;
}
//______________________________________________________________________________
RadiativeProcessesCalculator* RadiativeFactory::GetRadiativeProcessesCalculator() const {
//
// build appropriate RadiativeProcessesCalculator object
//
string type = Conf()->GetStr("RadiativeFactory.RadiativeProcessesCalculator");
if(type == "fast")
return new FastRadiativeProcessesCalculator();
else if(type == "lowtran")
return new LowtranRadiativeProcessesCalculator();
else
Msg(EsafMsg::Panic) << "invalid RadiativeProcessesCalculator object" << MsgDispatch;
return NULL;
}
//______________________________________________________________________________
Ground* RadiativeFactory::GetGround() const {
//
// build appropriate Ground object
//
string type = Conf()->GetStr("RadiativeFactory.Ground");
if(type == "test")
return new TestGround();
else Msg(EsafMsg::Panic) << "invalid Ground object " << MsgDispatch;
return NULL;
}
//______________________________________________________________________________
ClearSkyPropagator* RadiativeFactory::GetClearSkyPropagator(const Ground* g) const {
//
//build appropriate ClearSkyPropagator object
//
string type = Conf()->GetStr("RadiativeFactory.ClearSkyPropagator");
// Fluo directly to Euso
// Ckov towrad ground then reflected
if(type == "order1")
return new O1_ClearSkyPropagator(g);
// order1 + Ckov backscattered when going downward
else if(type == "order2")
return new O2_ClearSkyPropagator(g);
// order2 but bunches assumed propagating along a track
else if(type == "alongtrack")
return new AlongTrack_CSPropagator(g);
else Msg(EsafMsg::Panic) << "invalid ClearSkyPropagator object" << MsgDispatch;
return NULL;
}
//______________________________________________________________________________
InCloudsPropagator* RadiativeFactory::GetInCloudsPropagator(const Ground* g) const {
//
// build appropriate InCloudsPropagator object
//
ConfigFileParser* pConfig = Config::Get()->GetCF("Atmosphere","AtmosphereFactory");
string type = pConfig->GetStr("Clouds.type");
if(type == "test")
return new TestCloudsPropagator(g);
if(type == "uniform")
return new UniformLayersCloudsPropagator(g);
if(type == "none")
return new NoCloudsPropagator();
if(type == "map")
Msg(EsafMsg::Panic) << "MapCloudsPropagator not handled yet" << MsgDispatch;
else Msg(EsafMsg::Panic) << "invalid InCloudsPropagator object" << MsgDispatch;
return NULL;
}