Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 08:27:29

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