Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/digits_hits/utils/src/G4ScoringBox.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /digits_hits/utils/src/G4ScoringBox.cc (Version 11.3.0) and /digits_hits/utils/src/G4ScoringBox.cc (Version 10.4.p2)


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