Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ScoringBox.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// $Id$
28//
29
30#include "G4ScoringBox.hh"
31
32#include "G4SystemOfUnits.hh"
33#include "G4Box.hh"
34#include "G4LogicalVolume.hh"
35#include "G4VPhysicalVolume.hh"
36#include "G4PVPlacement.hh"
37#include "G4PVReplica.hh"
38#include "G4PVDivision.hh"
39#include "G4VisAttributes.hh"
40#include "G4VVisManager.hh"
41#include "G4VScoreColorMap.hh"
42
44#include "G4SDParticleFilter.hh"
45#include "G4VPrimitiveScorer.hh"
46
47#include "G4ScoringManager.hh"
48
49#include <map>
50#include <fstream>
51
53 :G4VScoringMesh(wName), fSegmentDirection(-1),
54 fMeshElementLogical(0)
55{
57 fDivisionAxisNames[0] = "X";
58 fDivisionAxisNames[1] = "Y";
59 fDivisionAxisNames[2] = "Z";
60}
61
63{
64}
65
67{
68 if(fConstructed) {
69
70 if(verboseLevel > 0)
71 G4cout << fWorldPhys->GetName() << " --- All quantities are reset." << G4endl;
72 ResetScore();
73
74 } else {
75 fConstructed = true;
76 SetupGeometry(fWorldPhys);
77 }
78}
79
80
81
82void G4ScoringBox::SetupGeometry(G4VPhysicalVolume * fWorldPhys) {
83
84 if(verboseLevel > 9) G4cout << "G4ScoringBox::SetupGeometry() ..." << G4endl;
85
86 // World
87 G4VPhysicalVolume * scoringWorld = fWorldPhys;
88 G4LogicalVolume * worldLogical = scoringWorld->GetLogicalVolume();
89
90 // Scoring Mesh
92 G4String boxName = fWorldName;
93
94 if(verboseLevel > 9) G4cout << fSize[0] << ", " << fSize[1] << ", " << fSize[2] << G4endl;
95 G4VSolid * boxSolid = new G4Box(boxName+"0", fSize[0], fSize[1], fSize[2]);
96 G4LogicalVolume * boxLogical = new G4LogicalVolume(boxSolid, 0, boxName);
98 boxLogical, boxName+"0", worldLogical, false, 0);
99
100 //G4double fsegment[3][3];
101 //G4int segOrder[3];
102 //GetSegmentOrder(fSegmentDirection, fNSegment, segOrder, fsegment);
103 //EAxis axis[3] = {kXAxis, kYAxis, kZAxis};
104
105 G4String layerName[2] = {boxName + "1", boxName + "2"};
106 G4VSolid * layerSolid[2];
107 G4LogicalVolume * layerLogical[2];
108
109 //-- fisrt nested layer (replicated to x direction)
110 if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
111 layerSolid[0] = new G4Box(layerName[0],
112 fSize[0]/fNSegment[0],
113 fSize[1],
114 fSize[2]);
115 layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]);
116 if(fNSegment[0] > 1) {
117 if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to x direction" << G4endl;
119 {
120 new G4PVReplica(layerName[0], layerLogical[0], boxLogical, kXAxis,
121 fNSegment[0], fSize[0]/fNSegment[0]*2.);
122 }
123 else
124 {
125 new G4PVDivision(layerName[0], layerLogical[0], boxLogical, kXAxis,
126 fNSegment[0], 0.);
127 }
128 } else if(fNSegment[0] == 1) {
129 if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
130 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0], boxLogical, false, 0);
131 } else
132 G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
133 << fNSegment[0] << ") "
134 << "in placement of the first nested layer." << G4endl;
135
136 if(verboseLevel > 9) {
137 G4cout << fSize[0]/fNSegment[0] << ", "
138 << fSize[1] << ", "
139 << fSize[2] << G4endl;
140 G4cout << layerName[0] << ": kXAxis, "
141 << fNSegment[0] << ", "
142 << 2.*fSize[0]/fNSegment[0] << G4endl;
143 }
144
145 // second nested layer (replicated to y direction)
146 if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl;
147 layerSolid[1] = new G4Box(layerName[1],
148 fSize[0]/fNSegment[0],
149 fSize[1]/fNSegment[1],
150 fSize[2]);
151 layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]);
152 if(fNSegment[1] > 1) {
153 if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to y direction" << G4endl;
155 {
156 new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
157 fNSegment[1], fSize[1]/fNSegment[1]*2.);
158 }
159 else
160 {
161 new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
162 fNSegment[1], 0.);
163 }
164 } else if(fNSegment[1] == 1) {
165 if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
166 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1], layerLogical[0], false, 0);
167 } else
168 G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
169 << fNSegment[1] << ") "
170 << "in placement of the second nested layer." << G4endl;
171
172 if(verboseLevel > 9) {
173 G4cout << fSize[0]/fNSegment[0] << ", "
174 << fSize[1]/fNSegment[1] << ", "
175 << fSize[2] << G4endl;
176 G4cout << layerName[1] << ": kYAxis, "
177 << fNSegment[1] << ", "
178 << 2.*fSize[1]/fNSegment[1] << G4endl;
179 }
180
181 // mesh elements (replicated to z direction)
182 if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl;
183 G4String elementName = boxName +"3";
184 G4VSolid * elementSolid = new G4Box(elementName,
185 fSize[0]/fNSegment[0],
186 fSize[1]/fNSegment[1],
187 fSize[2]/fNSegment[2]);
188 fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
189 if(fNSegment[2] > 1) {
190 if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
191
193 {
194 new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
195 fNSegment[2], 2.*fSize[2]/fNSegment[2]);
196 }
197 else
198 {
199 new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
200 fNSegment[2], 0.);
201 }
202 } else if(fNSegment[2] == 1) {
203 if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
204 new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, elementName, layerLogical[1], false, 0);
205 } else
206 G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : "
207 << "invalid parameter (" << fNSegment[2] << ") "
208 << "in mesh element placement." << G4endl;
209
210 if(verboseLevel > 9) {
211 G4cout << fSize[0]/fNSegment[0] << ", "
212 << fSize[1]/fNSegment[1] << ", "
213 << fSize[2]/fNSegment[2] << G4endl;
214 G4cout << elementName << ": kZAxis, "
215 << fNSegment[2] << ", "
216 << 2.*fSize[2]/fNSegment[2] << G4endl;
217 }
218
219
220 // set the sensitive detector
221 fMeshElementLogical->SetSensitiveDetector(fMFD);
222
223
224 // vis. attributes
225 G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
226 visatt->SetVisibility(false);
227 layerLogical[0]->SetVisAttributes(visatt);
228 layerLogical[1]->SetVisAttributes(visatt);
229 visatt->SetVisibility(true);
230 fMeshElementLogical->SetVisAttributes(visatt);
231}
232
233
234void G4ScoringBox::List() const {
235 G4cout << "G4ScoringBox : " << fWorldName << " --- Shape: Box mesh" << G4endl;
236 G4cout << " Size (x, y, z): ("
237 << fSize[0]/cm << ", "
238 << fSize[1]/cm << ", "
239 << fSize[2]/cm << ") [cm]"
240 << G4endl;
241
243}
244
245void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg) {
246
248 if(pVisManager) {
249
250 // cell vectors
251 std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z]
252 std::vector<double> ez;
253 for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.);
254 std::vector<std::vector<double> > eyz;
255 for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
256 for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
257
258 std::vector<std::vector<double> > xycell; // xycell[X][Y]
259 std::vector<double> ey;
260 for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
261 for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
262
263 std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
264 for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
265
266 std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
267 for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
268
269 // projections
270 G4int q[3];
271 std::map<G4int, G4double*>::iterator itr = map->begin();
272 for(; itr != map->end(); itr++) {
273 GetXYZ(itr->first, q);
274
275 xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
276 yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
277 xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
278 }
279
280 // search max. & min. values in each slice
281 G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
282 G4double xymax = 0., yzmax = 0., xzmax = 0.;
283 for(int x = 0; x < fNSegment[0]; x++) {
284 for(int y = 0; y < fNSegment[1]; y++) {
285 if(xymin > xycell[x][y]) xymin = xycell[x][y];
286 if(xymax < xycell[x][y]) xymax = xycell[x][y];
287 }
288 for(int z = 0; z < fNSegment[2]; z++) {
289 if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
290 if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
291 }
292 }
293 for(int y = 0; y < fNSegment[1]; y++) {
294 for(int z = 0; z < fNSegment[2]; z++) {
295 if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
296 if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
297 }
298 }
299
300
301 G4VisAttributes att;
302 att.SetForceSolid(true);
303 att.SetForceAuxEdgeVisible(true);
304
305 G4Scale3D scale;
306 if(axflg/100==1) {
307 // xy plane
308 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin ,xymax); }
309 G4ThreeVector zhalf(0., 0., fSize[2]/fNSegment[2]*0.98);
310 G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]*0.01);
311 for(int x = 0; x < fNSegment[0]; x++) {
312 for(int y = 0; y < fNSegment[1]; y++) {
313 G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf);
314 G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2]-1) + zhalf);
315 G4Transform3D trans, trans2;
316 if(fRotationMatrix) {
317 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
318 trans = G4Translate3D(fCenterPosition)*trans;
319 trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
320 trans2 = G4Translate3D(fCenterPosition)*trans2;
321 } else {
324 }
325 G4double c[4];
326 colorMap->GetMapColor(xycell[x][y], c);
327 att.SetColour(c[0], c[1], c[2]);//, c[3]);
328 pVisManager->Draw(xyplate, att, trans);
329 pVisManager->Draw(xyplate, att, trans2);
330
331 }
332 }
333 }
334 axflg = axflg%100;
335 if(axflg/10==1) {
336 // yz plane
337 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin, yzmax); }
338 G4ThreeVector xhalf(fSize[0]/fNSegment[0]*0.98, 0., 0.);
339 G4Box yzplate("yz", fSize[0]/fNSegment[0]*0.01, fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
340 for(int y = 0; y < fNSegment[1]; y++) {
341 for(int z = 0; z < fNSegment[2]; z++) {
342 G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf);
343 G4ThreeVector pos2(GetReplicaPosition(fNSegment[0]-1, y, z) + xhalf);
344 G4Transform3D trans, trans2;
345 if(fRotationMatrix) {
346 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
347 trans = G4Translate3D(fCenterPosition)*trans;
348 trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
349 trans2 = G4Translate3D(fCenterPosition)*trans2;
350 } else {
353 }
354 G4double c[4];
355 colorMap->GetMapColor(yzcell[y][z], c);
356 att.SetColour(c[0], c[1], c[2]);//, c[3]);
357 pVisManager->Draw(yzplate, att, trans);
358 pVisManager->Draw(yzplate, att, trans2);
359
360 }
361 }
362 }
363 axflg = axflg%10;
364 if(axflg==1) {
365 // xz plane
366 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax); }
367 G4ThreeVector yhalf(0., fSize[1]/fNSegment[1]*0.98, 0.);
368 G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1]*0.01, fSize[2]/fNSegment[2]);
369 for(int x = 0; x < fNSegment[0]; x++) {
370 for(int z = 0; z < fNSegment[2]; z++) {
371 G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf);
372 G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1]-1, z) + yhalf);
373 G4Transform3D trans, trans2;
374 if(fRotationMatrix) {
375 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
376 trans = G4Translate3D(fCenterPosition)*trans;
377 trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
378 trans2 = G4Translate3D(fCenterPosition)*trans2;
379 } else {
382 }
383 G4double c[4];
384 colorMap->GetMapColor(xzcell[x][z], c);
385 att.SetColour(c[0], c[1], c[2]);//, c[3]);
386 pVisManager->Draw(xzplate, att, trans);
387 pVisManager->Draw(xzplate, att, trans2);
388
389 }
390 }
391 }
392 }
393 colorMap->SetPSUnit(fDrawUnit);
394 colorMap->SetPSName(fDrawPSName);
395 colorMap->DrawColorChart();
396}
397
398G4ThreeVector G4ScoringBox::GetReplicaPosition(G4int x, G4int y, G4int z) {
399
400 G4ThreeVector width(fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
401 G4ThreeVector pos(-fSize[0] + 2*(x+0.5)*width.x(),
402 -fSize[1] + 2*(y+0.5)*width.y(),
403 -fSize[2] + 2*(z+0.5)*width.z());
404
405 return pos;
406}
407
408void G4ScoringBox::GetXYZ(G4int index, G4int q[3]) const {
409
410 q[0] = index/(fNSegment[2]*fNSegment[1]);
411 q[1] = (index - q[0]*fNSegment[2]*fNSegment[1])/fNSegment[2];
412 q[2] = index - q[1]*fNSegment[2] - q[0]*fNSegment[2]*fNSegment[1];
413
414}
415
416G4int G4ScoringBox::GetIndex(G4int x, G4int y, G4int z) const {
417 return x + y*fNSegment[0] + z*fNSegment[0]*fNSegment[1];
418}
419
420void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
421 G4int idxProj, G4int idxColumn)
422{
423 if(idxColumn<0 || idxColumn>=fNSegment[idxProj])
424 {
425 G4cerr << "ERROR : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[idxProj]-1 <<
426 "]. Method ignored." << G4endl;
427 return;
428 }
430 if(pVisManager) {
431
432 // cell vectors
433 std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z]
434 std::vector<double> ez;
435 for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.);
436 std::vector<std::vector<double> > eyz;
437 for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
438 for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
439
440 std::vector<std::vector<double> > xycell; // xycell[X][Y]
441 std::vector<double> ey;
442 for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
443 for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
444
445 std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
446 for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
447
448 std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
449 for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
450
451 // projections
452 G4int q[3];
453 std::map<G4int, G4double*>::iterator itr = map->begin();
454 for(; itr != map->end(); itr++) {
455 GetXYZ(itr->first, q);
456
457 if(idxProj == 0 && q[2] == idxColumn) { // xy plane
458 xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
459 }
460 if(idxProj == 1 && q[0] == idxColumn) { // yz plane
461 yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
462 }
463 if(idxProj == 2 && q[1] == idxColumn) { // zx plane
464 xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
465 }
466 }
467
468 // search max. & min. values in each slice
469 G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
470 G4double xymax = 0., yzmax = 0., xzmax = 0.;
471 for(int x = 0; x < fNSegment[0]; x++) {
472 for(int y = 0; y < fNSegment[1]; y++) {
473 if(xymin > xycell[x][y]) xymin = xycell[x][y];
474 if(xymax < xycell[x][y]) xymax = xycell[x][y];
475 }
476 for(int z = 0; z < fNSegment[2]; z++) {
477 if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
478 if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
479 }
480 }
481 for(int y = 0; y < fNSegment[1]; y++) {
482 for(int z = 0; z < fNSegment[2]; z++) {
483 if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
484 if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
485 }
486 }
487
488
489 G4VisAttributes att;
490 att.SetForceSolid(true);
491 att.SetForceAuxEdgeVisible(true);
492
493
494 G4Scale3D scale;
495 // xy plane
496 if(idxProj == 0) {
497 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin,xymax); }
498 G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
499 for(int x = 0; x < fNSegment[0]; x++) {
500 for(int y = 0; y < fNSegment[1]; y++) {
501 G4ThreeVector pos(GetReplicaPosition(x, y, idxColumn));
502 G4Transform3D trans;
503 if(fRotationMatrix) {
504 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
505 trans = G4Translate3D(fCenterPosition)*trans;
506 } else {
508 }
509 G4double c[4];
510 colorMap->GetMapColor(xycell[x][y], c);
511 att.SetColour(c[0], c[1], c[2]);//, c[3]);
512 pVisManager->Draw(xyplate, att, trans);
513
514 }
515 }
516 } else
517 // yz plane
518 if(idxProj == 1) {
519 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin,yzmax); }
520 G4Box yzplate("yz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
521 for(int y = 0; y < fNSegment[1]; y++) {
522 for(int z = 0; z < fNSegment[2]; z++) {
523 G4ThreeVector pos(GetReplicaPosition(idxColumn, y, z));
524 G4Transform3D trans;
525 if(fRotationMatrix) {
526 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
527 trans = G4Translate3D(fCenterPosition)*trans;
528 } else {
530 }
531 G4double c[4];
532 colorMap->GetMapColor(yzcell[y][z], c);
533 att.SetColour(c[0], c[1], c[2]);//, c[3]);
534 pVisManager->Draw(yzplate, att, trans);
535 }
536 }
537 } else
538 // xz plane
539 if(idxProj == 2) {
540 if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax);}
541 G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
542 for(int x = 0; x < fNSegment[0]; x++) {
543 for(int z = 0; z < fNSegment[2]; z++) {
544 G4ThreeVector pos(GetReplicaPosition(x, idxColumn, z));
545 G4Transform3D trans;
546 if(fRotationMatrix) {
547 trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
548 trans = G4Translate3D(fCenterPosition)*trans;
549 } else {
551 }
552 G4double c[4];
553 colorMap->GetMapColor(xzcell[x][z], c);
554 att.SetColour(c[0], c[1], c[2]);//, c[3]);
555 pVisManager->Draw(xzplate, att, trans);
556 }
557 }
558 }
559 }
560
561 colorMap->SetPSUnit(fDrawUnit);
562 colorMap->SetPSName(fDrawPSName);
563 colorMap->DrawColorChart();
564}
565
566
CLHEP::Hep3Vector G4ThreeVector
HepGeom::Translate3D G4Translate3D
HepGeom::Rotate3D G4Rotate3D
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
@ boxMesh
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
Definition: G4Box.hh:55
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
void Construct(G4VPhysicalVolume *fWorldPhys)
Definition: G4ScoringBox.cc:66
void Draw(std::map< G4int, G4double * > *map, G4VScoreColorMap *colorMap, G4int axflg=111)
void List() const
G4ScoringBox(G4String wName)
Definition: G4ScoringBox.cc:52
void DrawColumn(std::map< G4int, G4double * > *map, G4VScoreColorMap *colorMap, G4int idxProj, G4int idxColumn)
static G4int GetReplicaLevel()
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
virtual void DrawColorChart(G4int nPoint=5)
G4bool IfFloatMinMax() const
void SetMinMax(G4double minVal, G4double maxVal)
void SetPSUnit(G4String &unit)
virtual void GetMapColor(G4double val, G4double color[4])=0
void SetPSName(G4String &psName)
G4RotationMatrix * fRotationMatrix
virtual void List() const
G4double fDrawUnitValue
G4String fDrawPSName
G4MultiFunctionalDetector * fMFD
G4String fDivisionAxisNames[3]
G4double fSize[3]
G4ThreeVector fCenterPosition
static G4VVisManager * GetConcreteInstance()
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetForceAuxEdgeVisible(G4bool)
void SetVisibility(G4bool)
void SetColour(const G4Colour &)
void SetForceSolid(G4bool)
Transform3D inverse() const
Definition: Transform3D.cc:142
@ kYAxis
Definition: geomdefs.hh:54
@ kXAxis
Definition: geomdefs.hh:54
@ kZAxis
Definition: geomdefs.hh:54
#define DBL_MAX
Definition: templates.hh:83