ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GB04BOptrBremSplitting.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GB04BOptrBremSplitting.cc
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 //
29 
32 
34 #include "G4GenericMessenger.hh"
35 
36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
37 
39 : G4VBiasingOperator("BremSplittingOperator"),
40  fSplittingFactor(1),
41  fBiasPrimaryOnly(true),
42  fBiasOnlyOnce(true)
43 {
44  fBremSplittingOperation = new GB04BOptnBremSplitting("BremSplittingOperation");
45 
46  // -- Define messengers:
47  // -- Splitting factor:
49  new G4GenericMessenger(this, "/GB04/biasing/","Biasing control" );
50  G4GenericMessenger::Command& splittingFactorCmd =
52  "Define the brem. splitting factor." );
53  splittingFactorCmd.SetStates(G4State_Idle);
54  // -- Bias ony primary particle:
56  new G4GenericMessenger(this, "/GB04/biasing/","Biasing control" );
57  G4GenericMessenger::Command& biasPrimaryCmd =
59  "Chose if brem. splitting applies to primary particles only." );
60  biasPrimaryCmd.SetStates(G4State_Idle);
61  // -- Bias ony primary particle:
63  new G4GenericMessenger(this, "/GB04/biasing/","Biasing control" );
64  G4GenericMessenger::Command& biasOnlyOnceCmd =
66  "Chose if apply the brem. splitting only once for the track." );
67  biasOnlyOnceCmd.SetStates(G4State_Idle);
68 
69 }
70 
71 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72 
74 {
76  G4cout << GetName() << " : starting run with brem. splitting factor = "
78  if ( fBiasPrimaryOnly ) G4cout << ", biasing only primaries ";
79  else G4cout << ", biasing primary and secondary tracks ";
80  if ( fBiasOnlyOnce ) G4cout << ", biasing only once per track ";
81  else G4cout << ", biasing several times per track ";
82  G4cout << " . " << G4endl;
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86 
88 {
89  // -- reset the number of times the brem. splitting was applied:
90  fNInteractions = 0;
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
94 
98  const G4BiasingProcessInterface* /* callingProcess */)
99 {
100  // -- Check if biasing of primary particle only is requested. If so, and
101  // -- if particle is not a primary one, don't ask for biasing:
102  if ( fBiasPrimaryOnly && ( track->GetParentID() !=0 ) ) return 0;
103  // -- Check if brem. splitting should be applied only once to the track,
104  // -- and if so, and if brem. splitting already occured, don't ask for biasing:
105  if ( fBiasOnlyOnce && ( fNInteractions > 0 ) ) return 0;
106 
107  // -- Count the number of times the brem. splitting is applied:
108  fNInteractions++;
109  // -- Return the brem. splitting operation:
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......