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.2.1)


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