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 // G4ScoringBox << 26 // 27 // ------------------------------------------- << 27 // $Id: G4ScoringBox.cc 74457 2013-10-07 15:21:35Z gcosmo $ >> 28 // 28 29 29 #include "G4ScoringBox.hh" 30 #include "G4ScoringBox.hh" 30 31 >> 32 #include "G4SystemOfUnits.hh" 31 #include "G4Box.hh" 33 #include "G4Box.hh" 32 #include "G4LogicalVolume.hh" 34 #include "G4LogicalVolume.hh" 33 #include "G4VPhysicalVolume.hh" 35 #include "G4VPhysicalVolume.hh" 34 #include "G4PVPlacement.hh" 36 #include "G4PVPlacement.hh" 35 #include "G4PVReplica.hh" 37 #include "G4PVReplica.hh" 36 #include "G4PVDivision.hh" 38 #include "G4PVDivision.hh" 37 #include "G4VisAttributes.hh" 39 #include "G4VisAttributes.hh" 38 #include "G4VVisManager.hh" 40 #include "G4VVisManager.hh" 39 #include "G4VScoreColorMap.hh" 41 #include "G4VScoreColorMap.hh" 40 42 41 #include "G4MultiFunctionalDetector.hh" 43 #include "G4MultiFunctionalDetector.hh" >> 44 #include "G4SDParticleFilter.hh" 42 #include "G4VPrimitiveScorer.hh" 45 #include "G4VPrimitiveScorer.hh" 43 #include "G4Polyhedron.hh" << 44 46 45 #include "G4ScoringManager.hh" 47 #include "G4ScoringManager.hh" 46 #include "G4StatDouble.hh" << 47 << 48 #include "G4SystemOfUnits.hh" << 49 48 50 #include <map> 49 #include <map> 51 #include <fstream> 50 #include <fstream> 52 51 53 G4ScoringBox::G4ScoringBox(const G4String& wNa << 52 G4ScoringBox::G4ScoringBox(G4String wName) 54 : G4VScoringMesh(wName) << 53 :G4VScoringMesh(wName), fSegmentDirection(-1) 55 , fSegmentDirection(-1) << 56 { 54 { 57 fShape = MeshShape::box; << 55 fShape = boxMesh; 58 fDivisionAxisNames[0] = "X"; 56 fDivisionAxisNames[0] = "X"; 59 fDivisionAxisNames[1] = "Y"; 57 fDivisionAxisNames[1] = "Y"; 60 fDivisionAxisNames[2] = "Z"; 58 fDivisionAxisNames[2] = "Z"; 61 } 59 } 62 60 63 void G4ScoringBox::SetupGeometry(G4VPhysicalVo << 61 G4ScoringBox::~G4ScoringBox() 64 { 62 { 65 if(verboseLevel > 9) << 63 } 66 G4cout << "G4ScoringBox::SetupGeometry() . << 67 64 68 // World << 65 void G4ScoringBox::Construct(G4VPhysicalVolume* fWorldPhys) 69 G4VPhysicalVolume* scoringWorld = fWorldPhys << 66 { 70 G4LogicalVolume* worldLogical = scoringWor << 67 if(fConstructed) { >> 68 >> 69 if(verboseLevel > 0) >> 70 G4cout << fWorldPhys->GetName() << " --- All quantities are reset." >> 71 << G4endl; >> 72 ResetScore(); >> 73 >> 74 } else { >> 75 fConstructed = true; >> 76 SetupGeometry(fWorldPhys); >> 77 } >> 78 } 71 79 >> 80 void G4ScoringBox::SetupGeometry(G4VPhysicalVolume * fWorldPhys) { >> 81 >> 82 if(verboseLevel > 9) G4cout << "G4ScoringBox::SetupGeometry() ..." << G4endl; >> 83 >> 84 // World >> 85 G4VPhysicalVolume * scoringWorld = fWorldPhys; >> 86 G4LogicalVolume * worldLogical = scoringWorld->GetLogicalVolume(); >> 87 72 // Scoring Mesh 88 // Scoring Mesh 73 if(verboseLevel > 9) << 89 if(verboseLevel > 9) G4cout << fWorldName << G4endl; 74 G4cout << fWorldName << G4endl; << 75 G4String boxName = fWorldName; 90 G4String boxName = fWorldName; 76 << 91 77 if(verboseLevel > 9) 92 if(verboseLevel > 9) 78 G4cout << fSize[0] << ", " << fSize[1] << 93 G4cout << fSize[0] << ", " << fSize[1] << ", " << fSize[2] << G4endl; 79 G4VSolid* boxSolid = new G4Box(boxName + "0" << 94 G4VSolid * boxSolid = new G4Box(boxName+"0", fSize[0], fSize[1], fSize[2]); 80 auto boxLogical = << 95 G4LogicalVolume * boxLogical = new G4LogicalVolume(boxSolid, 0, boxName+"_0"); 81 new G4LogicalVolume(boxSolid, nullptr, box << 96 new G4PVPlacement(fRotationMatrix, fCenterPosition, 82 new G4PVPlacement(fRotationMatrix, fCenterPo << 97 boxLogical, boxName+"0", worldLogical, false, 0); 83 worldLogical, false, 0); << 98 84 << 99 //G4double fsegment[3][3]; 85 G4String layerName[2] = { boxName + "_1", bo << 100 //G4int segOrder[3]; 86 G4VSolid* layerSolid[2]; << 101 //GetSegmentOrder(fSegmentDirection, fNSegment, segOrder, fsegment); 87 G4LogicalVolume* layerLogical[2]; << 102 //EAxis axis[3] = {kXAxis, kYAxis, kZAxis}; 88 << 103 >> 104 G4String layerName[2] = {boxName + "_1", boxName + "_2"}; >> 105 G4VSolid * layerSolid[2]; >> 106 G4LogicalVolume * layerLogical[2]; >> 107 89 //-- fisrt nested layer (replicated to x dir 108 //-- fisrt nested layer (replicated to x direction) 90 if(verboseLevel > 9) << 109 if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl; 91 G4cout << "layer 1 :" << G4endl; << 110 layerSolid[0] = new G4Box(layerName[0], 92 layerSolid[0] = << 111 fSize[0]/fNSegment[0], 93 new G4Box(layerName[0], fSize[0] / fNSegme << 112 fSize[1], 94 layerLogical[0] = new G4LogicalVolume(layerS << 113 fSize[2]); 95 if(fNSegment[0] > 1) << 114 layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]); 96 { << 115 if(fNSegment[0] > 1) { 97 if(verboseLevel > 9) 116 if(verboseLevel > 9) 98 G4cout << "G4ScoringBox::Construct() : R << 117 G4cout << "G4ScoringBox::Construct() : Replicate to x direction" << G4endl; 99 << G4endl; << 118 if(G4ScoringManager::GetReplicaLevel()>0) 100 if(G4ScoringManager::GetReplicaLevel() > 0 << 101 { 119 { 102 new G4PVReplica(layerName[0], layerLogic 120 new G4PVReplica(layerName[0], layerLogical[0], boxLogical, kXAxis, 103 fNSegment[0], fSize[0] / << 121 fNSegment[0], fSize[0]/fNSegment[0]*2.); 104 } 122 } 105 else 123 else 106 { 124 { 107 new G4PVDivision(layerName[0], layerLogi 125 new G4PVDivision(layerName[0], layerLogical[0], boxLogical, kXAxis, 108 fNSegment[0], 0.); 126 fNSegment[0], 0.); 109 } 127 } 110 } << 128 } else if(fNSegment[0] == 1) { 111 else if(fNSegment[0] == 1) << 112 { << 113 if(verboseLevel > 9) 129 if(verboseLevel > 9) 114 G4cout << "G4ScoringBox::Construct() : P 130 G4cout << "G4ScoringBox::Construct() : Placement" << G4endl; 115 new G4PVPlacement(nullptr, G4ThreeVector(0 << 131 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0], 116 layerName[0], boxLogical << 132 boxLogical, false, 0); 117 } << 133 } else 118 else << 119 G4cerr << "ERROR : G4ScoringBox::SetupGeom 134 G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter (" 120 << fNSegment[0] << ") " << 135 << fNSegment[0] << ") " 121 << "in placement of the first neste << 136 << "in placement of the first nested layer." << G4endl; 122 << 137 123 if(verboseLevel > 9) << 138 if(verboseLevel > 9) { 124 { << 139 G4cout << fSize[0]/fNSegment[0] << ", " 125 G4cout << fSize[0] / fNSegment[0] << ", " << 140 << fSize[1] << ", " 126 << G4endl; << 141 << fSize[2] << G4endl; 127 G4cout << layerName[0] << ": kXAxis, " << << 142 G4cout << layerName[0] << ": kXAxis, " 128 << 2. * fSize[0] / fNSegment[0] << << 143 << fNSegment[0] << ", " >> 144 << 2.*fSize[0]/fNSegment[0] << G4endl; 129 } 145 } 130 << 146 131 // second nested layer (replicated to y dire 147 // second nested layer (replicated to y direction) 132 if(verboseLevel > 9) << 148 if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl; 133 G4cout << "layer 2 :" << G4endl; << 149 layerSolid[1] = new G4Box(layerName[1], 134 layerSolid[1] = new G4Box(layerName[1], fS << 150 fSize[0]/fNSegment[0], 135 fSize[1] / fNSegme << 151 fSize[1]/fNSegment[1], 136 layerLogical[1] = new G4LogicalVolume(layerS << 152 fSize[2]); 137 if(fNSegment[1] > 1) << 153 layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]); 138 { << 154 if(fNSegment[1] > 1) { 139 if(verboseLevel > 9) 155 if(verboseLevel > 9) 140 G4cout << "G4ScoringBox::Construct() : R << 156 G4cout << "G4ScoringBox::Construct() : Replicate to y direction" << G4endl; 141 << G4endl; << 157 if(G4ScoringManager::GetReplicaLevel()>1) 142 if(G4ScoringManager::GetReplicaLevel() > 1 << 143 { 158 { 144 new G4PVReplica(layerName[1], layerLogic 159 new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kYAxis, 145 fNSegment[1], fSize[1] / << 160 fNSegment[1], fSize[1]/fNSegment[1]*2.); 146 } 161 } 147 else 162 else 148 { 163 { 149 new G4PVDivision(layerName[1], layerLogi 164 new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kYAxis, 150 fNSegment[1], 0.); 165 fNSegment[1], 0.); 151 } 166 } 152 } << 167 } else if(fNSegment[1] == 1) { 153 else if(fNSegment[1] == 1) << 154 { << 155 if(verboseLevel > 9) 168 if(verboseLevel > 9) 156 G4cout << "G4ScoringBox::Construct() : P 169 G4cout << "G4ScoringBox::Construct() : Placement" << G4endl; 157 new G4PVPlacement(nullptr, G4ThreeVector(0 << 170 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1], 158 layerName[1], layerLogic << 171 layerLogical[0], false, 0); 159 } << 172 } else 160 else << 161 G4cerr << "ERROR : G4ScoringBox::SetupGeom 173 G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter (" 162 << fNSegment[1] << ") " << 174 << fNSegment[1] << ") " 163 << "in placement of the second nest << 175 << "in placement of the second nested layer." << G4endl; 164 << 176 165 if(verboseLevel > 9) << 177 if(verboseLevel > 9) { 166 { << 178 G4cout << fSize[0]/fNSegment[0] << ", " 167 G4cout << fSize[0] / fNSegment[0] << ", " << 179 << fSize[1]/fNSegment[1] << ", " 168 << fSize[2] << G4endl; << 180 << fSize[2] << G4endl; 169 G4cout << layerName[1] << ": kYAxis, " << << 181 G4cout << layerName[1] << ": kYAxis, " 170 << 2. * fSize[1] / fNSegment[1] << << 182 << fNSegment[1] << ", " >> 183 << 2.*fSize[1]/fNSegment[1] << G4endl; 171 } 184 } 172 << 185 173 // mesh elements (replicated to z direction) 186 // mesh elements (replicated to z direction) 174 if(verboseLevel > 9) << 187 if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl; 175 G4cout << "mesh elements :" << G4endl; << 188 G4String elementName = boxName +"_3"; 176 G4String elementName = boxName + "_3"; << 189 G4VSolid * elementSolid = new G4Box(elementName, 177 G4VSolid* elementSolid = << 190 fSize[0]/fNSegment[0], 178 new G4Box(elementName, fSize[0] / fNSegmen << 191 fSize[1]/fNSegment[1], 179 fSize[2] / fNSegment[2]); << 192 fSize[2]/fNSegment[2]); 180 fMeshElementLogical = new G4LogicalVolume(el << 193 fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName); 181 if(fNSegment[2] > 1) << 194 if(fNSegment[2] > 1) { 182 { << 183 if(verboseLevel > 9) 195 if(verboseLevel > 9) 184 G4cout << "G4ScoringBox::Construct() : R << 196 G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl; 185 << G4endl; << 197 186 << 198 if(G4ScoringManager::GetReplicaLevel()>2) 187 if(G4ScoringManager::GetReplicaLevel() > 2 << 188 { 199 { 189 new G4PVReplica(elementName, fMeshElemen 200 new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis, 190 fNSegment[2], 2. * fSize << 201 fNSegment[2], 2.*fSize[2]/fNSegment[2]); 191 } 202 } 192 else 203 else 193 { 204 { 194 new G4PVDivision(elementName, fMeshEleme << 205 new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis, 195 kZAxis, fNSegment[2], 0 << 206 fNSegment[2], 0.); 196 } 207 } 197 } << 208 } else if(fNSegment[2] == 1) { 198 else if(fNSegment[2] == 1) << 199 { << 200 if(verboseLevel > 9) 209 if(verboseLevel > 9) 201 G4cout << "G4ScoringBox::Construct() : P 210 G4cout << "G4ScoringBox::Construct() : Placement" << G4endl; 202 new G4PVPlacement(nullptr, G4ThreeVector(0 << 211 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, 203 elementName, layerLogica 212 elementName, layerLogical[1], false, 0); 204 } << 213 } else 205 else << 206 G4cerr << "ERROR : G4ScoringBox::SetupGeom 214 G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : " 207 << "invalid parameter (" << fNSegme << 215 << "invalid parameter (" << fNSegment[2] << ") " 208 << "in mesh element placement." << << 216 << "in mesh element placement." << G4endl; 209 << 217 210 if(verboseLevel > 9) << 218 if(verboseLevel > 9) { 211 { << 219 G4cout << fSize[0]/fNSegment[0] << ", " 212 G4cout << fSize[0] / fNSegment[0] << ", " << 220 << fSize[1]/fNSegment[1] << ", " 213 << fSize[2] / fNSegment[2] << G4end << 221 << fSize[2]/fNSegment[2] << G4endl; 214 G4cout << elementName << ": kZAxis, " << f << 222 G4cout << elementName << ": kZAxis, " 215 << 2. * fSize[2] / fNSegment[2] << << 223 << fNSegment[2] << ", " >> 224 << 2.*fSize[2]/fNSegment[2] << G4endl; 216 } 225 } 217 << 226 >> 227 218 // set the sensitive detector 228 // set the sensitive detector 219 fMeshElementLogical->SetSensitiveDetector(fM 229 fMeshElementLogical->SetSensitiveDetector(fMFD); 220 << 230 >> 231 221 // vis. attributes 232 // vis. attributes 222 auto visatt = new G4VisAttributes(G4Colour( << 233 G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5)); 223 visatt->SetVisibility(false); 234 visatt->SetVisibility(false); 224 layerLogical[0]->SetVisAttributes(visatt); 235 layerLogical[0]->SetVisAttributes(visatt); 225 layerLogical[1]->SetVisAttributes(visatt); 236 layerLogical[1]->SetVisAttributes(visatt); 226 visatt->SetVisibility(true); 237 visatt->SetVisibility(true); 227 fMeshElementLogical->SetVisAttributes(visatt 238 fMeshElementLogical->SetVisAttributes(visatt); 228 } 239 } 229 240 230 void G4ScoringBox::List() const << 231 { << 232 G4cout << "G4ScoringBox : " << fWorldName << << 233 G4cout << " Size (x, y, z): (" << fSize[0] / << 234 << ", " << fSize[2] / cm << ") [cm]" << 235 241 >> 242 void G4ScoringBox::List() const { >> 243 G4cout << "G4ScoringBox : " << fWorldName << " --- Shape: Box mesh" << G4endl; >> 244 G4cout << " Size (x, y, z): (" >> 245 << fSize[0]/cm << ", " >> 246 << fSize[1]/cm << ", " >> 247 << fSize[2]/cm << ") [cm]" >> 248 << G4endl; >> 249 236 G4VScoringMesh::List(); 250 G4VScoringMesh::List(); 237 } 251 } 238 252 239 void G4ScoringBox::Draw(RunScore* map, G4VScor << 253 void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, 240 { << 254 G4VScoreColorMap* colorMap, G4int axflg) { 241 G4VVisManager* pVisManager = G4VVisManager:: << 255 242 if(pVisManager != nullptr) << 256 G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance(); 243 { << 257 if(pVisManager) { >> 258 244 // cell vectors 259 // cell vectors 245 std::vector<std::vector<std::vector<G4doub << 260 std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z] 246 std::vector<G4double> ez; << 261 std::vector<double> ez; 247 for(G4int z = 0; z < fNSegment[2]; z++) << 262 for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.); 248 ez.push_back(0.); << 263 std::vector<std::vector<double> > eyz; 249 std::vector<std::vector<G4double>> eyz; << 264 for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez); 250 for(G4int y = 0; y < fNSegment[1]; y++) << 265 for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz); 251 eyz.push_back(ez); << 266 252 for(G4int x = 0; x < fNSegment[0]; x++) << 267 std::vector<std::vector<double> > xycell; // xycell[X][Y] 253 cell.push_back(eyz); << 268 std::vector<double> ey; 254 << 269 for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.); 255 std::vector<std::vector<G4double>> xycell; << 270 for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey); 256 std::vector<G4double> ey; << 271 257 for(G4int y = 0; y < fNSegment[1]; y++) << 272 std::vector<std::vector<double> > yzcell; // yzcell[Y][Z] 258 ey.push_back(0.); << 273 for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez); 259 for(G4int x = 0; x < fNSegment[0]; x++) << 274 260 xycell.push_back(ey); << 275 std::vector<std::vector<double> > xzcell; // xzcell[X][Z] 261 << 276 for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez); 262 std::vector<std::vector<G4double>> yzcell; << 277 263 for(G4int y = 0; y < fNSegment[1]; y++) << 264 yzcell.push_back(ez); << 265 << 266 std::vector<std::vector<G4double>> xzcell; << 267 for(G4int x = 0; x < fNSegment[0]; x++) << 268 xzcell.push_back(ez); << 269 << 270 // projections 278 // projections 271 G4int q[3]; 279 G4int q[3]; 272 auto itr = map->GetMap()->begin(); << 280 std::map<G4int, G4double*>::iterator itr = map->begin(); 273 for(; itr != map->GetMap()->end(); itr++) << 281 for(; itr != map->end(); itr++) { 274 { << 275 GetXYZ(itr->first, q); 282 GetXYZ(itr->first, q); 276 << 283 277 xycell[q[0]][q[1]] += (itr->second->sum_ << 284 xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue; 278 yzcell[q[1]][q[2]] += (itr->second->sum_ << 285 yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue; 279 xzcell[q[0]][q[2]] += (itr->second->sum_ << 286 xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue; 280 } 287 } 281 << 288 282 // search max. & min. values in each slice 289 // search max. & min. values in each slice 283 G4double xymin = DBL_MAX, yzmin = DBL_MAX, 290 G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX; 284 G4double xymax = 0., yzmax = 0., xzmax = 0 291 G4double xymax = 0., yzmax = 0., xzmax = 0.; 285 for(G4int x = 0; x < fNSegment[0]; x++) << 292 for(int x = 0; x < fNSegment[0]; x++) { 286 { << 293 for(int y = 0; y < fNSegment[1]; y++) { 287 for(G4int y = 0; y < fNSegment[1]; y++) << 294 if(xymin > xycell[x][y]) xymin = xycell[x][y]; 288 { << 295 if(xymax < xycell[x][y]) xymax = xycell[x][y]; 289 if(xymin > xycell[x][y]) << 296 } 290 xymin = xycell[x][y]; << 297 for(int z = 0; z < fNSegment[2]; z++) { 291 if(xymax < xycell[x][y]) << 298 if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z]; 292 xymax = xycell[x][y]; << 299 if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z]; 293 } << 294 for(G4int z = 0; z < fNSegment[2]; z++) << 295 { << 296 if(xzmin > xzcell[x][z]) << 297 xzmin = xzcell[x][z]; << 298 if(xzmax < xzcell[x][z]) << 299 xzmax = xzcell[x][z]; << 300 } 300 } 301 } 301 } 302 for(G4int y = 0; y < fNSegment[1]; y++) << 302 for(int y = 0; y < fNSegment[1]; y++) { 303 { << 303 for(int z = 0; z < fNSegment[2]; z++) { 304 for(G4int z = 0; z < fNSegment[2]; z++) << 304 if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z]; 305 { << 305 if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z]; 306 if(yzmin > yzcell[y][z]) << 307 yzmin = yzcell[y][z]; << 308 if(yzmax < yzcell[y][z]) << 309 yzmax = yzcell[y][z]; << 310 } 306 } 311 } 307 } 312 << 308 >> 309 313 G4VisAttributes att; 310 G4VisAttributes att; 314 att.SetForceSolid(true); 311 att.SetForceSolid(true); 315 att.SetForceAuxEdgeVisible(true); 312 att.SetForceAuxEdgeVisible(true); 316 G4double thick = 0.01; << 313 317 << 318 G4Scale3D scale; 314 G4Scale3D scale; 319 if(axflg / 100 == 1) << 315 if(axflg/100==1) { 320 { << 321 pVisManager->BeginDraw(); << 322 << 323 // xy plane 316 // xy plane 324 if(colorMap->IfFloatMinMax()) << 317 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin ,xymax); } 325 { << 318 G4ThreeVector zhalf(0., 0., fSize[2]/fNSegment[2]*0.98); 326 colorMap->SetMinMax(xymin, xymax); << 319 G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 327 } << 320 fSize[2]/fNSegment[2]*0.01); 328 G4ThreeVector zhalf(0., 0., fSize[2] / f << 321 for(int x = 0; x < fNSegment[0]; x++) { 329 for(G4int x = 0; x < fNSegment[0]; x++) << 322 for(int y = 0; y < fNSegment[1]; y++) { 330 { << 331 for(G4int y = 0; y < fNSegment[1]; y++ << 332 { << 333 G4ThreeVector pos(GetReplicaPosition 323 G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf); 334 G4ThreeVector pos2(GetReplicaPositio << 324 G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2]-1) + zhalf); 335 zhalf); << 336 G4Transform3D trans, trans2; 325 G4Transform3D trans, trans2; 337 if(fRotationMatrix != nullptr) << 326 if(fRotationMatrix) { 338 { << 327 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos); 339 trans = G4Rotate3D(*fRotationMatri << 328 trans = G4Translate3D(fCenterPosition)*trans; 340 trans = G4Translate3D(fCenterPosit << 329 trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2); 341 trans2 = << 330 trans2 = G4Translate3D(fCenterPosition)*trans2; 342 G4Rotate3D(*fRotationMatrix).inv << 331 } else { 343 trans2 = G4Translate3D(fCenterPosi << 332 trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition); 344 } << 333 trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition); 345 else << 346 { << 347 trans = G4Translate3D(pos) * G4Tr << 348 trans2 = G4Translate3D(pos2) * G4T << 349 } 334 } 350 G4double c[4]; 335 G4double c[4]; 351 colorMap->GetMapColor(xycell[x][y], 336 colorMap->GetMapColor(xycell[x][y], c); 352 att.SetColour(c[0], c[1], c[2]); // << 337 att.SetColour(c[0], c[1], c[2]);//, c[3]); 353 << 338 pVisManager->Draw(xyplate, att, trans); 354 G4Box xyplate("xy", fSize[0] / fNSeg << 339 pVisManager->Draw(xyplate, att, trans2); 355 thick); << 340 356 G4Polyhedron* poly = xyplate.GetPoly << 357 poly->Transform(trans); << 358 poly->SetVisAttributes(&att); << 359 pVisManager->Draw(*poly); << 360 << 361 G4Box xyplate2 = xyplate; << 362 G4Polyhedron* poly2 = xyplate2.GetPo << 363 poly2->Transform(trans2); << 364 poly2->SetVisAttributes(&att); << 365 pVisManager->Draw(*poly2); << 366 } 341 } 367 } 342 } 368 pVisManager->EndDraw(); << 369 } 343 } 370 axflg = axflg % 100; << 344 axflg = axflg%100; 371 if(axflg / 10 == 1) << 345 if(axflg/10==1) { 372 { << 373 pVisManager->BeginDraw(); << 374 << 375 // yz plane 346 // yz plane 376 if(colorMap->IfFloatMinMax()) << 347 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin, yzmax); } 377 { << 348 G4ThreeVector xhalf(fSize[0]/fNSegment[0]*0.98, 0., 0.); 378 colorMap->SetMinMax(yzmin, yzmax); << 349 G4Box yzplate("yz", fSize[0]/fNSegment[0]*0.01, fSize[1]/fNSegment[1], 379 } << 350 fSize[2]/fNSegment[2]); 380 G4ThreeVector xhalf(fSize[0] / fNSegment << 351 for(int y = 0; y < fNSegment[1]; y++) { 381 for(G4int y = 0; y < fNSegment[1]; y++) << 352 for(int z = 0; z < fNSegment[2]; z++) { 382 { << 383 for(G4int z = 0; z < fNSegment[2]; z++ << 384 { << 385 G4ThreeVector pos(GetReplicaPosition 353 G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf); 386 G4ThreeVector pos2(GetReplicaPositio << 354 G4ThreeVector pos2(GetReplicaPosition(fNSegment[0]-1, y, z) + xhalf); 387 xhalf); << 388 G4Transform3D trans, trans2; 355 G4Transform3D trans, trans2; 389 if(fRotationMatrix != nullptr) << 356 if(fRotationMatrix) { 390 { << 357 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos); 391 trans = G4Rotate3D(*fRotationMatri << 358 trans = G4Translate3D(fCenterPosition)*trans; 392 trans = G4Translate3D(fCenterPosit << 359 trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2); 393 trans2 = << 360 trans2 = G4Translate3D(fCenterPosition)*trans2; 394 G4Rotate3D(*fRotationMatrix).inv << 361 } else { 395 trans2 = G4Translate3D(fCenterPosi << 362 trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition); 396 } << 363 trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition); 397 else << 398 { << 399 trans = G4Translate3D(pos) * G4Tr << 400 trans2 = G4Translate3D(pos2) * G4T << 401 } 364 } 402 G4double c[4]; 365 G4double c[4]; 403 colorMap->GetMapColor(yzcell[y][z], 366 colorMap->GetMapColor(yzcell[y][z], c); 404 att.SetColour(c[0], c[1], c[2]); // << 367 att.SetColour(c[0], c[1], c[2]);//, c[3]); 405 << 368 pVisManager->Draw(yzplate, att, trans); 406 G4Box yzplate("yz", thick, // fSize << 369 pVisManager->Draw(yzplate, att, trans2); 407 fSize[1] / fNSegment[1 << 370 408 G4Polyhedron* poly = yzplate.GetPoly << 409 poly->Transform(trans); << 410 poly->SetVisAttributes(&att); << 411 pVisManager->Draw(*poly); << 412 << 413 G4Box yzplate2 = yzplate; << 414 G4Polyhedron* poly2 = yzplate2.GetPo << 415 poly2->Transform(trans2); << 416 poly2->SetVisAttributes(&att); << 417 pVisManager->Draw(*poly2); << 418 } 371 } 419 } 372 } 420 pVisManager->EndDraw(); << 421 } 373 } 422 axflg = axflg % 10; << 374 axflg = axflg%10; 423 if(axflg == 1) << 375 if(axflg==1) { 424 { << 425 pVisManager->BeginDraw(); << 426 << 427 // xz plane 376 // xz plane 428 if(colorMap->IfFloatMinMax()) << 377 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax); } 429 { << 378 G4ThreeVector yhalf(0., fSize[1]/fNSegment[1]*0.98, 0.); 430 colorMap->SetMinMax(xzmin, xzmax); << 379 G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1]*0.01, 431 } << 380 fSize[2]/fNSegment[2]); 432 G4ThreeVector yhalf(0., fSize[1] / fNSeg << 381 for(int x = 0; x < fNSegment[0]; x++) { 433 for(G4int x = 0; x < fNSegment[0]; x++) << 382 for(int z = 0; z < fNSegment[2]; z++) { 434 { << 435 for(G4int z = 0; z < fNSegment[2]; z++ << 436 { << 437 G4ThreeVector pos(GetReplicaPosition 383 G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf); 438 G4ThreeVector pos2(GetReplicaPositio << 384 G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1]-1, z) + yhalf); 439 yhalf); << 440 G4Transform3D trans, trans2; 385 G4Transform3D trans, trans2; 441 if(fRotationMatrix != nullptr) << 386 if(fRotationMatrix) { 442 { << 387 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos); 443 trans = G4Rotate3D(*fRotationMatri << 388 trans = G4Translate3D(fCenterPosition)*trans; 444 trans = G4Translate3D(fCenterPosit << 389 trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2); 445 trans2 = << 390 trans2 = G4Translate3D(fCenterPosition)*trans2; 446 G4Rotate3D(*fRotationMatrix).inv << 391 } else { 447 trans2 = G4Translate3D(fCenterPosi << 392 trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition); 448 } << 393 trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition); 449 else << 450 { << 451 trans = G4Translate3D(pos) * G4Tr << 452 trans2 = G4Translate3D(pos2) * G4T << 453 } 394 } 454 G4double c[4]; 395 G4double c[4]; 455 colorMap->GetMapColor(xzcell[x][z], 396 colorMap->GetMapColor(xzcell[x][z], c); 456 att.SetColour(c[0], c[1], c[2]); // << 397 att.SetColour(c[0], c[1], c[2]);//, c[3]); 457 << 398 pVisManager->Draw(xzplate, att, trans); 458 G4Box xzplate("xz", fSize[0] / fNSeg << 399 pVisManager->Draw(xzplate, att, trans2); 459 thick, // fSize[1]/fN << 400 460 fSize[2] / fNSegment[2 << 461 G4Polyhedron* poly = xzplate.GetPoly << 462 poly->Transform(trans); << 463 poly->SetVisAttributes(&att); << 464 pVisManager->Draw(*poly); << 465 << 466 G4Box xzplate2 = xzplate; << 467 G4Polyhedron* poly2 = xzplate2.GetPo << 468 poly2->Transform(trans2); << 469 poly2->SetVisAttributes(&att); << 470 pVisManager->Draw(*poly2); << 471 } 401 } 472 } 402 } 473 pVisManager->EndDraw(); << 474 } 403 } 475 } 404 } 476 colorMap->SetPSUnit(fDrawUnit); 405 colorMap->SetPSUnit(fDrawUnit); 477 colorMap->SetPSName(fDrawPSName); 406 colorMap->SetPSName(fDrawPSName); 478 colorMap->DrawColorChart(); 407 colorMap->DrawColorChart(); 479 } 408 } 480 409 481 G4ThreeVector G4ScoringBox::GetReplicaPosition << 410 G4ThreeVector G4ScoringBox::GetReplicaPosition(G4int x, G4int y, G4int z) { 482 { << 411 483 G4ThreeVector width(fSize[0] / fNSegment[0], << 412 G4ThreeVector width(fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 484 fSize[2] / fNSegment[2]) << 413 fSize[2]/fNSegment[2]); 485 G4ThreeVector pos(-fSize[0] + 2 * (x + 0.5) << 414 G4ThreeVector pos(-fSize[0] + 2*(x+0.5)*width.x(), 486 -fSize[1] + 2 * (y + 0.5) << 415 -fSize[1] + 2*(y+0.5)*width.y(), 487 -fSize[2] + 2 * (z + 0.5) << 416 -fSize[2] + 2*(z+0.5)*width.z()); 488 << 417 489 return pos; 418 return pos; 490 } 419 } 491 420 492 void G4ScoringBox::GetXYZ(G4int index, G4int q << 421 void G4ScoringBox::GetXYZ(G4int index, G4int q[3]) const { 493 { << 422 494 q[0] = index / (fNSegment[2] * fNSegment[1]) << 423 q[0] = index/(fNSegment[2]*fNSegment[1]); 495 q[1] = (index - q[0] * fNSegment[2] * fNSegm << 424 q[1] = (index - q[0]*fNSegment[2]*fNSegment[1])/fNSegment[2]; 496 q[2] = index - q[1] * fNSegment[2] - q[0] * << 425 q[2] = index - q[1]*fNSegment[2] - q[0]*fNSegment[2]*fNSegment[1]; >> 426 497 } 427 } 498 428 499 G4int G4ScoringBox::GetIndex(G4int x, G4int y, << 429 G4int G4ScoringBox::GetIndex(G4int x, G4int y, G4int z) const { 500 { << 430 return x + y*fNSegment[0] + z*fNSegment[0]*fNSegment[1]; 501 return x + y * fNSegment[0] + z * fNSegment[ << 502 } 431 } 503 432 504 void G4ScoringBox::DrawColumn(RunScore* map, G << 433 void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, >> 434 G4VScoreColorMap* colorMap, 505 G4int idxProj, G 435 G4int idxProj, G4int idxColumn) 506 { 436 { 507 G4int iColumn[3] = { 2, 0, 1 }; << 437 G4int iColumn[3] = {2, 0, 1}; 508 if(idxColumn < 0 || idxColumn >= fNSegment[i << 438 if(idxColumn<0 || idxColumn>=fNSegment[iColumn[idxProj]]) 509 { 439 { 510 G4cerr << "ERROR : Column number " << idxC 440 G4cerr << "ERROR : Column number " << idxColumn 511 << " is out of scoring mesh [0," << << 441 << " is out of scoring mesh [0," << fNSegment[iColumn[idxProj]]-1 512 << "]. Method ignored." << G4endl; << 442 << "]. Method ignored." << G4endl; 513 return; 443 return; 514 } 444 } 515 G4VVisManager* pVisManager = G4VVisManager:: << 445 G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance(); 516 if(pVisManager != nullptr) << 446 if(pVisManager) { 517 { << 447 518 pVisManager->BeginDraw(); << 519 << 520 // cell vectors 448 // cell vectors 521 std::vector<std::vector<std::vector<G4doub << 449 std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z] 522 std::vector<G4double> ez; << 450 std::vector<double> ez; 523 for(G4int z = 0; z < fNSegment[2]; z++) << 451 for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.); 524 ez.push_back(0.); << 452 std::vector<std::vector<double> > eyz; 525 std::vector<std::vector<G4double>> eyz; << 453 for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez); 526 for(G4int y = 0; y < fNSegment[1]; y++) << 454 for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz); 527 eyz.push_back(ez); << 455 528 for(G4int x = 0; x < fNSegment[0]; x++) << 456 std::vector<std::vector<double> > xycell; // xycell[X][Y] 529 cell.push_back(eyz); << 457 std::vector<double> ey; 530 << 458 for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.); 531 std::vector<std::vector<G4double>> xycell; << 459 for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey); 532 std::vector<G4double> ey; << 460 533 for(G4int y = 0; y < fNSegment[1]; y++) << 461 std::vector<std::vector<double> > yzcell; // yzcell[Y][Z] 534 ey.push_back(0.); << 462 for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez); 535 for(G4int x = 0; x < fNSegment[0]; x++) << 463 536 xycell.push_back(ey); << 464 std::vector<std::vector<double> > xzcell; // xzcell[X][Z] 537 << 465 for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez); 538 std::vector<std::vector<G4double>> yzcell; << 466 539 for(G4int y = 0; y < fNSegment[1]; y++) << 540 yzcell.push_back(ez); << 541 << 542 std::vector<std::vector<G4double>> xzcell; << 543 for(G4int x = 0; x < fNSegment[0]; x++) << 544 xzcell.push_back(ez); << 545 << 546 // projections 467 // projections 547 G4int q[3]; 468 G4int q[3]; 548 auto itr = map->GetMap()->begin(); << 469 std::map<G4int, G4double*>::iterator itr = map->begin(); 549 for(; itr != map->GetMap()->end(); itr++) << 470 for(; itr != map->end(); itr++) { 550 { << 551 GetXYZ(itr->first, q); 471 GetXYZ(itr->first, q); 552 << 472 553 if(idxProj == 0 && q[2] == idxColumn) << 473 if(idxProj == 0 && q[2] == idxColumn) { // xy plane 554 { // xy plane << 474 xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue; 555 xycell[q[0]][q[1]] += (itr->second->su << 475 } 556 } << 476 if(idxProj == 1 && q[0] == idxColumn) { // yz plane 557 if(idxProj == 1 && q[0] == idxColumn) << 477 yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue; 558 { // yz plane << 478 } 559 yzcell[q[1]][q[2]] += (itr->second->su << 479 if(idxProj == 2 && q[1] == idxColumn) { // zx plane 560 } << 480 xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue; 561 if(idxProj == 2 && q[1] == idxColumn) << 562 { // zx plane << 563 xzcell[q[0]][q[2]] += (itr->second->su << 564 } 481 } 565 } 482 } 566 << 483 567 // search max. & min. values in each slice 484 // search max. & min. values in each slice 568 G4double xymin = DBL_MAX, yzmin = DBL_MAX, 485 G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX; 569 G4double xymax = 0., yzmax = 0., xzmax = 0 486 G4double xymax = 0., yzmax = 0., xzmax = 0.; 570 for(G4int x = 0; x < fNSegment[0]; x++) << 487 for(int x = 0; x < fNSegment[0]; x++) { 571 { << 488 for(int y = 0; y < fNSegment[1]; y++) { 572 for(G4int y = 0; y < fNSegment[1]; y++) << 489 if(xymin > xycell[x][y]) xymin = xycell[x][y]; 573 { << 490 if(xymax < xycell[x][y]) xymax = xycell[x][y]; 574 if(xymin > xycell[x][y]) << 491 } 575 xymin = xycell[x][y]; << 492 for(int z = 0; z < fNSegment[2]; z++) { 576 if(xymax < xycell[x][y]) << 493 if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z]; 577 xymax = xycell[x][y]; << 494 if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z]; 578 } << 579 for(G4int z = 0; z < fNSegment[2]; z++) << 580 { << 581 if(xzmin > xzcell[x][z]) << 582 xzmin = xzcell[x][z]; << 583 if(xzmax < xzcell[x][z]) << 584 xzmax = xzcell[x][z]; << 585 } 495 } 586 } 496 } 587 for(G4int y = 0; y < fNSegment[1]; y++) << 497 for(int y = 0; y < fNSegment[1]; y++) { 588 { << 498 for(int z = 0; z < fNSegment[2]; z++) { 589 for(G4int z = 0; z < fNSegment[2]; z++) << 499 if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z]; 590 { << 500 if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z]; 591 if(yzmin > yzcell[y][z]) << 592 yzmin = yzcell[y][z]; << 593 if(yzmax < yzcell[y][z]) << 594 yzmax = yzcell[y][z]; << 595 } 501 } 596 } 502 } 597 << 503 >> 504 598 G4VisAttributes att; 505 G4VisAttributes att; 599 att.SetForceSolid(true); 506 att.SetForceSolid(true); 600 att.SetForceAuxEdgeVisible(true); 507 att.SetForceAuxEdgeVisible(true); 601 << 508 >> 509 602 G4Scale3D scale; 510 G4Scale3D scale; 603 // xy plane 511 // xy plane 604 if(idxProj == 0) << 512 if(idxProj == 0) { 605 { << 513 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin,xymax); } 606 if(colorMap->IfFloatMinMax()) << 514 G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 607 { << 515 fSize[2]/fNSegment[2]); 608 colorMap->SetMinMax(xymin, xymax); << 516 for(int x = 0; x < fNSegment[0]; x++) { 609 } << 517 for(int y = 0; y < fNSegment[1]; y++) { 610 for(G4int x = 0; x < fNSegment[0]; x++) << 611 { << 612 for(G4int y = 0; y < fNSegment[1]; y++ << 613 { << 614 G4Box xyplate("xy", fSize[0] / fNSeg << 615 fSize[2] / fNSegment[2 << 616 << 617 G4ThreeVector pos(GetReplicaPosition 518 G4ThreeVector pos(GetReplicaPosition(x, y, idxColumn)); 618 G4Transform3D trans; 519 G4Transform3D trans; 619 if(fRotationMatrix != nullptr) << 520 if(fRotationMatrix) { 620 { << 521 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos); 621 trans = G4Rotate3D(*fRotationMatri << 522 trans = G4Translate3D(fCenterPosition)*trans; 622 trans = G4Translate3D(fCenterPosit << 523 } else { 623 } << 524 trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition); 624 else << 625 { << 626 trans = G4Translate3D(pos) * G4Tra << 627 } 525 } 628 G4double c[4]; 526 G4double c[4]; 629 colorMap->GetMapColor(xycell[x][y], 527 colorMap->GetMapColor(xycell[x][y], c); 630 att.SetColour(c[0], c[1], c[2]); << 528 att.SetColour(c[0], c[1], c[2]);//, c[3]); 631 << 529 pVisManager->Draw(xyplate, att, trans); 632 G4Polyhedron* poly = xyplate.GetPoly << 530 633 poly->Transform(trans); << 634 poly->SetVisAttributes(att); << 635 pVisManager->Draw(*poly); << 636 } 531 } 637 } 532 } 638 } << 533 } else 639 else << 640 // yz plane 534 // yz plane 641 if(idxProj == 1) << 535 if(idxProj == 1) { 642 { << 536 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin,yzmax); } 643 if(colorMap->IfFloatMinMax()) << 537 G4Box yzplate("yz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 644 { << 538 fSize[2]/fNSegment[2]); 645 colorMap->SetMinMax(yzmin, yzmax); << 539 for(int y = 0; y < fNSegment[1]; y++) { 646 } << 540 for(int z = 0; z < fNSegment[2]; z++) { 647 for(G4int y = 0; y < fNSegment[1]; y++) << 541 G4ThreeVector pos(GetReplicaPosition(idxColumn, y, z)); 648 { << 542 G4Transform3D trans; 649 for(G4int z = 0; z < fNSegment[2]; z++ << 543 if(fRotationMatrix) { 650 { << 544 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos); 651 G4Box yzplate("yz", fSize[0] / fNSeg << 545 trans = G4Translate3D(fCenterPosition)*trans; 652 fSize[2] / fNSegment[2 << 546 } else { 653 << 547 trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition); 654 G4ThreeVector pos(GetReplicaPosition << 548 } 655 G4Transform3D trans; << 549 G4double c[4]; 656 if(fRotationMatrix != nullptr) << 550 colorMap->GetMapColor(yzcell[y][z], c); 657 { << 551 att.SetColour(c[0], c[1], c[2]);//, c[3]); 658 trans = G4Rotate3D(*fRotationMatri << 552 pVisManager->Draw(yzplate, att, trans); 659 trans = G4Translate3D(fCenterPosit << 660 } << 661 else << 662 { << 663 trans = G4Translate3D(pos) * G4Tra << 664 } 553 } 665 G4double c[4]; << 666 colorMap->GetMapColor(yzcell[y][z], << 667 att.SetColour(c[0], c[1], c[2]); // << 668 << 669 G4Polyhedron* poly = yzplate.GetPoly << 670 poly->Transform(trans); << 671 poly->SetVisAttributes(att); << 672 pVisManager->Draw(*poly); << 673 } 554 } 674 } << 555 } else 675 } << 556 // xz plane 676 else << 557 if(idxProj == 2) { 677 // xz plane << 558 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax);} 678 if(idxProj == 2) << 559 G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 679 { << 560 fSize[2]/fNSegment[2]); 680 if(colorMap->IfFloatMinMax()) << 561 for(int x = 0; x < fNSegment[0]; x++) { 681 { << 562 for(int z = 0; z < fNSegment[2]; z++) { 682 colorMap->SetMinMax(xzmin, xzmax); << 563 G4ThreeVector pos(GetReplicaPosition(x, idxColumn, z)); 683 } << 564 G4Transform3D trans; 684 for(G4int x = 0; x < fNSegment[0]; x++) << 565 if(fRotationMatrix) { 685 { << 566 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos); 686 for(G4int z = 0; z < fNSegment[2]; z++ << 567 trans = G4Translate3D(fCenterPosition)*trans; 687 { << 568 } else { 688 G4Box xzplate("xz", fSize[0] / fNSeg << 569 trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition); 689 fSize[2] / fNSegment[2 << 570 } 690 << 571 G4double c[4]; 691 G4ThreeVector pos(GetReplicaPosition << 572 colorMap->GetMapColor(xzcell[x][z], c); 692 G4Transform3D trans; << 573 att.SetColour(c[0], c[1], c[2]);//, c[3]); 693 if(fRotationMatrix != nullptr) << 574 pVisManager->Draw(xzplate, att, trans); 694 { << 575 } 695 trans = G4Rotate3D(*fRotationMatri << 696 trans = G4Translate3D(fCenterPosit << 697 } << 698 else << 699 { << 700 trans = G4Translate3D(pos) * G4Tra << 701 } 576 } 702 G4double c[4]; << 703 colorMap->GetMapColor(xzcell[x][z], << 704 att.SetColour(c[0], c[1], c[2]); // << 705 << 706 G4Polyhedron* poly = xzplate.GetPoly << 707 poly->Transform(trans); << 708 poly->SetVisAttributes(att); << 709 pVisManager->Draw(*poly); << 710 } 577 } 711 } << 712 } << 713 pVisManager->EndDraw(); << 714 } 578 } 715 << 579 716 colorMap->SetPSUnit(fDrawUnit); 580 colorMap->SetPSUnit(fDrawUnit); 717 colorMap->SetPSName(fDrawPSName); 581 colorMap->SetPSName(fDrawPSName); 718 colorMap->DrawColorChart(); 582 colorMap->DrawColorChart(); 719 } 583 } >> 584 >> 585 720 586