Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DetectorConstruction.cc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 //
30 // $Id: DetectorConstruction.cc 101309 2016-11-14 11:26:17Z gcosmo $
31 //
32 //
33 
34 #include "DetectorConstruction.hh"
35 #include "DetectorSimpleALICE.hh"
36 #include "DetectorALICE06.hh"
37 #include "DetectorBari05.hh"
38 #include "DetectorHarris73.hh"
39 #include "DetectorWatase86.hh"
40 #include "DetectorBarr90.hh"
41 #include "DetectorMessenger.hh"
42 #include "Materials.hh"
43 #include "G4Region.hh"
44 #include "G4RegionStore.hh"
45 #include "G4ProductionCuts.hh"
46 
47 #include "G4LogicalVolumeStore.hh"
48 #include "G4LogicalVolume.hh"
49 #include "G4ios.hh"
50 
51 #include "G4SystemOfUnits.hh"
52 
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
54 
57  fRadiatorDescription(0),
58  fSetUp("simpleALICE")
59 {
60  fDetectorMessenger = new DetectorMessenger(this);
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {
67  delete fRadiatorDescription;
68  delete fDetectorMessenger;
69  delete Materials::GetInstance();
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  G4VPhysicalVolume* world = nullptr;
77  if( fSetUp == "simpleALICE" )
78  {
79  DetectorSimpleALICE simpleALICE;
80  world = simpleALICE.Construct();
81  fRadiatorDescription = simpleALICE.GetRadiatorDescription();
82  }
83  else if( fSetUp == "alice06" )
84  {
85  DetectorALICE06 alice06;
86  world = alice06.Construct();
87  fRadiatorDescription = alice06.GetRadiatorDescription();
88  }
89  else if( fSetUp == "bari05" )
90  {
91  DetectorBari05 bari05;
92  world = bari05.Construct();
93  fRadiatorDescription = bari05.GetRadiatorDescription();
94  }
95  else if( fSetUp == "harris73" )
96  {
97  DetectorHarris73 harris73;
98  world = harris73.Construct();
99  fRadiatorDescription = harris73.GetRadiatorDescription();
100  }
101  else if( fSetUp == "watase86" )
102  {
103  DetectorWatase86 watase86;
104  world = watase86.Construct();
105  fRadiatorDescription = watase86.GetRadiatorDescription();
106  }
107  else if( fSetUp == "barr90" )
108  {
109  DetectorBarr90 barr90;
110  world = barr90.Construct();
111  fRadiatorDescription = barr90.GetRadiatorDescription();
112  }
113  else
114  {
115  G4cout << "Experimental setup is unsupported. Check /XTRdetector/setup "
116  <<G4endl;
117  G4cout << "Run default: simpleALICE"<<G4endl;
118 
119  DetectorSimpleALICE simpleALICE;
120  world = simpleALICE.Construct();
121  fRadiatorDescription = simpleALICE.GetRadiatorDescription();
122  }
123  G4RegionStore* regionStore = G4RegionStore::GetInstance();
124  size_t nRegions = regionStore->size();
125  G4double cut = 1.*CLHEP::mm;
126  for(size_t i=0; i<nRegions; ++i) {
127  G4Region* reg = (*regionStore)[i];
128  if(!reg->GetProductionCuts()) {
129  G4ProductionCuts* cuts = new G4ProductionCuts();
130  cuts->SetProductionCut(cut,"gamma");
131  cuts->SetProductionCut(cut,"e-");
132  cuts->SetProductionCut(cut,"e+");
133  cuts->SetProductionCut(cut,"proton");
134  reg->SetProductionCuts(cuts);
135  }
136  }
137  return world;
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141 
143 {
144  if ( ! fRadiatorDescription ) {
145  G4cout << "RadiatorDescription is not defined" << G4endl;
146  }
147  return fRadiatorDescription;
148 }
149 
150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
151 
153 {
154  G4LogicalVolume* lv
156 
157  if ( ! lv ) {
158  G4cerr << "Absorber logical volume is not defined." << G4endl;
159  return 0;
160  }
161 
162  return lv->GetMaterial();
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
G4ProductionCuts * GetProductionCuts() const
RadiatorDescription * GetRadiatorDescription() const
G4Material * GetMaterial() const
RadiatorDescription * GetRadiatorDescription() const
RadiatorDescription * GetRadiatorDescription() const
Definition of the DetectorALICE06 class.
G4VPhysicalVolume * Construct()
RadiatorDescription * GetRadiatorDescription() const
G4VPhysicalVolume * Construct()
void SetProductionCut(G4double cut, G4int index=-1)
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
Definition of the DetectorWatase86 class.
static const G4double reg
static G4RegionStore * GetInstance()
static Materials * GetInstance()
Definition: Materials.cc:52
G4GLOB_DLL std::ostream G4cout
Definition of the DetectorBarr90 class.
Definition of the DetectorSimpleALICE class.
G4Material * GetAbsorberMaterial()
static constexpr double mm
Definition: SystemOfUnits.h:95
static G4LogicalVolumeStore * GetInstance()
RadiatorDescription * GetRadiatorDescription() const
RadiatorDescription * GetRadiatorDescription() const
RadiatorDescription * GetRadiatorDescription() const
G4VPhysicalVolume * Construct()
Definition of the DetectorBari05 class.
G4VPhysicalVolume * Construct()
G4VPhysicalVolume * Construct()
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
G4VPhysicalVolume * Construct()
double G4double
Definition: G4Types.hh:76
G4GLOB_DLL std::ostream G4cerr
Definition of the DetectorHarris73 class.
G4VPhysicalVolume * Construct()