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 //  29 Aug 2003  Alfonso Mantero created
0034 //
0035 // -------------------------------------------------------------------
0036 
0037 
0038 #include "XrayFluoPlaneDetectorMessenger.hh"
0039 #include "XrayFluoPlaneDetectorConstruction.hh"
0040 #include "G4RunManager.hh"
0041 #include "G4UIdirectory.hh"
0042 #include "G4UIcmdWithAString.hh"
0043 #include "G4UIcmdWithADoubleAndUnit.hh"
0044 #include "G4UIcmdWithoutParameter.hh"
0045 #include "G4UIcmdWithABool.hh"
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0048 
0049 XrayFluoPlaneDetectorMessenger::XrayFluoPlaneDetectorMessenger(XrayFluoPlaneDetectorConstruction * 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/planeMaterial",this);
0063   sampleCmd->SetGuidance("select a diferent material for the plane");
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   grainDiaCmd = new G4UIcmdWithADoubleAndUnit( "/apparate/GrainDiameter",this );
0077   grainDiaCmd->SetGuidance( "Set diameter of grains" );
0078   grainDiaCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0079   grainDiaCmd->SetGuidance( "Default: 0.5 mm " );
0080   grainDiaCmd->SetParameterName( "Grain Diameter", true, true );
0081   grainDiaCmd->SetDefaultUnit( "mm" );
0082   grainDiaCmd->SetUnitCategory( "Length" );
0083   grainDiaCmd->AvailableForStates(G4State_Idle);
0084 
0085   granularityFlagCmd= new G4UIcmdWithABool("/apparate/sampleGranularity",this);
0086   granularityFlagCmd->SetGuidance("Set if sample granularity is present");
0087   granularityFlagCmd->SetGuidance( "After this, /apparate/update must be executed before BeamOn" );
0088   granularityFlagCmd->SetParameterName("Granularity Flag",true);
0089   granularityFlagCmd->SetDefaultValue(false);
0090   granularityFlagCmd->AvailableForStates(G4State_Idle);
0091 
0092 }
0093 
0094 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0095 
0096  XrayFluoPlaneDetectorMessenger::~XrayFluoPlaneDetectorMessenger()
0097 {
0098   delete UpdateCmd;
0099   delete detDir;
0100 }
0101 
0102 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0103 
0104 void XrayFluoPlaneDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0105 {
0106  if( command == UpdateCmd )
0107    { 
0108      //This triggers a full re-build of the geometry. The method in the 
0109      //geometry will take care of that.
0110      Detector->UpdateGeometry(); 
0111      return;
0112    }
0113  else if ( command == sampleCmd )
0114    { 
0115      Detector->SetPlaneMaterial(newValue);
0116    }
0117  else if ( command == detectorCmd )
0118    { 
0119      Detector->SetDetectorType(newValue);
0120    }
0121  else if ( command == grainDiaCmd )
0122    {  
0123      G4double newSize = grainDiaCmd->GetNewDoubleValue(newValue);  
0124      Detector->SetGrainDia(newSize);
0125    }
0126  else if ( command == granularityFlagCmd )
0127    { 
0128      Detector->DeleteGrainObjects();
0129      G4bool newGranFlag = granularityFlagCmd->GetNewBoolValue(newValue);
0130      Detector->SetPlaneGranularity(newGranFlag);
0131    }
0132  //Notify the run manager that the geometry has been modified
0133  G4RunManager::GetRunManager()->GeometryHasBeenModified();
0134  
0135 }
0136 
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0139 
0140 
0141 
0142 
0143 
0144 
0145 
0146 
0147