source: trunk/source/processes/hadronic/models/chiral_inv_phase_space/interface/src/G4QHadronInelasticDataSet.cc @ 1198

Last change on this file since 1198 was 1197, checked in by garnier, 15 years ago

nvx fichiers dans CVS

File size: 18.8 KB
Line 
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: G4QHadronInelasticDataSet.cc,v 1.1 2009/11/20 10:08:36 mkossov Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29// GEANT4 physics class: G4QHadronInelasticDataSet -- header file
30// Created by M. Kosov (Mikhail.Kossov@cern.ch) 11.11.09
31//
32// ------------------------------------------------------------------------
33// Short description: G4hadr wrapper for CHIPS inelastic hA cross-sections.
34// ------------------------------------------------------------------------
35//
36
37#include "G4QHadronInelasticDataSet.hh"
38
39// Initialization of static vectors
40std::vector<G4int> G4QHadronInelasticDataSet::ElementZ; // Z of the element(i) in LastCalc
41std::vector<std::vector<G4int>*> G4QHadronInelasticDataSet::ElIsoN; // N of iso(j) of El(i)
42std::vector<std::vector<G4double>*> G4QHadronInelasticDataSet::IsoProbInEl;//SumProbIsoInEl
43
44G4QHadronInelasticDataSet::G4QHadronInelasticDataSet()
45{
46  //CHIPSpAin    = G4QProtonNuclearCrossSection::GetPointer();
47  //CHIPSnAin    = G4QNeutronNuclearCrossSection::GetPointer();
48  //CHIPSpimAin  = G4QPionMinusNuclearCrossSection::GetPointer();
49  //CHIPSpipAin  = G4QPionPlusNuclearCrossSection::GetPointer();
50  //CHIPSkpAin   = G4QKaonPlusNuclearCrossSection::GetPointer();
51  //CHIPSkmAin   = G4QKaonMinusNuclearCrossSection::GetPointer();
52  //CHIPSk0Ain   = G4QKaonZeroNuclearCrossSection::GetPointer();
53  //CHIPShAin    = G4QHyperonNuclearCrossSection::GetPointer();
54  //CHIPShpAin   = G4QHyperonPlusNuclearCrossSection::GetPointer();
55  //CHIPSabpAin  = G4QAntiBaryonPlusNuclearCrossSection::GetPointer();
56  //CHIPSabAin   = G4QAntiBaryonNuclearCrossSection::GetPointer();
57  ////CHIPSphAin   = G4QPhotonNuclearCrossSection::GetPointer();
58  ////CHIPSeAin    = G4QElectronNuclearCrossSection::GetPointer();
59  ////CHIPSmuAin   = G4QMuonNuclearCrossSection::GetPointer();
60  ////CHIPStauAin  = G4QTauNuclearCrossSection::GetPointer();
61  ////CHIPSnumAin  = G4QNuMuNuclearCrossSection::GetPointer();
62  ////CHIPSanumAin = G4QANuMuNuclearCrossSection::GetPointer();
63  ////CHIPSnueAin  = G4QNuENuclearCrossSection::GetPointer();
64  ////CHIPSanueAin = G4QANuENuclearCrossSection::GetPointer();
65  ////CHIPSnunuAin = G4QNuNuNuclearCrossSection::GetPointer();
66  ////CHIPSananAin = G4QANuANuNuclearCrossSection::GetPointer();
67
68  Isotopes = G4QIsotope::Get(); // Pointer to the G4QIsotopes singleton
69}
70
71G4bool G4QHadronInelasticDataSet::IsApplicable(const G4DynamicParticle* P,const G4Element*)
72{
73  G4ParticleDefinition* particle = P->GetDefinition();
74  if      (particle ==         G4Neutron::Neutron()        ) return true; 
75  else if (particle ==          G4Proton::Proton()         ) return true;
76  else if (particle ==       G4PionMinus::PionMinus()      ) return true;
77  else if (particle ==        G4PionPlus::PionPlus()       ) return true;
78  else if (particle ==        G4KaonPlus::KaonPlus()       ) return true;
79  else if (particle ==       G4KaonMinus::KaonMinus()      ) return true;
80  else if (particle ==    G4KaonZeroLong::KaonZeroLong()   ) return true;
81  else if (particle ==   G4KaonZeroShort::KaonZeroShort()  ) return true;
82  else if (particle ==          G4Lambda::Lambda()         ) return true;
83  else if (particle ==       G4SigmaPlus::SigmaPlus()      ) return true;
84  else if (particle ==      G4SigmaMinus::SigmaMinus()     ) return true;
85  else if (particle ==       G4SigmaZero::SigmaZero()      ) return true;
86  else if (particle ==         G4XiMinus::XiMinus()        ) return true;
87  else if (particle ==          G4XiZero::XiZero()         ) return true;
88  else if (particle ==      G4OmegaMinus::OmegaMinus()     ) return true;
89  else if (particle ==     G4AntiNeutron::AntiNeutron()    ) return true;
90  else if (particle ==      G4AntiProton::AntiProton()     ) return true;
91  else if (particle ==      G4AntiLambda::AntiLambda()     ) return true;
92  else if (particle ==   G4AntiSigmaPlus::AntiSigmaPlus()  ) return true;
93  else if (particle ==  G4AntiSigmaMinus::AntiSigmaMinus() ) return true;
94  else if (particle ==   G4AntiSigmaZero::AntiSigmaZero()  ) return true;
95  else if (particle ==     G4AntiXiMinus::AntiXiMinus()    ) return true;
96  else if (particle ==      G4AntiXiZero::AntiXiZero()     ) return true;
97  else if (particle ==  G4AntiOmegaMinus::AntiOmegaMinus() ) return true;
98  //else if (particle ==        G4MuonPlus::MuonPlus()       ) return true;
99  //else if (particle ==       G4MuonMinus::MuonMinus()      ) return true;
100  //else if (particle ==           G4Gamma::Gamma()          ) return true;
101  //else if (particle ==        G4Electron::Electron()       ) return true;
102  //else if (particle ==        G4Positron::Positron()       ) return true;
103  //else if (particle ==         G4TauPlus::TauPlus()        ) return true;
104  //else if (particle ==        G4TauMinus::TauMinus()       ) return true;
105  //else if (particle ==   G4AntiNeutrinoE::AntiNeutrinoE()  ) return true;
106  //else if (particle ==       G4NeutrinoE::NeutrinoE()      ) return true;
107  //else if (particle ==  G4AntiNeutrinoMu::AntiNeutrinoMu() ) return true;
108  //else if (particle ==      G4NeutrinoMu::NeutrinoMu()     ) return true;
109  //else if (particle == G4AntiNeutrinoTau::AntiNeutrinoTau()) return true;
110  //else if (particle ==     G4NeutrinoTau::NeutrinoTau()    ) return true;
111  return false;
112}
113
114G4bool G4QHadronInelasticDataSet::IsZAApplicable(const G4DynamicParticle* Pt,
115                                                 G4double, G4double)
116{
117  G4ParticleDefinition* particle = Pt->GetDefinition();
118  if      (particle ==         G4Neutron::Neutron()        ) return true; // @@ isotopes?
119  else if (particle ==          G4Proton::Proton()         ) return true;
120  else if (particle ==       G4PionMinus::PionMinus()      ) return true;
121  else if (particle ==        G4PionPlus::PionPlus()       ) return true;
122  else if (particle ==        G4KaonPlus::KaonPlus()       ) return true;
123  else if (particle ==       G4KaonMinus::KaonMinus()      ) return true;
124  else if (particle ==    G4KaonZeroLong::KaonZeroLong()   ) return true;
125  else if (particle ==   G4KaonZeroShort::KaonZeroShort()  ) return true;
126  else if (particle ==          G4Lambda::Lambda()         ) return true;
127  else if (particle ==       G4SigmaPlus::SigmaPlus()      ) return true;
128  else if (particle ==      G4SigmaMinus::SigmaMinus()     ) return true;
129  else if (particle ==       G4SigmaZero::SigmaZero()      ) return true;
130  else if (particle ==         G4XiMinus::XiMinus()        ) return true;
131  else if (particle ==          G4XiZero::XiZero()         ) return true;
132  else if (particle ==      G4OmegaMinus::OmegaMinus()     ) return true;
133  else if (particle ==     G4AntiNeutron::AntiNeutron()    ) return true;
134  else if (particle ==      G4AntiProton::AntiProton()     ) return true;
135  else if (particle ==      G4AntiLambda::AntiLambda()     ) return true;
136  else if (particle ==   G4AntiSigmaPlus::AntiSigmaPlus()  ) return true;
137  else if (particle ==  G4AntiSigmaMinus::AntiSigmaMinus() ) return true;
138  else if (particle ==   G4AntiSigmaZero::AntiSigmaZero()  ) return true;
139  else if (particle ==     G4AntiXiMinus::AntiXiMinus()    ) return true;
140  else if (particle ==      G4AntiXiZero::AntiXiZero()     ) return true;
141  else if (particle ==  G4AntiOmegaMinus::AntiOmegaMinus() ) return true;
142  //else if (particle ==        G4MuonPlus::MuonPlus()       ) return true;
143  //else if (particle ==       G4MuonMinus::MuonMinus()      ) return true;
144  //else if (particle ==           G4Gamma::Gamma()          ) return true;
145  //else if (particle ==        G4Electron::Electron()       ) return true;
146  //else if (particle ==        G4Positron::Positron()       ) return true;
147  //else if (particle ==         G4TauPlus::TauPlus()        ) return true;
148  //else if (particle ==        G4TauMinus::TauMinus()       ) return true;
149  //else if (particle ==   G4AntiNeutrinoE::AntiNeutrinoE()  ) return true;
150  //else if (particle ==       G4NeutrinoE::NeutrinoE()      ) return true;
151  //else if (particle ==  G4AntiNeutrinoMu::AntiNeutrinoMu() ) return true;
152  //else if (particle ==      G4NeutrinoMu::NeutrinoMu()     ) return true;
153  //else if (particle == G4AntiNeutrinoTau::AntiNeutrinoTau()) return true;
154  //else if (particle ==     G4NeutrinoTau::NeutrinoTau()    ) return true;
155  return false;
156}
157
158G4double G4QHadronInelasticDataSet::GetCrossSection(const G4DynamicParticle* Pt,
159                                                    const G4Element* pElement,
160                                                    G4double)
161{
162  G4int IPIE=IsoProbInEl.size();            // How many old elements?
163  if(IPIE) for(G4int ip=0; ip<IPIE; ++ip)   // Clean up the SumProb's of Isotopes (SPI)
164  {
165    std::vector<G4double>* SPI=IsoProbInEl[ip]; // Pointer to the SPI vector
166    SPI->clear();
167    delete SPI;
168    std::vector<G4int>* IsN=ElIsoN[ip];     // Pointer to the N vector
169    IsN->clear();
170    delete IsN;
171  }
172  ElementZ.clear();                         // Clear the body vector for Z of Elements
173  IsoProbInEl.clear();                      // Clear the body vector for SPI
174  ElIsoN.clear();                           // Clear the body vector for N of Isotopes
175  G4int Z = static_cast<G4int>(pElement->GetZ()); // Z of the Element
176  ElementZ.push_back(Z);                  // Remember Z of the Element
177  G4int isoSize=0;                        // The default for the isoVectorLength is 0
178  G4int indEl=0;                          // Index of non-trivial element or 0(default)
179  G4IsotopeVector* isoVector=pElement->GetIsotopeVector(); // Get the predefined IsoVect
180  if(isoVector) isoSize=isoVector->size();// Get size of the existing isotopeVector
181  if(isoSize)                             // The Element has non-trivial abundance set
182  {
183    indEl=pElement->GetIndex()+1;         // Index of the non-trivial element
184    if(!Isotopes->IsDefined(Z,indEl))     // This index is not defined for this Z: define
185    {
186      std::vector<std::pair<G4int,G4double>*>* newAbund =
187                                             new std::vector<std::pair<G4int,G4double>*>;
188      G4double* abuVector=pElement->GetRelativeAbundanceVector();
189      for(G4int j=0; j<isoSize; j++)      // Calculation of abundance vector for isotopes
190      {
191        G4int N=pElement->GetIsotope(j)->GetN()-Z; // N means A=N+Z !
192        if(pElement->GetIsotope(j)->GetZ()!=Z)G4cerr<<"G4QCollision::GetMeanFreePath"
193                               <<": Z="<<pElement->GetIsotope(j)->GetZ()<<"#"<<Z<<G4endl;
194        G4double abund=abuVector[j];
195        std::pair<G4int,G4double>* pr= new std::pair<G4int,G4double>(N,abund);
196        newAbund->push_back(pr);
197      }
198      indEl=G4QIsotope::Get()->InitElement(Z,indEl,newAbund); // definition of the newInd
199      for(G4int k=0; k<isoSize; k++) delete (*newAbund)[k];   // Cleaning temporary
200      delete newAbund; // Was "new" in the beginning of the name space
201    }
202  }
203  std::vector<std::pair<G4int,G4double>*>* cs= Isotopes->GetCSVector(Z,indEl);//CSPointer
204  std::vector<G4double>* SPI = new std::vector<G4double>; // Pointer to the SPI vector
205  IsoProbInEl.push_back(SPI);
206  std::vector<G4int>* IsN = new std::vector<G4int>; // Pointer to the N vector
207  ElIsoN.push_back(IsN);
208  G4int nIs=cs->size();                   // A#Of Isotopes in the Element
209  G4double susi=0.;                       // sum of CS over isotopes
210  if(nIs) for(G4int j=0; j<nIs; j++)      // Calculate CS for eachIsotope of El
211  {
212    std::pair<G4int,G4double>* curIs=(*cs)[j]; // A pointer, which is used twice
213    G4int N=curIs->first;                 // #of Neuterons in the isotope j of El i
214    IsN->push_back(N);                    // Remember Min N for the Element
215    G4double CSI=GetIsoZACrossSection(Pt,Z,N,0.);//CrossSection(j,i) for the isotope
216    curIs->second = CSI;
217    susi+=CSI;                            // Make a sum per isotopes
218    SPI->push_back(susi);                 // Remember summed cross-section
219  } // End of temporary initialization of the cross sections in the G4QIsotope singeltone
220  return Isotopes->GetMeanCrossSection(Z,indEl); // MeanCS over isotopes
221}
222
223G4double G4QHadronInelasticDataSet::GetIsoZACrossSection(const G4DynamicParticle* Pt,
224                                                         G4double Z, G4double A, G4double)
225{
226  G4ParticleDefinition* particle = Pt->GetDefinition();
227  G4double Momentum=Pt->GetTotalMomentum();
228  G4VQCrossSection* CSmanager=0;
229  //G4VQCrossSection* CSmanager2=0;
230  G4int pPDG=0;
231  if(particle == G4Neutron::Neutron())
232  {
233    CSmanager=G4QNeutronNuclearCrossSection::GetPointer();
234    pPDG=2112;
235  }
236  else if(particle == G4Proton::Proton())
237  {
238    CSmanager=G4QProtonNuclearCrossSection::GetPointer();
239    pPDG=2212;
240  }
241  else if(particle == G4PionMinus::PionMinus())
242  {
243    CSmanager=G4QPionMinusNuclearCrossSection::GetPointer();
244    pPDG=-211;
245  }
246  else if(particle == G4PionPlus::PionPlus())
247  {
248    CSmanager=G4QPionPlusNuclearCrossSection::GetPointer();
249    pPDG=211;
250  }
251  else if(particle == G4KaonMinus::KaonMinus())
252  {
253    CSmanager=G4QKaonMinusNuclearCrossSection::GetPointer();
254    pPDG=-321;
255  }
256  else if(particle == G4KaonPlus::KaonPlus())
257  {
258    CSmanager=G4QKaonPlusNuclearCrossSection::GetPointer();
259    pPDG=321;
260  }
261  else if(particle == G4KaonZeroLong::KaonZeroLong()   ||
262          particle == G4KaonZeroShort::KaonZeroShort() ||
263          particle == G4KaonZero::KaonZero()           ||
264          particle == G4AntiKaonZero::AntiKaonZero()   )
265  {
266    CSmanager=G4QKaonZeroNuclearCrossSection::GetPointer();
267    if(G4UniformRand() > 0.5) pPDG= 311;
268    else                      pPDG=-311;
269  }
270  else if(particle == G4Lambda::Lambda())
271  {
272    CSmanager=G4QHyperonNuclearCrossSection::GetPointer();
273    pPDG=3122;
274  }
275  else if(particle == G4SigmaPlus::SigmaPlus())
276  {
277    CSmanager=G4QHyperonPlusNuclearCrossSection::GetPointer();
278    pPDG=3222;
279  }
280  else if(particle == G4SigmaMinus::SigmaMinus())
281  {
282    CSmanager=G4QHyperonNuclearCrossSection::GetPointer();
283    pPDG=3112;
284  }
285  else if(particle == G4SigmaZero::SigmaZero())
286  {
287    CSmanager=G4QHyperonNuclearCrossSection::GetPointer();
288    pPDG=3212;
289  }
290  else if(particle == G4XiMinus::XiMinus())
291  {
292    CSmanager=G4QHyperonNuclearCrossSection::GetPointer();
293    pPDG=3312;
294  }
295  else if(particle == G4XiZero::XiZero())
296  {
297    CSmanager=G4QHyperonNuclearCrossSection::GetPointer();
298    pPDG=3322;
299  }
300  else if(particle == G4OmegaMinus::OmegaMinus())
301  {
302    CSmanager=G4QHyperonNuclearCrossSection::GetPointer();
303    pPDG=3334;
304  }
305  else if(particle == G4AntiNeutron::AntiNeutron())
306  {
307    CSmanager=G4QAntiBaryonNuclearCrossSection::GetPointer();
308    pPDG=-2112;
309  }
310  else if(particle == G4AntiProton::AntiProton())
311  {
312    CSmanager=G4QAntiBaryonNuclearCrossSection::GetPointer();
313    pPDG=-2212;
314  }
315  else if(particle == G4AntiLambda::AntiLambda())
316  {
317    CSmanager=G4QAntiBaryonNuclearCrossSection::GetPointer();
318    pPDG=-3122;
319  }
320  else if(particle == G4AntiSigmaPlus::AntiSigmaPlus())
321  {
322    CSmanager=G4QAntiBaryonNuclearCrossSection::GetPointer();
323    pPDG=-3222;
324  }
325  else if(particle == G4AntiSigmaMinus::AntiSigmaMinus())
326  {
327    CSmanager=G4QAntiBaryonPlusNuclearCrossSection::GetPointer();
328    pPDG=-3112;
329  }
330  else if(particle == G4AntiSigmaZero::AntiSigmaZero())
331  {
332    CSmanager=G4QAntiBaryonNuclearCrossSection::GetPointer();
333    pPDG=-3212;
334  }
335  else if(particle == G4AntiXiMinus::AntiXiMinus())
336  {
337    CSmanager=G4QAntiBaryonPlusNuclearCrossSection::GetPointer();
338    pPDG=-3312;
339  }
340  else if(particle == G4AntiXiZero::AntiXiZero())
341  {
342    CSmanager=G4QAntiBaryonNuclearCrossSection::GetPointer();
343    pPDG=-3322;
344  }
345  else if(particle == G4AntiOmegaMinus::AntiOmegaMinus())
346  {
347    CSmanager=G4QAntiBaryonPlusNuclearCrossSection::GetPointer();
348    pPDG=-3334;
349  }
350  //else if(particle == G4Gamma::Gamma())
351  //{
352  //  CSmanager=G4QPhotonNuclearCrossSection::GetPointer();
353  //  pPDG=22;
354  //}
355  //else if(particle == G4Electron::Electron() ||
356  //        particle == G4Positron::Positron())
357  //{
358  //  CSmanager=G4QElectronNuclearCrossSection::GetPointer();
359  //  pPDG=11;
360  //}
361  //else if(particle == G4MuonPlus::MuonPlus() ||
362  //        particle == G4MuonMinus::MuonMinus())
363  //{
364  //  CSmanager=G4QMuonNuclearCrossSection::GetPointer();
365  //  pPDG=13;
366  //}
367  //else if(particle == G4TauPlus::TauPlus() ||
368  //        particle == G4TauMinus::TauMinus())
369  //{
370  //  CSmanager=G4QTauNuclearCrossSection::GetPointer();
371  //  pPDG=15;
372  //}
373  //else if(particle == G4NeutrinoMu::NeutrinoMu() )
374  //{
375  //  CSmanager=G4QNuMuNuclearCrossSection::GetPointer();
376  //  CSmanager2=G4QNuNuNuclearCrossSection::GetPointer();
377  //  pPDG=14;
378  //}
379  //else if(particle == G4AntiNeutrinoMu::AntiNeutrinoMu() )
380  //{
381  //  CSmanager=G4QANuMuNuclearCrossSection::GetPointer();
382  //  CSmanager2=G4QANuANuNuclearCrossSection::GetPointer();
383  //  pPDG=-14;
384  //}
385  //else if(particle == G4NeutrinoE::NeutrinoE() )
386  //{
387  //  CSmanager=G4QNuENuclearCrossSection::GetPointer();
388  //  CSmanager2=G4QNuNuNuclearCrossSection::GetPointer();
389  //  pPDG=12;
390  //}
391  //else if(particle == G4AntiNeutrinoE::AntiNeutrinoE() )
392  //{
393  //  CSmanager=G4QANuENuclearCrossSection::GetPointer();
394  //  CSmanager2=G4QANuANuNuclearCrossSection::GetPointer();
395  //  pPDG=-12;
396  //}
397  else G4cout<<"-Warning-G4QHadronInelasticDataSet::GetIsoZACrossSection: PDG="
398             <<particle->GetPDGEncoding()<<" isn't supported by CHIPS"<<G4endl;
399  G4int tZ=(G4int)(Z);
400  G4int tN=(G4int)(A-Z);
401  G4double CSI=CSmanager->GetCrossSection(true, Momentum, tZ, tN, pPDG); // CS(j,i) basic
402  //if(CSmanager2) CSI+=CSmanager2->GetCrossSection(true,Momentum,Z,N,pPDG); // e.g.(nu,nu)
403  return CSI;
404}
Note: See TracBrowser for help on using the repository browser.