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