Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/field/field04/src/F04DetectorConstruction.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 /examples/extended/field/field04/src/F04DetectorConstruction.cc (Version 11.3.0) and /examples/extended/field/field04/src/F04DetectorConstruction.cc (Version 11.0)


  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 //                                                 26 //
 27 /// \file field/field04/src/F04DetectorConstru     27 /// \file field/field04/src/F04DetectorConstruction.cc
 28 /// \brief Implementation of the F04DetectorCo     28 /// \brief Implementation of the F04DetectorConstruction class
 29 //                                                 29 //
 30 //....oooOO0OOooo........oooOO0OOooo........oo     30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 31 //....oooOO0OOooo........oooOO0OOooo........oo     31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 32                                                    32 
 33 #include "F04DetectorConstruction.hh"          <<  33 #include "globals.hh"
 34                                                    34 
                                                   >>  35 #include "F04DetectorConstruction.hh"
 35 #include "F04DetectorMessenger.hh"                 36 #include "F04DetectorMessenger.hh"
 36 #include "F04FocusSolenoid.hh"                 << 
 37 #include "F04GlobalField.hh"                   << 
 38 #include "F04Materials.hh"                     << 
 39 #include "F04SimpleSolenoid.hh"                << 
 40                                                    37 
 41 #include "G4AutoDelete.hh"                     <<  38 #include "G4Tubs.hh"
 42 #include "G4GeometryManager.hh"                << 
 43 #include "G4LogicalVolume.hh"                      39 #include "G4LogicalVolume.hh"
 44 #include "G4LogicalVolumeStore.hh"             <<  40 #include "G4PVPlacement.hh"
                                                   >>  41 
 45 #include "G4Material.hh"                           42 #include "G4Material.hh"
 46 #include "G4NistManager.hh"                        43 #include "G4NistManager.hh"
 47 #include "G4PVPlacement.hh"                    <<  44 
 48 #include "G4PhysicalConstants.hh"              <<  45 #include "F04GlobalField.hh"
                                                   >>  46 
                                                   >>  47 #include "G4GeometryManager.hh"
                                                   >>  48 #include "G4SolidStore.hh"
                                                   >>  49 #include "G4LogicalVolumeStore.hh"
 49 #include "G4PhysicalVolumeStore.hh"                50 #include "G4PhysicalVolumeStore.hh"
 50 #include "G4RotationMatrix.hh"                 <<  51 
 51 #include "G4RunManager.hh"                         52 #include "G4RunManager.hh"
 52 #include "G4SolidStore.hh"                     << 
 53 #include "G4StateManager.hh"                       53 #include "G4StateManager.hh"
                                                   >>  54 
                                                   >>  55 #include "G4PhysicalConstants.hh"
 54 #include "G4SystemOfUnits.hh"                      56 #include "G4SystemOfUnits.hh"
 55 #include "G4Tubs.hh"                           <<  57 
 56 #include "globals.hh"                          <<  58 #include "F04Materials.hh"
                                                   >>  59 
                                                   >>  60 #include "G4RotationMatrix.hh"
                                                   >>  61 
                                                   >>  62 #include "F04SimpleSolenoid.hh"
                                                   >>  63 #include "F04FocusSolenoid.hh"
                                                   >>  64 
                                                   >>  65 #include "G4AutoDelete.hh"
 57                                                    66 
 58 //....oooOO0OOooo........oooOO0OOooo........oo     67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 59                                                    68 
 60 F04DetectorConstruction::F04DetectorConstructi     69 F04DetectorConstruction::F04DetectorConstruction()
                                                   >>  70  : G4VUserDetectorConstruction(),
                                                   >>  71    fDetectorMessenger(0),
                                                   >>  72    fSolidWorld(0), fLogicWorld(0), fPhysiWorld(0),
                                                   >>  73    fSolidTarget(0), fLogicTarget(0), fPhysiTarget(0),
                                                   >>  74    fSolidDegrader(0), fLogicDegrader(0), fPhysiDegrader(0),
                                                   >>  75    fSolidCaptureMgnt(0), fLogicCaptureMgnt(0), fPhysiCaptureMgnt(0),
                                                   >>  76    fSolidTransferMgnt(0), fLogicTransferMgnt(0), fPhysiTransferMgnt(0),
                                                   >>  77    fWorldMaterial(0), fTargetMaterial(0), fDegraderMaterial(0)
 61 {                                                  78 {
                                                   >>  79   fWorldSizeZ = 50.*m;
                                                   >>  80   fWorldSizeR =  5.*m;
                                                   >>  81 
                                                   >>  82   fTargetRadius       =   0.4*cm;
                                                   >>  83   fTargetThickness    =  16.0*cm;
                                                   >>  84 
 62   SetTargetAngle(170);                             85   SetTargetAngle(170);
 63   SetCaptureMgntB1(2.5 * tesla);               << 
 64   SetCaptureMgntB2(5.0 * tesla);               << 
 65   SetTransferMgntB(5.0 * tesla);               << 
 66                                                    86 
 67   fDegraderPos = -fTransferMgntLength / 2. + f <<  87   fDegraderRadius     =  30.0*cm;
                                                   >>  88   fDegraderThickness  =   0.1*cm;
                                                   >>  89 
                                                   >>  90   fCaptureMgntRadius  =  0.6*m;
                                                   >>  91   fCaptureMgntLength  =  4.0*m;
                                                   >>  92 
                                                   >>  93   SetCaptureMgntB1(2.5*tesla);
                                                   >>  94   SetCaptureMgntB2(5.0*tesla);
                                                   >>  95 
                                                   >>  96   fTransferMgntRadius =  0.3*m;
                                                   >>  97   fTransferMgntLength = 15.0*m;
                                                   >>  98 
                                                   >>  99   SetTransferMgntB(5.0*tesla);
                                                   >> 100 
                                                   >> 101   fDegraderPos = -fTransferMgntLength/2. + fDegraderThickness/2.;
 68                                                   102 
 69   fDetectorMessenger = new F04DetectorMessenge    103   fDetectorMessenger = new F04DetectorMessenger(this);
 70 }                                                 104 }
 71                                                   105 
 72 //....oooOO0OOooo........oooOO0OOooo........oo    106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 73                                                   107 
 74 F04DetectorConstruction::~F04DetectorConstruct    108 F04DetectorConstruction::~F04DetectorConstruction()
 75 {                                                 109 {
 76   delete fDetectorMessenger;                      110   delete fDetectorMessenger;
 77 }                                                 111 }
 78                                                   112 
 79 //....oooOO0OOooo........oooOO0OOooo........oo    113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 80                                                   114 
 81 G4VPhysicalVolume* F04DetectorConstruction::Co    115 G4VPhysicalVolume* F04DetectorConstruction::Construct()
 82 {                                                 116 {
                                                   >> 117 
 83   if (fPhysiWorld) {                              118   if (fPhysiWorld) {
 84     G4GeometryManager::GetInstance()->OpenGeom << 119      G4GeometryManager::GetInstance()->OpenGeometry();
 85     G4PhysicalVolumeStore::GetInstance()->Clea << 120      G4PhysicalVolumeStore::GetInstance()->Clean();
 86     G4LogicalVolumeStore::GetInstance()->Clean << 121      G4LogicalVolumeStore::GetInstance()->Clean();
 87     G4SolidStore::GetInstance()->Clean();      << 122      G4SolidStore::GetInstance()->Clean();
 88   }                                               123   }
 89                                                   124 
 90   fMaterials = F04Materials::GetInstance();       125   fMaterials = F04Materials::GetInstance();
 91                                                   126 
 92   DefineMaterials();                              127   DefineMaterials();
 93                                                   128 
 94   return ConstructDetector();                     129   return ConstructDetector();
 95 }                                                 130 }
 96                                                   131 
 97 //....oooOO0OOooo........oooOO0OOooo........oo    132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 98                                                   133 
 99 void F04DetectorConstruction::DefineMaterials(    134 void F04DetectorConstruction::DefineMaterials()
100 {                                                 135 {
101   // define materials for the experiment       << 136   //define materials for the experiment
102                                                   137 
103   fVacuum = fMaterials->GetMaterial("G4_Galact    138   fVacuum = fMaterials->GetMaterial("G4_Galactic");
104                                                   139 
105   fWorldMaterial = fMaterials->GetMaterial("G4 << 140   fWorldMaterial    = fMaterials->GetMaterial("G4_AIR");
106   fDegraderMaterial = fMaterials->GetMaterial(    141   fDegraderMaterial = fMaterials->GetMaterial("G4_Pb");
107   fTargetMaterial = fMaterials->GetMaterial("G << 142   fTargetMaterial   = fMaterials->GetMaterial("G4_W");
108 }                                                 143 }
109                                                   144 
110 //....oooOO0OOooo........oooOO0OOooo........oo    145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111                                                   146 
112 G4VPhysicalVolume* F04DetectorConstruction::Co    147 G4VPhysicalVolume* F04DetectorConstruction::ConstructDetector()
113 {                                                 148 {
114   fSolidWorld = new G4Tubs("World", 0., GetWor << 149   fSolidWorld = new G4Tubs("World",
115                                                << 150                0.,GetWorldSizeR(),GetWorldSizeZ()/2.,0.,twopi);
116   fLogicWorld = new G4LogicalVolume(fSolidWorl << 151  
117                                                << 152   fLogicWorld = new G4LogicalVolume(fSolidWorld,
118   fPhysiWorld =                                << 153                                    GetWorldMaterial(),
119     new G4PVPlacement(nullptr, G4ThreeVector() << 154                                    "World");
                                                   >> 155 
                                                   >> 156   fPhysiWorld = new G4PVPlacement(0,
                                                   >> 157                                  G4ThreeVector(),
                                                   >> 158                                  "World",
                                                   >> 159                                  fLogicWorld,
                                                   >> 160                                  0,
                                                   >> 161                                  false,
                                                   >> 162                                  0);
120                                                   163 
121   // Capture Magnet                               164   // Capture Magnet
122                                                   165 
123   fSolidCaptureMgnt =                          << 166   fSolidCaptureMgnt = new G4Tubs("CaptureMgnt",
124     new G4Tubs("CaptureMgnt", 0., GetCaptureMg << 167                      0.,GetCaptureMgntRadius(),
125                                                << 168                      GetCaptureMgntLength()/2.,0.,twopi);
126   fLogicCaptureMgnt = new G4LogicalVolume(fSol << 169 
                                                   >> 170   fLogicCaptureMgnt = new G4LogicalVolume(fSolidCaptureMgnt,
                                                   >> 171                                          fVacuum,
                                                   >> 172                                          "CaptureMgnt");
127                                                   173 
128   fCaptureMgntCenter = G4ThreeVector();           174   fCaptureMgntCenter = G4ThreeVector();
129                                                   175 
130   fPhysiCaptureMgnt = new G4PVPlacement(nullpt << 176   fPhysiCaptureMgnt = new G4PVPlacement(0,
131                                         fLogic << 177                                        fCaptureMgntCenter,
                                                   >> 178                                        "CaptureMgnt",
                                                   >> 179                                        fLogicCaptureMgnt,
                                                   >> 180                                        fPhysiWorld,
                                                   >> 181                                        false,
                                                   >> 182                                        0);
132                                                   183 
133   // Transfer Magnet                              184   // Transfer Magnet
134                                                   185 
135   fSolidTransferMgnt = new G4Tubs("TransferMgn << 186   fSolidTransferMgnt = new G4Tubs("TransferMgnt",
136                                   GetTransferM << 187                       0.,GetTransferMgntRadius(),
                                                   >> 188                       GetTransferMgntLength()/2.,0.,twopi);
137                                                   189 
138   fLogicTransferMgnt = new G4LogicalVolume(fSo << 190   fLogicTransferMgnt = new G4LogicalVolume(fSolidTransferMgnt,
                                                   >> 191                                           fVacuum,
                                                   >> 192                                           "TransferMgnt");
139                                                   193 
140   G4double z = GetCaptureMgntLength() / 2. + G << 194   G4double z  = GetCaptureMgntLength()/2. + GetTransferMgntLength()/2.
141   G4double x = GetTransferMgntPos() / 2.;      << 195                               + GetTransferMgntPos();
                                                   >> 196   G4double x =  GetTransferMgntPos()/2.;
142                                                   197 
143   fTransferMgntCenter = G4ThreeVector(x, 0., z << 198   fTransferMgntCenter = G4ThreeVector(x,0.,z);
144                                                   199 
145   auto g4rot = new G4RotationMatrix();         << 200   G4RotationMatrix* g4rot = new G4RotationMatrix();
146   *g4rot = StringToRotationMatrix("Y30,X10");     201   *g4rot = StringToRotationMatrix("Y30,X10");
147   *g4rot = g4rot->inverse();                      202   *g4rot = g4rot->inverse();
148   if (*g4rot == G4RotationMatrix()) g4rot = nu << 203   if (*g4rot == G4RotationMatrix()) g4rot = NULL;
149                                                   204 
150   fPhysiTransferMgnt = new G4PVPlacement(g4rot << 205   fPhysiTransferMgnt = new G4PVPlacement(g4rot,
151                                          fLogi << 206                                         fTransferMgntCenter,
                                                   >> 207                                         "TransferMgnt",
                                                   >> 208                                         fLogicTransferMgnt,
                                                   >> 209                                         fPhysiWorld,
                                                   >> 210                                         false,
                                                   >> 211                                         0);
152                                                   212 
153   // Test Plane                                   213   // Test Plane
154                                                   214 
155   auto solidTestPlane = new G4Tubs("TestPlane" << 215   G4Tubs* solidTestPlane = new G4Tubs("TestPlane",
156                                                << 216                                       0.,GetTransferMgntRadius(),
157   auto logicTestPlane = new G4LogicalVolume(so << 217                                       1.*mm,0.,twopi);
158                                                << 218 
159   z = GetTransferMgntLength() / 2. - 1. * mm;  << 219   G4LogicalVolume* logicTestPlane = new G4LogicalVolume(solidTestPlane,
160                                                << 220                                                         fVacuum,
161   G4ThreeVector testPlaneCenter = G4ThreeVecto << 221                                                         "TestPlane");
162                                                << 222 
163   new G4PVPlacement(nullptr, testPlaneCenter,  << 223   z = GetTransferMgntLength()/2. - 1.*mm;
164                     false, 0);                 << 224 
                                                   >> 225   G4ThreeVector testPlaneCenter = G4ThreeVector(0.,0.,z);
                                                   >> 226 
                                                   >> 227   new G4PVPlacement(0,
                                                   >> 228                     testPlaneCenter,
                                                   >> 229                     "TestPlane",
                                                   >> 230                     logicTestPlane,
                                                   >> 231                     fPhysiTransferMgnt,
                                                   >> 232                     false,
                                                   >> 233                     0);
165                                                   234 
166   // Target                                       235   // Target
167                                                   236 
168   if (GetTargetThickness() > 0.) {             << 237   if (GetTargetThickness() > 0.)
169     fSolidTarget =                             << 238   {
170       new G4Tubs("Target", 0., GetTargetRadius << 239       fSolidTarget = new G4Tubs("Target",
171                                                << 240                     0.,GetTargetRadius(),
172     fLogicTarget = new G4LogicalVolume(fSolidT << 241                     GetTargetThickness()/2.,0.,twopi);
173                                                << 242 
174     G4int i = GetTargetAngle();                << 243       fLogicTarget = new G4LogicalVolume(fSolidTarget,
175                                                << 244                                         GetTargetMaterial(),
176     G4String angle = std::to_string(i);        << 245                                         "Target");
177     G4StrUtil::strip(angle);                   << 246 
178     angle = "Y" + angle;                       << 247       G4int i =  GetTargetAngle();
179                                                << 248 
180     g4rot = new G4RotationMatrix();            << 249       char c[4];
181     *g4rot = StringToRotationMatrix(angle);    << 250       sprintf(c,"%d",i);
182     *g4rot = g4rot->inverse();                 << 251       G4String angle = c;
183     if (*g4rot == G4RotationMatrix()) g4rot =  << 252       G4StrUtil::strip(angle);
184                                                << 253       angle = "Y" + angle;
185     G4ThreeVector targetCenter(0., 0., GetTarg << 254 
186                                                << 255       g4rot = new G4RotationMatrix();
187     fPhysiTarget =                             << 256       *g4rot = StringToRotationMatrix(angle);
188       new G4PVPlacement(g4rot, targetCenter, " << 257       *g4rot = g4rot->inverse();
                                                   >> 258       if (*g4rot == G4RotationMatrix()) g4rot = NULL;
                                                   >> 259 
                                                   >> 260       G4ThreeVector targetCenter(0.,0.,GetTargetPos());
                                                   >> 261 
                                                   >> 262       fPhysiTarget = new G4PVPlacement(g4rot,
                                                   >> 263                                       targetCenter,
                                                   >> 264                                       "Target",
                                                   >> 265                                       fLogicTarget,
                                                   >> 266                                       fPhysiCaptureMgnt,
                                                   >> 267                                       false,
                                                   >> 268                                       0);
189   }                                               269   }
190                                                   270 
191   // Degrader                                     271   // Degrader
192                                                   272 
193   if (GetDegraderThickness() > 0.) {           << 273   if (GetDegraderThickness() > 0.)
194     fSolidDegrader =                           << 274   {
195       new G4Tubs("Degrader", 0., GetDegraderRa << 275       fSolidDegrader = new G4Tubs("Degrader",
196                                                << 276                       0., GetDegraderRadius(),
197     fLogicDegrader = new G4LogicalVolume(fSoli << 277                       GetDegraderThickness()/2., 0.,twopi);
198                                                << 278  
199     G4ThreeVector degraderCenter = G4ThreeVect << 279       fLogicDegrader = new G4LogicalVolume(fSolidDegrader,
200                                                << 280                                                 GetDegraderMaterial(),
201     fPhysiDegrader = new G4PVPlacement(nullptr << 281                                                 "Degrader");
202                                        fPhysiT << 282 
                                                   >> 283       G4ThreeVector degraderCenter = G4ThreeVector(0.,0.,GetDegraderPos());
                                                   >> 284 
                                                   >> 285       fPhysiDegrader = new G4PVPlacement(0,
                                                   >> 286                                         degraderCenter,
                                                   >> 287                                         "Degrader",
                                                   >> 288                                         fLogicDegrader,
                                                   >> 289                                         fPhysiTransferMgnt,
                                                   >> 290                                         false,
                                                   >> 291                                         0);
203   }                                               292   }
204                                                   293 
205   return fPhysiWorld;                             294   return fPhysiWorld;
206 }                                                 295 }
207                                                   296 
208 //....oooOO0OOooo........oooOO0OOooo........oo    297 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
209                                                   298 
210 void F04DetectorConstruction::SetWorldMaterial    299 void F04DetectorConstruction::SetWorldMaterial(const G4String materialChoice)
211 {                                                 300 {
212   G4Material* pttoMaterial = G4NistManager::In << 301   G4Material* pttoMaterial =
                                                   >> 302       G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
213                                                   303 
214   if (pttoMaterial != fWorldMaterial) {           304   if (pttoMaterial != fWorldMaterial) {
215     if (pttoMaterial) {                        << 305      if ( pttoMaterial ) {
216       fWorldMaterial = pttoMaterial;           << 306         fWorldMaterial = pttoMaterial;
217       G4RunManager::GetRunManager()->PhysicsHa << 307         G4RunManager::GetRunManager()->PhysicsHasBeenModified();
218     }                                          << 308      } else {
219     else {                                     << 309         G4cout << "\n--> WARNING from SetWorldMaterial : "
220       G4cout << "\n--> WARNING from SetWorldMa << 310                << materialChoice << " not found" << G4endl;
221              << G4endl;                        << 311      }
222     }                                          << 
223   }                                               312   }
224 }                                                 313 }
225                                                   314 
226 //....oooOO0OOooo........oooOO0OOooo........oo    315 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
227                                                   316 
228 void F04DetectorConstruction::SetTargetMateria    317 void F04DetectorConstruction::SetTargetMaterial(const G4String materialChoice)
229 {                                                 318 {
230   G4Material* pttoMaterial = G4NistManager::In << 319   G4Material* pttoMaterial =
                                                   >> 320       G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
231                                                   321 
232   if (pttoMaterial != fTargetMaterial) {          322   if (pttoMaterial != fTargetMaterial) {
233     if (pttoMaterial) {                        << 323      if ( pttoMaterial ) {
234       fTargetMaterial = pttoMaterial;          << 324         fTargetMaterial = pttoMaterial;
235       G4RunManager::GetRunManager()->PhysicsHa << 325         G4RunManager::GetRunManager()->PhysicsHasBeenModified();
236     }                                          << 326      } else {
237     else {                                     << 327         G4cout << "\n-->  WARNING from SetTargetMaterial : "
238       G4cout << "\n-->  WARNING from SetTarget << 328                << materialChoice << " not found" << G4endl;
239              << G4endl;                        << 329      }
240     }                                          << 
241   }                                               330   }
242 }                                                 331 }
243                                                   332 
244 //....oooOO0OOooo........oooOO0OOooo........oo    333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
245                                                   334 
246 void F04DetectorConstruction::SetDegraderMater    335 void F04DetectorConstruction::SetDegraderMaterial(const G4String materialChoice)
247                                                   336 
248 {                                                 337 {
249   G4Material* pttoMaterial = G4NistManager::In << 338   G4Material* pttoMaterial =
                                                   >> 339       G4NistManager::Instance()->FindOrBuildMaterial(materialChoice);
250                                                   340 
251   if (pttoMaterial != fDegraderMaterial) {        341   if (pttoMaterial != fDegraderMaterial) {
252     if (pttoMaterial) {                        << 342      if ( pttoMaterial ) {
253       fDegraderMaterial = pttoMaterial;        << 343         fDegraderMaterial = pttoMaterial;
254       G4RunManager::GetRunManager()->PhysicsHa << 344         G4RunManager::GetRunManager()->PhysicsHasBeenModified();
255     }                                          << 345      } else {
256     else {                                     << 346         G4cout << "\n--> WARNING from SetDegraderMaterial : "
257       G4cout << "\n--> WARNING from SetDegrade << 347                << materialChoice << " not found" << G4endl;
258              << G4endl;                        << 348      }
259     }                                          << 
260   }                                               349   }
261 }                                                 350 }
262                                                   351 
263 //....oooOO0OOooo........oooOO0OOooo........oo    352 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
264                                                   353 
265 void F04DetectorConstruction::SetWorldSizeZ(G4    354 void F04DetectorConstruction::SetWorldSizeZ(G4double val)
266 {                                                 355 {
267   fWorldSizeZ = val;                              356   fWorldSizeZ = val;
268   if (G4StateManager::GetStateManager()->GetCu << 357 
269     G4RunManager::GetRunManager()->GeometryHas << 358   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
                                                   >> 359     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 360   }
270 }                                                 361 }
271                                                   362 
272 //....oooOO0OOooo........oooOO0OOooo........oo    363 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
273                                                   364 
274 void F04DetectorConstruction::SetWorldSizeR(G4    365 void F04DetectorConstruction::SetWorldSizeR(G4double val)
275 {                                                 366 {
276   fWorldSizeR = val;                              367   fWorldSizeR = val;
277   if (G4StateManager::GetStateManager()->GetCu << 368   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
278     G4RunManager::GetRunManager()->GeometryHas << 369     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 370   }
279 }                                                 371 }
280                                                   372 
281 //....oooOO0OOooo........oooOO0OOooo........oo    373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
282                                                   374 
283 void F04DetectorConstruction::SetCaptureMgntRa    375 void F04DetectorConstruction::SetCaptureMgntRadius(G4double val)
284 {                                                 376 {
285   fCaptureMgntRadius = val;                       377   fCaptureMgntRadius = val;
286   if (G4StateManager::GetStateManager()->GetCu << 378   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
287     G4RunManager::GetRunManager()->GeometryHas << 379     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 380   }
288 }                                                 381 }
289                                                   382 
290 //....oooOO0OOooo........oooOO0OOooo........oo    383 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
291                                                   384 
292 void F04DetectorConstruction::SetCaptureMgntLe    385 void F04DetectorConstruction::SetCaptureMgntLength(G4double val)
293 {                                                 386 {
294   fCaptureMgntLength = val;                       387   fCaptureMgntLength = val;
295   if (G4StateManager::GetStateManager()->GetCu << 388   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
296     G4RunManager::GetRunManager()->GeometryHas << 389     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 390   }
297 }                                                 391 }
298                                                   392 
299 //....oooOO0OOooo........oooOO0OOooo........oo    393 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
300                                                   394 
301 void F04DetectorConstruction::SetCaptureMgntB1    395 void F04DetectorConstruction::SetCaptureMgntB1(G4double val)
302 {                                                 396 {
303   fCaptureMgntB1 = val;                           397   fCaptureMgntB1 = val;
304   if (G4StateManager::GetStateManager()->GetCu << 398   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
305     G4RunManager::GetRunManager()->GeometryHas << 399     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 400   }
306 }                                                 401 }
307                                                   402 
308 //....oooOO0OOooo........oooOO0OOooo........oo    403 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
309                                                   404 
310 void F04DetectorConstruction::SetCaptureMgntB2    405 void F04DetectorConstruction::SetCaptureMgntB2(G4double val)
311 {                                                 406 {
312   fCaptureMgntB2 = val;                           407   fCaptureMgntB2 = val;
313   if (G4StateManager::GetStateManager()->GetCu << 408   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
314     G4RunManager::GetRunManager()->GeometryHas << 409     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 410   }
315 }                                                 411 }
316                                                   412 
317 //....oooOO0OOooo........oooOO0OOooo........oo    413 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
318                                                   414 
319 void F04DetectorConstruction::SetTransferMgntR    415 void F04DetectorConstruction::SetTransferMgntRadius(G4double val)
320 {                                                 416 {
321   fTransferMgntRadius = val;                      417   fTransferMgntRadius = val;
322   if (G4StateManager::GetStateManager()->GetCu << 418   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
323     G4RunManager::GetRunManager()->GeometryHas << 419     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 420   }
324 }                                                 421 }
325                                                   422 
326 //....oooOO0OOooo........oooOO0OOooo........oo    423 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
327                                                   424 
328 void F04DetectorConstruction::SetTransferMgntL    425 void F04DetectorConstruction::SetTransferMgntLength(G4double val)
329 {                                                 426 {
330   fTransferMgntLength = val;                      427   fTransferMgntLength = val;
331   if (G4StateManager::GetStateManager()->GetCu << 428   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
332     G4RunManager::GetRunManager()->GeometryHas << 429     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 430   }
333 }                                                 431 }
334                                                   432 
335 //....oooOO0OOooo........oooOO0OOooo........oo    433 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
336                                                   434 
337 void F04DetectorConstruction::SetTransferMgntB    435 void F04DetectorConstruction::SetTransferMgntB(G4double val)
338 {                                                 436 {
339   fTransferMgntB = val;                           437   fTransferMgntB = val;
340   if (G4StateManager::GetStateManager()->GetCu << 438   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
341     G4RunManager::GetRunManager()->GeometryHas << 439     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 440   }
342 }                                                 441 }
343                                                   442 
344 //....oooOO0OOooo........oooOO0OOooo........oo    443 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
345                                                   444 
346 void F04DetectorConstruction::SetTransferMgntP    445 void F04DetectorConstruction::SetTransferMgntPos(G4double val)
347 {                                                 446 {
348   fTransferMgntPos = val;                         447   fTransferMgntPos = val;
349   if (G4StateManager::GetStateManager()->GetCu << 448   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
350     G4RunManager::GetRunManager()->GeometryHas << 449     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 450   }
351 }                                                 451 }
352                                                   452 
353 //....oooOO0OOooo........oooOO0OOooo........oo    453 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
354                                                   454 
355 void F04DetectorConstruction::SetTargetRadius(    455 void F04DetectorConstruction::SetTargetRadius(G4double val)
356 {                                                 456 {
357   fTargetRadius = val;                            457   fTargetRadius = val;
358   if (G4StateManager::GetStateManager()->GetCu << 458   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
359     G4RunManager::GetRunManager()->GeometryHas << 459     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 460   }
360 }                                                 461 }
361                                                   462 
362 //....oooOO0OOooo........oooOO0OOooo........oo    463 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
363                                                   464 
364 void F04DetectorConstruction::SetTargetThickne    465 void F04DetectorConstruction::SetTargetThickness(G4double val)
365 {                                                 466 {
366   fTargetThickness = val;                         467   fTargetThickness = val;
367   if (G4StateManager::GetStateManager()->GetCu << 468   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
368     G4RunManager::GetRunManager()->GeometryHas << 469     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 470   }
369 }                                                 471 }
370                                                   472 
371 //....oooOO0OOooo........oooOO0OOooo........oo    473 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
372                                                   474 
373 void F04DetectorConstruction::SetTargetPos(G4d    475 void F04DetectorConstruction::SetTargetPos(G4double val)
374 {                                                 476 {
375   fTargetPos = val;                               477   fTargetPos = val;
376   if (G4StateManager::GetStateManager()->GetCu << 478   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
377     G4RunManager::GetRunManager()->GeometryHas << 479     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 480   }
378 }                                                 481 }
379                                                   482 
380 //....oooOO0OOooo........oooOO0OOooo........oo    483 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
381                                                   484 
382 void F04DetectorConstruction::SetTargetAngle(G    485 void F04DetectorConstruction::SetTargetAngle(G4int val)
383 {                                                 486 {
384   fTargetAngle = val;                             487   fTargetAngle = val;
385   if (G4StateManager::GetStateManager()->GetCu << 488   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
386     G4RunManager::GetRunManager()->GeometryHas << 489     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 490   }
387 }                                                 491 }
388                                                   492 
389 //....oooOO0OOooo........oooOO0OOooo........oo    493 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
390                                                   494 
391 void F04DetectorConstruction::SetDegraderRadiu    495 void F04DetectorConstruction::SetDegraderRadius(G4double val)
392 {                                                 496 {
393   fDegraderRadius = val;                          497   fDegraderRadius = val;
394   if (G4StateManager::GetStateManager()->GetCu << 498   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
395     G4RunManager::GetRunManager()->GeometryHas << 499     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 500   }
396 }                                                 501 }
397                                                   502 
398 //....oooOO0OOooo........oooOO0OOooo........oo    503 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
399                                                   504 
400 void F04DetectorConstruction::SetDegraderThick    505 void F04DetectorConstruction::SetDegraderThickness(G4double val)
401 {                                                 506 {
402   fDegraderThickness = val;                       507   fDegraderThickness = val;
403   if (G4StateManager::GetStateManager()->GetCu << 508   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
404     G4RunManager::GetRunManager()->GeometryHas << 509     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 510   }
405 }                                                 511 }
406                                                   512 
407 //....oooOO0OOooo........oooOO0OOooo........oo    513 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
408                                                   514 
409 void F04DetectorConstruction::SetDegraderPos(G    515 void F04DetectorConstruction::SetDegraderPos(G4double val)
410 {                                                 516 {
411   fDegraderPos = val;                             517   fDegraderPos = val;
412   if (G4StateManager::GetStateManager()->GetCu << 518   if ( G4StateManager::GetStateManager()->GetCurrentState() != G4State_PreInit ) {
413     G4RunManager::GetRunManager()->GeometryHas << 519     G4RunManager::GetRunManager()->ReinitializeGeometry();
                                                   >> 520   }
414 }                                                 521 }
415                                                   522 
416 //....oooOO0OOooo........oooOO0OOooo........oo    523 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
417                                                   524 
418 void F04DetectorConstruction::ConstructSDandFi    525 void F04DetectorConstruction::ConstructSDandField()
419 {                                                 526 {
420   if (!fFieldSetUp.Get()) {                       527   if (!fFieldSetUp.Get()) {
421     F04GlobalField* field = F04GlobalField::Ge << 528      F04GlobalField* field = F04GlobalField::GetObject(this);
422     G4AutoDelete::Register(field);  // Kernel  << 529      G4AutoDelete::Register(field);  // Kernel will delete the F04GlobalField
423     fFieldSetUp.Put(field);                    << 530      fFieldSetUp.Put(field);
424   }                                               531   }
425 }                                                 532 }
426                                                   533 
427 //....oooOO0OOooo........oooOO0OOooo........oo    534 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
428                                                   535 
429 G4RotationMatrix F04DetectorConstruction::Stri << 536 G4RotationMatrix
                                                   >> 537             F04DetectorConstruction::StringToRotationMatrix(G4String rotation)
430 {                                                 538 {
431   // We apply successive rotations OF THE OBJE    539   // We apply successive rotations OF THE OBJECT around the FIXED
432   // axes of the parent's local coordinates; r    540   // axes of the parent's local coordinates; rotations are applied
433   // left-to-right (rotation="r1,r2,r3" => r1     541   // left-to-right (rotation="r1,r2,r3" => r1 then r2 then r3).
434                                                   542 
435   G4RotationMatrix rot;                           543   G4RotationMatrix rot;
436                                                   544 
437   unsigned int place = 0;                         545   unsigned int place = 0;
438                                                   546 
439   while (place < rotation.size()) {               547   while (place < rotation.size()) {
440     G4double angle;                            << 548 
441     char* p(nullptr);                          << 549         G4double angle;
442     G4String current = rotation.substr(place + << 550         char* p(0);
443     angle = strtod(current.c_str(), &p) * deg; << 551         G4String current=rotation.substr(place+1);
444                                                << 552         angle = strtod(current.c_str(),&p) * deg;
445     if (!p || (*p != ',' && *p != '\0')) {     << 553 
446       G4cerr << "Invalid rotation specificatio << 554         if (!p || (*p != ',' && *p != '\0')) {
447                                                << 555           G4cerr << "Invalid rotation specification: " <<
448       return rot;                              << 556                                                   rotation.c_str() << G4endl;
449     }                                          << 557 
450                                                << 558            return rot;
451     G4RotationMatrix thisRotation;             << 559         }
452                                                << 560 
453     switch (rotation.substr(place, 1).c_str()[ << 561         G4RotationMatrix thisRotation;
454       case 'X':                                << 562 
455       case 'x':                                << 563         switch(rotation.substr(place,1).c_str()[0]) {
456         thisRotation = G4RotationMatrix(CLHEP: << 564               case 'X': case 'x':
457         break;                                 << 565                 thisRotation = G4RotationMatrix(CLHEP::HepRotationX(angle));
458       case 'Y':                                << 566                 break;
459       case 'y':                                << 567               case 'Y': case 'y':
460         thisRotation = G4RotationMatrix(CLHEP: << 568                 thisRotation = G4RotationMatrix(CLHEP::HepRotationY(angle));
461         break;                                 << 569                 break;
462       case 'Z':                                << 570               case 'Z': case 'z':
463       case 'z':                                << 571                 thisRotation = G4RotationMatrix(CLHEP::HepRotationZ(angle));
464         thisRotation = G4RotationMatrix(CLHEP: << 572                 break;
465         break;                                 << 573               default:
466       default:                                 << 574                 G4cerr << " Invalid rotation specification: "
467         G4cerr << " Invalid rotation specifica << 575                        << rotation << G4endl;
468         return rot;                            << 576                 return rot;
469     }                                          << 577         }
470                                                << 578 
471     rot = thisRotation * rot;                  << 579        rot = thisRotation * rot;
472     place = rotation.find(',', place);         << 580        place = rotation.find(',',place);
473     if (place > rotation.size()) break;        << 581        if (place > rotation.size()) break;
474     ++place;                                   << 582        ++place;
475   }                                               583   }
476                                                   584 
477   return rot;                                     585   return rot;
                                                   >> 586 
478 }                                                 587 }
479                                                   588