ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MolecularDissociationTable.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4MolecularDissociationTable.cc
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 // WARNING : This class is released as a prototype.
28 // It might strongly evolve or even disapear in the next releases.
29 //
30 // ----------------------------------------------------------------------
31 // GEANT 4 class implementation file
32 //
33 // History: first implementation by Alfonso Mantero 4 Mar 2009
34 //
35 // ----------------------------------------------------------------
36 
40 
41 using namespace std;
42 using namespace G4DNA;
43 
44 //______________________________________________________________________________
45 
47 {
48  ;
49 }
50 
51 //______________________________________________________________________________
52 
54 {
55  ChannelMap::iterator it_map = fDissociationChannels.begin();
56 
57  for (; it_map != fDissociationChannels.end(); it_map++)
58  {
59  vector<const G4MolecularDissociationChannel*>& decayChannels = it_map
60  ->second;
61  if (!decayChannels.empty())
62  {
63  for (int i = 0; i < (int) decayChannels.size(); i++)
64  {
65  if (decayChannels[i])
66  {
67  delete decayChannels[i];
68  decayChannels[i] = 0;
69  }
70  }
71  decayChannels.clear();
72  }
73  }
74  fDissociationChannels.clear();
75 }
76 
77 //______________________________________________________________________________
78 
81 {
82  *this = right;
83 }
84 
85 //______________________________________________________________________________
86 
89 {
90  if(this == &right) return *this;
91  fDissociationChannels = right.fDissociationChannels;
92  return *this;
93 }
94 
95 //______________________________________________________________________________
96 
97 const vector<const G4MolecularDissociationChannel*>*
100 {
101  ChannelMap::const_iterator it_exstates = fDissociationChannels.find(conf);
102  if (it_exstates == fDissociationChannels.end()) return 0;
103  return &(it_exstates->second);
104 }
105 
106 //______________________________________________________________________________
107 
108 const vector<const G4MolecularDissociationChannel*>*
110 {
111  for(ChannelMap::const_iterator it = fDissociationChannels.begin() ;
112  it!=fDissociationChannels.end() ; ++it
113  )
114  {
115  if(it->first->GetLabel() == exState) return &(it->second);
116  }
117  return 0;
118 }
119 
120 //______________________________________________________________________________
121 
122 //void G4MolecularDissociationTable::
123 // AddExcitedState(const G4String& label,
124 // const G4MolecularConfiguration* molConf);
125 //{
126 //
127 //}
128 
129 //______________________________________________________________________________
130 
133  const G4MolecularDissociationChannel* channel)
134 {
135  fDissociationChannels[molConf].push_back(channel);
136 }
137 
138 //______________________________________________________________________________
139 
141 {
142  ChannelMap::const_iterator channelsIter;
143 
144  for(channelsIter = fDissociationChannels.begin();
145  channelsIter != fDissociationChannels.end(); ++channelsIter)
146  {
147 
148  const vector<const G4MolecularDissociationChannel*>& decayVect =
149  channelsIter->second;
150  G4double sum = 0;
151 
152  G4double max = decayVect.size();
153 
154  for(size_t i = 0; i < max; i++)
155  {
156  const G4MolecularDissociationChannel* decay = decayVect[i];
157  const G4double prob = decay->GetProbability();
158  sum += prob;
159  }
160 
161  if(sum != 1)
162  {
163  G4ExceptionDescription errMsg;
164  errMsg << "The probabilities for deecitation of molecular configuration "
165  << channelsIter->first->GetName()
166  << " with label :" << channelsIter->first->GetLabel()
167  << " don't sum up to 1";
168  G4Exception("G4MolecularDissociationTable::CheckDataConsistency",
169  "BRANCHING_RATIOS_CONSISTENCY",
171  errMsg);
172  }
173  }
174 }
175 
176 void G4MolecularDissociationTable::Serialize(std::ostream& /*char_traits*/)
177 {
178  // TODO
179 }