Geant4_10
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: G4ScoringBox.cc 74457 2013-10-07 15:21:35Z gcosmo $
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 {
55  fShape = boxMesh;
56  fDivisionAxisNames[0] = "X";
57  fDivisionAxisNames[1] = "Y";
58  fDivisionAxisNames[2] = "Z";
59 }
60 
62 {
63 }
64 
66 {
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 }
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 
88  // Scoring Mesh
89  if(verboseLevel > 9) G4cout << fWorldName << G4endl;
90  G4String boxName = fWorldName;
91 
92  if(verboseLevel > 9)
93  G4cout << fSize[0] << ", " << fSize[1] << ", " << fSize[2] << G4endl;
94  G4VSolid * boxSolid = new G4Box(boxName+"0", fSize[0], fSize[1], fSize[2]);
95  G4LogicalVolume * boxLogical = new G4LogicalVolume(boxSolid, 0, boxName+"_0");
97  boxLogical, boxName+"0", worldLogical, false, 0);
98 
99  //G4double fsegment[3][3];
100  //G4int segOrder[3];
101  //GetSegmentOrder(fSegmentDirection, fNSegment, segOrder, fsegment);
102  //EAxis axis[3] = {kXAxis, kYAxis, kZAxis};
103 
104  G4String layerName[2] = {boxName + "_1", boxName + "_2"};
105  G4VSolid * layerSolid[2];
106  G4LogicalVolume * layerLogical[2];
107 
108  //-- fisrt nested layer (replicated to x direction)
109  if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
110  layerSolid[0] = new G4Box(layerName[0],
111  fSize[0]/fNSegment[0],
112  fSize[1],
113  fSize[2]);
114  layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]);
115  if(fNSegment[0] > 1) {
116  if(verboseLevel > 9)
117  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)
130  G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
131  new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0],
132  boxLogical, false, 0);
133  } else
134  G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
135  << fNSegment[0] << ") "
136  << "in placement of the first nested layer." << G4endl;
137 
138  if(verboseLevel > 9) {
139  G4cout << fSize[0]/fNSegment[0] << ", "
140  << fSize[1] << ", "
141  << fSize[2] << G4endl;
142  G4cout << layerName[0] << ": kXAxis, "
143  << fNSegment[0] << ", "
144  << 2.*fSize[0]/fNSegment[0] << G4endl;
145  }
146 
147  // second nested layer (replicated to y direction)
148  if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl;
149  layerSolid[1] = new G4Box(layerName[1],
150  fSize[0]/fNSegment[0],
151  fSize[1]/fNSegment[1],
152  fSize[2]);
153  layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]);
154  if(fNSegment[1] > 1) {
155  if(verboseLevel > 9)
156  G4cout << "G4ScoringBox::Construct() : Replicate to y direction" << G4endl;
158  {
159  new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
160  fNSegment[1], fSize[1]/fNSegment[1]*2.);
161  }
162  else
163  {
164  new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
165  fNSegment[1], 0.);
166  }
167  } else if(fNSegment[1] == 1) {
168  if(verboseLevel > 9)
169  G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
170  new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1],
171  layerLogical[0], false, 0);
172  } else
173  G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
174  << fNSegment[1] << ") "
175  << "in placement of the second nested layer." << G4endl;
176 
177  if(verboseLevel > 9) {
178  G4cout << fSize[0]/fNSegment[0] << ", "
179  << fSize[1]/fNSegment[1] << ", "
180  << fSize[2] << G4endl;
181  G4cout << layerName[1] << ": kYAxis, "
182  << fNSegment[1] << ", "
183  << 2.*fSize[1]/fNSegment[1] << G4endl;
184  }
185 
186  // mesh elements (replicated to z direction)
187  if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl;
188  G4String elementName = boxName +"_3";
189  G4VSolid * elementSolid = new G4Box(elementName,
190  fSize[0]/fNSegment[0],
191  fSize[1]/fNSegment[1],
192  fSize[2]/fNSegment[2]);
193  fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
194  if(fNSegment[2] > 1) {
195  if(verboseLevel > 9)
196  G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
197 
199  {
200  new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
201  fNSegment[2], 2.*fSize[2]/fNSegment[2]);
202  }
203  else
204  {
205  new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
206  fNSegment[2], 0.);
207  }
208  } else if(fNSegment[2] == 1) {
209  if(verboseLevel > 9)
210  G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
212  elementName, layerLogical[1], false, 0);
213  } else
214  G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : "
215  << "invalid parameter (" << fNSegment[2] << ") "
216  << "in mesh element placement." << G4endl;
217 
218  if(verboseLevel > 9) {
219  G4cout << fSize[0]/fNSegment[0] << ", "
220  << fSize[1]/fNSegment[1] << ", "
221  << fSize[2]/fNSegment[2] << G4endl;
222  G4cout << elementName << ": kZAxis, "
223  << fNSegment[2] << ", "
224  << 2.*fSize[2]/fNSegment[2] << G4endl;
225  }
226 
227 
228  // set the sensitive detector
230 
231 
232  // vis. attributes
233  G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
234  visatt->SetVisibility(false);
235  layerLogical[0]->SetVisAttributes(visatt);
236  layerLogical[1]->SetVisAttributes(visatt);
237  visatt->SetVisibility(true);
239 }
240 
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 
251 }
252 
253 void G4ScoringBox::Draw(std::map<G4int, G4double*> * map,
254  G4VScoreColorMap* colorMap, G4int axflg) {
255 
257  if(pVisManager) {
258 
259  // cell vectors
260  std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z]
261  std::vector<double> ez;
262  for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.);
263  std::vector<std::vector<double> > eyz;
264  for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
265  for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
266 
267  std::vector<std::vector<double> > xycell; // xycell[X][Y]
268  std::vector<double> ey;
269  for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
270  for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
271 
272  std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
273  for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
274 
275  std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
276  for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
277 
278  // projections
279  G4int q[3];
280  std::map<G4int, G4double*>::iterator itr = map->begin();
281  for(; itr != map->end(); itr++) {
282  GetXYZ(itr->first, q);
283 
284  xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
285  yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
286  xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
287  }
288 
289  // search max. & min. values in each slice
290  G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
291  G4double xymax = 0., yzmax = 0., xzmax = 0.;
292  for(int x = 0; x < fNSegment[0]; x++) {
293  for(int y = 0; y < fNSegment[1]; y++) {
294  if(xymin > xycell[x][y]) xymin = xycell[x][y];
295  if(xymax < xycell[x][y]) xymax = xycell[x][y];
296  }
297  for(int z = 0; z < fNSegment[2]; z++) {
298  if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
299  if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
300  }
301  }
302  for(int y = 0; y < fNSegment[1]; y++) {
303  for(int z = 0; z < fNSegment[2]; z++) {
304  if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
305  if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
306  }
307  }
308 
309 
310  G4VisAttributes att;
311  att.SetForceSolid(true);
312  att.SetForceAuxEdgeVisible(true);
313 
315  if(axflg/100==1) {
316  // xy plane
317  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin ,xymax); }
318  G4ThreeVector zhalf(0., 0., fSize[2]/fNSegment[2]*0.98);
319  G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
320  fSize[2]/fNSegment[2]*0.01);
321  for(int x = 0; x < fNSegment[0]; x++) {
322  for(int y = 0; y < fNSegment[1]; y++) {
323  G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf);
324  G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2]-1) + zhalf);
325  G4Transform3D trans, trans2;
326  if(fRotationMatrix) {
327  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
328  trans = G4Translate3D(fCenterPosition)*trans;
329  trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
330  trans2 = G4Translate3D(fCenterPosition)*trans2;
331  } else {
334  }
335  G4double c[4];
336  colorMap->GetMapColor(xycell[x][y], c);
337  att.SetColour(c[0], c[1], c[2]);//, c[3]);
338  pVisManager->Draw(xyplate, att, trans);
339  pVisManager->Draw(xyplate, att, trans2);
340 
341  }
342  }
343  }
344  axflg = axflg%100;
345  if(axflg/10==1) {
346  // yz plane
347  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin, yzmax); }
348  G4ThreeVector xhalf(fSize[0]/fNSegment[0]*0.98, 0., 0.);
349  G4Box yzplate("yz", fSize[0]/fNSegment[0]*0.01, fSize[1]/fNSegment[1],
350  fSize[2]/fNSegment[2]);
351  for(int y = 0; y < fNSegment[1]; y++) {
352  for(int z = 0; z < fNSegment[2]; z++) {
353  G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf);
354  G4ThreeVector pos2(GetReplicaPosition(fNSegment[0]-1, y, z) + xhalf);
355  G4Transform3D trans, trans2;
356  if(fRotationMatrix) {
357  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
358  trans = G4Translate3D(fCenterPosition)*trans;
359  trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
360  trans2 = G4Translate3D(fCenterPosition)*trans2;
361  } else {
364  }
365  G4double c[4];
366  colorMap->GetMapColor(yzcell[y][z], c);
367  att.SetColour(c[0], c[1], c[2]);//, c[3]);
368  pVisManager->Draw(yzplate, att, trans);
369  pVisManager->Draw(yzplate, att, trans2);
370 
371  }
372  }
373  }
374  axflg = axflg%10;
375  if(axflg==1) {
376  // xz plane
377  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax); }
378  G4ThreeVector yhalf(0., fSize[1]/fNSegment[1]*0.98, 0.);
379  G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1]*0.01,
380  fSize[2]/fNSegment[2]);
381  for(int x = 0; x < fNSegment[0]; x++) {
382  for(int z = 0; z < fNSegment[2]; z++) {
383  G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf);
384  G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1]-1, z) + yhalf);
385  G4Transform3D trans, trans2;
386  if(fRotationMatrix) {
387  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
388  trans = G4Translate3D(fCenterPosition)*trans;
389  trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
390  trans2 = G4Translate3D(fCenterPosition)*trans2;
391  } else {
394  }
395  G4double c[4];
396  colorMap->GetMapColor(xzcell[x][z], c);
397  att.SetColour(c[0], c[1], c[2]);//, c[3]);
398  pVisManager->Draw(xzplate, att, trans);
399  pVisManager->Draw(xzplate, att, trans2);
400 
401  }
402  }
403  }
404  }
405  colorMap->SetPSUnit(fDrawUnit);
406  colorMap->SetPSName(fDrawPSName);
407  colorMap->DrawColorChart();
408 }
409 
410 G4ThreeVector G4ScoringBox::GetReplicaPosition(G4int x, G4int y, G4int z) {
411 
413  fSize[2]/fNSegment[2]);
414  G4ThreeVector pos(-fSize[0] + 2*(x+0.5)*width.x(),
415  -fSize[1] + 2*(y+0.5)*width.y(),
416  -fSize[2] + 2*(z+0.5)*width.z());
417 
418  return pos;
419 }
420 
421 void G4ScoringBox::GetXYZ(G4int index, G4int q[3]) const {
422 
423  q[0] = index/(fNSegment[2]*fNSegment[1]);
424  q[1] = (index - q[0]*fNSegment[2]*fNSegment[1])/fNSegment[2];
425  q[2] = index - q[1]*fNSegment[2] - q[0]*fNSegment[2]*fNSegment[1];
426 
427 }
428 
429 G4int G4ScoringBox::GetIndex(G4int x, G4int y, G4int z) const {
430  return x + y*fNSegment[0] + z*fNSegment[0]*fNSegment[1];
431 }
432 
433 void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map,
434  G4VScoreColorMap* colorMap,
435  G4int idxProj, G4int idxColumn)
436 {
437  G4int iColumn[3] = {2, 0, 1};
438  if(idxColumn<0 || idxColumn>=fNSegment[iColumn[idxProj]])
439  {
440  G4cerr << "ERROR : Column number " << idxColumn
441  << " is out of scoring mesh [0," << fNSegment[iColumn[idxProj]]-1
442  << "]. Method ignored." << G4endl;
443  return;
444  }
446  if(pVisManager) {
447 
448  // cell vectors
449  std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z]
450  std::vector<double> ez;
451  for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.);
452  std::vector<std::vector<double> > eyz;
453  for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
454  for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
455 
456  std::vector<std::vector<double> > xycell; // xycell[X][Y]
457  std::vector<double> ey;
458  for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
459  for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
460 
461  std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
462  for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
463 
464  std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
465  for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
466 
467  // projections
468  G4int q[3];
469  std::map<G4int, G4double*>::iterator itr = map->begin();
470  for(; itr != map->end(); itr++) {
471  GetXYZ(itr->first, q);
472 
473  if(idxProj == 0 && q[2] == idxColumn) { // xy plane
474  xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
475  }
476  if(idxProj == 1 && q[0] == idxColumn) { // yz plane
477  yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
478  }
479  if(idxProj == 2 && q[1] == idxColumn) { // zx plane
480  xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
481  }
482  }
483 
484  // search max. & min. values in each slice
485  G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
486  G4double xymax = 0., yzmax = 0., xzmax = 0.;
487  for(int x = 0; x < fNSegment[0]; x++) {
488  for(int y = 0; y < fNSegment[1]; y++) {
489  if(xymin > xycell[x][y]) xymin = xycell[x][y];
490  if(xymax < xycell[x][y]) xymax = xycell[x][y];
491  }
492  for(int z = 0; z < fNSegment[2]; z++) {
493  if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
494  if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
495  }
496  }
497  for(int y = 0; y < fNSegment[1]; y++) {
498  for(int z = 0; z < fNSegment[2]; z++) {
499  if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
500  if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
501  }
502  }
503 
504 
505  G4VisAttributes att;
506  att.SetForceSolid(true);
507  att.SetForceAuxEdgeVisible(true);
508 
509 
511  // xy plane
512  if(idxProj == 0) {
513  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin,xymax); }
514  G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
515  fSize[2]/fNSegment[2]);
516  for(int x = 0; x < fNSegment[0]; x++) {
517  for(int y = 0; y < fNSegment[1]; y++) {
518  G4ThreeVector pos(GetReplicaPosition(x, y, idxColumn));
519  G4Transform3D trans;
520  if(fRotationMatrix) {
521  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
522  trans = G4Translate3D(fCenterPosition)*trans;
523  } else {
525  }
526  G4double c[4];
527  colorMap->GetMapColor(xycell[x][y], c);
528  att.SetColour(c[0], c[1], c[2]);//, c[3]);
529  pVisManager->Draw(xyplate, att, trans);
530 
531  }
532  }
533  } else
534  // yz plane
535  if(idxProj == 1) {
536  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin,yzmax); }
537  G4Box yzplate("yz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
538  fSize[2]/fNSegment[2]);
539  for(int y = 0; y < fNSegment[1]; y++) {
540  for(int z = 0; z < fNSegment[2]; z++) {
541  G4ThreeVector pos(GetReplicaPosition(idxColumn, y, z));
542  G4Transform3D trans;
543  if(fRotationMatrix) {
544  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
545  trans = G4Translate3D(fCenterPosition)*trans;
546  } else {
548  }
549  G4double c[4];
550  colorMap->GetMapColor(yzcell[y][z], c);
551  att.SetColour(c[0], c[1], c[2]);//, c[3]);
552  pVisManager->Draw(yzplate, att, trans);
553  }
554  }
555  } else
556  // xz plane
557  if(idxProj == 2) {
558  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax);}
559  G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
560  fSize[2]/fNSegment[2]);
561  for(int x = 0; x < fNSegment[0]; x++) {
562  for(int z = 0; z < fNSegment[2]; z++) {
563  G4ThreeVector pos(GetReplicaPosition(x, idxColumn, z));
564  G4Transform3D trans;
565  if(fRotationMatrix) {
566  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
567  trans = G4Translate3D(fCenterPosition)*trans;
568  } else {
570  }
571  G4double c[4];
572  colorMap->GetMapColor(xzcell[x][z], c);
573  att.SetColour(c[0], c[1], c[2]);//, c[3]);
574  pVisManager->Draw(xzplate, att, trans);
575  }
576  }
577  }
578  }
579 
580  colorMap->SetPSUnit(fDrawUnit);
581  colorMap->SetPSName(fDrawPSName);
582  colorMap->DrawColorChart();
583 }
584 
585 
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
G4ScoringBox(G4String wName)
Definition: G4ScoringBox.cc:52
void SetColour(const G4Colour &)
void SetPSName(G4String &psName)
G4ThreeVector fCenterPosition
CLHEP::Hep3Vector G4ThreeVector
Int_t index
Definition: macro.C:9
static G4VVisManager * GetConcreteInstance()
Definition: G4Box.hh:63
G4MultiFunctionalDetector * fMFD
void SetVisibility(G4bool)
void SetPSUnit(G4String &unit)
void List() const
virtual void GetMapColor(G4double val, G4double color[4])=0
Transform3D inverse() const
Definition: Transform3D.cc:142
#define width
G4double fSize[3]
tuple x
Definition: test.py:50
void DrawColumn(std::map< G4int, G4double * > *map, G4VScoreColorMap *colorMap, G4int idxProj, G4int idxColumn)
void SetForceSolid(G4bool)
int G4int
Definition: G4Types.hh:78
Double_t y
Definition: plot.C:279
void SetMinMax(G4double minVal, G4double maxVal)
G4double fDrawUnitValue
G4GLOB_DLL std::ostream G4cout
static G4int GetReplicaLevel()
const G4String & GetName() const
virtual void List() const
G4RotationMatrix * fRotationMatrix
Double_t scale
Definition: plot.C:11
virtual void Construct(G4VPhysicalVolume *fWorldPhys)
Definition: G4ScoringBox.cc:65
void SetForceAuxEdgeVisible(G4bool)
G4LogicalVolume * fMeshElementLogical
HepGeom::Rotate3D G4Rotate3D
void Draw(std::map< G4int, G4double * > *map, G4VScoreColorMap *colorMap, G4int axflg=111)
G4LogicalVolume * GetLogicalVolume() const
tuple z
Definition: test.py:28
HepGeom::Translate3D G4Translate3D
G4bool IfFloatMinMax() const
#define G4endl
Definition: G4ios.hh:61
G4String fDivisionAxisNames[3]
double G4double
Definition: G4Types.hh:76
tuple c
Definition: test.py:13
#define DBL_MAX
Definition: templates.hh:83
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
G4String fDrawPSName
G4GLOB_DLL std::ostream G4cerr
virtual void DrawColorChart(G4int nPoint=5)