1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: LightSourceFactory.cc 2037 2005-07-13 10:59:06Z berat $ |
---|
3 | // Anne Stutz created Mar, 23 2004 |
---|
4 | |
---|
5 | #include <string> |
---|
6 | #include "LightSourceFactory.hh" |
---|
7 | #include "KakimotoFluoCalculator.hh" |
---|
8 | #include "NaganoFluoCalculator.hh" |
---|
9 | #include "N2dataFluoCalculator.hh" |
---|
10 | #include "SimpleCrkCalculator.hh" |
---|
11 | |
---|
12 | ClassImp(LightSourceFactory) |
---|
13 | |
---|
14 | LightSourceFactory *LightSourceFactory::fMe = NULL; |
---|
15 | |
---|
16 | // ctor |
---|
17 | LightSourceFactory::LightSourceFactory() { |
---|
18 | } |
---|
19 | |
---|
20 | // dtor |
---|
21 | LightSourceFactory::~LightSourceFactory() { |
---|
22 | } |
---|
23 | |
---|
24 | // instance |
---|
25 | LightSourceFactory* LightSourceFactory::Get() { |
---|
26 | if ( fMe == NULL ) |
---|
27 | fMe = new LightSourceFactory(); |
---|
28 | return fMe; |
---|
29 | } |
---|
30 | |
---|
31 | // call ctor of appropriate Fluorescence Calculator |
---|
32 | FluoCalculator* LightSourceFactory::GetFluoCalculator( const string& name ) { |
---|
33 | if ( name == "kakimoto" ) |
---|
34 | return new KakimotoFluoCalculator(); |
---|
35 | else if ( name == "nagano" ) |
---|
36 | return new NaganoFluoCalculator(); |
---|
37 | else if ( name == "N2data" ) |
---|
38 | return new N2dataFluoCalculator(); |
---|
39 | else throw invalid_argument("invalid FluoCalculator object : " + name); |
---|
40 | return NULL; |
---|
41 | } |
---|
42 | |
---|
43 | // call ctor of appropriate Cerenkov Calculator |
---|
44 | CrkCalculator* LightSourceFactory::GetCrkCalculator( const string& name ) { |
---|
45 | if ( name == "simple" ) |
---|
46 | return new SimpleCrkCalculator(); |
---|
47 | else throw invalid_argument("invalid CrkCalculator object : " + name); |
---|
48 | return NULL; |
---|
49 | } |
---|