LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
Py8TauDecayerPhysics.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 //
33 
34 #include "Py8TauDecayerPhysics.hh"
35 #include "Py8Decayer.hh"
36 
37 #include "Geant4/G4ParticleDefinition.hh"
38 #include "Geant4/G4ProcessManager.hh"
39 #include "Geant4/G4Decay.hh"
40 #include "Geant4/G4DecayTable.hh"
41 
42 // factory
43 //
44 #include "Geant4/G4PhysicsConstructorFactory.hh"
45 //
46 // register it with contructor factory
47 //
49 
50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
51 
53  : G4VPhysicsConstructor("Py8TauDecayerPhysics")
54 {
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
61 }
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64 
66 {
67  // Nothing needs to be done here
68 }
69 
70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
71 
73 {
74 
75  // Loop over all particles instantiated and add external decayer
76  // to all decay processes where there's no decay table, plus tau's
77 
78  // Create external decayer for G4Decay process
79  // NOTE: The extDecayer will be deleted in G4Decay destructor
80  Py8Decayer* extDecayer = new Py8Decayer();
81 
82  auto particleIterator=GetParticleIterator();
83  particleIterator->reset();
84  while ((*particleIterator)())
85  {
86  G4ParticleDefinition* particle = particleIterator->value();
87  G4ProcessManager* pmanager = particle->GetProcessManager();
88 /*
89  if ( verboseLevel > 1 ) {
90  G4cout << "Setting ext decayer for: "
91  << particleIterator->value()->GetParticleName()
92  << G4endl;
93  }
94 */
95  G4ProcessVector* processVector = pmanager->GetProcessList();
96  for ( size_t i=0; i<processVector->length(); ++i )
97  {
98  G4Decay* decay = dynamic_cast<G4Decay*>((*processVector)[i]);
99  if ( decay )
100  {
101  // remove native/existing decay table for
102  // a) tau's
103  // and replace with external decayer
104  if ( std::abs(particle->GetPDGEncoding()) == 15 )
105  {
106  if ( particle->GetDecayTable() )
107  {
108  delete particle->GetDecayTable();
109  particle->SetDecayTable(nullptr);
110  }
111  decay->SetExtDecayer(extDecayer);
112  }
113  // now set external decayer to all particles
114  // that don't yet have a decay table
115  if ( !particle->GetDecayTable() )
116  {
117  decay->SetExtDecayer(extDecayer);
118  }
119  }
120  }
121  }
122 
123  return;
124 
125 }
126 
127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
virtual void ConstructParticle()
G4_DECLARE_PHYSCONSTR_FACTORY(Py8TauDecayerPhysics)
virtual void ConstructProcess()
constexpr auto abs(T v)
Returns the absolute value of the argument.
Py8TauDecayerPhysics(G4int verb=1)