Geant4  10.02.p02
G4MolecularDissociationTable.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: G4MolecularDissociationTable.cc 93883 2015-11-03 08:25:04Z gcosmo $
27 //
28 // WARNING : This class is released as a prototype.
29 // It might strongly evolve or even disapear in the next releases.
30 //
31 // ----------------------------------------------------------------------
32 // GEANT 4 class implementation file
33 //
34 // History: first implementation by Alfonso Mantero 4 Mar 2009
35 //
36 // ----------------------------------------------------------------
37 
41 
42 using namespace std;
43 using namespace G4DNA;
44 
45 //______________________________________________________________________________
46 
48 {
49  ;
50 }
51 
52 //______________________________________________________________________________
53 
55 {
56  ChannelMap::iterator it_map = fDissociationChannels.begin();
57 
58  for (; it_map != fDissociationChannels.end(); it_map++)
59  {
60  vector<const G4MolecularDissociationChannel*>& decayChannels = it_map
61  ->second;
62  if (!decayChannels.empty())
63  {
64  for (int i = 0; i < (int) decayChannels.size(); i++)
65  {
66  if (decayChannels[i])
67  {
68  delete decayChannels[i];
69  decayChannels[i] = 0;
70  }
71  }
72  decayChannels.clear();
73  }
74  }
75  fDissociationChannels.clear();
76 }
77 
78 //______________________________________________________________________________
79 
82 {
83  *this = right;
84 }
85 
86 //______________________________________________________________________________
87 
90 {
91  if(this == &right) return *this;
92  fDissociationChannels = right.fDissociationChannels;
93  return *this;
94 }
95 
96 //______________________________________________________________________________
97 
98 const vector<const G4MolecularDissociationChannel*>*
101 {
102  ChannelMap::const_iterator it_exstates = fDissociationChannels.find(conf);
103  if (it_exstates == fDissociationChannels.end()) return 0;
104  return &(it_exstates->second);
105 }
106 
107 //______________________________________________________________________________
108 
109 const vector<const G4MolecularDissociationChannel*>*
111 {
112  for(ChannelMap::const_iterator it = fDissociationChannels.begin() ;
113  it!=fDissociationChannels.end() ; ++it
114  )
115  {
116  if(it->first->GetLabel() == exState) return &(it->second);
117  }
118  return 0;
119 }
120 
121 //______________________________________________________________________________
122 
123 //void G4MolecularDissociationTable::
124 // AddExcitedState(const G4String& label,
125 // const G4MolecularConfiguration* molConf);
126 //{
127 //
128 //}
129 
130 //______________________________________________________________________________
131 
134  const G4MolecularDissociationChannel* channel)
135 {
136  fDissociationChannels[molConf].push_back(channel);
137 }
138 
139 //______________________________________________________________________________
140 
142 {
143  ChannelMap::const_iterator channelsIter;
144 
145  for(channelsIter = fDissociationChannels.begin();
146  channelsIter != fDissociationChannels.end(); ++channelsIter)
147  {
148 
149  const vector<const G4MolecularDissociationChannel*>& decayVect =
150  channelsIter->second;
151  G4double sum = 0;
152 
153  G4double max = decayVect.size();
154 
155  for(size_t i = 0; i < max; i++)
156  {
157  const G4MolecularDissociationChannel* decay = decayVect[i];
158  const G4double prob = decay->GetProbability();
159  sum += prob;
160  }
161 
162  if(sum != 1)
163  {
164  G4ExceptionDescription errMsg;
165  errMsg << "The probabilities for deecitation of molecular configuration "
166  << channelsIter->first->GetName()
167  << " with label :" << channelsIter->first->GetLabel()
168  << " don't sum up to 1";
169  G4Exception("G4MolecularDissociationTable::CheckDataConsistency",
170  "BRANCHING_RATIOS_CONSISTENCY",
172  errMsg);
173  }
174  }
175 }
176 
177 void G4MolecularDissociationTable::Serialize(std::ostream& /*char_traits*/)
178 {
179  // TODO
180 }
The pointer G4MolecularConfiguration will be shared by all the molecules having the same molecule def...
const std::vector< const G4MolecularDissociationChannel * > * GetDecayChannels(const G4MolecularConfiguration *) const
G4MolecularDissociationTable & operator=(const G4MolecularDissociationTable &right)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
Class Description G4MolecularDecayTable operates as a container of deexcitation modes for excited or ...
ParticleList decay(Cluster *const c)
Carries out a cluster decay.
void AddChannel(const G4MolecularConfiguration *molConf, const G4MolecularDissociationChannel *channel)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
T max(const T t1, const T t2)
brief Return the largest of the two arguments
double G4double
Definition: G4Types.hh:76