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