60                          solidMod1(0),         logicMod1(0),          physiMod1(0),
 
   61                          solidMod2(0),         logicMod2(0),          physiMod2(0),
 
   62                          solidMod3(0),         logicMod3(0),          physiMod3(0),
 
   63                          solidMod4(0),         logicMod4(0),          physiMod4(0),
 
   64                          FileName(
"ModoulWeight.txt")
 
   69    StepThickness=
new G4double[StepNumbers];
 
   70    StartingAngle=
new G4double[StepNumbers];
 
   71    SpanningAngle=
new G4double[StepNumbers];
 
   75    solidMod=
new G4Tubs *[StepNumbers];
 
   79    for (
G4int i=0;i<StepNumbers;i++)
 
   91   for (
G4int i=0;i<4*(StepNumbers-1)+1;i++)
 
  108   delete [] StepThickness;
 
  109   delete [] StartingAngle;
 
  110   delete [] SpanningAngle;
 
  111   delete [] PositionMod;
 
  115   delete ModulatorMessenger;
 
  125  StepThickness[0]=0; Weight[0]=.14445;  
 
  126  StepThickness[1]=.8; Weight[1]=.05665; 
 
  127  StepThickness[2]=1.6; Weight[2]=.05049;
 
  128  StepThickness[3]=2.4; Weight[3]=.04239;
 
  129  StepThickness[4]=3.2; Weight[4]=.04313;
 
  130  StepThickness[5]=4.0; Weight[5]=.03879;
 
  131  StepThickness[6]=4.8; Weight[6]=.04182;
 
  132  StepThickness[7]=5.6; Weight[7]=.03422;
 
  133  StepThickness[8]=6.4; Weight[8]=.03469;
 
  134  StepThickness[9]=7.2; Weight[9]=.03589;
 
  135  StepThickness[10]=8.0; Weight[10]=.03633;
 
  136  StepThickness[11]=8.8; Weight[11]=.03842;
 
  137  StepThickness[12]=9.6; Weight[12]=.03688;
 
  138  StepThickness[13]=10.4; Weight[13]=.03705;
 
  139  StepThickness[14]=11.2; Weight[14]=.03773;
 
  140  StepThickness[15]=12.0; Weight[15]=.03968;
 
  141  StepThickness[16]=12.8; Weight[16]=.04058;
 
  142  StepThickness[17]=13.6; Weight[17]=.03903;
 
  143  StepThickness[18]=14.4; Weight[18]=.04370;
 
  144  StepThickness[19]=15.2; Weight[19]=.03981;
 
  145  StepThickness[20]=16.0; Weight[20]=.05226;
 
  146  StepThickness[21]=16.8; Weight[21]=.03603;
 
  154   delete [] StepThickness;
 
  155   delete [] StartingAngle;
 
  156   delete [] SpanningAngle;
 
  157   delete [] PositionMod;
 
  174   File.open(Name,  std::ios::in);
 
  177   G4cout<<
" WARNING: The File with name of "<<Name<<
 
  178  " doesn't exist to get modulator step properties. please modify it and try again"<<
G4endl;
 
  180  G4Exception(
"HadrontherapyModulator::ModulatorPropertiesFromFile( )", 
"Hadrontherapy0009" 
  181  , 
FatalException, 
"Error: No available external file for reading from");
 
  185   File >>
string>> StepNumbers;
 
  186   File >>
string>>
string>>string;
 
  190    StepThickness=
new G4double[StepNumbers];
 
  191    StartingAngle=
new G4double[StepNumbers];
 
  192    SpanningAngle=
new G4double[StepNumbers];
 
  196    solidMod=
new G4Tubs *[StepNumbers];
 
  200   for(
G4int i=0;i<StepNumbers;i++)
 
  203      File>>stringX>> StepThickness[i]>>Weight[i];  
 
  218  for(
G4int i=0;i<StepNumbers;i++)
 
  220      TotalWeight+=Weight[i];
 
  223  for(
G4int i=0;i<StepNumbers;i++)
 
  225    Weight[i]=Weight[i]/TotalWeight;
 
  230   StartingAngle[0]=0 *
deg;
 
  231   SpanningAngle[0]=90 *
deg;
 
  235   for(
G4int i=1;i<StepNumbers;i++)
 
  237       StartingAngle[i]=WholeStartingAngle+(Weight[i-1]*(2*pi))/8;
 
  238       SpanningAngle[i]=90* 
deg -2*StartingAngle[i];
 
  239       StepThickness[i]=StepThickness[i]-WholeThickness;
 
  240       PositionModx=WholeThickness+StepThickness[i]/2.;
 
  242       WholeThickness+=StepThickness[i];
 
  243       WholeStartingAngle=StartingAngle[i];
 
  258   innerRadiusOfTheTube = 2.5 *
cm;
 
  259   outerRadiusOfTheTube = 9.5 *
cm;
 
  266   logicMotherMod = 
new G4LogicalVolume(solidMotherMod, Mod0Mater,
"MotherMod",0,0,0);
 
  268   physiMotherMod = 
new G4PVPlacement(rm,positionMotherMod,  
"MotherMod", 
 
  294   solidMod1 = 
new G4Tubs(
"Mod1",
 
  295              innerRadiusOfTheTube, 
 
  296              outerRadiusOfTheTube,
 
  298              startAngleOfTheTube0, 
 
  299              spanningAngleOfTheTube0);
 
  314   for (
G4int i=1;i<StepNumbers;i++)
 
  317   solidMod[i] = 
new G4Tubs(
"Modstep",
 
  318              innerRadiusOfTheTube, 
 
  319              outerRadiusOfTheTube,
 
  325                                    ModMater, 
"Modstep",0,0,0);
 
  349   solidMod2 = 
new G4Tubs(
"Mod2",
 
  350               innerRadiusOfTheTube, 
 
  351               outerRadiusOfTheTube,
 
  353               startAngleOfTheTube0, 
 
  354               spanningAngleOfTheTube0);
 
  357                                   Mod0Mater, 
"Mod2",0,0,0);
 
  368     for (
G4int i=1;i<StepNumbers;i++)
 
  393   solidMod3 = 
new G4Tubs(
"Mod3",
 
  394               innerRadiusOfTheTube, 
 
  395               outerRadiusOfTheTube,
 
  397               startAngleOfTheTube0/2., 
 
  398               spanningAngleOfTheTube0);
 
  401                                   Mod0Mater, 
"Mod3",0,0,0);
 
  414  for (
G4int i=1;i<StepNumbers;i++)
 
  437   solidMod4 = 
new G4Tubs(
"Mod4",
 
  438               innerRadiusOfTheTube, 
 
  439               outerRadiusOfTheTube,
 
  441               startAngleOfTheTube0/2., 
 
  442               spanningAngleOfTheTube0);
 
  445                                   Mod0Mater, 
"Mod4",0,0,0);
 
  456 for (
G4int i=1;i<StepNumbers;i++)
 
  470   red-> SetVisibility(
true);
 
  471   red-> SetForceSolid(
true);
 
  479   for (
G4int i=1;i<StepNumbers;i++)
 
  481      logicMod[i] -> SetVisAttributes(red); 
 
  492   rm -> rotateZ(rotationAngle);
 
  493   physiMotherMod -> SetRotation(rm);  
 
  494   G4cout << 
"MODULATOR HAS BEEN ROTATED OF " << rotationAngle/
deg  
  506         for(
G4int i=1;i<StepNumbers;i++)
 
  514     G4cout << 
"The material of the Modulator wheel has been changed to " << Material << 
G4endl;
 
  519     G4cout << 
"WARNING: material \"" << Material << 
"\" doesn't exist in NIST elements/materials" 
  520         " table [located in $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc]" << 
G4endl; 
 
  521     G4cout << 
"Use command \"/parameter/nist\" to see full materials list!" << 
G4endl; 
 
  532   physiMotherMod -> SetTranslation( NewModulatorPos); 
 
  534   G4cout << 
"The modulator wheel is translated to"<<  NewModulatorPos/
mm <<
"mm " <<
G4endl;
 
  541 solidMod1 -> SetInnerRadius(newvalue);
 
  542 solidMod2 -> SetInnerRadius(newvalue);
 
  543 solidMod3 -> SetInnerRadius(newvalue);
 
  544 solidMod4 -> SetInnerRadius(newvalue);
 
  545  for(
G4int i=1;i<StepNumbers;i++)
 
  547  solidMod[i] -> SetInnerRadius(newvalue);}
 
  549   G4cout << 
"InnerRadius of the Modulator Wheel has been changed to :" 
  556 solidMod1 -> SetOuterRadius(newvalue);
 
  557 solidMod2 -> SetOuterRadius(newvalue);
 
  558 solidMod3 -> SetOuterRadius(newvalue);
 
  559 solidMod4 -> SetOuterRadius(newvalue);
 
  560  for(
G4int i=1;i<StepNumbers;i++)
 
  562  solidMod[i] -> SetOuterRadius(newvalue);}
 
  564   G4cout << 
"OuterRadius of the Modulator Wheel has been changed to :" 
  572 if(value==
"default" )   
 
  576 G4cout<<
" Step properties of modulator will be get out from the external file " 
void ModulatorDefaultProperties()
 
void SetModulatorPosition(G4ThreeVector)
 
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
 
void GetDataFromFile(G4String value)
 
static constexpr double mm
 
void SetModulatorInnerRadius(G4double)
 
CLHEP::Hep3Vector G4ThreeVector
 
CLHEP::HepRotation G4RotationMatrix
 
void SetModulatorOuterRadius(G4double)
 
static G4double angle[DIM]
 
void GetStepInformation()
 
static G4NistManager * Instance()
 
G4GLOB_DLL std::ostream G4cout
 
const XML_Char int const XML_Char * value
 
void BuildModulator(G4VPhysicalVolume *)
 
static constexpr double cm
 
void SetModulatorMaterial(G4String)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
static G4RunManager * GetRunManager()
 
static const G4VisAttributes Invisible
 
HepRotation & rotateZ(double delta)
 
~HadrontherapyModulator()
 
void ModulatorPropertiesFromFile(G4String)
 
static constexpr double deg
 
void SetModulatorAngle(G4double)
 
void SetVisAttributes(const G4VisAttributes *pVA)