Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file Par02DetectorConstruction.cc 27 /// \file Par02DetectorConstruction.cc 28 /// \brief Implementation of the Par02Detector 28 /// \brief Implementation of the Par02DetectorConstruction class 29 29 30 #include "Par02DetectorConstruction.hh" 30 #include "Par02DetectorConstruction.hh" 31 << 32 #include "G4AutoDelete.hh" << 33 #include "G4GDMLParser.hh" << 34 #include "G4GlobalMagFieldMessenger.hh" << 35 #include "G4ProductionCuts.hh" 31 #include "G4ProductionCuts.hh" 36 #include "G4RegionStore.hh" << 37 #include "G4SystemOfUnits.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 38 39 //....oooOO0OOooo........oooOO0OOooo........oo 39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 40 40 41 Par02DetectorConstruction::Par02DetectorConstr 41 Par02DetectorConstruction::Par02DetectorConstruction() = default; 42 42 43 //....oooOO0OOooo........oooOO0OOooo........oo 43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 44 44 45 Par02DetectorConstruction::~Par02DetectorConst 45 Par02DetectorConstruction::~Par02DetectorConstruction() = default; 46 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 48 48 49 G4VPhysicalVolume* Par02DetectorConstruction:: << 49 G4VPhysicalVolume* Par02DetectorConstruction::Construct() { 50 { << 51 G4GDMLParser parser; 50 G4GDMLParser parser; 52 parser.Read("Par02FullDetector.gdml"); << 51 parser.Read( "Par02FullDetector.gdml" ); 53 G4cout << "Geometry loaded from file ...... 52 G4cout << "Geometry loaded from file .......Par02FullDetector.gdml " << G4endl; 54 53 55 // This GDML detector description uses the a 54 // This GDML detector description uses the auxiliary information part to store 56 // information regarding which Geant4 volume 55 // information regarding which Geant4 volumes have a fast simulation model. 57 56 58 const G4GDMLAuxMapType* aAuxMap = parser.Get 57 const G4GDMLAuxMapType* aAuxMap = parser.GetAuxMap(); 59 for (G4GDMLAuxMapType::const_iterator iter = << 58 for ( G4GDMLAuxMapType::const_iterator iter = aAuxMap->begin(); 60 for (G4GDMLAuxListType::const_iterator vit << 59 iter != aAuxMap->end(); ++iter ) { 61 vit != (*iter).second.end(); ++vit) << 60 for ( G4GDMLAuxListType::const_iterator vit = (*iter).second.begin(); 62 { << 61 vit != (*iter).second.end(); ++vit ) { 63 if ((*vit).type == "FastSimModel") { << 62 if ( (*vit).type == "FastSimModel" ) { 64 G4LogicalVolume* myvol = (*iter).first 63 G4LogicalVolume* myvol = (*iter).first; 65 if ((myvol->GetName()).find("Tracker") << 64 if ( ( myvol->GetName() ).find( "Tracker" ) != std::string::npos ) { 66 fTrackerList.push_back(new G4Region( << 65 fTrackerList.push_back( new G4Region( myvol->GetName() ) ); 67 fTrackerList.back()->AddRootLogicalV << 66 fTrackerList.back()->AddRootLogicalVolume( myvol ); 68 G4cout << G4endl << "tracker !!!" << 67 G4cout << G4endl << "tracker !!!" << G4endl; 69 } << 68 } else if ( ( myvol->GetName() ).find( "HCal" ) != std::string::npos ) { 70 else if ((myvol->GetName()).find("HCal << 69 fHCalList.push_back( new G4Region( myvol->GetName() ) ); 71 fHCalList.push_back(new G4Region(myv << 70 fHCalList.back()->AddRootLogicalVolume( myvol ); 72 fHCalList.back()->AddRootLogicalVolu << 73 G4cout << G4endl << "hcal !!!" << G4 71 G4cout << G4endl << "hcal !!!" << G4endl; 74 } << 72 } else if ( ( myvol->GetName() ).find( "ECal" ) != std::string::npos ) { 75 else if ((myvol->GetName()).find("ECal << 73 fECalList.push_back( new G4Region( myvol->GetName() ) ); 76 fECalList.push_back(new G4Region(myv << 74 fECalList.back()->AddRootLogicalVolume( myvol ); 77 fECalList.back()->AddRootLogicalVolu << 78 G4cout << G4endl << "ecal !!!" << G4 75 G4cout << G4endl << "ecal !!!" << G4endl; 79 } << 76 } else if ( ( myvol->GetName() ).find( "Muon" ) != std::string::npos ) { 80 else if ((myvol->GetName()).find("Muon << 77 fMuonList.push_back( new G4Region( myvol->GetName() ) ); 81 fMuonList.push_back(new G4Region(myv << 78 fMuonList.back()->AddRootLogicalVolume( myvol ); 82 fMuonList.back()->AddRootLogicalVolu << 79 } else { 83 } << 84 else { << 85 G4cout << G4endl << "NOT A KNOWN DET 80 G4cout << G4endl << "NOT A KNOWN DETECTOR !!!" << G4endl; 86 } 81 } 87 } 82 } 88 } 83 } 89 } 84 } 90 for (G4int iterTracker = 0; iterTracker < G4 << 85 for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() ); 91 fTrackerList[iterTracker]->SetProductionCu << 86 iterTracker++ ) { 92 fTrackerList[iterTracker]->GetProductionCu << 87 fTrackerList[ iterTracker ]->SetProductionCuts( new G4ProductionCuts() ); 93 1.0 << 88 fTrackerList[ iterTracker ]->GetProductionCuts()->SetProductionCut 94 * ((*fTrackerList[iterTracker]->GetRootL << 89 ( 1.0* ( ( *fTrackerList[ iterTracker ]->GetRootLogicalVolumeIterator() )-> 95 fTrackerList[iterTracker]->GetProductionCu << 90 GetMaterial()->GetRadlen() ) ); 96 } << 91 fTrackerList[ iterTracker ]->GetProductionCuts()-> 97 for (G4int iterECal = 0; iterECal < G4int(fE << 92 SetProductionCut( 1.0*m, idxG4GammaCut ); 98 fECalList[iterECal]->SetProductionCuts(new << 93 } 99 fECalList[iterECal]->GetProductionCuts()-> << 94 for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) { 100 0.5 * ((*fECalList[iterECal]->GetRootLog << 95 fECalList[ iterECal ]->SetProductionCuts( new G4ProductionCuts() ); 101 fECalList[iterECal]->GetProductionCuts()-> << 96 fECalList[ iterECal ]->GetProductionCuts()->SetProductionCut 102 } << 97 ( 0.5* ( ( *fECalList[ iterECal ]->GetRootLogicalVolumeIterator() )-> 103 for (G4int iterHCal = 0; iterHCal < G4int(fH << 98 GetMaterial()->GetRadlen() ) ); 104 fHCalList[iterHCal]->SetProductionCuts(new << 99 fECalList[ iterECal ]->GetProductionCuts()-> 105 fHCalList[iterHCal]->GetProductionCuts()-> << 100 SetProductionCut( 0.1*m, idxG4GammaCut ); 106 0.5 * ((*fHCalList[iterHCal]->GetRootLog << 101 } 107 fHCalList[iterHCal]->GetProductionCuts()-> << 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 ); 108 } 109 } 109 110 110 // Returns the pointer to the physical world 111 // Returns the pointer to the physical world. 111 return parser.GetWorldVolume(); 112 return parser.GetWorldVolume(); 112 } 113 } 113 114 114 //....oooOO0OOooo........oooOO0OOooo........oo 115 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 115 116 116 void Par02DetectorConstruction::ConstructSDand << 117 void Par02DetectorConstruction::ConstructSDandField() { 117 { << 118 for ( G4int iterTracker = 0; iterTracker < G4int( fTrackerList.size() ); 118 for (G4int iterTracker = 0; iterTracker < G4 << 119 iterTracker++ ) { 119 // Bound the fast simulation model for the 120 // Bound the fast simulation model for the tracker subdetector 120 // to all the corresponding Geant4 regions 121 // to all the corresponding Geant4 regions 121 Par02FastSimModelTracker* fastSimModelTrac << 122 Par02FastSimModelTracker* fastSimModelTracker 122 "fastSimModelTracker", fTrackerList[iter << 123 = new Par02FastSimModelTracker( "fastSimModelTracker", fTrackerList[ iterTracker ], 123 << 124 Par02DetectorParametrisation::eCMS ); >> 125 124 // Register the fast simulation model for 126 // Register the fast simulation model for deleting 125 G4AutoDelete::Register(fastSimModelTracker 127 G4AutoDelete::Register(fastSimModelTracker); 126 } 128 } 127 for (G4int iterECal = 0; iterECal < G4int(fE << 129 for ( G4int iterECal = 0; iterECal < G4int( fECalList.size() ); iterECal++ ) { 128 // Bound the fast simulation model for the 130 // Bound the fast simulation model for the electromagnetic calorimeter 129 // to all the corresponding Geant4 regions 131 // to all the corresponding Geant4 regions 130 Par02FastSimModelEMCal* fastSimModelEMCal << 132 Par02FastSimModelEMCal* fastSimModelEMCal 131 "fastSimModelEMCal", fECalList[iterECal] << 133 = new Par02FastSimModelEMCal( "fastSimModelEMCal", fECalList[ iterECal ], 132 << 134 Par02DetectorParametrisation::eCMS ); >> 135 133 // Register the fast simulation model for 136 // Register the fast simulation model for deleting 134 G4AutoDelete::Register(fastSimModelEMCal); 137 G4AutoDelete::Register(fastSimModelEMCal); 135 } 138 } 136 for (G4int iterHCal = 0; iterHCal < G4int(fH << 139 for ( G4int iterHCal = 0; iterHCal < G4int( fHCalList.size() ); iterHCal++ ) { 137 // Bound the fast simulation model for the 140 // Bound the fast simulation model for the hadronic calorimeter 138 // to all the corresponding Geant4 regions 141 // to all the corresponding Geant4 regions 139 Par02FastSimModelHCal* fastSimModelHCal = << 142 Par02FastSimModelHCal* fastSimModelHCal 140 "fastSimModelHCal", fHCalList[iterHCal], << 143 = new Par02FastSimModelHCal( "fastSimModelHCal", fHCalList[ iterHCal ], 141 << 144 Par02DetectorParametrisation::eCMS ); >> 145 142 // Register the fast simulation model for 146 // Register the fast simulation model for deleting 143 G4AutoDelete::Register(fastSimModelHCal); << 147 G4AutoDelete::Register( fastSimModelHCal ); 144 } 148 } 145 // Currently we don't have a fast muon simul 149 // Currently we don't have a fast muon simulation model to be bound 146 // to all the corresponding Geant4 regions. 150 // to all the corresponding Geant4 regions. 147 // But it could be added in future, in a sim 151 // But it could be added in future, in a similar way as done above for 148 // the tracker subdetector and the electroma 152 // the tracker subdetector and the electromagnetic and hadronic calorimeters. 149 153 150 // Add global magnetic field 154 // Add global magnetic field 151 G4ThreeVector fieldValue = G4ThreeVector(); 155 G4ThreeVector fieldValue = G4ThreeVector(); 152 fMagFieldMessenger = new G4GlobalMagFieldMes << 156 fMagFieldMessenger = new G4GlobalMagFieldMessenger( fieldValue ); 153 fMagFieldMessenger->SetVerboseLevel(1); 157 fMagFieldMessenger->SetVerboseLevel(1); 154 } 158 } 155 << 159 156 //....oooOO0OOooo........oooOO0OOooo........oo 160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 161 157 162