Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:41

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 /// \file TrackingMessenger.cc
0027 /// \brief Implementation of the TrackingMessenger class
0028 //
0029 //
0030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 
0033 #include "TrackingMessenger.hh"
0034 
0035 #include "TrackingAction.hh"
0036 
0037 #include "G4UIcmdWithABool.hh"
0038 #include "G4UIcommand.hh"
0039 #include "G4UIparameter.hh"
0040 
0041 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0042 
0043 TrackingMessenger::TrackingMessenger(TrackingAction* trackA) : fTrackingAction(trackA)
0044 {
0045   fTrackingCmd = new G4UIcmdWithABool("/rdecay01/fullChain", this);
0046   fTrackingCmd->SetGuidance("allow full decay chain");
0047   fTrackingCmd->SetParameterName("flag", true);
0048   fTrackingCmd->SetDefaultValue(true);
0049 
0050   fTimeWindowCmd = new G4UIcommand("/rdecay01/timeWindow", this);
0051   fTimeWindowCmd->SetGuidance("set time window to survey activity per nuclide");
0052   fTimeWindowCmd->SetGuidance("  t1, delta_t");
0053   //
0054   G4UIparameter* t1Prm = new G4UIparameter("t1", 'd', false);
0055   t1Prm->SetGuidance("time_1");
0056   t1Prm->SetParameterRange("t1>=0.");
0057   fTimeWindowCmd->SetParameter(t1Prm);
0058   //
0059   G4UIparameter* unit1Prm = new G4UIparameter("unit1", 's', false);
0060   unit1Prm->SetGuidance("unit of t1");
0061   G4String unitList = G4UIcommand::UnitsList(G4UIcommand::CategoryOf("second"));
0062   unit1Prm->SetParameterCandidates(unitList);
0063   fTimeWindowCmd->SetParameter(unit1Prm);
0064   //
0065   G4UIparameter* dtPrm = new G4UIparameter("dt", 'd', false);
0066   dtPrm->SetGuidance("delta_t");
0067   dtPrm->SetParameterRange("dt>0.");
0068   fTimeWindowCmd->SetParameter(dtPrm);
0069   //
0070   G4UIparameter* unit2Prm = new G4UIparameter("unit2", 's', false);
0071   unit2Prm->SetGuidance("unit of dt");
0072   unit2Prm->SetParameterCandidates(unitList);
0073   fTimeWindowCmd->SetParameter(unit2Prm);
0074   //
0075   fTimeWindowCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0076 }
0077 
0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0079 
0080 TrackingMessenger::~TrackingMessenger()
0081 {
0082   delete fTrackingCmd;
0083   delete fTimeWindowCmd;
0084 }
0085 
0086 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0087 
0088 void TrackingMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0089 {
0090   if (command == fTrackingCmd) {
0091     fTrackingAction->SetFullChain(fTrackingCmd->GetNewBoolValue(newValue));
0092   }
0093 
0094   if (command == fTimeWindowCmd) {
0095     G4double t1;
0096     G4double dt;
0097     G4String unt1, unt2;
0098     std::istringstream is(newValue);
0099     is >> t1 >> unt1 >> dt >> unt2;
0100     t1 *= G4UIcommand::ValueOf(unt1);
0101     dt *= G4UIcommand::ValueOf(unt2);
0102     fTrackingAction->SetTimeWindow(t1, dt);
0103   }
0104 }
0105 
0106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......