Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 27 // User Classes 28 #include "Par04ParallelFastWorld.hh" 29 30 #include "Par04ParallelFastSensitiveDetector.h 31 #include "Par04ParallelFullWorld.hh" 32 33 // G4 Classes 34 #include "G4AutoDelete.hh" 35 #include "G4Colour.hh" 36 #include "G4LogicalVolume.hh" 37 #include "G4Material.hh" 38 #include "G4NistManager.hh" 39 #include "G4PVPlacement.hh" 40 #include "G4PVReplica.hh" 41 #include "G4SDManager.hh" 42 #include "G4SystemOfUnits.hh" 43 #include "G4ThreeVector.hh" 44 #include "G4Tubs.hh" 45 #include "G4UnitsTable.hh" 46 #include "G4VPhysicalVolume.hh" 47 #include "G4VisAttributes.hh" 48 #include "globals.hh" 49 50 //....oooOO0OOooo........oooOO0OOooo........oo 51 52 Par04ParallelFastWorld::Par04ParallelFastWorld 53 54 55 : G4VUserParallelWorld(aWorldName), fMassDet 56 { 57 fNbOfLayers = fMassDetector->GetNbOfLayers() 58 } 59 60 //....oooOO0OOooo........oooOO0OOooo........oo 61 62 Par04ParallelFastWorld::~Par04ParallelFastWorl 63 64 //....oooOO0OOooo........oooOO0OOooo........oo 65 66 void Par04ParallelFastWorld::Construct() 67 { 68 // In parallel world material does not matte 69 G4Material* dummy = nullptr; 70 71 // Build parallel geometry: 72 auto parallelLogicalVolume = GetWorld()->Get 73 74 G4double detectorInnerRadius = fMassDetector 75 G4double detectorLength = fMassDetector->Get 76 G4double fullLayerThickness = 77 fMassDetector->GetAbsorberThickness(0) + f 78 fLayerThickness = fullLayerThickness; 79 // Get an updated value 80 fNbOfLayers = fMassDetector->GetNbOfLayers() 81 fNbOfSlices = fParallelFull->GetNbOfSlices() 82 fNbOfRows = fParallelFull->GetNbOfRows(); 83 G4double detectorRadius = fNbOfLayers * full 84 G4double detectorOuterRadius = detectorInner 85 G4double rowThickness = detectorLength / fNb 86 G4double full2Pi = 2. * CLHEP::pi * rad; 87 Print(); 88 89 // Insert cells to create a readout structur 90 // Mostly a copy from the detector construct 91 auto solidDetector = new G4Tubs("Detector", 92 detectorInne 93 detectorOute 94 detectorLeng 95 0, // start 96 full2Pi); / 97 auto logicDetector = new G4LogicalVolume(sol 98 dum 99 "De 100 new G4PVPlacement(0, // no rotation 101 G4ThreeVector(0, 0, 0), / 102 logicDetector, // logical 103 "Detector", // name 104 parallelLogicalVolume, // 105 false, // not used 106 9999, // copy number 107 true); // check overlaps 108 109 //--------- Detector cylinder (division alon 110 auto solidRow = 111 new G4Tubs("Row", detectorInnerRadius, det 112 113 auto logicRow = new G4LogicalVolume(solidRow 114 if (fNbOfRows > 1) 115 new G4PVReplica("Row", logicRow, logicDete 116 else 117 new G4PVPlacement(0, G4ThreeVector(), logi 118 119 //--------- Detector slices (division in azi 120 G4double cellPhi = full2Pi / fNbOfSlices; 121 auto solidSlice = 122 new G4Tubs("Slice", detectorInnerRadius, d 123 auto logicSlice = new G4LogicalVolume(solidS 124 if (fNbOfSlices > 1) { 125 new G4PVReplica("Slice", logicSlice, logic 126 } 127 else { 128 new G4PVPlacement(0, G4ThreeVector(), logi 129 } 130 131 //--------- Detector cells (division along r 132 G4VisAttributes attribs; 133 attribs.SetColour(G4Colour(0, 1, 0, 0.1)); 134 attribs.SetForceSolid(true); 135 if (fNbOfLayers > 1) { 136 auto solidCell = new G4Tubs("Cell", detect 137 rowThickness / 138 fLogicalCell.push_back(new G4LogicalVolume 139 new G4PVReplica("Cell", fLogicalCell.back( 140 detectorInnerRadius); 141 } 142 else { 143 auto solidCell = new G4Tubs("Cell", detect 144 rowThickness / 145 fLogicalCell.push_back(new G4LogicalVolume 146 fLogicalCell.back()->SetVisAttributes(attr 147 new G4PVPlacement(0, G4ThreeVector(), fLog 148 } 149 Print(); 150 } 151 152 //....oooOO0OOooo........oooOO0OOooo........oo 153 154 void Par04ParallelFastWorld::ConstructSD() 155 { 156 // -- sensitive detectors: 157 G4SDManager* SDman = G4SDManager::GetSDMpoin 158 Par04ParallelFastSensitiveDetector* caloSD = 159 new Par04ParallelFastSensitiveDetector("pa 160 SDman->AddNewDetector(caloSD); 161 for (const auto& logicalCell : fLogicalCell) 162 logicalCell->SetSensitiveDetector(caloSD); 163 } 164 165 //....oooOO0OOooo........oooOO0OOooo........oo 166 167 void Par04ParallelFastWorld::Print() 168 { 169 G4cout << "\n------------------------------- 170 << "\n Readout geometry with physics 171 << "\n Cylindrical detector is divide 172 << "\n Number of layers is determined 173 << "\n- Number of layers: " << fNbOfL 174 << "\n- Number of rows: " << fNbOfRow 175 G4cout << "\n Readout will collect energy fr 176 << "a sum of all absorbers" 177 << " = " << G4BestUnit(fLayerThicknes 178 << "\n------------------------------- 179 } 180