ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GB07BOptrLeadingParticle.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file GB07BOptrLeadingParticle.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 //
28 //
31 
33 #include "G4ParticleDefinition.hh"
34 #include "G4Gamma.hh"
35 #include "G4Electron.hh"
36 #include "G4Positron.hh"
37 #include "G4PionZero.hh"
38 #include "G4ProcessManager.hh"
39 
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44  : G4VBiasingOperator ( operatorName ),
45  fAnnihilation ( nullptr ),
46  fConversion ( nullptr ),
47  fDecay ( nullptr ),
48  fTwoParticleProcess ( nullptr )
49 {
51  new G4BOptnLeadingParticle("LeadingParticleBiasingOperation");
52 }
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 {
59 }
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
66  const G4BiasingProcessInterface* callingProcess)
67 {
68  // -- When the present method is called, we are at the process final state
69  // -- generation level. The process is given by the callingProcess argument,
70  // -- which, in our case, wrappes a physics process, to control it.
71  // -- To bias the final state generation, we return a biasing operation
72  // -- which is fLeadingParticleBiasingOperation here. Before returning it, we
73  // -- configure it depending on if the process is a two-particle final state
74  // -- or if it is a many-particle final state process. For the two-particle
75  // -- final state, one track is the leading and the other is alone in its category,
76  // -- so always surviving by default. We play a Russian roulette on it to
77  // -- trim also these two-particles final states.
78 
79  if ( callingProcess == fTwoParticleProcess )
80  {
81  // -- secondary particle accompagnying the leading one will be
82  // -- killed with 2./3. probability (Russian roulette):
84  }
85  else
86  {
87  // -- -1.0 means no effect : no further killing is applied to secondary
88  // -- particles accompanying the leading one.
90  }
91 
93 }
94 
95 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
96 
97 void
100 {
101  // -- collect the two-particle final state processes:
102  fAnnihilation = nullptr;
103  fConversion = nullptr;
104  fDecay = nullptr;
105 
106  // ---- collect e+ annihilation process:
107  auto positronProcesses = G4Positron::Definition()->GetProcessManager()->GetProcessList();
108  for ( size_t i = 0; i < positronProcesses->size(); ++i )
109  {
110  if ( (*positronProcesses)[i]->GetProcessName() == "biasWrapper(annihil)")
111  {
112  fAnnihilation = (*positronProcesses)[i];
113  break;
114  }
115  }
116 
117  // ---- collect gamma conversion process:
118  auto gammaProcesses = G4Gamma::Definition()->GetProcessManager()->GetProcessList();
119  for ( size_t i = 0; i < gammaProcesses->size(); ++i )
120  {
121  if ( (*gammaProcesses)[i]->GetProcessName() == "biasWrapper(conv)")
122  {
123  fConversion = (*gammaProcesses)[i];
124  break;
125  }
126  }
127 
128  // ---- collect pi0 decay process:
129  auto pi0Processes = G4PionZero::Definition()->GetProcessManager()->GetProcessList();
130  for ( size_t i = 0; i < pi0Processes->size(); ++i )
131  {
132  if ( (*pi0Processes)[i]->GetProcessName() == "biasWrapper(Decay)")
133  {
134  fDecay = (*pi0Processes)[i];
135  break;
136  }
137  }
138 }
139 
140 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
141 
142 void
145 {
146  // -- remember what is the two-particle final state process -if any- for this starting
147  // -- track:
148  fTwoParticleProcess = nullptr;
152 }