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 // G4ScoringCylinder << 26 // 27 // ------------------------------------------- << 27 // $Id: G4ScoringCylinder.cc 99154 2016-09-07 08:06:30Z gcosmo $ >> 28 // 28 29 29 #include "G4ScoringCylinder.hh" 30 #include "G4ScoringCylinder.hh" 30 31 31 #include "G4LogicalVolume.hh" << 32 #include "G4MultiFunctionalDetector.hh" << 33 #include "G4PVDivision.hh" << 34 #include "G4PVPlacement.hh" << 35 #include "G4PVReplica.hh" << 36 #include "G4PhysicalConstants.hh" 32 #include "G4PhysicalConstants.hh" 37 #include "G4SDManager.hh" << 38 #include "G4ScoringManager.hh" << 39 #include "G4StatDouble.hh" << 40 #include "G4SystemOfUnits.hh" 33 #include "G4SystemOfUnits.hh" >> 34 #include "G4VPhysicalVolume.hh" 41 #include "G4Tubs.hh" 35 #include "G4Tubs.hh" >> 36 #include "G4LogicalVolume.hh" 42 #include "G4VPhysicalVolume.hh" 37 #include "G4VPhysicalVolume.hh" 43 #include "G4VPrimitiveScorer.hh" << 38 #include "G4PVPlacement.hh" 44 #include "G4VScoreColorMap.hh" << 39 #include "G4PVReplica.hh" 45 #include "G4VVisManager.hh" << 40 #include "G4PVDivision.hh" 46 #include "G4VisAttributes.hh" 41 #include "G4VisAttributes.hh" >> 42 #include "G4VVisManager.hh" >> 43 #include "G4VScoreColorMap.hh" 47 44 48 #include "G4LogicalVolumeStore.hh" << 45 #include "G4SDManager.hh" 49 #include "G4Material.hh" << 46 #include "G4MultiFunctionalDetector.hh" 50 #include "G4PhysicalVolumeStore.hh" << 47 #include "G4SDParticleFilter.hh" 51 #include "G4SolidStore.hh" << 48 #include "G4VPrimitiveScorer.hh" 52 #include "G4UnitsTable.hh" << 49 #include "G4PSEnergyDeposit.hh" 53 #include "G4VSensitiveDetector.hh" << 50 #include "G4PSTrackLength.hh" 54 #include "G4VSolid.hh" << 51 #include "G4PSNofStep.hh" >> 52 #include "G4ScoringManager.hh" >> 53 #include "G4StatDouble.hh" 55 54 56 55 57 G4ScoringCylinder::G4ScoringCylinder(const G4S << 56 G4ScoringCylinder::G4ScoringCylinder(G4String wName) 58 : G4VScoringMesh(wName) << 57 :G4VScoringMesh(wName) 59 { 58 { 60 fShape = MeshShape::cylinder; << 59 fShape = cylinderMesh; 61 60 62 fDivisionAxisNames[0] = "Z"; 61 fDivisionAxisNames[0] = "Z"; 63 fDivisionAxisNames[1] = "PHI"; 62 fDivisionAxisNames[1] = "PHI"; 64 fDivisionAxisNames[2] = "R"; 63 fDivisionAxisNames[2] = "R"; 65 } 64 } 66 65 67 void G4ScoringCylinder::SetupGeometry(G4VPhysi << 66 G4ScoringCylinder::~G4ScoringCylinder() 68 { << 67 {;} 69 if(verboseLevel > 9) << 68 70 G4cout << "G4ScoringCylinder::SetupGeometr << 69 void G4ScoringCylinder::SetupGeometry(G4VPhysicalVolume * fWorldPhys) { >> 70 >> 71 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::SetupGeometry() ..." << G4endl; 71 72 72 // World 73 // World 73 G4VPhysicalVolume* scoringWorld = fWorldPhys << 74 G4VPhysicalVolume * scoringWorld = fWorldPhys; 74 G4LogicalVolume* worldLogical = scoringWor << 75 G4LogicalVolume * worldLogical = scoringWorld->GetLogicalVolume(); 75 76 76 // Scoring Mesh 77 // Scoring Mesh 77 if(verboseLevel > 9) << 78 if(verboseLevel > 9) G4cout << fWorldName << G4endl; 78 G4cout << fWorldName << G4endl; << 79 G4String tubsName = fWorldName+"_mesh"; 79 G4String tubsName = fWorldName + "_mesh"; << 80 80 81 if(verboseLevel > 9) << 81 if(verboseLevel > 9) G4cout << "R max., Dz =: " << fSize[0] << ", " << fSize[1] << G4endl; 82 { << 82 G4VSolid * tubsSolid = new G4Tubs(tubsName+"0", // name 83 G4cout << "R min, R max., Dz =: " << fSize << 83 0., // R min 84 << ", " << 84 fSize[0], // R max 85 } << 85 fSize[1], // Dz 86 G4VSolid* tubsSolid = new G4Tubs(tu << 86 0., // starting phi 87 fSize[0], << 87 twopi*rad); // segment phi 88 fSize[1], << 88 G4LogicalVolume * tubsLogical = new G4LogicalVolume(tubsSolid, 0, tubsName); 89 fSize[2], << 89 new G4PVPlacement(fRotationMatrix, fCenterPosition, 90 fAngle[0], << 90 tubsLogical, tubsName+"0", worldLogical, false, 0); 91 fAngle[1]); << 91 92 auto tubsLogical = new G4LogicalVolume(tubs << 92 if(verboseLevel > 9) G4cout << " # of segments : r, phi, z =: " 93 new G4PVPlacement(fRotationMatrix, fCenterPo << 93 << fNSegment[IR] << ", " << fNSegment[IPHI] << ", " << fNSegment[IZ] << G4endl; 94 tubsName + "0", worldLogic << 94 95 << 95 G4String layerName[2] = {tubsName + "1", tubsName + "2"}; 96 if(verboseLevel > 9) << 96 G4VSolid * layerSolid[2]; 97 G4cout << " # of segments : r, phi, z =: " << 97 G4LogicalVolume * layerLogical[2]; 98 << fNSegment[IPHI] << ", " << fNSeg << 99 << 100 G4String layerName[2] = { tubsName + "1", tu << 101 G4VSolid* layerSolid[2]; << 102 G4LogicalVolume* layerLogical[2]; << 103 98 104 //-- fisrt nested layer (replicated along z 99 //-- fisrt nested layer (replicated along z direction) 105 if(verboseLevel > 9) << 100 if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl; 106 G4cout << "layer 1 :" << G4endl; << 101 layerSolid[0] = new G4Tubs(layerName[0], // name 107 layerSolid[0] = new G4Tubs(layerName[0], << 102 0., // inner radius 108 fSize[0], << 103 fSize[0], // outer radius 109 fSize[1], << 104 fSize[1]/fNSegment[IZ], // half len. in z 110 fSize[2] / fNSegm << 105 0., // starting phi angle 111 fAngle[0], << 106 twopi*rad); // delta angle of the segment 112 fAngle[1]); // d << 107 layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]); 113 layerLogical[0] = new G4LogicalVolume(layerS << 108 if(fNSegment[IZ] > 1) { 114 if(fNSegment[IZ] > 1) << 109 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along z direction" << G4endl; 115 { << 110 if(G4ScoringManager::GetReplicaLevel()>0) { 116 if(verboseLevel > 9) << 111 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl; 117 G4cout << "G4ScoringCylinder::Construct( << 112 new G4PVReplica(layerName[0], layerLogical[0], tubsLogical, kZAxis, fNSegment[IZ], 2.*fSize[1]/fNSegment[IZ]); 118 << G4endl; << 113 } else { 119 if(G4ScoringManager::GetReplicaLevel() > 0 << 114 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl; 120 { << 115 new G4PVDivision(layerName[0], layerLogical[0], tubsLogical, kZAxis, fNSegment[IZ], 0.); 121 if(verboseLevel > 9) << 116 } 122 G4cout << "G4ScoringCylinder::Construc << 117 } else if(fNSegment[IZ] == 1) { 123 new G4PVReplica(layerName[0], layerLogic << 118 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl; 124 fNSegment[IZ], 2. * fSiz << 119 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0], tubsLogical, false, 0); 125 } << 120 } else { 126 else << 127 { << 128 if(verboseLevel > 9) << 129 G4cout << "G4ScoringCylinder::Construc << 130 new G4PVDivision(layerName[0], layerLogi << 131 fNSegment[IZ], 0.); << 132 } << 133 } << 134 else if(fNSegment[IZ] == 1) << 135 { << 136 if(verboseLevel > 9) << 137 G4cout << "G4ScoringCylinder::Construct( << 138 new G4PVPlacement(nullptr, G4ThreeVector(0 << 139 layerName[0], tubsLogica << 140 } << 141 else << 142 { << 143 G4cerr << "G4ScoringCylinder::SetupGeometr 121 G4cerr << "G4ScoringCylinder::SetupGeometry() : invalid parameter (" 144 << fNSegment[IZ] << ") " << 122 << fNSegment[IZ] << ") " 145 << "in placement of the first neste << 123 << "in placement of the first nested layer." << G4endl; 146 } 124 } 147 125 148 // second nested layer (replicated along phi 126 // second nested layer (replicated along phi direction) 149 if(verboseLevel > 9) << 127 if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl; 150 G4cout << "layer 2 :" << G4endl; << 128 layerSolid[1] = new G4Tubs(layerName[1], 151 layerSolid[1] = << 129 0., 152 new G4Tubs(layerName[1], fSize[0], fSize[1 << 130 fSize[0], 153 fAngle[0], fAngle[1] / fNSegmen << 131 fSize[1]/fNSegment[IZ], 154 layerLogical[1] = new G4LogicalVolume(layerS << 132 0., 155 if(fNSegment[IPHI] > 1) << 133 twopi*rad/fNSegment[IPHI]); 156 { << 134 layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]); 157 if(verboseLevel > 9) << 135 if(fNSegment[IPHI] > 1) { 158 G4cout << "G4ScoringCylinder::Construct( << 136 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along phi direction" << G4endl; 159 << G4endl; << 137 if(G4ScoringManager::GetReplicaLevel()>1) { 160 if(G4ScoringManager::GetReplicaLevel() > 1 << 138 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl; 161 { << 162 if(verboseLevel > 9) << 163 G4cout << "G4ScoringCylinder::Construc << 164 new G4PVReplica(layerName[1], layerLogic 139 new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kPhi, 165 fNSegment[IPHI], fAngle[ << 140 fNSegment[IPHI], twopi*rad/fNSegment[IPHI]); 166 } << 141 } else { 167 else << 142 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl; 168 { << 143 new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kPhi, fNSegment[IPHI], 0.); 169 if(verboseLevel > 9) << 144 } 170 G4cout << "G4ScoringCylinder::Construc << 145 } else if(fNSegment[IPHI] == 1) { 171 new G4PVDivision(layerName[1], layerLogi << 146 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl; 172 fNSegment[IPHI], 0.); << 147 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1], layerLogical[0], false, 0); 173 } << 148 } else 174 } << 175 else if(fNSegment[IPHI] == 1) << 176 { << 177 if(verboseLevel > 9) << 178 G4cout << "G4ScoringCylinder::Construct( << 179 new G4PVPlacement(nullptr, G4ThreeVector(0 << 180 layerName[1], layerLogic << 181 } << 182 else << 183 G4cerr << "ERROR : G4ScoringCylinder::Setu 149 G4cerr << "ERROR : G4ScoringCylinder::SetupGeometry() : invalid parameter (" 184 << fNSegment[IPHI] << ") " << 150 << fNSegment[IPHI] << ") " 185 << "in placement of the second nest << 151 << "in placement of the second nested layer." << G4endl; 186 152 187 // mesh elements 153 // mesh elements 188 if(verboseLevel > 9) << 154 if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl; 189 G4cout << "mesh elements :" << G4endl; << 155 G4String elementName = tubsName +"3"; 190 G4String elementName = tubsName + "3"; << 156 G4VSolid * elementSolid = new G4Tubs(elementName, 191 G4VSolid* elementSolid = new G4Tubs( << 157 0., 192 elementName, fSize[0], (fSize[1] - fSize[0 << 158 fSize[0]/fNSegment[IR], 193 fSize[2] / fNSegment[IZ], fAngle[0], fAngl << 159 fSize[1]/fNSegment[IZ], 194 fMeshElementLogical = new G4LogicalVolume(el << 160 0., 195 if(fNSegment[IR] >= 1) << 161 twopi*rad/fNSegment[IPHI]); 196 { << 162 fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName); 197 if(verboseLevel > 9) << 163 if(fNSegment[IR] > 1) { 198 G4cout << "G4ScoringCylinder::Construct( << 164 199 << G4endl; << 165 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along r direction" << G4endl; 200 << 166 201 if(G4ScoringManager::GetReplicaLevel() > 2 << 167 if(G4ScoringManager::GetReplicaLevel()>2) { 202 { << 168 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl; 203 if(verboseLevel > 9) << 204 G4cout << "G4ScoringCylinder::Construc << 205 new G4PVReplica(elementName, fMeshElemen 169 new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kRho, 206 fNSegment[IR], (fSize[1] << 170 fNSegment[IR], fSize[0]/fNSegment[IR]); 207 fSize[0]); << 171 } else { 208 } << 172 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl; 209 else << 173 new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kRho, fNSegment[IR], 0.); 210 { << 174 } 211 if(verboseLevel > 9) << 175 } else if(fNSegment[IR] == 1) { 212 G4cout << "G4ScoringCylinder::Construc << 176 if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl; 213 new G4PVDivision(elementName, fMeshEleme << 177 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, elementName, layerLogical[1], false, 0); 214 fNSegment[IR], 0.); << 178 } else { 215 } << 216 } << 217 else << 218 { << 219 G4cerr << "G4ScoringCylinder::SetupGeometr 179 G4cerr << "G4ScoringCylinder::SetupGeometry() : " 220 << "invalid parameter (" << fNSegme << 180 << "invalid parameter (" << fNSegment[IR] << ") " 221 << "in mesh element placement." << << 181 << "in mesh element placement." << G4endl; 222 } 182 } 223 183 224 // set the sensitive detector 184 // set the sensitive detector 225 fMeshElementLogical->SetSensitiveDetector(fM 185 fMeshElementLogical->SetSensitiveDetector(fMFD); >> 186 226 187 227 // vis. attributes 188 // vis. attributes 228 auto visatt = new G4VisAttributes(G4Colour( << 189 G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5)); 229 visatt->SetVisibility(true); 190 visatt->SetVisibility(true); 230 layerLogical[0]->SetVisAttributes(visatt); 191 layerLogical[0]->SetVisAttributes(visatt); 231 layerLogical[1]->SetVisAttributes(visatt); 192 layerLogical[1]->SetVisAttributes(visatt); 232 visatt = new G4VisAttributes(G4Colour(.5, .5 << 193 visatt = new G4VisAttributes(G4Colour(.5,.5,.5,0.01)); 233 // visatt->SetForceSolid(true); << 194 //visatt->SetForceSolid(true); 234 fMeshElementLogical->SetVisAttributes(visatt 195 fMeshElementLogical->SetVisAttributes(visatt); 235 << 236 if(verboseLevel > 9) << 237 DumpVolumes(); << 238 } 196 } 239 197 240 void G4ScoringCylinder::List() const << 198 void G4ScoringCylinder::List() const { 241 { << 199 G4cout << "G4ScoringCylinder : " << fWorldName << " --- Shape: Cylindrical mesh" << G4endl; 242 G4cout << "G4ScoringCylinder : " << fWorldNa << 243 << " --- Shape: Cylindrical mesh" << << 244 200 245 G4cout << " Size (Rmin, Rmax, Dz): (" << fSi << 201 G4cout << " Size (R, Dz): (" 246 << fSize[1] / cm << ", " << fSize[2] << 202 << fSize[0]/cm << ", " 247 G4cout << " Angle (start, span): (" << fAngl << 203 << fSize[1]/cm << ") [cm]" 248 << fAngle[1] / deg << ") [deg]" << G4 << 204 << G4endl; 249 205 250 G4VScoringMesh::List(); 206 G4VScoringMesh::List(); 251 } 207 } 252 208 253 void G4ScoringCylinder::Draw(RunScore* map, G4 << 209 254 G4int axflg) << 210 void G4ScoringCylinder::Draw(RunScore * map, 255 { << 211 G4VScoreColorMap* colorMap, G4int axflg) { 256 G4VVisManager* pVisManager = G4VVisManager:: << 212 257 if(pVisManager != nullptr) << 213 G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance(); 258 { << 214 if(pVisManager) { >> 215 259 // cell vectors 216 // cell vectors 260 std::vector<G4double> ephi; << 217 std::vector<double> ephi; 261 for(G4int phi = 0; phi < fNSegment[IPHI]; << 218 for(int phi = 0; phi < fNSegment[IPHI]; phi++) ephi.push_back(0.); 262 ephi.push_back(0.); << 263 //- 219 //- 264 std::vector<std::vector<G4double>> zphicel << 220 std::vector<std::vector<double> > zphicell; // zphicell[Z][PHI] 265 for(G4int z = 0; z < fNSegment[IZ]; z++) << 221 for(int z = 0; z < fNSegment[IZ]; z++) zphicell.push_back(ephi); 266 zphicell.push_back(ephi); << 267 //- 222 //- 268 std::vector<std::vector<G4double>> rphicel << 223 std::vector<std::vector<double> > rphicell; // rphicell[R][PHI] 269 for(G4int r = 0; r < fNSegment[IR]; r++) << 224 for(int r = 0; r < fNSegment[IR]; r++) rphicell.push_back(ephi); 270 rphicell.push_back(ephi); << 225 271 << 272 // projections 226 // projections 273 G4int q[3]; 227 G4int q[3]; 274 auto itr = map->GetMap()->begin(); << 228 std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin(); 275 for(; itr != map->GetMap()->end(); itr++) << 229 for(; itr != map->GetMap()->end(); itr++) { 276 { << 230 if(itr->first < 0) { 277 if(itr->first < 0) << 278 { << 279 G4cout << itr->first << G4endl; 231 G4cout << itr->first << G4endl; 280 continue; 232 continue; 281 } 233 } 282 GetRZPhi(itr->first, q); 234 GetRZPhi(itr->first, q); 283 << 235 284 zphicell[q[IZ]][q[IPHI]] += (itr->second << 236 zphicell[q[IZ]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue; 285 rphicell[q[IR]][q[IPHI]] += (itr->second << 237 rphicell[q[IR]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue; 286 } 238 } 287 << 239 288 // search min./max. values 240 // search min./max. values 289 G4double zphimin = DBL_MAX, rphimin = DBL_ 241 G4double zphimin = DBL_MAX, rphimin = DBL_MAX; 290 G4double zphimax = 0., rphimax = 0.; 242 G4double zphimax = 0., rphimax = 0.; 291 for(G4int iphi = 0; iphi < fNSegment[IPHI] << 243 for(int iphi = 0; iphi < fNSegment[IPHI]; iphi++) { 292 { << 244 for(int iz = 0; iz < fNSegment[IZ]; iz++) { 293 for(G4int iz = 0; iz < fNSegment[IZ]; iz << 245 if(zphimin > zphicell[iz][iphi]) zphimin = zphicell[iz][iphi]; 294 { << 246 if(zphimax < zphicell[iz][iphi]) zphimax = zphicell[iz][iphi]; 295 if(zphimin > zphicell[iz][iphi]) << 247 } 296 zphimin = zphicell[iz][iphi]; << 248 for(int ir = 0; ir < fNSegment[IR]; ir++) { 297 if(zphimax < zphicell[iz][iphi]) << 249 if(rphimin > rphicell[ir][iphi]) rphimin = rphicell[ir][iphi]; 298 zphimax = zphicell[iz][iphi]; << 250 if(rphimax < rphicell[ir][iphi]) rphimax = rphicell[ir][iphi]; 299 } << 300 for(G4int ir = 0; ir < fNSegment[IR]; ir << 301 { << 302 if(rphimin > rphicell[ir][iphi]) << 303 rphimin = rphicell[ir][iphi]; << 304 if(rphimax < rphicell[ir][iphi]) << 305 rphimax = rphicell[ir][iphi]; << 306 } 251 } 307 } 252 } 308 << 253 309 G4VisAttributes att; 254 G4VisAttributes att; 310 att.SetForceSolid(true); 255 att.SetForceSolid(true); 311 att.SetForceAuxEdgeVisible(true); 256 att.SetForceAuxEdgeVisible(true); 312 << 257 >> 258 313 G4Scale3D scale; 259 G4Scale3D scale; 314 if(axflg / 100 == 1) << 260 if(axflg/100==1) { 315 { << 316 // rz plane 261 // rz plane 317 } 262 } 318 axflg = axflg % 100; << 263 axflg = axflg%100; 319 if(axflg / 10 == 1) << 264 if(axflg/10==1) { 320 { << 321 pVisManager->BeginDraw(); 265 pVisManager->BeginDraw(); 322 << 266 323 // z-phi plane 267 // z-phi plane 324 if(colorMap->IfFloatMinMax()) << 268 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(zphimin, zphimax); } 325 { << 269 326 colorMap->SetMinMax(zphimin, zphimax); << 270 G4double zhalf = fSize[1]/fNSegment[IZ]; 327 } << 271 for(int phi = 0; phi < fNSegment[IPHI]; phi++) { 328 << 272 for(int z = 0; z < fNSegment[IZ]; z++) { 329 G4double zhalf = fSize[2] / fNSegment[IZ << 330 for(G4int phi = 0; phi < fNSegment[IPHI] << 331 { << 332 for(G4int z = 0; z < fNSegment[IZ]; z+ << 333 { << 334 //- 273 //- 335 G4double angle = fAngle[0] + fAngle[ << 274 G4double angle = twopi/fNSegment[IPHI]*phi; 336 G4double dphi = fAngle[1] / fNSegme << 275 G4double dphi = twopi/fNSegment[IPHI]; 337 G4Tubs cylinder( << 276 G4Tubs cylinder("z-phi", // name 338 "z-phi", // nam << 277 fSize[0]*0.99, fSize[0], // inner radius, outer radius 339 fSize[1] * 0.99, fSize[1], // inn << 278 zhalf, // half length in z 340 zhalf, // hal << 279 angle, dphi*0.99999); // starting phi angle, delta angle 341 angle, dphi * 0.99999); // sta << 342 //- 280 //- 343 G4ThreeVector zpos( << 281 G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[IZ]*(1 + 2.*z)); 344 0., 0., -fSize[2] + fSize[2] / fNS << 345 G4Transform3D trans; 282 G4Transform3D trans; 346 if(fRotationMatrix != nullptr) << 283 if(fRotationMatrix) { 347 { << 284 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos); 348 trans = << 285 trans = G4Translate3D(fCenterPosition)*trans; 349 G4Rotate3D(*fRotationMatrix).inv << 286 } else { 350 trans = G4Translate3D(fCenterPosit << 287 trans = G4Translate3D(zpos)*G4Translate3D(fCenterPosition); 351 } << 352 else << 353 { << 354 trans = G4Translate3D(zpos) * G4Tr << 355 } 288 } 356 G4double c[4]; 289 G4double c[4]; 357 colorMap->GetMapColor(zphicell[z][ph 290 colorMap->GetMapColor(zphicell[z][phi], c); 358 att.SetColour(c[0], c[1], c[2]); // << 291 att.SetColour(c[0], c[1], c[2]);//, c[3]); 359 //- 292 //- 360 G4Polyhedron* poly = cylinder.GetPol << 293 G4Polyhedron * poly = cylinder.GetPolyhedron(); 361 poly->Transform(trans); 294 poly->Transform(trans); 362 poly->SetVisAttributes(att); 295 poly->SetVisAttributes(att); 363 pVisManager->Draw(*poly); 296 pVisManager->Draw(*poly); 364 } 297 } 365 } 298 } 366 pVisManager->EndDraw(); 299 pVisManager->EndDraw(); 367 } 300 } 368 axflg = axflg % 10; << 301 axflg = axflg%10; 369 if(axflg == 1) << 302 if(axflg==1) { 370 { << 371 pVisManager->BeginDraw(); 303 pVisManager->BeginDraw(); 372 << 304 373 // r-phi plane 305 // r-phi plane 374 if(colorMap->IfFloatMinMax()) << 306 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(rphimin, rphimax); } 375 { << 307 376 colorMap->SetMinMax(rphimin, rphimax); << 308 G4double rsize = fSize[0]/fNSegment[IR]; 377 } << 309 for(int phi = 0; phi < fNSegment[IPHI]; phi++) { 378 << 310 for(int r = 0; r < fNSegment[IR]; r++) { 379 G4double rsize = (fSize[1] - fSize[0]) / << 311 380 for(G4int phi = 0; phi < fNSegment[IPHI] << 312 G4double rs[2] = {rsize*r, rsize*(r+1)}; 381 { << 313 G4double angle = twopi/fNSegment[IPHI]*phi; 382 for(G4int r = 0; r < fNSegment[IR]; r+ << 314 G4double dphi = twopi/fNSegment[IPHI]; 383 { << 315 G4Tubs cylindern("z-phi", rs[0], rs[1], 0.001, 384 G4double rs[2] = { fSize[0] + rsize << 316 angle, dphi*0.99999); 385 G4double angle = fAngle[0] + fAngle[ << 386 G4double dphi = fAngle[1] / fNSegme << 387 G4Tubs cylindern("z-phi", rs[0], rs[ << 388 G4Tubs cylinderp = cylindern; 317 G4Tubs cylinderp = cylindern; 389 << 318 390 G4ThreeVector zposn(0., 0., -fSize[2 << 319 G4ThreeVector zposn(0., 0., -fSize[1]); 391 G4ThreeVector zposp(0., 0., fSize[2] << 320 G4ThreeVector zposp(0., 0., fSize[1]); 392 G4Transform3D transn, transp; 321 G4Transform3D transn, transp; 393 if(fRotationMatrix != nullptr) << 322 if(fRotationMatrix) { 394 { << 323 transn = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zposn); 395 transn = << 324 transn = G4Translate3D(fCenterPosition)*transn; 396 G4Rotate3D(*fRotationMatrix).inv << 325 transp = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zposp); 397 transn = G4Translate3D(fCenterPosi << 326 transp = G4Translate3D(fCenterPosition)*transp; 398 transp = << 327 } else { 399 G4Rotate3D(*fRotationMatrix).inv << 328 transn = G4Translate3D(zposn)*G4Translate3D(fCenterPosition); 400 transp = G4Translate3D(fCenterPosi << 329 transp = G4Translate3D(zposp)*G4Translate3D(fCenterPosition); 401 } << 402 else << 403 { << 404 transn = G4Translate3D(zposn) * G4 << 405 transp = G4Translate3D(zposp) * G4 << 406 } 330 } 407 G4double c[4]; 331 G4double c[4]; 408 colorMap->GetMapColor(rphicell[r][ph 332 colorMap->GetMapColor(rphicell[r][phi], c); 409 att.SetColour(c[0], c[1], c[2]); // << 333 att.SetColour(c[0], c[1], c[2]);//, c[3]); 410 334 411 G4Polyhedron* polyn = cylindern.GetP << 335 G4Polyhedron * polyn = cylindern.GetPolyhedron(); 412 polyn->Transform(transn); 336 polyn->Transform(transn); 413 polyn->SetVisAttributes(att); 337 polyn->SetVisAttributes(att); 414 pVisManager->Draw(*polyn); 338 pVisManager->Draw(*polyn); 415 339 416 G4Polyhedron* polyp = cylinderp.GetP << 340 G4Polyhedron * polyp = cylinderp.GetPolyhedron(); 417 polyp->Transform(transp); 341 polyp->Transform(transp); 418 polyp->SetVisAttributes(att); 342 polyp->SetVisAttributes(att); 419 pVisManager->Draw(*polyp); 343 pVisManager->Draw(*polyp); 420 } 344 } 421 } 345 } 422 << 346 423 pVisManager->EndDraw(); 347 pVisManager->EndDraw(); 424 } 348 } 425 << 349 426 colorMap->SetPSUnit(fDrawUnit); 350 colorMap->SetPSUnit(fDrawUnit); 427 colorMap->SetPSName(fDrawPSName); 351 colorMap->SetPSName(fDrawPSName); 428 colorMap->DrawColorChart(); 352 colorMap->DrawColorChart(); >> 353 429 } 354 } 430 } 355 } 431 356 432 void G4ScoringCylinder::DrawColumn(RunScore* m << 357 void G4ScoringCylinder::DrawColumn(RunScore * map, G4VScoreColorMap* colorMap, 433 G4int idxPr << 358 G4int idxProj, G4int idxColumn) 434 { 359 { 435 G4int projAxis = 0; 360 G4int projAxis = 0; 436 switch(idxProj) << 361 switch(idxProj) { 437 { << 438 case 0: 362 case 0: 439 projAxis = IR; 363 projAxis = IR; 440 break; 364 break; 441 case 1: 365 case 1: 442 projAxis = IZ; 366 projAxis = IZ; 443 break; 367 break; 444 case 2: 368 case 2: 445 projAxis = IPHI; 369 projAxis = IPHI; 446 break; 370 break; 447 } 371 } 448 << 372 449 if(idxColumn < 0 || idxColumn >= fNSegment[p << 373 if(idxColumn<0 || idxColumn>=fNSegment[projAxis]) 450 { 374 { 451 G4cerr << "Warning : Column number " << id << 375 G4cerr << "Warning : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[projAxis]-1 << 452 << " is out of scoring mesh [0," << << 376 "]. Method ignored." << G4endl; 453 << "]. Method ignored." << G4endl; << 454 return; 377 return; 455 } 378 } 456 G4VVisManager* pVisManager = G4VVisManager:: << 379 G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance(); 457 if(pVisManager != nullptr) << 380 if(pVisManager) { 458 { << 381 459 // cell vectors 382 // cell vectors 460 std::vector<std::vector<std::vector<G4doub << 383 std::vector<std::vector<std::vector<double> > > cell; // cell[R][Z][PHI] 461 std::vector<G4double> ephi; << 384 std::vector<double> ephi; 462 for(G4int phi = 0; phi < fNSegment[IPHI]; << 385 for(int phi = 0; phi < fNSegment[IPHI]; phi++) ephi.push_back(0.); 463 ephi.push_back(0.); << 386 std::vector<std::vector<double> > ezphi; 464 std::vector<std::vector<G4double>> ezphi; << 387 for(int z = 0; z < fNSegment[IZ]; z++) ezphi.push_back(ephi); 465 for(G4int z = 0; z < fNSegment[IZ]; z++) << 388 for(int r = 0; r < fNSegment[IR]; r++) cell.push_back(ezphi); 466 ezphi.push_back(ephi); << 389 467 for(G4int r = 0; r < fNSegment[IR]; r++) << 390 std::vector<std::vector<double> > rzcell; // rzcell[R][Z] 468 cell.push_back(ezphi); << 391 std::vector<double> ez; 469 << 392 for(int z = 0; z < fNSegment[IZ]; z++) ez.push_back(0.); 470 std::vector<std::vector<G4double>> rzcell; << 393 for(int r = 0; r < fNSegment[IR]; r++) rzcell.push_back(ez); 471 std::vector<G4double> ez; << 394 472 for(G4int z = 0; z < fNSegment[IZ]; z++) << 395 std::vector<std::vector<double> > zphicell; // zphicell[Z][PHI] 473 ez.push_back(0.); << 396 for(int z = 0; z < fNSegment[IZ]; z++) zphicell.push_back(ephi); 474 for(G4int r = 0; r < fNSegment[IR]; r++) << 397 475 rzcell.push_back(ez); << 398 std::vector<std::vector<double> > rphicell; // rphicell[R][PHI] 476 << 399 for(int r = 0; r < fNSegment[IR]; r++) rphicell.push_back(ephi); 477 std::vector<std::vector<G4double>> zphicel << 400 478 for(G4int z = 0; z < fNSegment[IZ]; z++) << 479 zphicell.push_back(ephi); << 480 << 481 std::vector<std::vector<G4double>> rphicel << 482 for(G4int r = 0; r < fNSegment[IR]; r++) << 483 rphicell.push_back(ephi); << 484 << 485 // projections 401 // projections 486 G4int q[3]; 402 G4int q[3]; 487 auto itr = map->GetMap()->begin(); << 403 std::map<G4int,G4StatDouble*>::iterator itr = map->GetMap()->begin(); 488 for(; itr != map->GetMap()->end(); itr++) << 404 for(; itr != map->GetMap()->end(); itr++) { 489 { << 405 if(itr->first < 0) { 490 if(itr->first < 0) << 491 { << 492 G4cout << itr->first << G4endl; 406 G4cout << itr->first << G4endl; 493 continue; 407 continue; 494 } 408 } 495 GetRZPhi(itr->first, q); 409 GetRZPhi(itr->first, q); 496 << 410 497 if(projAxis == IR && q[IR] == idxColumn) << 411 if(projAxis == IR && q[IR] == idxColumn) { // zphi plane 498 { // zphi plane << 412 zphicell[q[IZ]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue; 499 zphicell[q[IZ]][q[IPHI]] += (itr->seco << 413 } 500 } << 414 if(projAxis == IZ && q[IZ] == idxColumn) { // rphi plane 501 if(projAxis == IZ && q[IZ] == idxColumn) << 415 rphicell[q[IR]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue; 502 { // rphi plane << 416 } 503 rphicell[q[IR]][q[IPHI]] += (itr->seco << 417 if(projAxis == IPHI && q[IPHI] == idxColumn) { // rz plane 504 } << 418 rzcell[q[IR]][q[IZ]] += (itr->second->sum_wx())/fDrawUnitValue; 505 if(projAxis == IPHI && q[IPHI] == idxCol << 506 { // rz plane << 507 rzcell[q[IR]][q[IZ]] += (itr->second-> << 508 } 419 } 509 } 420 } 510 << 421 511 // search min./max. values 422 // search min./max. values 512 G4double rzmin = DBL_MAX, zphimin = DBL_MA 423 G4double rzmin = DBL_MAX, zphimin = DBL_MAX, rphimin = DBL_MAX; 513 G4double rzmax = 0., zphimax = 0., rphimax 424 G4double rzmax = 0., zphimax = 0., rphimax = 0.; 514 for(G4int r = 0; r < fNSegment[IR]; r++) << 425 for(int r = 0; r < fNSegment[IR]; r++) { 515 { << 426 for(int phi = 0; phi < fNSegment[IPHI]; phi++) { 516 for(G4int phi = 0; phi < fNSegment[IPHI] << 427 if(rphimin > rphicell[r][phi]) rphimin = rphicell[r][phi]; 517 { << 428 if(rphimax < rphicell[r][phi]) rphimax = rphicell[r][phi]; 518 if(rphimin > rphicell[r][phi]) << 429 } 519 rphimin = rphicell[r][phi]; << 430 for(int z = 0; z < fNSegment[IZ]; z++) { 520 if(rphimax < rphicell[r][phi]) << 431 if(rzmin > rzcell[r][z]) rzmin = rzcell[r][z]; 521 rphimax = rphicell[r][phi]; << 432 if(rzmax < rzcell[r][z]) rzmax = rzcell[r][z]; 522 } << 523 for(G4int z = 0; z < fNSegment[IZ]; z++) << 524 { << 525 if(rzmin > rzcell[r][z]) << 526 rzmin = rzcell[r][z]; << 527 if(rzmax < rzcell[r][z]) << 528 rzmax = rzcell[r][z]; << 529 } << 530 } << 531 for(G4int z = 0; z < fNSegment[IZ]; z++) << 532 { << 533 for(G4int phi = 0; phi < fNSegment[IPHI] << 534 { << 535 if(zphimin > zphicell[z][phi]) << 536 zphimin = zphicell[z][phi]; << 537 if(zphimax < zphicell[z][phi]) << 538 zphimax = zphicell[z][phi]; << 539 } 433 } 540 } 434 } 541 << 435 for(int z = 0; z < fNSegment[IZ]; z++) { >> 436 for(int phi = 0; phi < fNSegment[IPHI]; phi++) { >> 437 if(zphimin > zphicell[z][phi]) zphimin = zphicell[z][phi]; >> 438 if(zphimax < zphicell[z][phi]) zphimax = zphicell[z][phi]; >> 439 } >> 440 } >> 441 >> 442 542 G4VisAttributes att; 443 G4VisAttributes att; 543 att.SetForceSolid(true); 444 att.SetForceSolid(true); 544 att.SetForceAuxEdgeVisible(true); 445 att.SetForceAuxEdgeVisible(true); 545 << 446 546 pVisManager->BeginDraw(); 447 pVisManager->BeginDraw(); 547 << 448 548 G4Scale3D scale; 449 G4Scale3D scale; 549 // z-phi plane 450 // z-phi plane 550 if(projAxis == IR) << 451 if(projAxis == IR) { 551 { << 452 552 if(colorMap->IfFloatMinMax()) << 453 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(zphimin,zphimax); } 553 { << 454 554 colorMap->SetMinMax(zphimin, zphimax); << 455 G4double zhalf = fSize[1]/fNSegment[IZ]; 555 } << 456 G4double rsize[2] = {fSize[0]/fNSegment[IR]*idxColumn, 556 << 457 fSize[0]/fNSegment[IR]*(idxColumn+1)}; 557 G4double zhalf = fSize[2] / fNSegment << 458 for(int phi = 0; phi < fNSegment[IPHI]; phi++) { 558 G4double rsize[2] = { << 459 for(int z = 0; z < fNSegment[IZ]; z++) { 559 fSize[0] + (fSize[1] - fSize[0]) / fNS << 460 560 fSize[0] + (fSize[1] - fSize[0]) / fNS << 461 G4double angle = twopi/fNSegment[IPHI]*phi*radian; 561 }; << 462 G4double dphi = twopi/fNSegment[IPHI]*radian; 562 for(int phi = 0; phi < fNSegment[IPHI]; << 463 G4Tubs cylinder("z-phi", rsize[0], rsize[1], zhalf, 563 { << 464 angle, dphi*0.99999); 564 for(int z = 0; z < fNSegment[IZ]; z++) << 465 565 { << 466 G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[IZ]*(1 + 2.*z)); 566 G4double angle = fAngle[0] + fAngle[ << 567 G4double dphi = fAngle[1] / fNSegme << 568 G4Tubs cylinder("z-phi", rsize[0], r << 569 dphi * 0.99999); << 570 << 571 G4ThreeVector zpos( << 572 0., 0., -fSize[2] + fSize[2] / fNS << 573 G4Transform3D trans; 467 G4Transform3D trans; 574 if(fRotationMatrix != nullptr) << 468 if(fRotationMatrix) { 575 { << 469 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos); 576 trans = << 470 trans = G4Translate3D(fCenterPosition)*trans; 577 G4Rotate3D(*fRotationMatrix).inv << 471 } else { 578 trans = G4Translate3D(fCenterPosit << 472 trans = G4Translate3D(zpos)*G4Translate3D(fCenterPosition); 579 } << 580 else << 581 { << 582 trans = G4Translate3D(zpos) * G4Tr << 583 } 473 } 584 G4double c[4]; 474 G4double c[4]; 585 colorMap->GetMapColor(zphicell[z][ph 475 colorMap->GetMapColor(zphicell[z][phi], c); 586 att.SetColour(c[0], c[1], c[2]); // << 476 att.SetColour(c[0], c[1], c[2]);//, c[3]); 587 << 477 588 G4Polyhedron* poly = cylinder.GetPol << 478 G4Polyhedron * poly = cylinder.GetPolyhedron(); 589 poly->Transform(trans); 479 poly->Transform(trans); 590 poly->SetVisAttributes(att); 480 poly->SetVisAttributes(att); 591 pVisManager->Draw(*poly); 481 pVisManager->Draw(*poly); 592 } 482 } 593 } 483 } 594 << 484 595 // r-phi plane 485 // r-phi plane 596 } << 486 } else if(projAxis == IZ) { 597 else if(projAxis == IZ) << 487 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(rphimin,rphimax); } 598 { << 488 599 if(colorMap->IfFloatMinMax()) << 489 G4double rsize = fSize[0]/fNSegment[IR]; 600 { << 490 for(int phi = 0; phi < fNSegment[IPHI]; phi++) { 601 colorMap->SetMinMax(rphimin, rphimax); << 491 for(int r = 0; r < fNSegment[IR]; r++) { 602 } << 492 603 << 493 G4double rs[2] = {rsize*r, rsize*(r+1)}; 604 G4double rsize = (fSize[1] - fSize[0]) / << 494 G4double angle = twopi/fNSegment[IPHI]*phi*radian; 605 for(G4int phi = 0; phi < fNSegment[IPHI] << 495 G4double dz = fSize[1]/fNSegment[IZ]; 606 { << 496 G4double dphi = twopi/fNSegment[IPHI]*radian; 607 for(G4int r = 0; r < fNSegment[IR]; r+ << 497 G4Tubs cylinder("r-phi", rs[0], rs[1], dz, 608 { << 498 angle, dphi*0.99999); 609 G4double rs[2] = { fSize[0] + rsize << 499 G4ThreeVector zpos(0., 0., 610 G4double angle = fAngle[0] + fAngle[ << 500 -fSize[1]+fSize[1]/fNSegment[IZ]*(idxColumn*2+1)); 611 G4double dz = fSize[2] / fNSegmen << 612 G4double dphi = fAngle[1] / fNSegme << 613 G4Tubs cylinder("r-phi", rs[0], rs[1 << 614 G4ThreeVector zpos( << 615 0., 0., -fSize[2] + fSize[2] / fNS << 616 G4Transform3D trans; 501 G4Transform3D trans; 617 if(fRotationMatrix != nullptr) << 502 if(fRotationMatrix) { 618 { << 503 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos); 619 trans = << 504 trans = G4Translate3D(fCenterPosition)*trans; 620 G4Rotate3D(*fRotationMatrix).inv << 505 } else { 621 trans = G4Translate3D(fCenterPosit << 506 trans = G4Translate3D(zpos)*G4Translate3D(fCenterPosition); 622 } << 623 else << 624 { << 625 trans = G4Translate3D(zpos) * G4Tr << 626 } 507 } 627 G4double c[4]; 508 G4double c[4]; 628 colorMap->GetMapColor(rphicell[r][ph 509 colorMap->GetMapColor(rphicell[r][phi], c); 629 att.SetColour(c[0], c[1], c[2]); // << 510 att.SetColour(c[0], c[1], c[2]);//, c[3]); 630 511 631 G4Polyhedron* poly = cylinder.GetPol << 512 G4Polyhedron * poly = cylinder.GetPolyhedron(); 632 poly->Transform(trans); 513 poly->Transform(trans); 633 poly->SetVisAttributes(att); 514 poly->SetVisAttributes(att); 634 pVisManager->Draw(*poly); 515 pVisManager->Draw(*poly); 635 } 516 } 636 } 517 } 637 << 518 638 // r-z plane 519 // r-z plane 639 } << 520 } else if(projAxis == IPHI) { 640 else if(projAxis == IPHI) << 521 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(rzmin,rzmax); } 641 { << 522 642 if(colorMap->IfFloatMinMax()) << 523 G4double rsize = fSize[0]/fNSegment[IR]; 643 { << 524 G4double zhalf = fSize[1]/fNSegment[IZ]; 644 colorMap->SetMinMax(rzmin, rzmax); << 525 G4double angle = twopi/fNSegment[IPHI]*idxColumn*radian; 645 } << 526 G4double dphi = twopi/fNSegment[IPHI]*radian; 646 << 527 for(int z = 0; z < fNSegment[IZ]; z++) { 647 G4double rsize = (fSize[1] - fSize[0]) / << 528 for(int r = 0; r < fNSegment[IR]; r++) { 648 G4double zhalf = fSize[2] / fNSegment[IZ << 529 649 G4double angle = fAngle[0] + fAngle[1] / << 530 G4double rs[2] = {rsize*r, rsize*(r+1)}; 650 G4double dphi = fAngle[1] / fNSegment[I << 531 G4Tubs cylinder("z-phi", rs[0], rs[1], zhalf, 651 for(G4int z = 0; z < fNSegment[IZ]; z++) << 532 angle, dphi); 652 { << 533 653 for(G4int r = 0; r < fNSegment[IR]; r+ << 534 G4ThreeVector zpos(0., 0., 654 { << 535 -fSize[1]+fSize[1]/fNSegment[IZ]*(2.*z+1)); 655 G4double rs[2] = { fSize[0] + rsize << 656 G4Tubs cylinder("z-phi", rs[0], rs[1 << 657 << 658 G4ThreeVector zpos( << 659 0., 0., -fSize[2] + fSize[2] / fNS << 660 G4Transform3D trans; 536 G4Transform3D trans; 661 if(fRotationMatrix != nullptr) << 537 if(fRotationMatrix) { 662 { << 538 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos); 663 trans = << 539 trans = G4Translate3D(fCenterPosition)*trans; 664 G4Rotate3D(*fRotationMatrix).inv << 540 } else { 665 trans = G4Translate3D(fCenterPosit << 541 trans = G4Translate3D(zpos)*G4Translate3D(fCenterPosition); 666 } << 667 else << 668 { << 669 trans = G4Translate3D(zpos) * G4Tr << 670 } 542 } 671 G4double c[4]; 543 G4double c[4]; 672 colorMap->GetMapColor(rzcell[r][z], 544 colorMap->GetMapColor(rzcell[r][z], c); 673 att.SetColour(c[0], c[1], c[2]); // << 545 att.SetColour(c[0], c[1], c[2]);//, c[3]); 674 546 675 G4Polyhedron* poly = cylinder.GetPol << 547 G4Polyhedron * poly = cylinder.GetPolyhedron(); 676 poly->Transform(trans); 548 poly->Transform(trans); 677 poly->SetVisAttributes(att); 549 poly->SetVisAttributes(att); 678 pVisManager->Draw(*poly); 550 pVisManager->Draw(*poly); 679 } 551 } 680 } 552 } 681 } 553 } 682 pVisManager->EndDraw(); 554 pVisManager->EndDraw(); 683 } 555 } 684 << 556 685 colorMap->SetPSUnit(fDrawUnit); 557 colorMap->SetPSUnit(fDrawUnit); 686 colorMap->SetPSName(fDrawPSName); 558 colorMap->SetPSName(fDrawPSName); 687 colorMap->DrawColorChart(); 559 colorMap->DrawColorChart(); >> 560 688 } 561 } 689 562 690 void G4ScoringCylinder::GetRZPhi(G4int index, << 563 void G4ScoringCylinder::GetRZPhi(G4int index, G4int q[3]) const { 691 { << 692 // index = k + j * k-size + i * jk-plane-siz 564 // index = k + j * k-size + i * jk-plane-size 693 565 694 // nested : z -> phi -> r 566 // nested : z -> phi -> r 695 G4int i = IZ; << 567 G4int i = IZ; 696 G4int j = IPHI; << 568 G4int j = IPHI; 697 G4int k = IR; << 569 G4int k = IR; 698 G4int jk = fNSegment[j] * fNSegment[k]; << 570 G4int jk = fNSegment[j]*fNSegment[k]; 699 q[i] = index / jk; << 571 q[i] = index/jk; 700 q[j] = (index - q[i] * jk) / fNSegment[k << 572 q[j] = (index - q[i]*jk)/fNSegment[k]; 701 q[k] = index - q[j] * fNSegment[k] - q[i << 573 q[k] = index - q[j]*fNSegment[k] - q[i]*jk; 702 } << 703 << 704 void G4ScoringCylinder::DumpVolumes() << 705 { << 706 G4int lvl = 2; << 707 DumpSolids(lvl); << 708 DumpLogVols(lvl); << 709 DumpPhysVols(lvl); << 710 } << 711 << 712 void G4ScoringCylinder::DumpSolids(G4int lvl) << 713 { << 714 G4cout << "*********** List of registered so << 715 auto store = G4SolidStore::GetInstance(); << 716 auto itr = store->begin(); << 717 for(; itr != store->end(); itr++) << 718 { << 719 switch(lvl) << 720 { << 721 case 0: << 722 G4cout << (*itr)->GetName() << G4endl; << 723 break; << 724 case 1: << 725 G4cout << (*itr)->GetName() << "\t vol << 726 << G4BestUnit((*itr)->GetCubicV << 727 << "\t surface = " << 728 << G4BestUnit((*itr)->GetSurfac << 729 break; << 730 default: << 731 (*itr)->DumpInfo(); << 732 break; << 733 } << 734 } << 735 } << 736 << 737 void G4ScoringCylinder::DumpLogVols(G4int lvl) << 738 { << 739 G4cout << "*********** List of registered lo << 740 << G4endl; << 741 auto store = G4LogicalVolumeStore::GetInstan << 742 auto itr = store->begin(); << 743 for(; itr != store->end(); itr++) << 744 { << 745 G4cout << (*itr)->GetName() << 746 << "\t Solid = " << (*itr)->GetSoli << 747 if((*itr)->GetMaterial() != nullptr) << 748 { << 749 G4cout << "\t Material = " << (*itr)->Ge << 750 } << 751 else << 752 { << 753 G4cout << "\t Material : not defined " < << 754 } << 755 if(lvl < 1) << 756 continue; << 757 G4cout << "\t region = "; << 758 if((*itr)->GetRegion() != nullptr) << 759 { << 760 G4cout << (*itr)->GetRegion()->GetName() << 761 } << 762 else << 763 { << 764 G4cout << "not defined"; << 765 } << 766 G4cout << "\t sensitive detector = "; << 767 if((*itr)->GetSensitiveDetector() != nullp << 768 { << 769 G4cout << (*itr)->GetSensitiveDetector() << 770 } << 771 else << 772 { << 773 G4cout << "not defined"; << 774 } << 775 G4cout << G4endl; << 776 G4cout << "\t daughters = " << (*itr)->Get << 777 if((*itr)->GetNoDaughters() > 0) << 778 { << 779 switch((*itr)->CharacteriseDaughters()) << 780 { << 781 case kNormal: << 782 G4cout << " (placement)"; << 783 break; << 784 case kReplica: << 785 G4cout << " (replica : " << (*itr)-> << 786 << ")"; << 787 break; << 788 case kParameterised: << 789 G4cout << " (parameterized : " << 790 << (*itr)->GetDaughter(0)->Ge << 791 break; << 792 default:; << 793 } << 794 } << 795 G4cout << G4endl; << 796 if(lvl < 2) << 797 continue; << 798 if((*itr)->GetMaterial() != nullptr) << 799 { << 800 G4cout << "\t weight = " << G4BestUnit(( << 801 << G4endl; << 802 } << 803 else << 804 { << 805 G4cout << "\t weight : not available" << << 806 } << 807 } << 808 } << 809 << 810 void G4ScoringCylinder::DumpPhysVols(G4int lvl << 811 { << 812 G4cout << "*********** List of registered ph << 813 << G4endl; << 814 auto store = G4PhysicalVolumeStore::GetInsta << 815 auto itr = store->begin(); << 816 for(; itr != store->end(); itr++) << 817 { << 818 switch(lvl) << 819 { << 820 case 0: << 821 G4cout << (*itr)->GetName() << G4endl; << 822 break; << 823 case 1: << 824 G4cout << (*itr)->GetName() << "\t log << 825 << (*itr)->GetLogicalVolume()-> << 826 << "\t mother logical = "; << 827 if((*itr)->GetMotherLogical() != nullp << 828 { << 829 G4cout << (*itr)->GetMotherLogical() << 830 } << 831 else << 832 { << 833 G4cout << "not defined"; << 834 } << 835 G4cout << G4endl; << 836 break; << 837 default: << 838 G4cout << (*itr)->GetName() << "\t log << 839 << (*itr)->GetLogicalVolume()-> << 840 << "\t mother logical = "; << 841 if((*itr)->GetMotherLogical() != nullp << 842 { << 843 G4cout << (*itr)->GetMotherLogical() << 844 } << 845 else << 846 { << 847 G4cout << "not defined"; << 848 } << 849 G4cout << "\t type = "; << 850 switch((*itr)->VolumeType()) << 851 { << 852 case kNormal: << 853 G4cout << "placement"; << 854 break; << 855 case kReplica: << 856 G4cout << "replica"; << 857 break; << 858 case kParameterised: << 859 G4cout << "parameterized"; << 860 break; << 861 default:; << 862 } << 863 G4cout << G4endl; << 864 } << 865 } << 866 } 574 } 867 575