Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:20

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 /// \file DetectorMessenger.cc
0028 /// \brief Implementation of the DetectorMessenger class
0029 
0030 #include "DetectorMessenger.hh"
0031 
0032 #include "DetectorConstruction.hh"
0033 
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIdirectory.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 DetectorMessenger::DetectorMessenger(DetectorConstruction* detectorConstruction)
0040   : fDetectorConstruction(detectorConstruction)
0041 {
0042   fDirectory = new G4UIdirectory("/placement/");
0043   fDirectory->SetGuidance("Transform example detector control");
0044 
0045   fSetMethodCmd = new G4UIcmdWithAString("/placement/setMethod", this);
0046   fSetMethodCmd->SetGuidance("Select method for definition of transformations.");
0047   fSetMethodCmd->SetParameterName("Method", false);
0048   fSetMethodCmd->SetCandidates(
0049     "WithDirectMatrix WithInverseMatrix WithAxialRotations WithEulerAngles WithReflections");
0050   fSetMethodCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0051 }
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0054 
0055 DetectorMessenger::~DetectorMessenger()
0056 {
0057   delete fDirectory;
0058   delete fSetMethodCmd;
0059 }
0060 
0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0062 
0063 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0064 {
0065   if (command == fSetMethodCmd) {
0066     DetectorConstruction::EMethod method;
0067     if (newValue == "WithDirectMatrix")
0068       method = DetectorConstruction::kWithDirectMatrix;
0069     else if (newValue == "WithInverseMatrix")
0070       method = DetectorConstruction::kWithInverseMatrix;
0071     else if (newValue == "WithAxialRotations")
0072       method = DetectorConstruction::kWithAxialRotations;
0073     else if (newValue == "WithEulerAngles")
0074       method = DetectorConstruction::kWithEulerAngles;
0075     else if (newValue == "WithReflections")
0076       method = DetectorConstruction::kWithReflections;
0077     else
0078       return;
0079     fDetectorConstruction->SetMethod(method);
0080   }
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......