Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MolecularDecayChannel.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 // $Id: G4MolecularDecayChannel.cc 65022 2012-11-12 16:43:12Z gcosmo $
27 //
28 // ----------------------------------------------------------------------
29 // GEANT 4 class implementation file
30 //
31 // History: first implementation by Alfonso Mantero 4 Mar 2009
32 //
33 // **********************************************************************
34 
36 #include "G4Molecule.hh"
38 
39 using namespace std;
40 
41 // ######################################################################
42 // ### MolecularDecayChannel ###
43 // ######################################################################
44 
46 {
47  bool operator()(const G4Molecule* mol1, const G4Molecule* mol2) const
48  {
49  return (*mol1) < (*mol2);
50  }
51 };
52 
54 {
55  //pointer
56  fProductsVector = 0;
57  //double
58  fDecayTime = 0;
59  fProbability = 0;
60  fReleasedEnergy = 0;
61  fRMSMotherMoleculeDisplacement = 0;
62  fDisplacementType = 0; // meaning no displacement cf G4VMolecularDisplacer
63 }
64 
66 {
67  // pointer
68  fProductsVector = 0;
69  // double
70  fReleasedEnergy = 0;
71  fDecayTime = 0;
72  fProbability = 0;
73  fRMSMotherMoleculeDisplacement = 0;
74  fDisplacementType = 0; // meaning no displacement cf G4VMolecularDisplacer
75 }
76 
78 {
79  if(fProductsVector)
80  {
81  fProductsVector->clear();
82  delete fProductsVector;
83  }
84 }
85 
87 {
88  *this = right;
89 }
90 
91 G4MolecularDecayChannel& G4MolecularDecayChannel::operator=
93 {
94  if (&right==this) return *this;
95 
96  // string
97  fName = right.fName;
98  //displacement type
99  fDisplacementType = right.fDisplacementType;
100  // pointer
101  if(right.fProductsVector)
102  {
103  fProductsVector = new vector<G4MoleculeHandle>(*(right.fProductsVector));
104  }
105  else fProductsVector = 0;
106 
107  // double
108  fReleasedEnergy = right.fReleasedEnergy;
109  fDecayTime = right.fDecayTime;
110  fProbability = right.fProbability;
111  // vector
112  fRMSMotherMoleculeDisplacement = right.fRMSMotherMoleculeDisplacement;
113  fRMSProductsDisplacementVector = right.fRMSProductsDisplacementVector;
114  return *this;
115 
116 }
117 
118 void G4MolecularDecayChannel::AddProduct(const G4Molecule* molecule, G4double displacement)
119 {
120  if(!fProductsVector) fProductsVector = new vector<G4MoleculeHandle> ;
121 
122  G4MoleculeHandle molHandle(G4MoleculeHandleManager::Instance()->GetMoleculeHandle(molecule));
123  fProductsVector->push_back(molHandle);
124  fRMSProductsDisplacementVector.push_back(displacement);
125 }
126 
128 {
129  if(fProductsVector)
130  return fProductsVector->size();
131  return 0;
132 }
133 
135 {
136  if(fProductsVector)
137  return ((*fProductsVector)[index]).get();
138 
139  return 0;
140 }
141 
143 {
144  if(!fProductsVector) return -1.;
145 
146  G4int sz = fProductsVector->size();
148  for (G4int i=0; i<sz ; i++)
149  {
150  if(*product != *((*fProductsVector)[i]).get())
151  {
152  value = fRMSProductsDisplacementVector[i];
153  }
154  }
155  return value;
156 }
157