source: JEM-EUSO/esaf_lal/tags/v1_r0/esaf/packages/simulation/detector/G4Detector/optics/src/DetectorFactory.cc @ 117

Last change on this file since 117 was 117, checked in by moretto, 11 years ago

ESAF version compilable on mac OS

File size: 1.2 KB
Line 
1#include "DetectorFactory.hh"
2#include "G4TusGeometry.hh"
3#include "G4EusoGeometryShape.hh"
4
5#include <TString.h>
6#include <globals.hh>
7#include <stdexcept>
8
9DetectorFactory* DetectorFactory::fMe = 0;
10//_____________________________________________________________________________
11DetectorFactory::DetectorFactory() {
12    fMe = this;
13    fDetector = NULL;
14    SetSender("DetectorFactory");
15}
16
17//_____________________________________________________________________________
18DetectorFactory::~DetectorFactory() {
19     if(fDetector)delete fDetector;
20}
21
22//_____________________________________________________________________________
23G4VUserDetectorConstruction* DetectorFactory::GetDetector(){
24    if (fDetector) return fDetector;
25
26    TString det=Conf()->GetStr("G4Detector.DetectorType");
27    if(det=="") det="G4Euso";
28
29    if (det == "G4EusoShape") {
30        fDetector = new G4EusoGeometryShape();
31        Msg(EsafMsg::Info)<<"DetectorFactory : G4EusoGeometryShape (EUSO)"<<MsgDispatch;
32    }
33    else if (det == "G4Tus") {
34        fDetector = new G4TusGeometry();
35        Msg(EsafMsg::Info)<<"DetectorFactory : G4TusGeometry (TUS)"<<MsgDispatch;
36    }
37    else throw runtime_error(Form("DetectorFactory does not support detector %s",det.Data()));
38
39    return fDetector;
40}
Note: See TracBrowser for help on using the repository browser.