Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:17:10

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
0029 //
0030 // History:
0031 // -----------
0032 //
0033 //  18 Sep 2003  Alfonso Mantero created
0034 //
0035 // -------------------------------------------------------------------
0036 
0037 
0038 #include "XrayFluoMercuryDetectorMessenger.hh"
0039 #include "XrayFluoMercuryDetectorConstruction.hh"
0040 #include "G4UIdirectory.hh"
0041 #include "G4UIcmdWithAString.hh"
0042 #include "G4UIcmdWithADoubleAndUnit.hh"
0043 #include "G4UIcmdWithoutParameter.hh"
0044 #include "G4UIcmdWithABool.hh"
0045 #include "G4RunManager.hh"
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0048 
0049 XrayFluoMercuryDetectorMessenger::XrayFluoMercuryDetectorMessenger(XrayFluoMercuryDetectorConstruction * Det)
0050 :Detector(Det)
0051 { 
0052   detDir = new G4UIdirectory("/apparate/");
0053   detDir->SetGuidance("detector control.");
0054 
0055   UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
0056   UpdateCmd->SetGuidance("Update apparate geometry.");
0057   UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0058   UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
0059 
0060   UpdateCmd->AvailableForStates(G4State_Idle);
0061 
0062   sampleCmd = new G4UIcmdWithAString("/apparate/mercuryMaterial",this);
0063   sampleCmd->SetGuidance("select a diferent material for the mercury");
0064   sampleCmd->SetParameterName("material",true);
0065   sampleCmd->SetDefaultValue("mars1");
0066   sampleCmd->SetCandidates("Dolorite Anorthosite Mars1 IceBasalt");
0067   sampleCmd->AvailableForStates(G4State_Idle);
0068 
0069   detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
0070   detectorCmd->SetGuidance("select a diferent detectorType");
0071   detectorCmd->SetParameterName("detector",true);
0072   detectorCmd->SetDefaultValue("sili");
0073   detectorCmd->SetCandidates("sili hpge");
0074   detectorCmd->AvailableForStates(G4State_Idle);
0075   
0076   latitudeAngleCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/latitude",this );
0077   latitudeAngleCmd->SetGuidance( "Set latitude angle of the spacecraft" );
0078   latitudeAngleCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0079   latitudeAngleCmd->SetGuidance( "Default: 45 deg " );
0080   latitudeAngleCmd->SetParameterName( "Latitude Angle", true, true );
0081   latitudeAngleCmd->SetDefaultUnit( "deg" );
0082   latitudeAngleCmd->SetUnitCategory( "Angle" );
0083   latitudeAngleCmd->AvailableForStates(G4State_Idle);
0084 
0085   orbitHeightCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/orbitHeight",this );
0086   orbitHeightCmd->SetGuidance( "Set height of the spacecraft above Mercury Surface" );
0087   orbitHeightCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0088   orbitHeightCmd->SetGuidance( "Default: 400 km " );
0089   orbitHeightCmd->SetParameterName( "Spacecraft Altitude", true, true );
0090   orbitHeightCmd->SetDefaultUnit( "km" );
0091   orbitHeightCmd->SetUnitCategory( "Length" );
0092   orbitHeightCmd->AvailableForStates(G4State_Idle);
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0096 
0097  XrayFluoMercuryDetectorMessenger::~XrayFluoMercuryDetectorMessenger()
0098 {
0099   delete UpdateCmd;
0100   delete detDir;
0101 }
0102 
0103 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0104 
0105 void XrayFluoMercuryDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0106 {
0107  if( command == UpdateCmd )
0108    { 
0109      //This triggers a full re-build of the geometry. The method in the 
0110      //geometry will take care of that.
0111      Detector->UpdateGeometry(); 
0112      return;
0113    }
0114  else if ( command == sampleCmd )
0115    { Detector->SetMercuryMaterial(newValue);}
0116 
0117  else if ( command == detectorCmd )
0118    { Detector->SetDetectorType(newValue);}
0119 
0120  else if ( command == latitudeAngleCmd )
0121    {  
0122      G4double newAngle = latitudeAngleCmd->GetNewDoubleValue(newValue);  
0123      Detector->SetLatitude(newAngle);
0124    }
0125 
0126  else if ( command == orbitHeightCmd )
0127    {  
0128      G4double newAngle = orbitHeightCmd->GetNewDoubleValue(newValue);  
0129      Detector->SetOribitHeight(newAngle);
0130    }
0131  //Notify the run manager that the geometry has been modified
0132  G4RunManager::GetRunManager()->GeometryHasBeenModified();
0133  
0134 }
0135 
0136 
0137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0138 
0139 
0140 
0141 
0142 
0143 
0144 
0145 
0146