Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 08:30:23

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