File indexing completed on 2026-04-16 07:42:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "Par02DetectorConstruction.hh"
0030
0031 #include "G4AutoDelete.hh"
0032 #include "G4GDMLParser.hh"
0033 #include "G4GlobalMagFieldMessenger.hh"
0034 #include "G4ProductionCuts.hh"
0035 #include "G4RegionStore.hh"
0036 #include "G4SystemOfUnits.hh"
0037
0038
0039
0040 Par02DetectorConstruction::Par02DetectorConstruction() = default;
0041
0042
0043
0044 Par02DetectorConstruction::~Par02DetectorConstruction() = default;
0045
0046
0047
0048 G4VPhysicalVolume* Par02DetectorConstruction::Construct()
0049 {
0050 G4GDMLParser parser;
0051 parser.Read("Par02FullDetector.gdml");
0052 G4cout << "Geometry loaded from file .......Par02FullDetector.gdml " << G4endl;
0053
0054
0055
0056
0057 const G4GDMLAuxMapType* aAuxMap = parser.GetAuxMap();
0058 for (G4GDMLAuxMapType::const_iterator iter = aAuxMap->begin(); iter != aAuxMap->end(); ++iter) {
0059 for (G4GDMLAuxListType::const_iterator vit = (*iter).second.begin();
0060 vit != (*iter).second.end(); ++vit)
0061 {
0062 if ((*vit).type == "FastSimModel") {
0063 G4LogicalVolume* myvol = (*iter).first;
0064 if ((myvol->GetName()).find("Tracker") != std::string::npos) {
0065 fTrackerList.push_back(new G4Region(myvol->GetName()));
0066 fTrackerList.back()->AddRootLogicalVolume(myvol);
0067 G4cout << G4endl << "tracker !!!" << G4endl;
0068 }
0069 else if ((myvol->GetName()).find("HCal") != std::string::npos) {
0070 fHCalList.push_back(new G4Region(myvol->GetName()));
0071 fHCalList.back()->AddRootLogicalVolume(myvol);
0072 G4cout << G4endl << "hcal !!!" << G4endl;
0073 }
0074 else if ((myvol->GetName()).find("ECal") != std::string::npos) {
0075 fECalList.push_back(new G4Region(myvol->GetName()));
0076 fECalList.back()->AddRootLogicalVolume(myvol);
0077 G4cout << G4endl << "ecal !!!" << G4endl;
0078 }
0079 else if ((myvol->GetName()).find("Muon") != std::string::npos) {
0080 fMuonList.push_back(new G4Region(myvol->GetName()));
0081 fMuonList.back()->AddRootLogicalVolume(myvol);
0082 }
0083 else {
0084 G4cout << G4endl << "NOT A KNOWN DETECTOR !!!" << G4endl;
0085 }
0086 }
0087 }
0088 }
0089 for (G4int iterTracker = 0; iterTracker < G4int(fTrackerList.size()); iterTracker++) {
0090 fTrackerList[iterTracker]->SetProductionCuts(new G4ProductionCuts());
0091 fTrackerList[iterTracker]->GetProductionCuts()->SetProductionCut(
0092 1.0
0093 * ((*fTrackerList[iterTracker]->GetRootLogicalVolumeIterator())->GetMaterial()->GetRadlen()));
0094 fTrackerList[iterTracker]->GetProductionCuts()->SetProductionCut(1.0 * m, idxG4GammaCut);
0095 }
0096 for (G4int iterECal = 0; iterECal < G4int(fECalList.size()); iterECal++) {
0097 fECalList[iterECal]->SetProductionCuts(new G4ProductionCuts());
0098 fECalList[iterECal]->GetProductionCuts()->SetProductionCut(
0099 0.5 * ((*fECalList[iterECal]->GetRootLogicalVolumeIterator())->GetMaterial()->GetRadlen()));
0100 fECalList[iterECal]->GetProductionCuts()->SetProductionCut(0.1 * m, idxG4GammaCut);
0101 }
0102 for (G4int iterHCal = 0; iterHCal < G4int(fHCalList.size()); iterHCal++) {
0103 fHCalList[iterHCal]->SetProductionCuts(new G4ProductionCuts());
0104 fHCalList[iterHCal]->GetProductionCuts()->SetProductionCut(
0105 0.5 * ((*fHCalList[iterHCal]->GetRootLogicalVolumeIterator())->GetMaterial()->GetRadlen()));
0106 fHCalList[iterHCal]->GetProductionCuts()->SetProductionCut(1.0 * m, idxG4GammaCut);
0107 }
0108
0109
0110 return parser.GetWorldVolume();
0111 }
0112
0113
0114
0115 void Par02DetectorConstruction::ConstructSDandField()
0116 {
0117 for (G4int iterTracker = 0; iterTracker < G4int(fTrackerList.size()); iterTracker++) {
0118
0119
0120 Par02FastSimModelTracker* fastSimModelTracker = new Par02FastSimModelTracker(
0121 "fastSimModelTracker", fTrackerList[iterTracker], Par02DetectorParametrisation::eCMS);
0122
0123
0124 G4AutoDelete::Register(fastSimModelTracker);
0125 }
0126 for (G4int iterECal = 0; iterECal < G4int(fECalList.size()); iterECal++) {
0127
0128
0129 Par02FastSimModelEMCal* fastSimModelEMCal = new Par02FastSimModelEMCal(
0130 "fastSimModelEMCal", fECalList[iterECal], Par02DetectorParametrisation::eCMS);
0131
0132
0133 G4AutoDelete::Register(fastSimModelEMCal);
0134 }
0135 for (G4int iterHCal = 0; iterHCal < G4int(fHCalList.size()); iterHCal++) {
0136
0137
0138 Par02FastSimModelHCal* fastSimModelHCal = new Par02FastSimModelHCal(
0139 "fastSimModelHCal", fHCalList[iterHCal], Par02DetectorParametrisation::eCMS);
0140
0141
0142 G4AutoDelete::Register(fastSimModelHCal);
0143 }
0144
0145
0146
0147
0148
0149
0150 G4ThreeVector fieldValue = G4ThreeVector();
0151 fMagFieldMessenger = new G4GlobalMagFieldMessenger(fieldValue);
0152 fMagFieldMessenger->SetVerboseLevel(1);
0153 }
0154
0155