Loading...
Searching...
No Matches
Par02DetectorConstruction.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//
26//
27/// \file Par02DetectorConstruction.cc
28/// \brief Implementation of the Par02DetectorConstruction class
29
31#include "G4ProductionCuts.hh"
32#include "G4SystemOfUnits.hh"
33#include "G4RegionStore.hh"
34#include "G4GDMLParser.hh"
35#include "G4AutoDelete.hh"
36#include "G4GlobalMagFieldMessenger.hh"
37#include "G4AutoDelete.hh"
38
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
42
43//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44
46
47//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48
50 G4GDMLParser parser;
51 parser.Read( "Par02FullDetector.gdml" );
52 G4cout << "Geometry loaded from file .......Par02FullDetector.gdml " << G4endl;
53
54 // This GDML detector description uses the auxiliary information part to store
55 // information regarding which Geant4 volumes have a fast simulation model.
56
57 const G4GDMLAuxMapType* aAuxMap = parser.GetAuxMap();
58 for ( G4GDMLAuxMapType::const_iterator iter = aAuxMap->begin();
59 iter != aAuxMap->end(); ++iter ) {
60 for ( G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
61 vit != (*iter).second.end(); ++vit ) {
62 if ( (*vit).type == "FastSimModel" ) {
63 G4LogicalVolume* myvol = (*iter).first;
64 if ( ( myvol->GetName() ).find( "Tracker" ) != std::string::npos ) {
65 fTrackerList.push_back( new G4Region( myvol->GetName() ) );
66 fTrackerList.back()->AddRootLogicalVolume( myvol );
67 G4cout << G4endl << "tracker !!!" << G4endl;
68 } else if ( ( myvol->GetName() ).find( "HCal" ) != std::string::npos ) {
69 fHCalList.push_back( new G4Region( myvol->GetName() ) );
70 fHCalList.back()->AddRootLogicalVolume( myvol );
71 G4cout << G4endl << "hcal !!!" << G4endl;
72 } else if ( ( myvol->GetName() ).find( "ECal" ) != std::string::npos ) {
73 fECalList.push_back( new G4Region( myvol->GetName() ) );
74 fECalList.back()->AddRootLogicalVolume( myvol );
75 G4cout << G4endl << "ecal !!!" << G4endl;
76 } else if ( ( myvol->GetName() ).find( "Muon" ) != std::string::npos ) {
77 fMuonList.push_back( new G4Region( myvol->GetName() ) );
78 fMuonList.back()->AddRootLogicalVolume( myvol );
79 } else {
80 G4cout << G4endl << "NOT A KNOWN DETECTOR !!!" << G4endl;
81 }
82 }
83 }
84 }
85 for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() );
86 iterTracker++ ) {
87 fTrackerList[ iterTracker ]->SetProductionCuts( new G4ProductionCuts() );
88 fTrackerList[ iterTracker ]->GetProductionCuts()->SetProductionCut
89 ( 1.0* ( ( *fTrackerList[ iterTracker ]->GetRootLogicalVolumeIterator() )->
90 GetMaterial()->GetRadlen() ) );
91 fTrackerList[ iterTracker ]->GetProductionCuts()->
92 SetProductionCut( 1.0*m, idxG4GammaCut );
93 }
94 for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) {
95 fECalList[ iterECal ]->SetProductionCuts( new G4ProductionCuts() );
96 fECalList[ iterECal ]->GetProductionCuts()->SetProductionCut
97 ( 0.5* ( ( *fECalList[ iterECal ]->GetRootLogicalVolumeIterator() )->
98 GetMaterial()->GetRadlen() ) );
99 fECalList[ iterECal ]->GetProductionCuts()->
100 SetProductionCut( 0.1*m, idxG4GammaCut );
101 }
102 for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) {
103 fHCalList[ iterHCal ]->SetProductionCuts( new G4ProductionCuts() );
104 fHCalList[ iterHCal ]->GetProductionCuts()->SetProductionCut(
105 0.5* ( ( *fHCalList[iterHCal]->GetRootLogicalVolumeIterator() )->
106 GetMaterial()->GetRadlen() ) );
107 fHCalList[ iterHCal ]->GetProductionCuts()->
108 SetProductionCut( 1.0*m, idxG4GammaCut );
109 }
110
111 // Returns the pointer to the physical world.
112 return parser.GetWorldVolume();
113}
114
115//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
116
118 for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() );
119 iterTracker++ ) {
120 // Bound the fast simulation model for the tracker subdetector
121 // to all the corresponding Geant4 regions
122 Par02FastSimModelTracker* fastSimModelTracker
123 = new Par02FastSimModelTracker( "fastSimModelTracker", fTrackerList[ iterTracker ],
125
126 // Register the fast simulation model for deleting
127 G4AutoDelete::Register(fastSimModelTracker);
128 }
129 for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) {
130 // Bound the fast simulation model for the electromagnetic calorimeter
131 // to all the corresponding Geant4 regions
132 Par02FastSimModelEMCal* fastSimModelEMCal
133 = new Par02FastSimModelEMCal( "fastSimModelEMCal", fECalList[ iterECal ],
135
136 // Register the fast simulation model for deleting
137 G4AutoDelete::Register(fastSimModelEMCal);
138 }
139 for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) {
140 // Bound the fast simulation model for the hadronic calorimeter
141 // to all the corresponding Geant4 regions
142 Par02FastSimModelHCal* fastSimModelHCal
143 = new Par02FastSimModelHCal( "fastSimModelHCal", fHCalList[ iterHCal ],
145
146 // Register the fast simulation model for deleting
147 G4AutoDelete::Register( fastSimModelHCal );
148 }
149 // Currently we don't have a fast muon simulation model to be bound
150 // to all the corresponding Geant4 regions.
151 // But it could be added in future, in a similar way as done above for
152 // the tracker subdetector and the electromagnetic and hadronic calorimeters.
153
154 // Add global magnetic field
155 G4ThreeVector fieldValue = G4ThreeVector();
157 fMagFieldMessenger->SetVerboseLevel(1);
158}
159
160//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161
Definition of the Par02DetectorConstruction class.
Par02DetectorConstruction()
A default constructor.
std::vector< G4Region * > fTrackerList
A vector of the tracking detector regions.
virtual G4VPhysicalVolume * Construct()
A method invoked by G4RunManager::Initialize()
virtual void ConstructSDandField()
A method invoked by G4RunManager::Initialize() to construct thread local objects.
std::vector< G4Region * > fECalList
A vector of the the electromagnetic calorimeter regions.
virtual ~Par02DetectorConstruction()
std::vector< G4Region * > fMuonList
A vector of the muon detector regions.
std::vector< G4Region * > fHCalList
A vector of the the hadronic calorimeter regions.
G4GlobalMagFieldMessenger * fMagFieldMessenger
Messenger of the magnetic field.
Shortcut to the ordinary tracking for electromagnetic calorimeters.
Shortcut to the ordinary tracking for hadronic calorimeters.
Shortcut to the ordinary tracking for tracking detectors.

Applications | User Support | Publications | Collaboration