Back to home page

EIC code displayed by LXR

 
 

    


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

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: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
0029 //
0030 // History:
0031 // -----------
0032 // 28 Nov 2001 Elena Guardincerri     Created
0033 //
0034 // -------------------------------------------------------------------
0035 
0036 #include "XrayFluoDetectorMessenger.hh"
0037 #include "XrayFluoDetectorConstruction.hh"
0038 #include "G4RunManager.hh"
0039 #include "G4UIdirectory.hh"
0040 #include "G4UIcmdWithAString.hh"
0041 #include "G4UIcmdWithADoubleAndUnit.hh"
0042 #include "G4UIcmdWithoutParameter.hh"
0043 #include "G4UIcmdWithABool.hh"
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0046 
0047 XrayFluoDetectorMessenger::XrayFluoDetectorMessenger(XrayFluoDetectorConstruction * Det)
0048 :Detector(Det)
0049 { 
0050   detDir = new G4UIdirectory("/apparate/");
0051   detDir->SetGuidance("detector control.");
0052 
0053   UpdateCmd = new G4UIcmdWithoutParameter("/apparate/update",this);
0054   UpdateCmd->SetGuidance("Update apparate geometry.");
0055   UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0056   UpdateCmd->SetGuidance("if you changed geometrical value(s): /apparate/GrainDiameter and /apparate/sampleGranularity");
0057 
0058   UpdateCmd->AvailableForStates(G4State_Idle);
0059 
0060   sampleCmd = new G4UIcmdWithAString("/apparate/sampleMaterial",this);
0061   sampleCmd->SetGuidance("select a diferent material for the sample: materials can be: Dolorite, Anorthosite, Mars1, HawaiianWD, HawaiianRF, IceBasalt, IcelandicWD, IcelandicRF, Gabbro, GabbroWD, GabbroRF, HPGe OR choosen from Nist database (see /material/nist/listMaterials for details");
0062   sampleCmd->SetParameterName("material",true);
0063   sampleCmd->SetDefaultValue("mars1");
0064   sampleCmd->AvailableForStates(G4State_Idle);
0065 
0066   detectorCmd = new G4UIcmdWithAString("/apparate/detector",this);
0067   detectorCmd->SetGuidance("select a diferent detectorType");
0068   detectorCmd->SetParameterName("detector",true);
0069   detectorCmd->SetDefaultValue("sili");
0070   detectorCmd->SetCandidates("sili hpge");
0071   detectorCmd->AvailableForStates(G4State_Idle);
0072   
0073   grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
0074   grainDiaCmd->SetGuidance( "Set diameter of grains" );
0075   grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0076   grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
0077   grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
0078   grainDiaCmd->SetDefaultUnit( "mm" );
0079   grainDiaCmd->SetUnitCategory( "Length" );
0080   grainDiaCmd->AvailableForStates(G4State_Idle);
0081 
0082   granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
0083   granularityFlagCmd->SetGuidance("Set if sample granularity is present");
0084   granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0085   granularityFlagCmd->SetParameterName("Granularity Flag",true);
0086   granularityFlagCmd->SetDefaultValue(false);
0087   granularityFlagCmd->AvailableForStates(G4State_Idle);
0088 
0089   OhmicPosThicknessCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/ohmicPosThickness",this );
0090   OhmicPosThicknessCmd->SetGuidance( "Changes thickness of the detector anode" );
0091   OhmicPosThicknessCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0092   OhmicPosThicknessCmd->SetGuidance( "Default: 0.005 mm " );
0093   OhmicPosThicknessCmd->SetParameterName( "OhmicPos Thickness", true, true );
0094   OhmicPosThicknessCmd->SetDefaultUnit( "mm" );
0095   OhmicPosThicknessCmd->SetUnitCategory( "Length" );
0096   OhmicPosThicknessCmd->AvailableForStates(G4State_Idle);
0097 }
0098 
0099 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0100 
0101  XrayFluoDetectorMessenger::~XrayFluoDetectorMessenger()
0102 {
0103   delete UpdateCmd;
0104   delete detDir;
0105 }
0106 
0107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0108 
0109 void XrayFluoDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0110 {
0111  if( command == UpdateCmd )
0112    { 
0113      //This triggers a full re-build of the geometry. The method in the 
0114      //geometry will take care of that.
0115      Detector->UpdateGeometry(); 
0116      return;
0117    }
0118  else if ( command == sampleCmd )
0119    { 
0120      Detector->SetSampleMaterial(newValue);
0121    }
0122 
0123  else if ( command == detectorCmd )
0124    { 
0125      Detector->SetDetectorType(newValue);     
0126    }
0127  else if ( command == grainDiaCmd )
0128    {  
0129      G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);  
0130      Detector->SetGrainDia(newSize);
0131    }
0132 
0133  else if ( command == granularityFlagCmd )
0134    { 
0135      Detector->DeleteGrainObjects();
0136      G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
0137      Detector->SetSampleGranularity(newGranFlag);
0138    }
0139  else if ( command == OhmicPosThicknessCmd )
0140    {  
0141      G4double newSize = OhmicPosThicknessCmd->GetNewDoubleValue(newValue);  
0142      Detector->SetOhmicPosThickness(newSize);
0143    }
0144  //Notify the run manager that the geometry has been modified
0145  G4RunManager::GetRunManager()->GeometryHasBeenModified();
0146 }
0147 
0148 
0149 
0150 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0151 
0152 
0153 
0154 
0155 
0156 
0157 
0158 
0159