Back to home page

EIC code displayed by LXR

 
 

    


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

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 GB04BOptrBremSplitting.cc
0028 /// \brief Implementation of the GB04BOptrBremSplitting class
0029 
0030 #include "GB04BOptrBremSplitting.hh"
0031 
0032 #include "GB04BOptnBremSplitting.hh"
0033 
0034 #include "G4BiasingProcessInterface.hh"
0035 #include "G4GenericMessenger.hh"
0036 
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0038 
0039 GB04BOptrBremSplitting::GB04BOptrBremSplitting()
0040   : G4VBiasingOperator("BremSplittingOperator"),
0041     fSplittingFactor(1),
0042     fBiasPrimaryOnly(true),
0043     fBiasOnlyOnce(true)
0044 {
0045   fBremSplittingOperation = new GB04BOptnBremSplitting("BremSplittingOperation");
0046 
0047   // -- Define messengers:
0048   // -- Splitting factor:
0049   fSplittingFactorMessenger = new G4GenericMessenger(this, "/GB04/biasing/", "Biasing control");
0050   G4GenericMessenger::Command& splittingFactorCmd = fSplittingFactorMessenger->DeclareProperty(
0051     "setSplittingFactor", fSplittingFactor, "Define the brem. splitting factor.");
0052   splittingFactorCmd.SetStates(G4State_Idle);
0053   // -- Bias ony primary particle:
0054   fBiasPrimaryOnlyMessenger = new G4GenericMessenger(this, "/GB04/biasing/", "Biasing control");
0055   G4GenericMessenger::Command& biasPrimaryCmd = fBiasPrimaryOnlyMessenger->DeclareProperty(
0056     "biasPrimaryOnly", fBiasPrimaryOnly,
0057     "Chose if brem. splitting applies to primary particles only.");
0058   biasPrimaryCmd.SetStates(G4State_Idle);
0059   // -- Bias ony primary particle:
0060   fBiasOnlyOnceMessenger = new G4GenericMessenger(this, "/GB04/biasing/", "Biasing control");
0061   G4GenericMessenger::Command& biasOnlyOnceCmd = fBiasPrimaryOnlyMessenger->DeclareProperty(
0062     "biasOnlyOnce", fBiasOnlyOnce, "Chose if apply the brem. splitting only once for the track.");
0063   biasOnlyOnceCmd.SetStates(G4State_Idle);
0064 }
0065 
0066 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0067 
0068 void GB04BOptrBremSplitting::StartRun()
0069 {
0070   fBremSplittingOperation->SetSplittingFactor(fSplittingFactor);
0071   G4cout << GetName() << " : starting run with brem. splitting factor = " << fSplittingFactor;
0072   if (fBiasPrimaryOnly)
0073     G4cout << ", biasing only primaries ";
0074   else
0075     G4cout << ", biasing primary and secondary tracks ";
0076   if (fBiasOnlyOnce)
0077     G4cout << ", biasing only once per track ";
0078   else
0079     G4cout << ", biasing several times per track ";
0080   G4cout << " . " << G4endl;
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0084 
0085 void GB04BOptrBremSplitting::StartTracking(const G4Track* /* track */)
0086 {
0087   // -- reset the number of times the brem. splitting was applied:
0088   fNInteractions = 0;
0089 }
0090 
0091 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0092 
0093 G4VBiasingOperation* GB04BOptrBremSplitting::ProposeFinalStateBiasingOperation(
0094   const G4Track* track, const G4BiasingProcessInterface* /* callingProcess */)
0095 {
0096   // -- Check if biasing of primary particle only is requested. If so, and
0097   // -- if particle is not a primary one, don't ask for biasing:
0098   if (fBiasPrimaryOnly && (track->GetParentID() != 0)) return 0;
0099   // -- Check if brem. splitting should be applied only once to the track,
0100   // -- and if so, and if brem. splitting already occured, don't ask for biasing:
0101   if (fBiasOnlyOnce && (fNInteractions > 0)) return 0;
0102 
0103   // -- Count the number of times the brem. splitting is applied:
0104   fNInteractions++;
0105   // -- Return the brem. splitting operation:
0106   return fBremSplittingOperation;
0107 }
0108 
0109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......