Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/processes/electromagnetic/lowenergy/src/G4AtomicDeexcitation.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /processes/electromagnetic/lowenergy/src/G4AtomicDeexcitation.cc (Version 11.3.0) and /processes/electromagnetic/lowenergy/src/G4AtomicDeexcitation.cc (Version 8.1.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4AtomicDeexcitation.cc,v 1.11 
                                                   >>  28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
 27 //                                                 29 //
 28 // Authors: Elena Guardincerri (Elena.Guardinc     30 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
 29 //          Alfonso Mantero (Alfonso.Mantero@g     31 //          Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
 30 //                                                 32 //
 31 // History:                                        33 // History:
 32 // -----------                                     34 // -----------
 33 //                                                 35 //  
 34 //  16 Sept 2001  First committed to cvs           36 //  16 Sept 2001  First committed to cvs
 35 //  12 Sep  2003  Bug in auger production fixe     37 //  12 Sep  2003  Bug in auger production fixed
 36 //                                                 38 //
 37 // -------------------------------------------     39 // -------------------------------------------------------------------
 38                                                    40 
 39 #include "G4AtomicDeexcitation.hh"                 41 #include "G4AtomicDeexcitation.hh"
 40 #include "Randomize.hh"                            42 #include "Randomize.hh"
 41 #include "G4PhysicalConstants.hh"              << 
 42 #include "G4SystemOfUnits.hh"                  << 
 43 #include "G4Gamma.hh"                              43 #include "G4Gamma.hh"
 44 #include "G4Electron.hh"                           44 #include "G4Electron.hh"
 45 #include "G4AtomicTransitionManager.hh"            45 #include "G4AtomicTransitionManager.hh"
 46 #include "G4FluoTransition.hh"                     46 #include "G4FluoTransition.hh"
 47                                                    47 
 48 G4AtomicDeexcitation::G4AtomicDeexcitation():      48 G4AtomicDeexcitation::G4AtomicDeexcitation():
 49   minGammaEnergy(100.*eV),                         49   minGammaEnergy(100.*eV),
 50   minElectronEnergy(100.*eV),                      50   minElectronEnergy(100.*eV),
 51   fAuger(false)                                    51   fAuger(false)
 52 {                                              <<  52 {}
 53                                                << 
 54   G4cout << " ******************************** << 
 55   G4cout << " *                  W A R N I N G << 
 56   G4cout << " ******************************** << 
 57   G4cout << " *                                << 
 58   G4cout << " *  Class G4AtomicDeexcitation is << 
 59   G4cout << " * discontinued and is going to b << 
 60   G4cout << " *     release please migrate to  << 
 61   G4cout << " *                                << 
 62   G4cout << " ******************************** << 
 63                                                << 
 64   augerVacancyId=0;                            << 
 65   newShellId=0;                                << 
 66 }                                              << 
 67                                                    53 
 68 G4AtomicDeexcitation::~G4AtomicDeexcitation()      54 G4AtomicDeexcitation::~G4AtomicDeexcitation()
 69 {}                                                 55 {}
 70                                                    56 
 71 std::vector<G4DynamicParticle*>* G4AtomicDeexc     57 std::vector<G4DynamicParticle*>* G4AtomicDeexcitation::GenerateParticles(G4int Z,G4int givenShellId)
 72 {                                                  58 { 
 73                                                <<  59   std::vector<G4DynamicParticle*>* vectorOfParticles = new std::vector<G4DynamicParticle*>;
 74   std::vector<G4DynamicParticle*>* vectorOfPar <<  60   G4DynamicParticle* aParticle;
 75   vectorOfParticles = new std::vector<G4Dynami << 
 76                                                << 
 77   G4DynamicParticle* aParticle = nullptr;      << 
 78   G4int provShellId = 0;                           61   G4int provShellId = 0;
 79   G4int counter = 0;                               62   G4int counter = 0;
 80                                                    63   
 81   // The aim of this loop is to generate more      64   // The aim of this loop is to generate more than one fluorecence photon 
 82   // from the same ionizing event                  65   // from the same ionizing event 
 83   do                                           <<  66 do
 84     {                                              67     {
 85       if (counter == 0)                            68       if (counter == 0) 
 86   // First call to GenerateParticles(...):         69   // First call to GenerateParticles(...):
 87   // givenShellId is given by the process          70   // givenShellId is given by the process
 88   {                                                71   {
 89     provShellId = SelectTypeOfTransition(Z, gi     72     provShellId = SelectTypeOfTransition(Z, givenShellId);
 90                                                    73     
 91     if  ( provShellId >0)                          74     if  ( provShellId >0) 
 92       {                                            75       {
 93         aParticle = GenerateFluorescence(Z,giv     76         aParticle = GenerateFluorescence(Z,givenShellId,provShellId);  
 94       }                                            77       }
 95     else if ( provShellId == -1)                   78     else if ( provShellId == -1)
 96       {                                            79       {
 97         aParticle = GenerateAuger(Z, givenShel     80         aParticle = GenerateAuger(Z, givenShellId);
 98       }                                            81       }
 99     else                                           82     else
100       {                                            83       {
101         G4Exception("G4AtomicDeexcitation::Con <<  84         G4Exception("G4AtomicDeexcitation: starting shell uncorrect: check it");
102       }                                            85       }
103   }                                                86   }
104       else                                         87       else 
105   // Following calls to GenerateParticles(...)     88   // Following calls to GenerateParticles(...):
106   // newShellId is given by GenerateFluorescen     89   // newShellId is given by GenerateFluorescence(...)
107   {                                                90   {
108     provShellId = SelectTypeOfTransition(Z,new     91     provShellId = SelectTypeOfTransition(Z,newShellId);
109     if  (provShellId >0)                           92     if  (provShellId >0)
110       {                                            93       {
111         aParticle = GenerateFluorescence(Z,new     94         aParticle = GenerateFluorescence(Z,newShellId,provShellId);
112       }                                            95       }
113     else if ( provShellId == -1)                   96     else if ( provShellId == -1)
114       {                                            97       {
                                                   >>  98         // controllae che newshellId porti ad una transizione fattibile, in qualche modo.
115         aParticle = GenerateAuger(Z, newShellI     99         aParticle = GenerateAuger(Z, newShellId);
116       }                                        << 100         }
117     else                                          101     else
118       {                                           102       {
119         G4Exception("G4AtomicDeexcitation::con << 103         G4Exception("G4AtomicDeexcitation: starting shell uncorrect: check it");
120       }                                           104       }
121   }                                               105   }
122       counter++;                                  106       counter++;
123       if (aParticle != nullptr) {vectorOfParti << 107       if (aParticle != 0) {vectorOfParticles->push_back(aParticle);}
124       else {provShellId = -2;}                    108       else {provShellId = -2;}
125     }                                             109     }
126                                                << 
127   // Look this in a particular way: only one a << 
128   while (provShellId > -2);                    << 
129                                                << 
130   // debug                                     << 
131   // if (vectorOfParticles->size() > 0) {      << 
132   //   G4cout << " DEEXCITATION!" << G4endl;   << 
133   // }                                         << 
134                                                   110 
                                                   >> 111 // Look this in a particular way: only one auger emitted! //
                                                   >> 112  while (provShellId > -2); 
                                                   >> 113  
135   return vectorOfParticles;                       114   return vectorOfParticles;
136 }                                                 115 }
137                                                   116 
138 G4int G4AtomicDeexcitation::SelectTypeOfTransi    117 G4int G4AtomicDeexcitation::SelectTypeOfTransition(G4int Z, G4int shellId)
139 {                                                 118 {
140   if (shellId <=0 )                               119   if (shellId <=0 ) 
141     {G4Exception("G4AtomicDeexcitation::Select << 120     {G4Exception("G4AtomicDeexcitation: zero or negative shellId");}
142                                                   121 
143   //G4bool fluoTransitionFoundFlag = false;    << 122   G4bool fluoTransitionFoundFlag = false;
144                                                   123   
145   const G4AtomicTransitionManager*  transition    124   const G4AtomicTransitionManager*  transitionManager = 
146         G4AtomicTransitionManager::Instance();    125         G4AtomicTransitionManager::Instance();
147   G4int provShellId = -1;                         126   G4int provShellId = -1;
148   G4int shellNum = 0;                             127   G4int shellNum = 0;
149   G4int maxNumOfShells = transitionManager->Nu    128   G4int maxNumOfShells = transitionManager->NumberOfReachableShells(Z);  
150                                                   129   
151   const G4FluoTransition* refShell = transitio    130   const G4FluoTransition* refShell = transitionManager->ReachableShell(Z,maxNumOfShells-1);
152                                                   131 
153   // This loop gives shellNum the value of the    132   // This loop gives shellNum the value of the index of shellId
154   // in the vector storing the list of the she    133   // in the vector storing the list of the shells reachable through
155   // a radiative transition                       134   // a radiative transition
156   if ( shellId <= refShell->FinalShellId())       135   if ( shellId <= refShell->FinalShellId())
157     {                                             136     {
158       while (shellId != transitionManager->Rea    137       while (shellId != transitionManager->ReachableShell(Z,shellNum)->FinalShellId())
159   {                                               138   {
160     if(shellNum ==maxNumOfShells-1)               139     if(shellNum ==maxNumOfShells-1)
161       {                                           140       {
162         break;                                    141         break;
163       }                                           142       }
164     shellNum++;                                   143     shellNum++;
165   }                                               144   }
166       G4int transProb = 0; //AM change 29/6/07 << 145       G4int transProb = 1;
167                                                   146    
168       G4double partialProb = G4UniformRand();     147       G4double partialProb = G4UniformRand();      
169       G4double partSum = 0;                       148       G4double partSum = 0;
170       const G4FluoTransition* aShell = transit    149       const G4FluoTransition* aShell = transitionManager->ReachableShell(Z,shellNum);      
171       G4int trSize = (G4int)(aShell->Transitio << 150       G4int trSize =  (aShell->TransitionProbabilities()).size();
172                                                   151     
173       // Loop over the shells wich can provide    152       // Loop over the shells wich can provide an electron for a 
174       // radiative transition towards shellId:    153       // radiative transition towards shellId:
175       // in every loop the partial sum of the     154       // in every loop the partial sum of the first transProb shells
176       // is calculated and compared with a ran    155       // is calculated and compared with a random number [0,1].
177       // If the partial sum is greater, the sh    156       // If the partial sum is greater, the shell whose index is transProb
178       // is chosen as the starting shell for a    157       // is chosen as the starting shell for a radiative transition
179       // and its identity is returned             158       // and its identity is returned
180       // Else, terminateded the loop, -1 is re    159       // Else, terminateded the loop, -1 is returned
181       while(transProb < trSize){                  160       while(transProb < trSize){
182                                                   161   
183    partSum += aShell->TransitionProbability(tr    162    partSum += aShell->TransitionProbability(transProb);
184                                                   163 
185    if(partialProb <= partSum)                     164    if(partialProb <= partSum)
186      {                                            165      {
187        provShellId = aShell->OriginatingShellI    166        provShellId = aShell->OriginatingShellId(transProb);
188        //fluoTransitionFoundFlag = true;       << 167        fluoTransitionFoundFlag = true;
189                                                   168 
190        break;                                     169        break;
191      }                                            170      }
192    transProb++;                                   171    transProb++;
193       }                                           172       }
194                                                   173 
195       // here provShellId is the right one or     174       // here provShellId is the right one or is -1.
196       // if -1, the control is passed to the A    175       // if -1, the control is passed to the Auger generation part of the package 
197     }                                             176     }
                                                   >> 177 
                                                   >> 178 
                                                   >> 179 
198   else                                            180   else 
199     provShellId = -1;                          << 181     {
                                                   >> 182  
                                                   >> 183      provShellId = -1;
200                                                   184 
                                                   >> 185     }
201   return provShellId;                             186   return provShellId;
202 }                                                 187 }
203                                                   188 
204 G4DynamicParticle* G4AtomicDeexcitation::Gener    189 G4DynamicParticle* G4AtomicDeexcitation::GenerateFluorescence(G4int Z, 
205                     G4int shellId,                190                     G4int shellId,
206                     G4int provShellId )           191                     G4int provShellId )
207 {                                                 192 { 
                                                   >> 193 
                                                   >> 194 
208   const G4AtomicTransitionManager*  transition    195   const G4AtomicTransitionManager*  transitionManager = G4AtomicTransitionManager::Instance();
209   //  G4int provenienceShell = provShellId;       196   //  G4int provenienceShell = provShellId;
210                                                   197 
211   //isotropic angular distribution for the out    198   //isotropic angular distribution for the outcoming photon
212   G4double newcosTh = 1.-2.*G4UniformRand();      199   G4double newcosTh = 1.-2.*G4UniformRand();
213   G4double  newsinTh = std::sqrt(1.-newcosTh*n    200   G4double  newsinTh = std::sqrt(1.-newcosTh*newcosTh);
214   G4double newPhi = twopi*G4UniformRand();        201   G4double newPhi = twopi*G4UniformRand();
215                                                   202   
216   G4double xDir =  newsinTh*std::sin(newPhi);     203   G4double xDir =  newsinTh*std::sin(newPhi);
217   G4double yDir = newsinTh*std::cos(newPhi);      204   G4double yDir = newsinTh*std::cos(newPhi);
218   G4double zDir = newcosTh;                       205   G4double zDir = newcosTh;
219                                                   206   
220   G4ThreeVector newGammaDirection(xDir,yDir,zD    207   G4ThreeVector newGammaDirection(xDir,yDir,zDir);
221                                                   208   
222   G4int shellNum = 0;                             209   G4int shellNum = 0;
223   G4int maxNumOfShells = transitionManager->Nu    210   G4int maxNumOfShells = transitionManager->NumberOfReachableShells(Z);
224                                                   211   
225   // find the index of the shell named shellId    212   // find the index of the shell named shellId
226   while (shellId != transitionManager->           213   while (shellId != transitionManager->
227    ReachableShell(Z,shellNum)->FinalShellId())    214    ReachableShell(Z,shellNum)->FinalShellId())
228     {                                             215     {
229       if(shellNum == maxNumOfShells-1)            216       if(shellNum == maxNumOfShells-1)
230   {                                               217   {
231     break;                                        218     break;
232   }                                               219   }
233       shellNum++;                                 220       shellNum++;
234     }                                             221     }
235   // number of shell from wich an electron can    222   // number of shell from wich an electron can reach shellId
236   G4int transitionSize = (G4int)transitionMana << 223   size_t transitionSize = transitionManager->
237     ReachableShell(Z,shellNum)->OriginatingShe    224     ReachableShell(Z,shellNum)->OriginatingShellIds().size();
238                                                   225   
239   G4int index = 0;                             << 226   size_t index = 0;
240                                                   227   
241   // find the index of the shell named provShe    228   // find the index of the shell named provShellId in the vector
242   // storing the shells from which shellId can    229   // storing the shells from which shellId can be reached 
243   while (provShellId != transitionManager->       230   while (provShellId != transitionManager->
244    ReachableShell(Z,shellNum)->OriginatingShel    231    ReachableShell(Z,shellNum)->OriginatingShellId(index))
245     {                                             232     {
246       if(index ==  transitionSize-1)              233       if(index ==  transitionSize-1)
247   {                                               234   {
248     break;                                        235     break;
249   }                                               236   }
250       index++;                                    237       index++;
251     }                                             238     }
252   // energy of the gamma leaving provShellId f    239   // energy of the gamma leaving provShellId for shellId
253   G4double transitionEnergy = transitionManage    240   G4double transitionEnergy = transitionManager->
254     ReachableShell(Z,shellNum)->TransitionEner    241     ReachableShell(Z,shellNum)->TransitionEnergy(index);
255                                                   242   
256   // This is the shell where the new vacancy i    243   // This is the shell where the new vacancy is: it is the same
257   // shell where the electron came from           244   // shell where the electron came from
258   newShellId = transitionManager->                245   newShellId = transitionManager->
259     ReachableShell(Z,shellNum)->OriginatingShe    246     ReachableShell(Z,shellNum)->OriginatingShellId(index);
260                                                   247   
                                                   >> 248   
261   G4DynamicParticle* newPart = new G4DynamicPa    249   G4DynamicParticle* newPart = new G4DynamicParticle(G4Gamma::Gamma(), 
262                  newGammaDirection,               250                  newGammaDirection,
263                  transitionEnergy);               251                  transitionEnergy);
264   return newPart;                                 252   return newPart;
265 }                                                 253 }
266                                                   254 
267 G4DynamicParticle* G4AtomicDeexcitation::Gener    255 G4DynamicParticle* G4AtomicDeexcitation::GenerateAuger(G4int Z, G4int shellId)
268 {                                                 256 {
269   if(!fAuger) return 0;                           257   if(!fAuger) return 0;
270                                                   258   
                                                   >> 259 
271   const G4AtomicTransitionManager*  transition    260   const G4AtomicTransitionManager*  transitionManager = 
272         G4AtomicTransitionManager::Instance();    261         G4AtomicTransitionManager::Instance();
273                                                   262 
                                                   >> 263 
                                                   >> 264 
274   if (shellId <=0 )                               265   if (shellId <=0 ) 
275     {G4Exception("G4AtomicDeexcitation::Genera << 266     {G4Exception("G4AtomicDeexcitation: zero or negative shellId");}
276                                                   267   
277   // G4int provShellId = -1;                      268   // G4int provShellId = -1;
278   G4int maxNumOfShells = transitionManager->Nu    269   G4int maxNumOfShells = transitionManager->NumberOfReachableAugerShells(Z);  
279                                                   270   
280   const G4AugerTransition* refAugerTransition     271   const G4AugerTransition* refAugerTransition = 
281         transitionManager->ReachableAugerShell    272         transitionManager->ReachableAugerShell(Z,maxNumOfShells-1);
282                                                   273 
283                                                   274 
284   // This loop gives to shellNum the value of     275   // This loop gives to shellNum the value of the index of shellId
285   // in the vector storing the list of the vac    276   // in the vector storing the list of the vacancies in the variuos shells 
286   // that can originate a NON-radiative transi    277   // that can originate a NON-radiative transition
                                                   >> 278   
                                                   >> 279   // ---- MGP ---- Next line commented out to remove compilation warning
                                                   >> 280   // G4int p = refAugerTransition->FinalShellId();
                                                   >> 281 
287   G4int shellNum = 0;                             282   G4int shellNum = 0;
288                                                   283 
                                                   >> 284 
289   if ( shellId <= refAugerTransition->FinalShe    285   if ( shellId <= refAugerTransition->FinalShellId() ) 
290     //"FinalShellId" is final from the point o    286     //"FinalShellId" is final from the point of view of the elctron who makes the transition, 
291     // being the Id of the shell in which ther    287     // being the Id of the shell in which there is a vacancy
292     {                                             288     {
293       G4int pippo = transitionManager->Reachab    289       G4int pippo = transitionManager->ReachableAugerShell(Z,shellNum)->FinalShellId();
294       if (shellId  != pippo ) {                   290       if (shellId  != pippo ) {
295   do {                                            291   do { 
296     shellNum++;                                   292     shellNum++;
297     if(shellNum == maxNumOfShells)                293     if(shellNum == maxNumOfShells)
298       {                                           294       {
299                                                << 295 //          G4cout << "G4AtomicDeexcitation warning: No Auger transition found" <<  G4endl;
300         //G4Exception("G4AtomicDeexcitation: N << 296 //        G4cout << "Absorbed enrgy deposited locally" << G4endl;
301         return 0;                              << 297         return 0;
                                                   >> 298 //        //  G4Exception("G4AtomicDeexcitation: No Auger transition found");
302       }                                           299       }
303   }                                               300   }
304   while (shellId != (transitionManager->Reacha    301   while (shellId != (transitionManager->ReachableAugerShell(Z,shellNum)->FinalShellId()) ) ;
305       }                                           302       }
                                                   >> 303     /*  {
                                                   >> 304 
                                                   >> 305     if(shellNum == maxNumOfShells-1)
                                                   >> 306       {
                                                   >> 307         G4Exception("G4AtomicDeexcitation: No Auger tramsition found");
                                                   >> 308       }
                                                   >> 309     shellNum++;
                                                   >> 310     }*/
                                                   >> 311     
                                                   >> 312 
                                                   >> 313 
                                                   >> 314 
                                                   >> 315       // Now we have that shellnum is the shellIndex of the shell named ShellId
                                                   >> 316 
                                                   >> 317       //      G4cout << " the index of the shell is: "<<shellNum<<G4endl;
                                                   >> 318 
                                                   >> 319       // But we have now to select two shells: one for the transition, 
                                                   >> 320       // and another for the auger emission.
306                                                   321 
307       G4int transitionLoopShellIndex = 0;         322       G4int transitionLoopShellIndex = 0;      
308       G4double partSum = 0;                       323       G4double partSum = 0;
309       const G4AugerTransition* anAugerTransiti    324       const G4AugerTransition* anAugerTransition = 
310             transitionManager->ReachableAugerS    325             transitionManager->ReachableAugerShell(Z,shellNum);
311                                                   326 
312       G4int transitionSize = (G4int)           << 327       //      G4cout << " corresponding to the ID: "<< anAugerTransition->FinalShellId() << G4endl;
                                                   >> 328 
                                                   >> 329 
                                                   >> 330       G4int transitionSize = 
313             (anAugerTransition->TransitionOrig    331             (anAugerTransition->TransitionOriginatingShellIds())->size();
314       while (transitionLoopShellIndex < transi    332       while (transitionLoopShellIndex < transitionSize) {
315                                                   333 
316         std::vector<G4int>::const_iterator pos    334         std::vector<G4int>::const_iterator pos = 
317                anAugerTransition->TransitionOr    335                anAugerTransition->TransitionOriginatingShellIds()->begin();
318                                                   336 
319         G4int transitionLoopShellId = *(pos+tr    337         G4int transitionLoopShellId = *(pos+transitionLoopShellIndex);
320         G4int numberOfPossibleAuger = (G4int)  << 338         G4int numberOfPossibleAuger = 
321               (anAugerTransition->AugerTransit    339               (anAugerTransition->AugerTransitionProbabilities(transitionLoopShellId))->size();
322         G4int augerIndex = 0;                     340         G4int augerIndex = 0;
                                                   >> 341         //      G4int partSum2 = 0;
323                                                   342 
324   if (augerIndex < numberOfPossibleAuger) {    << 343 
                                                   >> 344   if (augerIndex < numberOfPossibleAuger) {
                                                   >> 345     
325     do                                            346     do 
326       {                                           347       {
327         G4double thisProb = anAugerTransition-    348         G4double thisProb = anAugerTransition->AugerTransitionProbability(augerIndex, 
328                     transitionLoopShellId);       349                     transitionLoopShellId);
329         partSum += thisProb;                      350         partSum += thisProb;
330         augerIndex++;                             351         augerIndex++;
331                                                   352         
332       } while (augerIndex < numberOfPossibleAu    353       } while (augerIndex < numberOfPossibleAuger);
333     }                                             354     }
334         transitionLoopShellIndex++;               355         transitionLoopShellIndex++;
335       }                                           356       }
336                                                   357       
337                                                   358 
                                                   >> 359 
338       // Now we have the entire probability of    360       // Now we have the entire probability of an auger transition for the vacancy 
339       // located in shellNum (index of shellId    361       // located in shellNum (index of shellId) 
                                                   >> 362 
                                                   >> 363       // AM *********************** F I X E D **************************** AM
                                                   >> 364       // Here we duplicate the previous loop, this time looking to the sum of the probabilities 
                                                   >> 365       // to be under the random number shoot by G4 UniformRdandom. This could have been done in the 
                                                   >> 366       // previuos loop, while integrating the probabilities. There is a bug that will be fixed 
                                                   >> 367       // 5 minutes from now: a line:
                                                   >> 368       // G4int numberOfPossibleAuger = (anAugerTransition->
                                                   >> 369       // AugerTransitionProbabilities(transitionLoopShellId))->size();
                                                   >> 370       // to be inserted.
                                                   >> 371       // AM *********************** F I X E D **************************** AM
                                                   >> 372 
                                                   >> 373       // Remains to get the same result with a single loop.
                                                   >> 374 
                                                   >> 375       // AM *********************** F I X E D **************************** AM
                                                   >> 376       // Another Bug: in EADL Auger Transition are normalized to all the transitions deriving from 
                                                   >> 377       // a vacancy in one shell, but no alla of these are present in data tables. So if a transition 
                                                   >> 378       // doesn't occur in the maoin onesm a local energy deposition must occur, instead of (like now) 
                                                   >> 379       // generating the last transition present in EADL data.
                                                   >> 380       // AM *********************** F I X E D **************************** AM
                                                   >> 381 
                                                   >> 382 
340       G4double totalVacancyAugerProbability =     383       G4double totalVacancyAugerProbability = partSum;
341                                                   384 
                                                   >> 385 
342       //And now we start to select the right a    386       //And now we start to select the right auger transition and emission
343       G4int transitionRandomShellIndex = 0;       387       G4int transitionRandomShellIndex = 0;
344       G4int transitionRandomShellId = 1;          388       G4int transitionRandomShellId = 1;
345       G4int augerIndex = 0;                       389       G4int augerIndex = 0;
346       partSum = 0;                                390       partSum = 0; 
347       G4double partialProb = G4UniformRand();     391       G4double partialProb = G4UniformRand();
348       // G4int augerOriginatingShellId = 0;       392       // G4int augerOriginatingShellId = 0;
349                                                   393       
350       G4int numberOfPossibleAuger = 0;         << 394       G4int numberOfPossibleAuger = 
351                                                << 395     (anAugerTransition->AugerTransitionProbabilities(transitionRandomShellId))->size();
352       G4bool foundFlag = false;                   396       G4bool foundFlag = false;
353                                                   397 
354       while (transitionRandomShellIndex < tran    398       while (transitionRandomShellIndex < transitionSize) {
                                                   >> 399 
355         std::vector<G4int>::const_iterator pos    400         std::vector<G4int>::const_iterator pos = 
356                anAugerTransition->TransitionOr    401                anAugerTransition->TransitionOriginatingShellIds()->begin();
357                                                   402 
358         transitionRandomShellId = *(pos+transi    403         transitionRandomShellId = *(pos+transitionRandomShellIndex);
359                                                   404         
360   augerIndex = 0;                                 405   augerIndex = 0;
361   numberOfPossibleAuger = (G4int)(anAugerTrans << 406   numberOfPossibleAuger = (anAugerTransition-> 
362          AugerTransitionProbabilities(transiti    407          AugerTransitionProbabilities(transitionRandomShellId))->size();
363                                                   408 
364         while (augerIndex < numberOfPossibleAu    409         while (augerIndex < numberOfPossibleAuger) {
365     G4double thisProb =anAugerTransition->Auge    410     G4double thisProb =anAugerTransition->AugerTransitionProbability(augerIndex, 
366                      transitionRandomShellId);    411                      transitionRandomShellId);
367                                                   412 
368           partSum += thisProb;                    413           partSum += thisProb;
369                                                   414           
370           if (partSum >= (partialProb*totalVac << 415           if (partSum >= (partialProb/totalVacancyAugerProbability) ) {
371       foundFlag = true;                           416       foundFlag = true;
372       break;                                      417       break;
373     }                                             418     }
374           augerIndex++;                           419           augerIndex++;
375         }                                         420         }
376         if (partSum >= (partialProb*totalVacan << 421         if (partSum >= (partialProb/totalVacancyAugerProbability) ) {break;}
377         transitionRandomShellIndex++;             422         transitionRandomShellIndex++;
378       }                                           423       }
379                                                   424 
380       // Now we have the index of the shell fr    425       // Now we have the index of the shell from wich comes the auger electron (augerIndex), 
381       // and the id of the shell, from which t    426       // and the id of the shell, from which the transition e- come (transitionRandomShellid)
382       // If no Transition has been found, 0 is    427       // If no Transition has been found, 0 is returned.  
383                                                   428 
384       if (!foundFlag) {return 0;}                 429       if (!foundFlag) {return 0;}      
385                                                   430       
386       // Isotropic angular distribution for th    431       // Isotropic angular distribution for the outcoming e-
387       G4double newcosTh = 1.-2.*G4UniformRand(    432       G4double newcosTh = 1.-2.*G4UniformRand();
388       G4double  newsinTh = std::sqrt(1.-newcos    433       G4double  newsinTh = std::sqrt(1.-newcosTh*newcosTh);
389       G4double newPhi = twopi*G4UniformRand();    434       G4double newPhi = twopi*G4UniformRand();
390                                                   435       
391       G4double xDir =  newsinTh*std::sin(newPh    436       G4double xDir =  newsinTh*std::sin(newPhi);
392       G4double yDir = newsinTh*std::cos(newPhi    437       G4double yDir = newsinTh*std::cos(newPhi);
393       G4double zDir = newcosTh;                   438       G4double zDir = newcosTh;
394                                                   439       
395       G4ThreeVector newElectronDirection(xDir,    440       G4ThreeVector newElectronDirection(xDir,yDir,zDir);
396                                                   441       
397       // energy of the auger electron emitted     442       // energy of the auger electron emitted
398                                                << 443       
                                                   >> 444       
399       G4double transitionEnergy = anAugerTrans    445       G4double transitionEnergy = anAugerTransition->AugerTransitionEnergy(augerIndex, transitionRandomShellId);
400       /*                                          446       /*
401   G4cout << "AUger TransitionId " << anAugerTr    447   G4cout << "AUger TransitionId " << anAugerTransition->FinalShellId() << G4endl;
402   G4cout << "augerIndex: " << augerIndex << G4    448   G4cout << "augerIndex: " << augerIndex << G4endl;
403   G4cout << "transitionShellId: " << transitio    449   G4cout << "transitionShellId: " << transitionRandomShellId << G4endl;
404       */                                          450       */
405                                                   451       
406       // This is the shell where the new vacan    452       // This is the shell where the new vacancy is: it is the same
407       // shell where the electron came from       453       // shell where the electron came from
408       newShellId = transitionRandomShellId;       454       newShellId = transitionRandomShellId;
409                                                << 455       
                                                   >> 456       
410       G4DynamicParticle* newPart = new G4Dynam    457       G4DynamicParticle* newPart = new G4DynamicParticle(G4Electron::Electron(), 
411                newElectronDirection,              458                newElectronDirection,
412                transitionEnergy);                 459                transitionEnergy);
413       return newPart;                             460       return newPart;
                                                   >> 461 
414     }                                             462     }
415   else                                            463   else 
416     {                                             464     {
417       //G4Exception("G4AtomicDeexcitation: no     465       //G4Exception("G4AtomicDeexcitation: no auger transition found");
418       return 0;                                   466       return 0;
419     }                                             467     }
                                                   >> 468   
420 }                                                 469 }
421                                                   470 
422 void G4AtomicDeexcitation::SetCutForSecondaryP    471 void G4AtomicDeexcitation::SetCutForSecondaryPhotons(G4double cut)
423 {                                                 472 {
424   minGammaEnergy = cut;                           473   minGammaEnergy = cut;
425 }                                                 474 }
426                                                   475 
427 void G4AtomicDeexcitation::SetCutForAugerElect    476 void G4AtomicDeexcitation::SetCutForAugerElectrons(G4double cut)
428 {                                                 477 {
429   minElectronEnergy = cut;                        478   minElectronEnergy = cut;
430 }                                                 479 }
431                                                   480 
432 void G4AtomicDeexcitation::ActivateAugerElectr    481 void G4AtomicDeexcitation::ActivateAugerElectronProduction(G4bool val)
433 {                                                 482 {
434   fAuger = val;                                   483   fAuger = val;
435 }                                                 484 }
436                                                   485 
437                                                   486 
438                                                   487 
439                                                   488 
440                                                   489 
441                                                   490 
442                                                   491 
443                                                   492