Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4QDecayChan.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//
27// $Id$
28//
29// ---------------- G4QDecayChan ----------------
30// by Mikhail Kossov, Sept 1999.
31// class for Decay Channels of Hadrons in CHIPS Model
32// -------------------------------------------------------------------
33// Short description: In the CHIPS World the particles (G4QParticle)
34// are defined. For unstable particles there is a G4QDecayChannelVector
35// which describes different channels of decay for the particular
36// particle. So the G4QDecayChannel class is the class for the description
37// of such a decay channel in two or three particles (the secondaries can
38// be unstable too and have firther decay).
39// -------------------------------------------------------------------
40
41//#define debug
42//#define pdebug
43
44#include "G4QDecayChanVector.hh"
45#include <algorithm>
46
47G4QDecayChan::G4QDecayChan():aDecayChanLimit(0.),theMinMass(0.)
48{}
49
51 aDecayChanLimit(pLev)
52{
53 G4QPDGCode* firstPDG = new G4QPDGCode(PDG1);
54 theMinMass =firstPDG->GetMass();
55 aVecOfSecHadrons.push_back(firstPDG);
56 G4QPDGCode* secondPDG = new G4QPDGCode(PDG2);
57 theMinMass+=secondPDG->GetMass();
58 aVecOfSecHadrons.push_back(secondPDG);
59 if(PDG3)
60 {
61 G4QPDGCode* thirdPDG = new G4QPDGCode(PDG3);
62 theMinMass+=thirdPDG->GetMass();
63 aVecOfSecHadrons.push_back(thirdPDG);
64 }
65#ifdef debug
66 G4cout<<"G4QDecayChan is defined with pL="<<pLev<<",1="<<PDG1<<",2="<<PDG2<<",3="<<PDG3
67 <<",m1="<<firstPDG->GetMass()<<",m2="<<secondPDG->GetMass()<<",minM="<<theMinMass<<G4endl;
68#endif
69}
70
72{
73 aDecayChanLimit = right.aDecayChanLimit;
74 theMinMass = right.theMinMass;
75 //aVecOfSecHadrons (Vector)
76 G4int nSH = right.aVecOfSecHadrons.size();
77 if(nSH) for(G4int ih=0; ih<nSH; ih++)
78 {
79 G4QPDGCode* curPC = new G4QPDGCode(right.aVecOfSecHadrons[ih]);
80 aVecOfSecHadrons.push_back(curPC);
81 }
82}
83
85{
86 aDecayChanLimit = right->aDecayChanLimit;
87 theMinMass = right->theMinMass;
88 //aVecOfSecHadrons (Vector)
89 G4int nSH = right->aVecOfSecHadrons.size();
90 if(nSH) for(G4int ih=0; ih<nSH; ih++)
91 {
92 G4QPDGCode* curPC = new G4QPDGCode(right->aVecOfSecHadrons[ih]);
93 aVecOfSecHadrons.push_back(curPC);
94 }
95}
96
98{
99 G4int nSH=aVecOfSecHadrons.size();
100 //G4cout<<"G4QDecayChan::Destructor: Before nSH="<<nSH<<G4endl; // TMP
101 if(nSH)std::for_each(aVecOfSecHadrons.begin(), aVecOfSecHadrons.end(), DeleteQPDGCode());
102 //G4cout<<"G4QDecayChan::Destructor: After"<<G4endl; // TMP
103 aVecOfSecHadrons.clear();
104}
105
106// Assignment operator
108{
109 if(this != &right) // Beware of self assignment
110 {
111 aDecayChanLimit = right.aDecayChanLimit;
112 theMinMass = right.theMinMass;
113 //aVecOfSecHadrons (Vector)
114 G4int iSH = aVecOfSecHadrons.size();
115 if(iSH) for(G4int ii=0; ii<iSH; ii++) delete aVecOfSecHadrons[ii];
116 aVecOfSecHadrons.clear();
117 G4int nSH = right.aVecOfSecHadrons.size();
118 if(nSH) for(G4int ih=0; ih<nSH; ih++)
119 {
120 G4QPDGCode* curPC = new G4QPDGCode(right.aVecOfSecHadrons[ih]);
121 aVecOfSecHadrons.push_back(curPC);
122 }
123 }
124 return *this;
125}
126
127// Standard output for QDecayChan
128std::ostream& operator<<(std::ostream& lhs, G4QDecayChan& rhs)
129{
130 lhs << "[L=" << rhs.GetDecayChanLimit();
132 G4int n = VSH.size();
133 lhs << ", N=" << n << ": ";
134 for (int i=0; i<n; i++)
135 {
136 if(!i) lhs << ":";
137 else lhs << ",";
138 lhs << VSH[i]->GetPDGCode();
139 }
140 lhs << "]";
141 return lhs;
142}
std::ostream & operator<<(std::ostream &lhs, G4QDecayChan &rhs)
std::vector< G4QPDGCode * > G4QPDGCodeVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cout
const G4QDecayChan & operator=(const G4QDecayChan &right)
G4QPDGCodeVector GetVecOfSecHadrons()
Definition: G4QDecayChan.hh:94
G4double GetDecayChanLimit() const
Definition: G4QDecayChan.hh:92
G4double GetMass()
Definition: G4QPDGCode.cc:693