Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4ScoringBox Class Reference

#include <G4ScoringBox.hh>

Inheritance diagram for G4ScoringBox:
Collaboration diagram for G4ScoringBox:

Public Member Functions

 G4ScoringBox (G4String wName)
 
 ~G4ScoringBox ()
 
void List () const
 
void Draw (RunScore *map, G4VScoreColorMap *colorMap, G4int axflg=111)
 
void DrawColumn (RunScore *map, G4VScoreColorMap *colorMap, G4int idxProj, G4int idxColumn)
 
void SetSegmentDirection (G4int dir)
 
- Public Member Functions inherited from G4VScoringMesh
 G4VScoringMesh (const G4String &wName)
 
virtual ~G4VScoringMesh ()
 
void Construct (G4VPhysicalVolume *fWorldPhys)
 
void WorkerConstruct (G4VPhysicalVolume *fWorldPhys)
 
const G4StringGetWorldName () const
 
G4bool IsActive () const
 
void Activate (G4bool vl=true)
 
MeshShape GetShape () const
 
void Accumulate (G4THitsMap< G4double > *map)
 
void Accumulate (G4THitsMap< G4StatDouble > *map)
 
void Merge (const G4VScoringMesh *scMesh)
 
void Dump ()
 
void DrawMesh (const G4String &psName, G4VScoreColorMap *colorMap, G4int axflg=111)
 
void DrawMesh (const G4String &psName, G4int idxPlane, G4int iColumn, G4VScoreColorMap *colorMap)
 
void ResetScore ()
 
void SetSize (G4double size[3])
 
G4ThreeVector GetSize () const
 
void SetCenterPosition (G4double centerPosition[3])
 
G4ThreeVector GetTranslation () const
 
void RotateX (G4double delta)
 
void RotateY (G4double delta)
 
void RotateZ (G4double delta)
 
G4RotationMatrix GetRotationMatrix () const
 
void SetNumberOfSegments (G4int nSegment[3])
 
void GetNumberOfSegments (G4int nSegment[3])
 
void SetPrimitiveScorer (G4VPrimitiveScorer *ps)
 
void SetFilter (G4VSDFilter *filter)
 
void SetCurrentPrimitiveScorer (const G4String &name)
 
G4bool FindPrimitiveScorer (const G4String &psname)
 
G4bool IsCurrentPrimitiveScorerNull ()
 
G4String GetPSUnit (const G4String &psname)
 
G4String GetCurrentPSUnit ()
 
void SetCurrentPSUnit (const G4String &unit)
 
G4double GetPSUnitValue (const G4String &psname)
 
void SetDrawPSName (const G4String &psname)
 
void GetDivisionAxisNames (G4String divisionAxisNames[3])
 
void SetNullToCurrentPrimitiveScorer ()
 
void SetVerboseLevel (G4int vl)
 
MeshScoreMap GetScoreMap () const
 
G4bool ReadyForQuantity () const
 
void SetMeshElementLogical (G4LogicalVolume *val)
 
G4LogicalVolumeGetMeshElementLogical () const
 
void SetParallelWorldProcess (G4ParallelWorldProcess *proc)
 
G4ParallelWorldProcessGetParallelWorldProcess () const
 
void GeometryHasBeenDestroyed ()
 

Protected Member Functions

virtual void SetupGeometry (G4VPhysicalVolume *fWorldPhys)
 
- Protected Member Functions inherited from G4VScoringMesh
G4VPrimitiveScorerGetPrimitiveScorer (const G4String &name)
 

Additional Inherited Members

- Protected Attributes inherited from G4VScoringMesh
G4String fWorldName
 
G4VPrimitiveScorerfCurrentPS
 
G4bool fConstructed
 
G4bool fActive
 
MeshShape fShape
 
G4double fSize [3]
 
G4ThreeVector fCenterPosition
 
G4RotationMatrixfRotationMatrix
 
G4int fNSegment [3]
 
MeshScoreMap fMap
 
G4MultiFunctionalDetectorfMFD
 
G4int verboseLevel
 
G4bool sizeIsSet
 
G4bool nMeshIsSet
 
G4String fDrawUnit
 
G4double fDrawUnitValue
 
G4String fDrawPSName
 
G4String fDivisionAxisNames [3]
 
G4LogicalVolumefMeshElementLogical
 
G4ParallelWorldProcessfParallelWorldProcess
 
G4bool fGeometryHasBeenDestroyed
 

Detailed Description

Definition at line 43 of file G4ScoringBox.hh.

Constructor & Destructor Documentation

G4ScoringBox::G4ScoringBox ( G4String  wName)

Definition at line 54 of file G4ScoringBox.cc.

55  :G4VScoringMesh(wName), fSegmentDirection(-1)
56 {
57  fShape = boxMesh;
58  fDivisionAxisNames[0] = "X";
59  fDivisionAxisNames[1] = "Y";
60  fDivisionAxisNames[2] = "Z";
61 }
G4VScoringMesh(const G4String &wName)
G4String fDivisionAxisNames[3]
G4ScoringBox::~G4ScoringBox ( )

Definition at line 63 of file G4ScoringBox.cc.

64 {
65 }

Member Function Documentation

void G4ScoringBox::Draw ( RunScore map,
G4VScoreColorMap colorMap,
G4int  axflg = 111 
)
virtual

Implements G4VScoringMesh.

Definition at line 240 of file G4ScoringBox.cc.

241  {
242 
244  if(pVisManager) {
245 
246  // cell vectors
247  std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z]
248  std::vector<double> ez;
249  for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.);
250  std::vector<std::vector<double> > eyz;
251  for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
252  for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
253 
254  std::vector<std::vector<double> > xycell; // xycell[X][Y]
255  std::vector<double> ey;
256  for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
257  for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
258 
259  std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
260  for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
261 
262  std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
263  for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
264 
265  // projections
266  G4int q[3];
267  std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
268  for(; itr != map->GetMap()->end(); itr++) {
269  GetXYZ(itr->first, q);
270 
271  xycell[q[0]][q[1]] += (itr->second->sum_wx())/fDrawUnitValue;
272  yzcell[q[1]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
273  xzcell[q[0]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
274  }
275 
276  // search max. & min. values in each slice
277  G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
278  G4double xymax = 0., yzmax = 0., xzmax = 0.;
279  for(int x = 0; x < fNSegment[0]; x++) {
280  for(int y = 0; y < fNSegment[1]; y++) {
281  if(xymin > xycell[x][y]) xymin = xycell[x][y];
282  if(xymax < xycell[x][y]) xymax = xycell[x][y];
283  }
284  for(int z = 0; z < fNSegment[2]; z++) {
285  if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
286  if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
287  }
288  }
289  for(int y = 0; y < fNSegment[1]; y++) {
290  for(int z = 0; z < fNSegment[2]; z++) {
291  if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
292  if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
293  }
294  }
295 
296 
297  G4VisAttributes att;
298  att.SetForceSolid(true);
299  att.SetForceAuxEdgeVisible(true);
300  G4double thick = 0.01;
301 
302  G4Scale3D scale;
303  if(axflg/100==1) {
304  pVisManager->BeginDraw();
305 
306  // xy plane
307  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin ,xymax); }
308  G4ThreeVector zhalf(0., 0., fSize[2]/fNSegment[2]-thick);
309  for(int x = 0; x < fNSegment[0]; x++) {
310  for(int y = 0; y < fNSegment[1]; y++) {
311 
312  G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf);
313  G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2]-1) + zhalf);
314  G4Transform3D trans, trans2;
315  if(fRotationMatrix) {
316  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
317  trans = G4Translate3D(fCenterPosition)*trans;
318  trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
319  trans2 = G4Translate3D(fCenterPosition)*trans2;
320  } else {
323  }
324  G4double c[4];
325  colorMap->GetMapColor(xycell[x][y], c);
326  att.SetColour(c[0], c[1], c[2]);//, c[3]);
327 
328  G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
329  thick);
330  G4Polyhedron * poly = xyplate.GetPolyhedron();
331  poly->Transform(trans);
332  poly->SetVisAttributes(&att);
333  pVisManager->Draw(*poly);
334 
335  G4Box xyplate2 = xyplate;
336  G4Polyhedron * poly2 = xyplate2.GetPolyhedron();
337  poly2->Transform(trans2);
338  poly2->SetVisAttributes(&att);
339  pVisManager->Draw(*poly2);
340 
341  /*
342  G4double nodes[][3] =
343  {{-fSize[0]/fNSegment[0], -fSize[1]/fNSegment[1], 0.},
344  { fSize[0]/fNSegment[0], -fSize[1]/fNSegment[1], 0.},
345  { fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 0.},
346  {-fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], 0.}};
347  G4int facets[][4] = {{4, 3, 2, 1}};
348  G4int facets2[][4] = {{1, 2, 3, 4}};
349 
350  G4Polyhedron poly, poly2;
351  poly.createPolyhedron(4, 1, nodes, facets);
352  poly.Transform(trans);
353  poly.SetVisAttributes(att);
354  pVisManager->Draw(poly);
355 
356  poly2.createPolyhedron(4, 1, nodes, facets2);
357  poly2.Transform(trans2);
358  poly2.SetVisAttributes(att);
359  pVisManager->Draw(poly2);
360  */
361  }
362  }
363  pVisManager->EndDraw();
364  }
365  axflg = axflg%100;
366  if(axflg/10==1) {
367  pVisManager->BeginDraw();
368 
369  // yz plane
370  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin, yzmax); }
371  G4ThreeVector xhalf(fSize[0]/fNSegment[0]-thick, 0., 0.);
372  for(int y = 0; y < fNSegment[1]; y++) {
373  for(int z = 0; z < fNSegment[2]; z++) {
374 
375  G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf);
376  G4ThreeVector pos2(GetReplicaPosition(fNSegment[0]-1, y, z) + xhalf);
377  G4Transform3D trans, trans2;
378  if(fRotationMatrix) {
379  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
380  trans = G4Translate3D(fCenterPosition)*trans;
381  trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
382  trans2 = G4Translate3D(fCenterPosition)*trans2;
383  } else {
386  }
387  G4double c[4];
388  colorMap->GetMapColor(yzcell[y][z], c);
389  att.SetColour(c[0], c[1], c[2]);//, c[3]);
390 
391  G4Box yzplate("yz", thick,//fSize[0]/fNSegment[0]*0.001,
392  fSize[1]/fNSegment[1],
393  fSize[2]/fNSegment[2]);
394  G4Polyhedron * poly = yzplate.GetPolyhedron();
395  poly->Transform(trans);
396  poly->SetVisAttributes(&att);
397  pVisManager->Draw(*poly);
398 
399  G4Box yzplate2 = yzplate;
400  G4Polyhedron * poly2 = yzplate2.GetPolyhedron();
401  poly2->Transform(trans2);
402  poly2->SetVisAttributes(&att);
403  pVisManager->Draw(*poly2);
404 
405  /*
406  G4double nodes[][3] =
407  {{0., -fSize[1]/fNSegment[1], -fSize[2]/fNSegment[2]},
408  {0., fSize[1]/fNSegment[1], -fSize[2]/fNSegment[2]},
409  {0., fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]},
410  {0., -fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]}};
411  G4int facets[][4] = {{4, 3, 2, 1}};
412  G4int facets2[][4] = {{1, 2, 3, 4}};
413 
414  G4Polyhedron poly, poly2;
415  poly.createPolyhedron(4, 1, nodes, facets);
416  poly.Transform(trans);
417  poly.SetVisAttributes(att);
418  pVisManager->Draw(poly);
419 
420  poly2.createPolyhedron(4, 1, nodes, facets2);
421  poly2.Transform(trans2);
422  poly2.SetVisAttributes(att);
423  pVisManager->Draw(poly2);
424  */
425  }
426  }
427  pVisManager->EndDraw();
428  }
429  axflg = axflg%10;
430  if(axflg==1) {
431  pVisManager->BeginDraw();
432 
433  // xz plane
434  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax); }
435  G4ThreeVector yhalf(0., fSize[1]/fNSegment[1]-thick, 0.);
436  for(int x = 0; x < fNSegment[0]; x++) {
437  for(int z = 0; z < fNSegment[2]; z++) {
438 
439  G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf);
440  G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1]-1, z) + yhalf);
441  G4Transform3D trans, trans2;
442  if(fRotationMatrix) {
443  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
444  trans = G4Translate3D(fCenterPosition)*trans;
445  trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
446  trans2 = G4Translate3D(fCenterPosition)*trans2;
447  } else {
450  }
451  G4double c[4];
452  colorMap->GetMapColor(xzcell[x][z], c);
453  att.SetColour(c[0], c[1], c[2]);//, c[3]);
454 
455  G4Box xzplate("xz", fSize[0]/fNSegment[0], thick,//fSize[1]/fNSegment[1]*0.001,
456  fSize[2]/fNSegment[2]);
457  G4Polyhedron * poly = xzplate.GetPolyhedron();
458  poly->Transform(trans);
459  poly->SetVisAttributes(&att);
460  pVisManager->Draw(*poly);
461 
462  G4Box xzplate2 = xzplate;
463  G4Polyhedron * poly2 = xzplate2.GetPolyhedron();
464  poly2->Transform(trans2);
465  poly2->SetVisAttributes(&att);
466  pVisManager->Draw(*poly2);
467 
468 
469  /*
470  G4double nodes[][3] =
471  {{-fSize[1]/fNSegment[1], 0., -fSize[2]/fNSegment[2]},
472  { fSize[1]/fNSegment[1], 0., -fSize[2]/fNSegment[2]},
473  { fSize[1]/fNSegment[1], 0., fSize[2]/fNSegment[2]},
474  {-fSize[1]/fNSegment[1], 0., fSize[2]/fNSegment[2]}};
475  G4int facets[][4] = {{1, 2, 3, 4}};
476  G4int facets2[][4] = {{4, 3, 2, 1}};
477 
478  G4Polyhedron poly, poly2;
479  poly.createPolyhedron(4, 1, nodes, facets);
480  poly.Transform(trans);
481  poly.SetVisAttributes(att);
482  pVisManager->Draw(poly);
483 
484  poly2.createPolyhedron(4, 1, nodes, facets2);
485  poly2.Transform(trans2);
486  poly2.SetVisAttributes(att);
487  pVisManager->Draw(poly2);
488  */
489  }
490  }
491  pVisManager->EndDraw();
492  }
493  }
494  colorMap->SetPSUnit(fDrawUnit);
495  colorMap->SetPSName(fDrawPSName);
496  colorMap->DrawColorChart();
497 }
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetColour(const G4Colour &)
void SetPSName(G4String &psName)
G4ThreeVector fCenterPosition
static G4VVisManager * GetConcreteInstance()
Definition: G4Box.hh:64
void SetPSUnit(G4String &unit)
virtual void GetMapColor(G4double val, G4double color[4])=0
Transform3D inverse() const
Definition: Transform3D.cc:142
G4double fSize[3]
HepPolyhedron & Transform(const G4Transform3D &t)
int G4int
Definition: G4Types.hh:78
void SetForceSolid(G4bool=true)
void SetMinMax(G4double minVal, G4double maxVal)
G4double fDrawUnitValue
G4RotationMatrix * fRotationMatrix
virtual void EndDraw()=0
virtual G4Polyhedron * GetPolyhedron() const
Definition: G4CSGSolid.cc:134
virtual void BeginDraw(const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
HepGeom::Rotate3D G4Rotate3D
HepGeom::Translate3D G4Translate3D
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:99
G4bool IfFloatMinMax() const
void SetForceAuxEdgeVisible(G4bool=true)
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
static const G4double pos
G4String fDrawPSName
virtual void DrawColorChart(G4int nPoint=5)

Here is the call graph for this function:

void G4ScoringBox::DrawColumn ( RunScore map,
G4VScoreColorMap colorMap,
G4int  idxProj,
G4int  idxColumn 
)
virtual

Implements G4VScoringMesh.

Definition at line 522 of file G4ScoringBox.cc.

525 {
526  G4int iColumn[3] = {2, 0, 1};
527  if(idxColumn<0 || idxColumn>=fNSegment[iColumn[idxProj]])
528  {
529  G4cerr << "ERROR : Column number " << idxColumn
530  << " is out of scoring mesh [0," << fNSegment[iColumn[idxProj]]-1
531  << "]. Method ignored." << G4endl;
532  return;
533  }
535  if(pVisManager) {
536  pVisManager->BeginDraw();
537 
538  // cell vectors
539  std::vector<std::vector<std::vector<double> > > cell; // cell[X][Y][Z]
540  std::vector<double> ez;
541  for(int z = 0; z < fNSegment[2]; z++) ez.push_back(0.);
542  std::vector<std::vector<double> > eyz;
543  for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
544  for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
545 
546  std::vector<std::vector<double> > xycell; // xycell[X][Y]
547  std::vector<double> ey;
548  for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
549  for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
550 
551  std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
552  for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
553 
554  std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
555  for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
556 
557  // projections
558  G4int q[3];
559  std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
560  for(; itr != map->GetMap()->end(); itr++) {
561  GetXYZ(itr->first, q);
562 
563  if(idxProj == 0 && q[2] == idxColumn) { // xy plane
564  xycell[q[0]][q[1]] += (itr->second->sum_wx())/fDrawUnitValue;
565  }
566  if(idxProj == 1 && q[0] == idxColumn) { // yz plane
567  yzcell[q[1]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
568  }
569  if(idxProj == 2 && q[1] == idxColumn) { // zx plane
570  xzcell[q[0]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
571  }
572  }
573 
574  // search max. & min. values in each slice
575  G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
576  G4double xymax = 0., yzmax = 0., xzmax = 0.;
577  for(int x = 0; x < fNSegment[0]; x++) {
578  for(int y = 0; y < fNSegment[1]; y++) {
579  if(xymin > xycell[x][y]) xymin = xycell[x][y];
580  if(xymax < xycell[x][y]) xymax = xycell[x][y];
581  }
582  for(int z = 0; z < fNSegment[2]; z++) {
583  if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
584  if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
585  }
586  }
587  for(int y = 0; y < fNSegment[1]; y++) {
588  for(int z = 0; z < fNSegment[2]; z++) {
589  if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
590  if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
591  }
592  }
593 
594 
595  G4VisAttributes att;
596  att.SetForceSolid(true);
597  att.SetForceAuxEdgeVisible(true);
598 
599  G4Scale3D scale;
600  // xy plane
601  if(idxProj == 0) {
602  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin,xymax); }
603  for(int x = 0; x < fNSegment[0]; x++) {
604  for(int y = 0; y < fNSegment[1]; y++) {
605  G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
606  fSize[2]/fNSegment[2]);
607 
608  G4ThreeVector pos(GetReplicaPosition(x, y, idxColumn));
609  G4Transform3D trans;
610  if(fRotationMatrix) {
611  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
612  trans = G4Translate3D(fCenterPosition)*trans;
613  } else {
615  }
616  G4double c[4];
617  colorMap->GetMapColor(xycell[x][y], c);
618  att.SetColour(c[0], c[1], c[2]);
619 
620  G4Polyhedron * poly = xyplate.GetPolyhedron();
621  poly->Transform(trans);
622  poly->SetVisAttributes(att);
623  pVisManager->Draw(*poly);
624  }
625  }
626 
627  } else
628  // yz plane
629  if(idxProj == 1) {
630  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin,yzmax); }
631  for(int y = 0; y < fNSegment[1]; y++) {
632  for(int z = 0; z < fNSegment[2]; z++) {
633  G4Box yzplate("yz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
634  fSize[2]/fNSegment[2]);
635 
636  G4ThreeVector pos(GetReplicaPosition(idxColumn, y, z));
637  G4Transform3D trans;
638  if(fRotationMatrix) {
639  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
640  trans = G4Translate3D(fCenterPosition)*trans;
641  } else {
643  }
644  G4double c[4];
645  colorMap->GetMapColor(yzcell[y][z], c);
646  att.SetColour(c[0], c[1], c[2]);//, c[3]);
647 
648  G4Polyhedron * poly = yzplate.GetPolyhedron();
649  poly->Transform(trans);
650  poly->SetVisAttributes(att);
651  pVisManager->Draw(*poly);
652  }
653  }
654  } else
655  // xz plane
656  if(idxProj == 2) {
657  if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax);}
658  for(int x = 0; x < fNSegment[0]; x++) {
659  for(int z = 0; z < fNSegment[2]; z++) {
660  G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
661  fSize[2]/fNSegment[2]);
662 
663  G4ThreeVector pos(GetReplicaPosition(x, idxColumn, z));
664  G4Transform3D trans;
665  if(fRotationMatrix) {
666  trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
667  trans = G4Translate3D(fCenterPosition)*trans;
668  } else {
670  }
671  G4double c[4];
672  colorMap->GetMapColor(xzcell[x][z], c);
673  att.SetColour(c[0], c[1], c[2]);//, c[3]);
674 
675  G4Polyhedron * poly = xzplate.GetPolyhedron();
676  poly->Transform(trans);
677  poly->SetVisAttributes(att);
678  pVisManager->Draw(*poly);
679  }
680  }
681  }
682  pVisManager->EndDraw();
683 
684  }
685 
686  colorMap->SetPSUnit(fDrawUnit);
687  colorMap->SetPSName(fDrawPSName);
688  colorMap->DrawColorChart();
689 }
virtual void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetColour(const G4Colour &)
void SetPSName(G4String &psName)
G4ThreeVector fCenterPosition
static G4VVisManager * GetConcreteInstance()
Definition: G4Box.hh:64
void SetPSUnit(G4String &unit)
virtual void GetMapColor(G4double val, G4double color[4])=0
Transform3D inverse() const
Definition: Transform3D.cc:142
G4double fSize[3]
HepPolyhedron & Transform(const G4Transform3D &t)
int G4int
Definition: G4Types.hh:78
void SetForceSolid(G4bool=true)
void SetMinMax(G4double minVal, G4double maxVal)
G4double fDrawUnitValue
G4RotationMatrix * fRotationMatrix
virtual void EndDraw()=0
virtual void BeginDraw(const G4Transform3D &objectTransformation=G4Transform3D())=0
void SetVisAttributes(const G4VisAttributes *)
Definition: G4Visible.cc:80
HepGeom::Rotate3D G4Rotate3D
HepGeom::Translate3D G4Translate3D
std::map< G4int, T * > * GetMap() const
Definition: G4THitsMap.hh:99
G4bool IfFloatMinMax() const
#define G4endl
Definition: G4ios.hh:61
void SetForceAuxEdgeVisible(G4bool=true)
double G4double
Definition: G4Types.hh:76
#define DBL_MAX
Definition: templates.hh:83
static const G4double pos
G4String fDrawPSName
G4GLOB_DLL std::ostream G4cerr
virtual void DrawColorChart(G4int nPoint=5)

Here is the call graph for this function:

void G4ScoringBox::List ( ) const
virtual

Reimplemented from G4VScoringMesh.

Definition at line 229 of file G4ScoringBox.cc.

229  {
230  G4cout << "G4ScoringBox : " << fWorldName << " --- Shape: Box mesh" << G4endl;
231  G4cout << " Size (x, y, z): ("
232  << fSize[0]/cm << ", "
233  << fSize[1]/cm << ", "
234  << fSize[2]/cm << ") [cm]"
235  << G4endl;
236 
238 }
G4double fSize[3]
G4GLOB_DLL std::ostream G4cout
virtual void List() const
static constexpr double cm
Definition: G4SIunits.hh:119
#define G4endl
Definition: G4ios.hh:61

Here is the call graph for this function:

void G4ScoringBox::SetSegmentDirection ( G4int  dir)
inline

Definition at line 60 of file G4ScoringBox.hh.

60 {fSegmentDirection = dir;}
void G4ScoringBox::SetupGeometry ( G4VPhysicalVolume fWorldPhys)
protectedvirtual

Implements G4VScoringMesh.

Definition at line 67 of file G4ScoringBox.cc.

67  {
68 
69  if(verboseLevel > 9) G4cout << "G4ScoringBox::SetupGeometry() ..." << G4endl;
70 
71  // World
72  G4VPhysicalVolume * scoringWorld = fWorldPhys;
73  G4LogicalVolume * worldLogical = scoringWorld->GetLogicalVolume();
74 
75  // Scoring Mesh
76  if(verboseLevel > 9) G4cout << fWorldName << G4endl;
77  G4String boxName = fWorldName;
78 
79  if(verboseLevel > 9)
80  G4cout << fSize[0] << ", " << fSize[1] << ", " << fSize[2] << G4endl;
81  G4VSolid * boxSolid = new G4Box(boxName+"0", fSize[0], fSize[1], fSize[2]);
82  G4LogicalVolume * boxLogical = new G4LogicalVolume(boxSolid, 0, boxName+"_0");
84  boxLogical, boxName+"0", worldLogical, false, 0);
85 
86  //G4double fsegment[3][3];
87  //G4int segOrder[3];
88  //GetSegmentOrder(fSegmentDirection, fNSegment, segOrder, fsegment);
89  //EAxis axis[3] = {kXAxis, kYAxis, kZAxis};
90 
91  G4String layerName[2] = {boxName + "_1", boxName + "_2"};
92  G4VSolid * layerSolid[2];
93  G4LogicalVolume * layerLogical[2];
94 
95  //-- fisrt nested layer (replicated to x direction)
96  if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
97  layerSolid[0] = new G4Box(layerName[0],
98  fSize[0]/fNSegment[0],
99  fSize[1],
100  fSize[2]);
101  layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]);
102  if(fNSegment[0] > 1) {
103  if(verboseLevel > 9)
104  G4cout << "G4ScoringBox::Construct() : Replicate to x direction" << G4endl;
106  {
107  new G4PVReplica(layerName[0], layerLogical[0], boxLogical, kXAxis,
108  fNSegment[0], fSize[0]/fNSegment[0]*2.);
109  }
110  else
111  {
112  new G4PVDivision(layerName[0], layerLogical[0], boxLogical, kXAxis,
113  fNSegment[0], 0.);
114  }
115  } else if(fNSegment[0] == 1) {
116  if(verboseLevel > 9)
117  G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
118  new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0],
119  boxLogical, false, 0);
120  } else
121  G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
122  << fNSegment[0] << ") "
123  << "in placement of the first nested layer." << G4endl;
124 
125  if(verboseLevel > 9) {
126  G4cout << fSize[0]/fNSegment[0] << ", "
127  << fSize[1] << ", "
128  << fSize[2] << G4endl;
129  G4cout << layerName[0] << ": kXAxis, "
130  << fNSegment[0] << ", "
131  << 2.*fSize[0]/fNSegment[0] << G4endl;
132  }
133 
134  // second nested layer (replicated to y direction)
135  if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl;
136  layerSolid[1] = new G4Box(layerName[1],
137  fSize[0]/fNSegment[0],
138  fSize[1]/fNSegment[1],
139  fSize[2]);
140  layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]);
141  if(fNSegment[1] > 1) {
142  if(verboseLevel > 9)
143  G4cout << "G4ScoringBox::Construct() : Replicate to y direction" << G4endl;
145  {
146  new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
147  fNSegment[1], fSize[1]/fNSegment[1]*2.);
148  }
149  else
150  {
151  new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
152  fNSegment[1], 0.);
153  }
154  } else if(fNSegment[1] == 1) {
155  if(verboseLevel > 9)
156  G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
157  new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1],
158  layerLogical[0], false, 0);
159  } else
160  G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
161  << fNSegment[1] << ") "
162  << "in placement of the second nested layer." << G4endl;
163 
164  if(verboseLevel > 9) {
165  G4cout << fSize[0]/fNSegment[0] << ", "
166  << fSize[1]/fNSegment[1] << ", "
167  << fSize[2] << G4endl;
168  G4cout << layerName[1] << ": kYAxis, "
169  << fNSegment[1] << ", "
170  << 2.*fSize[1]/fNSegment[1] << G4endl;
171  }
172 
173  // mesh elements (replicated to z direction)
174  if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl;
175  G4String elementName = boxName +"_3";
176  G4VSolid * elementSolid = new G4Box(elementName,
177  fSize[0]/fNSegment[0],
178  fSize[1]/fNSegment[1],
179  fSize[2]/fNSegment[2]);
180  fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
181  if(fNSegment[2] > 1) {
182  if(verboseLevel > 9)
183  G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
184 
186  {
187  new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
188  fNSegment[2], 2.*fSize[2]/fNSegment[2]);
189  }
190  else
191  {
192  new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
193  fNSegment[2], 0.);
194  }
195  } else if(fNSegment[2] == 1) {
196  if(verboseLevel > 9)
197  G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
199  elementName, layerLogical[1], false, 0);
200  } else
201  G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : "
202  << "invalid parameter (" << fNSegment[2] << ") "
203  << "in mesh element placement." << G4endl;
204 
205  if(verboseLevel > 9) {
206  G4cout << fSize[0]/fNSegment[0] << ", "
207  << fSize[1]/fNSegment[1] << ", "
208  << fSize[2]/fNSegment[2] << G4endl;
209  G4cout << elementName << ": kZAxis, "
210  << fNSegment[2] << ", "
211  << 2.*fSize[2]/fNSegment[2] << G4endl;
212  }
213 
214 
215  // set the sensitive detector
217 
218 
219  // vis. attributes
220  G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
221  visatt->SetVisibility(false);
222  layerLogical[0]->SetVisAttributes(visatt);
223  layerLogical[1]->SetVisAttributes(visatt);
224  visatt->SetVisibility(true);
226 }
G4ThreeVector fCenterPosition
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
G4MultiFunctionalDetector * fMFD
G4double fSize[3]
G4GLOB_DLL std::ostream G4cout
static G4int GetReplicaLevel()
void SetVisibility(G4bool=true)
G4RotationMatrix * fRotationMatrix
G4LogicalVolume * fMeshElementLogical
G4LogicalVolume * GetLogicalVolume() const
#define G4endl
Definition: G4ios.hh:61
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:


The documentation for this class was generated from the following files: