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: G4QDecayChan.cc,v 1.27 2006/11/27 10:44:54 mkossov Exp $ |
---|
28 | // GEANT4 tag $Name: $ |
---|
29 | // |
---|
30 | // ---------------- G4QDecayChan ---------------- |
---|
31 | // by Mikhail Kossov, Sept 1999. |
---|
32 | // class for Decay Channels of Hadrons in CHIPS Model |
---|
33 | // ------------------------------------------------------------------- |
---|
34 | |
---|
35 | //#define debug |
---|
36 | //#define pdebug |
---|
37 | |
---|
38 | #include "G4QDecayChanVector.hh" |
---|
39 | #include <algorithm> |
---|
40 | |
---|
41 | G4QDecayChan::G4QDecayChan():aDecayChanLimit(0.),theMinMass(0.) |
---|
42 | {} |
---|
43 | |
---|
44 | G4QDecayChan::G4QDecayChan(G4double pLev, G4int PDG1, G4int PDG2, G4int PDG3): |
---|
45 | aDecayChanLimit(pLev) |
---|
46 | { |
---|
47 | G4QPDGCode* firstPDG = new G4QPDGCode(PDG1); |
---|
48 | theMinMass =firstPDG->GetMass(); |
---|
49 | aVecOfSecHadrons.push_back(firstPDG); |
---|
50 | G4QPDGCode* secondPDG = new G4QPDGCode(PDG2); |
---|
51 | theMinMass+=secondPDG->GetMass(); |
---|
52 | aVecOfSecHadrons.push_back(secondPDG); |
---|
53 | if(PDG3) |
---|
54 | { |
---|
55 | G4QPDGCode* thirdPDG = new G4QPDGCode(PDG3); |
---|
56 | theMinMass+=thirdPDG->GetMass(); |
---|
57 | aVecOfSecHadrons.push_back(thirdPDG); |
---|
58 | } |
---|
59 | #ifdef debug |
---|
60 | cout<<"G4QDecayChan is defined with pL="<<pLev<<",1="<<PDG1<<",2="<<PDG2<<",3="<<PDG3 |
---|
61 | <<",m1="<<firstPDG->GetMass()<<",m2="<<secondPDG->GetMass()<<",minM="<<theMinMass<<endl; |
---|
62 | #endif |
---|
63 | } |
---|
64 | |
---|
65 | G4QDecayChan::G4QDecayChan(const G4QDecayChan& right) |
---|
66 | { |
---|
67 | aDecayChanLimit = right.aDecayChanLimit; |
---|
68 | theMinMass = right.theMinMass; |
---|
69 | //aVecOfSecHadrons (Vector) |
---|
70 | G4int nSH = right.aVecOfSecHadrons.size(); |
---|
71 | if(nSH) for(G4int ih=0; ih<nSH; ih++) |
---|
72 | { |
---|
73 | G4QPDGCode* curPC = new G4QPDGCode(right.aVecOfSecHadrons[ih]); |
---|
74 | aVecOfSecHadrons.push_back(curPC); |
---|
75 | } |
---|
76 | } |
---|
77 | |
---|
78 | G4QDecayChan::G4QDecayChan(G4QDecayChan* right) |
---|
79 | { |
---|
80 | aDecayChanLimit = right->aDecayChanLimit; |
---|
81 | theMinMass = right->theMinMass; |
---|
82 | //aVecOfSecHadrons (Vector) |
---|
83 | G4int nSH = right->aVecOfSecHadrons.size(); |
---|
84 | if(nSH) for(G4int ih=0; ih<nSH; ih++) |
---|
85 | { |
---|
86 | G4QPDGCode* curPC = new G4QPDGCode(right->aVecOfSecHadrons[ih]); |
---|
87 | aVecOfSecHadrons.push_back(curPC); |
---|
88 | } |
---|
89 | } |
---|
90 | |
---|
91 | G4QDecayChan::~G4QDecayChan() |
---|
92 | { |
---|
93 | G4int nSH=aVecOfSecHadrons.size(); |
---|
94 | //G4cout<<"G4QDecayChan::Destructor: Before nSH="<<nSH<<G4endl; // TMP |
---|
95 | if(nSH)std::for_each(aVecOfSecHadrons.begin(), aVecOfSecHadrons.end(), DeleteQPDGCode()); |
---|
96 | //G4cout<<"G4QDecayChan::Destructor: After"<<G4endl; // TMP |
---|
97 | aVecOfSecHadrons.clear(); |
---|
98 | } |
---|
99 | |
---|
100 | // Assignment operator |
---|
101 | const G4QDecayChan& G4QDecayChan::operator=(const G4QDecayChan& right) |
---|
102 | { |
---|
103 | if(this != &right) // Beware of self assignment |
---|
104 | { |
---|
105 | aDecayChanLimit = right.aDecayChanLimit; |
---|
106 | theMinMass = right.theMinMass; |
---|
107 | //aVecOfSecHadrons (Vector) |
---|
108 | G4int iSH = aVecOfSecHadrons.size(); |
---|
109 | if(iSH) for(G4int ii=0; ii<iSH; ii++) delete aVecOfSecHadrons[ii]; |
---|
110 | aVecOfSecHadrons.clear(); |
---|
111 | G4int nSH = right.aVecOfSecHadrons.size(); |
---|
112 | if(nSH) for(G4int ih=0; ih<nSH; ih++) |
---|
113 | { |
---|
114 | G4QPDGCode* curPC = new G4QPDGCode(right.aVecOfSecHadrons[ih]); |
---|
115 | aVecOfSecHadrons.push_back(curPC); |
---|
116 | } |
---|
117 | } |
---|
118 | return *this; |
---|
119 | } |
---|
120 | |
---|
121 | // Standard output for QDecayChan |
---|
122 | std::ostream& operator<<(std::ostream& lhs, G4QDecayChan& rhs) |
---|
123 | // ========================================= |
---|
124 | { |
---|
125 | lhs << "[L=" << rhs.GetDecayChanLimit(); |
---|
126 | G4QPDGCodeVector VSH = rhs.GetVecOfSecHadrons(); |
---|
127 | G4int n = VSH.size(); |
---|
128 | lhs << ", N=" << n << ": "; |
---|
129 | for (int i=0; i<n; i++) |
---|
130 | { |
---|
131 | if(!i) lhs << ":"; |
---|
132 | else lhs << ","; |
---|
133 | lhs << VSH[i]->GetPDGCode(); |
---|
134 | } |
---|
135 | lhs << "]"; |
---|
136 | return lhs; |
---|
137 | } |
---|
138 | |
---|
139 | |
---|
140 | |
---|
141 | |
---|
142 | |
---|