Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GB04BOptrBremSplitting.cc
Go to the documentation of this file.
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 // $Id$
27 //
30 
33 
35 #include "G4GenericMessenger.hh"
36 
37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
38 
40 : G4VBiasingOperator("BremSplittingOperator"),
41  fSplittingFactor(1),
42  fBiasPrimaryOnly(true),
43  fBiasOnlyOnce(true)
44 {
45  fBremSplittingOperation = new GB04BOptnBremSplitting("BremSplittingOperation");
46 
47  // -- Define messengers:
48  // -- Splitting factor:
49  fSplittingFactorMessenger =
50  new G4GenericMessenger(this, "/GB04/biasing/","Biasing control" );
51  G4GenericMessenger::Command& splittingFactorCmd =
52  fSplittingFactorMessenger->DeclareProperty("setSplittingFactor", fSplittingFactor,
53  "Define the brem. splitting factor." );
54  splittingFactorCmd.SetStates(G4State_Idle);
55  // -- Bias ony primary particle:
56  fBiasPrimaryOnlyMessenger =
57  new G4GenericMessenger(this, "/GB04/biasing/","Biasing control" );
58  G4GenericMessenger::Command& biasPrimaryCmd =
59  fBiasPrimaryOnlyMessenger->DeclareProperty("biasPrimaryOnly", fBiasPrimaryOnly,
60  "Chose if brem. splitting applies to primary particles only." );
61  biasPrimaryCmd.SetStates(G4State_Idle);
62  // -- Bias ony primary particle:
63  fBiasOnlyOnceMessenger =
64  new G4GenericMessenger(this, "/GB04/biasing/","Biasing control" );
65  G4GenericMessenger::Command& biasOnlyOnceCmd =
66  fBiasPrimaryOnlyMessenger->DeclareProperty("biasOnlyOnce", fBiasOnlyOnce,
67  "Chose if apply the brem. splitting only once for the track." );
68  biasOnlyOnceCmd.SetStates(G4State_Idle);
69 
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  fBremSplittingOperation->SetSplittingFactor ( fSplittingFactor );
77  G4cout << GetName() << " : starting run with brem. splitting factor = "
78  << fSplittingFactor;
79  if ( fBiasPrimaryOnly ) G4cout << ", biasing only primaries ";
80  else G4cout << ", biasing primary and secondary tracks ";
81  if ( fBiasOnlyOnce ) G4cout << ", biasing only once per track ";
82  else G4cout << ", biasing several times per track ";
83  G4cout << " . " << G4endl;
84 }
85 
86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87 
89 {
90  // -- reset the number of times the brem. splitting was applied:
91  fNInteractions = 0;
92 }
93 
94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
95 
97 GB04BOptrBremSplitting::
98 ProposeFinalStateBiasingOperation(const G4Track* track,
99  const G4BiasingProcessInterface* /* callingProcess */)
100 {
101  // -- Check if biasing of primary particle only is requested. If so, and
102  // -- if particle is not a primary one, don't ask for biasing:
103  if ( fBiasPrimaryOnly && ( track->GetParentID() !=0 ) ) return 0;
104  // -- Check if brem. splitting should be applied only once to the track,
105  // -- and if so, and if brem. splitting already occured, don't ask for biasing:
106  if ( fBiasOnlyOnce && ( fNInteractions > 0 ) ) return 0;
107 
108  // -- Count the number of times the brem. splitting is applied:
109  fNInteractions++;
110  // -- Return the brem. splitting operation:
111  return fBremSplittingOperation;
112 }
113 
114 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4int GetParentID() const
Definition of the GB04BOptrBremSplitting class.
void SetSplittingFactor(G4int splittingFactor)
This class is generic messenger.
Command & DeclareProperty(const G4String &name, const G4AnyType &variable, const G4String &doc="")
Declare Methods.
G4GLOB_DLL std::ostream G4cout
virtual void StartTracking(const G4Track *track)
Command & SetStates(G4ApplicationState s0)
#define G4endl
Definition: G4ios.hh:61
Definition of the GB04BOptnBremSplitting class.
const G4String GetName() const