[807] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | |
---|
| 27 | #include "ExN04StackingActionMessenger.hh" |
---|
| 28 | #include "ExN04StackingAction.hh" |
---|
| 29 | #include "G4UIcmdWithAnInteger.hh" |
---|
| 30 | #include "G4UIcmdWithADoubleAndUnit.hh" |
---|
| 31 | #include "G4ios.hh" |
---|
| 32 | |
---|
| 33 | ExN04StackingActionMessenger::ExN04StackingActionMessenger(ExN04StackingAction * msa) |
---|
| 34 | :myAction(msa) |
---|
| 35 | { |
---|
| 36 | muonCmd = new G4UIcmdWithAnInteger("/mydet/reqmuon",this); |
---|
| 37 | muonCmd->SetGuidance("Number of muon for the trigger."); |
---|
| 38 | muonCmd->SetParameterName("N",true); |
---|
| 39 | muonCmd->SetDefaultValue(2); |
---|
| 40 | muonCmd->SetRange("N>=0"); |
---|
| 41 | |
---|
| 42 | isomuonCmd = new G4UIcmdWithAnInteger("/mydet/isomuon",this); |
---|
| 43 | isomuonCmd->SetGuidance("Number of isolated muon for the trigger."); |
---|
| 44 | isomuonCmd->SetParameterName("N",true); |
---|
| 45 | isomuonCmd->SetDefaultValue(2); |
---|
| 46 | isomuonCmd->SetRange("N>=0"); |
---|
| 47 | |
---|
| 48 | isoCmd = new G4UIcmdWithAnInteger("/mydet/isolation",this); |
---|
| 49 | isoCmd->SetGuidance("Maximum allowed number of hits in tracker"); |
---|
| 50 | isoCmd->SetGuidance(" for an isolated muon track (includes hits by muon)"); |
---|
| 51 | isoCmd->SetParameterName("N",true); |
---|
| 52 | isoCmd->SetDefaultValue(10); |
---|
| 53 | isoCmd->SetRange("N>=0"); |
---|
| 54 | |
---|
| 55 | roiCmd = new G4UIcmdWithADoubleAndUnit("/mydet/RoIangle",this); |
---|
| 56 | roiCmd->SetGuidance("Define RoI angle"); |
---|
| 57 | roiCmd->SetParameterName("theta",true,true); |
---|
| 58 | roiCmd->SetDefaultUnit("deg"); |
---|
| 59 | } |
---|
| 60 | |
---|
| 61 | ExN04StackingActionMessenger::~ExN04StackingActionMessenger() |
---|
| 62 | { |
---|
| 63 | delete muonCmd; |
---|
| 64 | delete isomuonCmd; |
---|
| 65 | delete isoCmd; |
---|
| 66 | delete roiCmd; |
---|
| 67 | } |
---|
| 68 | |
---|
| 69 | void ExN04StackingActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue) |
---|
| 70 | { |
---|
| 71 | if( command==muonCmd ) |
---|
| 72 | { myAction->SetNRequestMuon(muonCmd->GetNewIntValue(newValue)); } |
---|
| 73 | else if( command==isomuonCmd ) |
---|
| 74 | { myAction->SetNRequestIsoMuon(isomuonCmd->GetNewIntValue(newValue)); } |
---|
| 75 | else if( command==isoCmd ) |
---|
| 76 | { myAction->SetNIsolation(isoCmd->GetNewIntValue(newValue)); } |
---|
| 77 | else if( command==roiCmd ) |
---|
| 78 | { myAction->SetRoIAngle(roiCmd->GetNewDoubleValue(newValue)); } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | G4String ExN04StackingActionMessenger::GetCurrentValue(G4UIcommand * command) |
---|
| 82 | { |
---|
| 83 | G4String cv; |
---|
| 84 | |
---|
| 85 | if( command==muonCmd ) |
---|
| 86 | { cv = muonCmd->ConvertToString(myAction->GetNRequestMuon()); } |
---|
| 87 | else if( command==isomuonCmd ) |
---|
| 88 | { cv = isomuonCmd->ConvertToString(myAction->GetNRequestIsoMuon()); } |
---|
| 89 | else if( command==isoCmd ) |
---|
| 90 | { cv = isoCmd->ConvertToString(myAction->GetNIsolation()); } |
---|
| 91 | else if( command==roiCmd ) |
---|
| 92 | { cv = roiCmd->ConvertToString(myAction->GetRoIAngle(),"deg"); } |
---|
| 93 | |
---|
| 94 | return cv; |
---|
| 95 | } |
---|
| 96 | |
---|