Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/underground_physics/src/DMXDetectorMessenger.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 //   GEANT 4 - Underground Dark Matter Detector Advanced Example
0029 //
0030 //      For information related to this code contact: Alex Howard
0031 //      e-mail: alexander.howard@cern.ch
0032 // --------------------------------------------------------------
0033 // Comments
0034 //
0035 //                  Underground Advanced
0036 //               by A. Howard and H. Araujo 
0037 //                    (27th November 2001)
0038 //
0039 // SteppingActionMessenger program
0040 // --------------------------------------------------------------
0041 
0042 #include "DMXDetectorMessenger.hh"
0043 
0044 #include "DMXDetectorConstruction.hh"
0045 
0046 #include "globals.hh"
0047 #include "G4UIdirectory.hh"
0048 #include "G4UIcmdWithADoubleAndUnit.hh"
0049 #include "G4UIcmdWithoutParameter.hh"
0050 
0051 #include "G4RunManager.hh"
0052 
0053 
0054 DMXDetectorMessenger::DMXDetectorMessenger
0055    (DMXDetectorConstruction* DC):detectorConstruction(DC) {
0056 
0057   RoomEKineCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/RoomMinEnergyCut",this);
0058   RoomEKineCutCmd->SetGuidance("Minimum Charged particle cut in ROOM");
0059   RoomEKineCutCmd->SetParameterName("ECut",false,false);
0060   RoomEKineCutCmd->SetRange("ECut>=250.0*eV");
0061   RoomEKineCutCmd->SetDefaultUnit("eV");
0062   RoomEKineCutCmd->SetUnitCategory("Energy");
0063   RoomEKineCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0064 
0065   EKineCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/MinEnergyCut",this);
0066   EKineCutCmd->SetGuidance("Minimum Charged particle cut inside detector");
0067   EKineCutCmd->SetParameterName("ECut",false,false);
0068   EKineCutCmd->SetRange("ECut>=250.0*eV");
0069   EKineCutCmd->SetDefaultUnit("eV");
0070   EKineCutCmd->SetUnitCategory("Energy");
0071   EKineCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0072 
0073   RoomTimeCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/RoomTimeCut",this);
0074   RoomTimeCutCmd->SetGuidance("Set Time Cut (for neutrons) inside ROOM");
0075   RoomTimeCutCmd->SetParameterName("RTCut",false,false);
0076   RoomTimeCutCmd->SetRange("RTCut>0.");
0077   RoomTimeCutCmd->SetDefaultUnit("ns");
0078   RoomTimeCutCmd->SetUnitCategory("Time");
0079   RoomTimeCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0080 
0081   TimeCutCmd = new G4UIcmdWithADoubleAndUnit("/dmx/TimeCut",this);
0082   TimeCutCmd->SetGuidance("Set Time Cut (for neutrons) inside detector");
0083   TimeCutCmd->SetParameterName("TCut",false,false);
0084   TimeCutCmd->SetRange("TCut>0.");
0085   TimeCutCmd->SetDefaultUnit("ns");
0086   TimeCutCmd->SetUnitCategory("Time");
0087   TimeCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0088 
0089 }
0090 
0091 
0092 //ooooooooooooooooooooooooooooooooooooooooo
0093 DMXDetectorMessenger::~DMXDetectorMessenger() 
0094 {
0095   delete EKineCutCmd;
0096   delete RoomEKineCutCmd;
0097   delete RoomTimeCutCmd;
0098   delete TimeCutCmd;
0099  }
0100 
0101 
0102 //ooooooooooooooooooooooooooooooooooooooooo
0103 void DMXDetectorMessenger::SetNewValue(G4UIcommand* command, 
0104                        G4String newValue) 
0105 {
0106 
0107   if(command == EKineCutCmd)
0108    detectorConstruction->
0109      SetEnergyCut(EKineCutCmd->GetNewDoubleValue(newValue));
0110 
0111   if(command == RoomEKineCutCmd)
0112    detectorConstruction->
0113      SetEnergyCut(RoomEKineCutCmd->GetNewDoubleValue(newValue));
0114 
0115   if(command == TimeCutCmd)
0116    detectorConstruction->
0117      SetTimeCut(TimeCutCmd->GetNewDoubleValue(newValue));
0118 
0119   if(command == RoomTimeCutCmd)
0120     detectorConstruction->
0121       SetRoomTimeCut(RoomTimeCutCmd->GetNewDoubleValue(newValue));
0122 
0123   //trigger a re-optimization of the geometry
0124   G4RunManager::GetRunManager()->PhysicsHasBeenModified();
0125   G4RunManager::GetRunManager()->GeometryHasBeenModified();
0126 
0127 
0128 }
0129 
0130 
0131