Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4QCandidate.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 // ---------------- G4QCandidate ----------------
30 // by Mikhail Kossov, Sept 1999.
31 // class for Quasmon initiated Candidates used by CHIPS Model
32 // ------------------------------------------------------------------
33 // Short description: A candidate for hadronization. The candidates
34 // (hadrons or nuclear fragments) are competative, each quark of a
35 // Quasmon select which candidate to use for hadronization
36 // ------------------------------------------------------------------
37 
38 //#define debug
39 
40 #include "G4QCandidate.hh"
41 #include <algorithm>
42 
44  G4QHadron(),possible(false),parPossible(false),kMin(0),denseProbability(0.),
45  preProbability(0.),relativeProbability(0.),integralProbability(0.),
46  secondRelProbability(0.),secondIntProbability(0.),EBMass(0.),NBMass(0.)
47 
48 {
49 }
50 
52  G4QHadron(PDGcode),possible(false),parPossible(false),kMin(0),denseProbability(0.),
53  preProbability(0.),relativeProbability(0.),integralProbability(0.),
54  secondRelProbability(0.),secondIntProbability(0.),EBMass(0.),NBMass(0.)
55 {
56 #ifdef debug
57  G4cout<<"G4QCandidate::Constructor: PDG="<<PDGcode<<G4endl;
58 #endif
59  G4LorentzVector cur4Mom(0.,0.,0.,0.);
60  G4QPDGCode QPDG(PDGcode);
61 #ifdef debug
62  G4cout<<"G4QCandidate::Constructor: QPDG="<<QPDG<<G4endl;
63 #endif
64  SetQPDG(QPDG);
65  G4double vacMass=QPDG.GetMass();
66 #ifdef debug
67  G4cout<<"G4QCandidate::Constructor: M="<<vacMass<<G4endl;
68 #endif
69  cur4Mom.setE(vacMass);
70  Set4Momentum(cur4Mom);
71  SetQC(QPDG.GetQuarkContent());
72 }
73 
75  G4QHadron(&right)
76 {
77  Set4Momentum (right.Get4Momentum());
78  SetQPDG (right.GetQPDG());
79  SetQC (right.GetQC());
80  SetNFragments (right.GetNFragments());
81  possible = right.possible;
82  parPossible = right.parPossible;
83  kMin = right.kMin;
84  denseProbability = right.denseProbability;
85  preProbability = right.preProbability;
86  relativeProbability = right.relativeProbability;
87  integralProbability = right.integralProbability;
88  secondRelProbability= right.secondRelProbability;
89  secondIntProbability= right.secondIntProbability;
90  EBMass = right.EBMass;
91  NBMass = right.NBMass;
92  // thePClusters
93  G4int nParCl = right.thePClusters.size();
94  if(nParCl) for(G4int ip=0; ip<nParCl; ip++)
95  {
96  G4QParentCluster* curPC = new G4QParentCluster(right.thePClusters[ip]);
97  thePClusters.push_back(curPC);
98  }
99 }
100 
102 {
103  Set4Momentum (right->Get4Momentum());
104  SetQPDG (right->GetQPDG());
105  SetQC (right->GetQC());
106  SetNFragments (right->GetNFragments());
107  possible = right->possible;
108  parPossible = right->parPossible;
109  kMin = right->kMin;
110  denseProbability = right->denseProbability;
111  preProbability = right->preProbability;
112  relativeProbability = right->relativeProbability;
113  integralProbability = right->integralProbability;
114  secondRelProbability= right->secondRelProbability;
115  secondIntProbability= right->secondIntProbability;
116  EBMass = right->EBMass;
117  NBMass = right->NBMass;
118  // thePClusters
119  G4int nParCl = right->thePClusters.size();
120  if(nParCl) for(G4int ip=0; ip<nParCl; ip++)
121  {
122  G4QParentCluster* curPC = new G4QParentCluster(right->thePClusters[ip]);
123  thePClusters.push_back(curPC);
124  }
125 }
126 
128 {
129 #ifdef debug
130  G4cout<<"~G4QCandidate: before thePClusters nC="<<thePClusters.size()<<G4endl;
131 #endif
132  std::for_each(thePClusters.begin(), thePClusters.end(), DeleteQParentCluster());
133 #ifdef debug
134  G4cout<<"~G4QCandidate: === DONE ==="<<G4endl;
135 #endif
136 }
137 
138 // Assignment operator
140 {
141  if(this != &right) // Beware of self assignment
142  {
143  Set4Momentum (right.Get4Momentum());
144  SetQPDG (right.GetQPDG());
145  SetQC (right.GetQC());
146  SetNFragments (right.GetNFragments());
147  possible = right.possible;
148  parPossible = right.parPossible;
149  kMin = right.kMin;
150  denseProbability = right.denseProbability;
151  preProbability = right.preProbability;
152  relativeProbability = right.relativeProbability;
153  integralProbability = right.integralProbability;
154  secondRelProbability= right.secondRelProbability;
155  secondIntProbability= right.secondIntProbability;
156  EBMass = right.EBMass;
157  NBMass = right.NBMass;
158  // thePClusters (Vector)
159  G4int nParCl = right.thePClusters.size();
160  if(nParCl) for(G4int ip=0; ip<nParCl; ip++)
161  {
162  G4QParentCluster* curPC = new G4QParentCluster(right.thePClusters[ip]);
163  thePClusters.push_back(curPC);
164  }
165  }
166  return *this;
167 }