00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "TrkExtAlg/ExtBesDetectorConstruction.h"
00010
00011 #include "G4Colour.hh"
00012 #include "globals.hh"
00013 #include <cstdlib>
00014 #include <fstream>
00015 #include "G4String.hh"
00016
00017 #include "GDMLProcessor.hh"
00018 #include "GDMLExpressionEvaluator.hh"
00019
00020
00021 #include "G4BooleanSolid.hh"
00022 #include "G4Geo/BesG4Geo.h"
00023
00024
00025 ExtBesDetectorConstruction::ExtBesDetectorConstruction(const bool bFieldOn, int detVer)
00026 {
00027 if(bFieldOn) besField = new ExtBesMagneticField();
00028 fWorld=0;
00029 m_detVer = detVer;
00030 }
00031
00032
00033 ExtBesDetectorConstruction::~ExtBesDetectorConstruction()
00034 {
00035 if(besField)
00036 delete besField;
00037 }
00038
00039
00040 G4VPhysicalVolume* ExtBesDetectorConstruction::Construct()
00041 {
00042 BesG4Geo* aBesG4Geo = new BesG4Geo();
00043
00044 fWorld=(G4VPhysicalVolume *)GDMLProcessor::GetInstance()->GetWorldVolume();
00045 if( fWorld == 0 ) {
00046 G4Exception("World volume not set properly check your setup selection criteria or GDML input!");
00047 }
00048
00049 delete aBesG4Geo;
00050
00051 G4LogicalVolume* logicalBes = const_cast<G4LogicalVolume*>( GDMLProcessor::GetInstance()->GetLogicalVolume("logicalWorld" ) );
00052 Mdc.Construct(logicalBes);
00053
00054
00055 if( m_detVer==1 || m_detVer==2 ) {
00056 std::cout << "ExBesDetectorConstruction: You are using the Sintillator Tof Detector!" << std::endl;
00057 Tof.Construct(logicalBes);
00058 }
00059 else if( m_detVer==3 ) {
00060 std::cout << "ExBesDetectorConstruction: You are using the upgraded (MRPC) Tof Detector!" << std::endl;
00061 Tof.ConstructETF(logicalBes);
00062 }
00063 else {
00064 std::cout << "ExBesDetectorConstruction: Detector Version is not well defined! " << m_detVer << " \n " << std::endl;
00065 std::cout << " Use in your jobOption script " << std::endl;
00066 std::cout << " TrkExtAlg.Tof = 1; for the upgraded Tof (MRPC Endcaps, double sided readout) " << std::endl;
00067 std::cout << " TrkExtAlg.Tof = 0; for the Sintillator Tof. " << std::endl;
00068 }
00069
00070
00071 Emc.Construct(logicalBes);
00072 Muc.Construct(logicalBes);
00073
00074 return fWorld;
00075 }