source: trunk/source/processes/hadronic/models/chiral_inv_phase_space/interface/src/G4StringChipsInterface.cc @ 1071

Last change on this file since 1071 was 1055, checked in by garnier, 15 years ago

maj sur la beta de geant 4.9.3

File size: 17.3 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// !!! Was used in QBBC PL, NOW it is not. Must be absolete !!!
26// ============================================================
27
28//#define debug
29//#define pdebug
30
31#include "G4StringChipsInterface.hh"
32#include "globals.hh"
33#include <utility>
34#include <list>
35#include "G4KineticTrackVector.hh"
36#include "G4Nucleon.hh"
37#include "G4LorentzRotation.hh"
38
39G4StringChipsInterface::G4StringChipsInterface()
40{
41#ifdef CHIPSdebug
42  G4cout << "Please enter the energy loss per fermi in GeV"<<G4endl;
43  G4cin >> theEnergyLossPerFermi;
44#endif
45#ifdef debug
46  G4cout<<"G4StringChipsInterface::Constructor is called"<<G4endl;
47#endif
48  theEnergyLossPerFermi = 0.5*GeV;
49  // theEnergyLossPerFermi = 1.*GeV;
50}
51
52G4HadFinalState* G4StringChipsInterface::
53ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& theNucleus)
54{
55#ifdef debug
56  G4cout<<"G4StringChipsInterface::ApplyYourself is called"<<G4endl;
57#endif
58  return theModel.ApplyYourself(aTrack, theNucleus);
59}
60
61G4ReactionProductVector* G4StringChipsInterface::
62Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
63{
64#ifdef debug
65  G4cout<<"G4StringChipsInterface::Propagate is called"<<G4endl;
66#endif
67  // Protection for non physical conditions
68 
69  if(theSecondaries->size() == 1) 
70    throw G4HadronicException(__FILE__, __LINE__, "G4StringChipsInterface: Only one particle from String models!");
71 
72  // Calculate the mean energy lost
73  std::pair<G4double, G4double> theImpact = theNucleus->RefetchImpactXandY();
74  G4double impactX = theImpact.first;
75  G4double impactY = theImpact.second;
76  G4double inpactPar2 = impactX*impactX + impactY*impactY;
77 
78  G4double radius2 = theNucleus->GetNuclearRadius(5*perCent);
79  radius2 *= radius2;
80  G4double pathlength = 0;
81  if(radius2 - inpactPar2>0) pathlength = 2.*std::sqrt(radius2 - inpactPar2);
82  G4double theEnergyLostInFragmentation = theEnergyLossPerFermi*pathlength/fermi;
83 
84  // now select all particles in range
85  std::list<std::pair<G4double, G4KineticTrack *> > theSorted;
86  std::list<std::pair<G4double, G4KineticTrack *> >::iterator current;
87  for(unsigned int secondary = 0; secondary<theSecondaries->size(); secondary++)
88  {
89    G4LorentzVector a4Mom = theSecondaries->operator[](secondary)->Get4Momentum();
90
91#ifdef CHIPSdebug
92    G4cout <<"ALL STRING particles "<<theSecondaries->operator[](secondary)->GetDefinition()->GetPDGCharge()<<" "
93           << theSecondaries->operator[](secondary)->GetDefinition()->GetPDGEncoding()<<" "
94           << a4Mom <<G4endl; 
95#endif
96
97    G4double toSort = a4Mom.rapidity();
98    std::pair<G4double, G4KineticTrack *> it;
99    it.first = toSort;
100    it.second = theSecondaries->operator[](secondary);
101    G4bool inserted = false;
102    for(current = theSorted.begin(); current!=theSorted.end(); current++)
103    {
104      if((*current).first > toSort)
105      {
106               theSorted.insert(current, it);
107               inserted = true;
108               break;
109      }
110    }
111    if(!inserted)
112    {
113      theSorted.push_front(it);
114    }
115  }
116 
117  G4LorentzVector proj4Mom(0.,0.,0.,0.);
118  // @@ Use the G4QContent class, which is exactly (nD,nU,nS,nAD,nAU,nAS) !
119  // The G4QContent class is a basic clas in CHIPS (not PDG Code as in GEANT4),
120  // so in CHIPS on can has a hadronic obgect (Quasmon) with any Quark Content.
121  // As a simple extantion for the hadron (which is a special case for Hadron)
122  // there is a clas G4QChipolino, which is a Quasmon, which can decay in two
123  // hadrons. In future the three-hadron class can be added...
124  G4int nD  = 0;
125  G4int nU  = 0;
126  G4int nS  = 0;
127  G4int nAD = 0;
128  G4int nAU = 0;
129  G4int nAS = 0;
130  std::list<std::pair<G4double, G4KineticTrack *> >::iterator firstEscaping = theSorted.begin();
131  G4double runningEnergy = 0;
132  G4int particleCount = 0;
133  G4LorentzVector theLow = (*(theSorted.begin())).second->Get4Momentum();
134  G4LorentzVector theHigh;
135
136#ifdef CHIPSdebug
137  G4cout << "CHIPS ENERGY LOST "<<theEnergyLostInFragmentation<<G4endl;
138  G4cout << "sorted rapidities event start"<<G4endl;
139#endif
140
141  G4ReactionProductVector * theResult = new G4ReactionProductVector;
142  G4ReactionProduct * theSec;
143  G4KineticTrackVector * secondaries;
144#ifdef pdebug
145  G4cout<<"G4StringChipsInterface::Propagate: Absorption"<<G4endl; 
146#endif
147 
148  // first decay and add all escaping particles.
149  for(current = theSorted.begin(); current!=theSorted.end(); current++)
150  {
151    firstEscaping = current;
152    if((*current).second->GetDefinition()->GetQuarkContent(3)!=0 ||
153       (*current).second->GetDefinition()->GetAntiQuarkContent(3) !=0)
154    {
155      G4KineticTrack * aResult = (*current).second;
156      G4ParticleDefinition * pdef=aResult->GetDefinition();
157      secondaries = NULL;
158      if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
159      {
160        secondaries = aResult->Decay();
161      }
162      if ( secondaries == NULL )
163      {
164        theSec = new G4ReactionProduct(aResult->GetDefinition());
165        G4LorentzVector current4Mom = aResult->Get4Momentum();
166        theSec->SetTotalEnergy(current4Mom.t());
167        theSec->SetMomentum(current4Mom.vect());
168        theResult->push_back(theSec);
169      } 
170      else
171      {
172        for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
173        {
174          theSec = new G4ReactionProduct(secondaries->operator[](aSecondary)->GetDefinition());
175          G4LorentzVector current4Mom = secondaries->operator[](aSecondary)->Get4Momentum();
176          theSec->SetTotalEnergy(current4Mom.t());
177          theSec->SetMomentum(current4Mom.vect());
178          theResult->push_back(theSec);
179        }
180        std::for_each(secondaries->begin(), secondaries->end(), DeleteKineticTrack());
181        delete secondaries;
182      }
183      continue;
184    }
185    runningEnergy += (*current).second->Get4Momentum().t();
186    if(runningEnergy > theEnergyLostInFragmentation) break;
187   
188#ifdef CHIPSdebug
189    G4cout <<"ABSORBED STRING particles "<<current->second->GetDefinition()->GetPDGCharge()<<" "
190           << current->second->GetDefinition()->GetPDGEncoding()<<" "
191                  << current->second->Get4Momentum() <<G4endl; 
192#endif
193#ifdef pdebug
194    G4cout<<"G4StringChipsInterface::Propagate:C="
195          <<current->second->GetDefinition()->GetPDGCharge()<<", PDG="
196          << current->second->GetDefinition()->GetPDGEncoding()<<", 4M="
197                 << current->second->Get4Momentum() <<G4endl; 
198#endif
199
200    // projectile 4-momentum needed in constructor of quasmon
201    particleCount++;
202    theHigh = (*current).second->Get4Momentum(); 
203    proj4Mom += (*current).second->Get4Momentum(); 
204
205#ifdef CHIPSdebug
206    G4cout << "sorted rapidities "<<current->second->Get4Momentum().rapidity()<<G4endl;
207#endif
208   
209     // projectile quark contents needed for G4QContent construction (@@ ? -> G4QContent class)
210    nD  += (*current).second->GetDefinition()->GetQuarkContent(1);
211    nU  += (*current).second->GetDefinition()->GetQuarkContent(2);
212    nS  += (*current).second->GetDefinition()->GetQuarkContent(3);
213    nAD += (*current).second->GetDefinition()->GetAntiQuarkContent(1);
214    nAU += (*current).second->GetDefinition()->GetAntiQuarkContent(2);
215    nAS += (*current).second->GetDefinition()->GetAntiQuarkContent(3);
216  }
217  // construct G4QContent
218
219#ifdef CHIPSdebug
220  G4cout << "Quark content: d="<<nD<<", u="<<nU<< ", s="<< nS << G4endl;
221  G4cout << "Anti-quark content: anit-d="<<nAD<<", anti-u="<<nAU<< ", anti-s="<< nAS << G4endl;
222#endif
223
224  G4QContent theProjectiles(nD, nU, nS, nAD, nAU, nAS);
225
226#ifdef CHIPSdebug
227  G4cout << "G4QContent is constructed"<<endl;
228#endif
229 
230  // target properties needed in constructor of quasmon
231  // remove all hit nucleons to get Target code
232  theNucleus->StartLoop();
233  G4Nucleon * aNucleon;
234  G4int resA = 0;
235  G4int resZ = 0;
236  G4ThreeVector hitMomentum(0,0,0);
237  G4double hitMass = 0;
238  G4int hitCount = 0;
239  while((aNucleon = theNucleus->GetNextNucleon()))
240  {
241    if(!aNucleon->AreYouHit())
242    {
243      resA++;
244      resZ+=G4int (aNucleon->GetDefinition()->GetPDGCharge());
245    }
246    else
247    {
248      hitMomentum += aNucleon->GetMomentum().vect();
249      hitMass += aNucleon->GetMomentum().m();
250      hitCount ++;
251    }
252  }
253  G4int targetPDGCode = 90000000 + 1000*resZ + (resA-resZ);
254  G4double targetMass = theNucleus->GetMass();
255  targetMass -= hitMass;
256  G4double targetEnergy = std::sqrt(hitMomentum.mag2()+targetMass*targetMass);
257  // !! @@ Target should be at rest: hitMomentum=(0,0,0) @@ !! M.K.
258  G4LorentzVector targ4Mom(-1.*hitMomentum, targetEnergy);
259 
260  // construct the quasmon
261  //  G4int nop = 122; // clusters up to Alpha cluster
262  G4int nop = 152; // V.Ivanchenko set the same parameter as for all CHIPS models
263  G4double fractionOfSingleQuasiFreeNucleons = 0.5; // It is A-dependent (C=.85, U=.40)
264  G4double fractionOfPairedQuasiFreeNucleons = 0.05;
265  G4double clusteringCoefficient = 5.;
266  G4double temperature = 180.;
267  G4double halfTheStrangenessOfSee = 0.3; // = s/d = s/u
268  G4double etaToEtaPrime = 0.3;
269
270  G4QNucleus::SetParameters(fractionOfSingleQuasiFreeNucleons,
271                            fractionOfPairedQuasiFreeNucleons,
272                            clusteringCoefficient);
273  G4Quasmon::SetParameters(temperature,
274                           halfTheStrangenessOfSee,
275                           etaToEtaPrime);
276
277#ifdef CHIPSdebug
278  G4cout << "G4QNucleus parameters "<< fractionOfSingleQuasiFreeNucleons << " "
279         << fractionOfPairedQuasiFreeNucleons << " "<< clusteringCoefficient << G4endl;
280  G4cout << "G4Quasmon parameters "<< temperature << " "<< halfTheStrangenessOfSee << " "
281         <<etaToEtaPrime << G4endl;
282  G4cout << "The Target PDG code = "<<targetPDGCode<<G4endl;
283  G4cout << "The projectile momentum = "<<1./MeV*proj4Mom<<G4endl;
284  G4cout << "The target momentum = "<<1./MeV*targ4Mom<<G4endl;
285#endif
286
287 
288  // Chips expects all in target rest frame, along z.
289  // G4QCHIPSWorld aWorld(nop);              // Create CHIPS World of nop particles
290  G4QCHIPSWorld::Get()->GetParticles(nop);
291  G4QHadronVector projHV;
292  // target rest frame
293  proj4Mom.boost(-1.*targ4Mom.boostVector());
294  // now go along z
295  G4LorentzRotation toZ;
296  toZ.rotateZ(-1*proj4Mom.phi());
297  toZ.rotateY(-1*proj4Mom.theta());
298  proj4Mom = toZ*proj4Mom;
299  G4LorentzRotation toLab(toZ.inverse());
300
301#ifdef CHIPSdebug
302  G4cout << "a Boosted projectile vector along z"<<proj4Mom<<" "<<proj4Mom.mag()<<G4endl;
303#endif
304 
305  G4QHadron* iH = new G4QHadron(theProjectiles, 1./MeV*proj4Mom);
306  projHV.push_back(iH);
307
308  // now call chips with this info in place
309  G4QHadronVector * output = 0;
310  if (particleCount!=0)
311  {
312    G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
313    try
314    {
315      output = pan->Fragment();
316    }
317    catch(G4HadronicException & aR)
318    {
319      G4cerr << "Exception thrown passing through G4ChiralInvariantPhaseSpace "<<G4endl;
320      G4cerr << " targetPDGCode = "<< targetPDGCode <<G4endl;
321      G4cerr << " Dumping the information in the pojectile list"<<G4endl;
322      for(size_t i=0; i< projHV.size(); i++)
323      {
324               G4cerr <<"  Incoming 4-momentum and PDG code of "<<i<<"'th hadron: "
325               <<" "<< projHV[i]->Get4Momentum()<<" "<<projHV[i]->GetPDGCode()<<G4endl;
326      }
327      throw;
328    }
329    std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
330    projHV.clear();
331    delete pan;
332  }
333  else output = new G4QHadronVector;
334   
335  // Fill the result.
336#ifdef CHIPSdebug
337  G4cout << "NEXT EVENT"<<endl;
338#endif
339 
340  // first decay and add all escaping particles.
341  for(current = firstEscaping; current!=theSorted.end(); current++)
342  {
343    G4KineticTrack * aResult = (*current).second;
344    G4ParticleDefinition * pdef=aResult->GetDefinition();
345    secondaries = NULL;
346    if ( pdef->GetPDGWidth() > 0 && pdef->GetPDGLifeTime() < 5E-17*s )
347    {
348      secondaries = aResult->Decay();
349    }
350    if ( secondaries == NULL )
351    {
352      theSec = new G4ReactionProduct(aResult->GetDefinition());
353      G4LorentzVector current4Mom = aResult->Get4Momentum();
354      current4Mom = toLab*current4Mom;
355      current4Mom.boost(targ4Mom.boostVector());
356      theSec->SetTotalEnergy(current4Mom.t());
357      theSec->SetMomentum(current4Mom.vect());
358      theResult->push_back(theSec);
359    } 
360    else
361    {
362      for (unsigned int aSecondary=0; aSecondary<secondaries->size(); aSecondary++)
363      {
364        theSec = new G4ReactionProduct(secondaries->operator[](aSecondary)->GetDefinition());
365        G4LorentzVector current4Mom = secondaries->operator[](aSecondary)->Get4Momentum();
366        current4Mom = toLab*current4Mom;
367        current4Mom.boost(targ4Mom.boostVector());
368        theSec->SetTotalEnergy(current4Mom.t());
369        theSec->SetMomentum(current4Mom.vect());
370        theResult->push_back(theSec);
371      }
372      std::for_each(secondaries->begin(), secondaries->end(), DeleteKineticTrack());
373      delete secondaries;
374    }
375  }
376  std::for_each(theSecondaries->begin(), theSecondaries->end(), DeleteKineticTrack());
377  delete theSecondaries;
378   
379  // now add the quasmon output
380#ifdef CHIPSdebug
381  G4cout << "Number of particles from string"<<theResult->size()<<G4endl;
382  G4cout << "Number of particles from chips"<<output->size()<<G4endl;
383#endif
384
385  for(unsigned int particle = 0; particle < output->size(); particle++)
386  {
387    if(output->operator[](particle)->GetNFragments() != 0) 
388    {
389      delete output->operator[](particle);
390      continue;
391    }
392    theSec = new G4ReactionProduct; 
393    G4int pdgCode = output->operator[](particle)->GetPDGCode();
394    G4ParticleDefinition * theDefinition;
395    // Note that I still have to take care of strange nuclei
396    // For this I need the mass calculation, and a changed interface
397    // for ion-table ==> work for Hisaya @@@@@@@
398    // Then I can sort out the pdgCode. I also need a decau process
399    // for strange nuclei; may be another chips interface
400    if(pdgCode>90000000) 
401    {
402      G4int aZ = (pdgCode-90000000)/1000;
403      if (aZ>1000) aZ=aZ%1000;  // patch for strange nuclei, to be repaired @@@@
404      G4int anN = pdgCode-90000000-1000*aZ;
405      if(anN>1000) anN=anN%1000; // patch for strange nuclei, to be repaired @@@@
406      if(pdgCode==91000000) theDefinition = G4Lambda::LambdaDefinition();
407      else if(pdgCode==92000000) theDefinition = G4Lambda::LambdaDefinition();
408      else if(pdgCode==93000000) theDefinition = G4Lambda::LambdaDefinition();
409      else if(pdgCode==94000000) theDefinition = G4Lambda::LambdaDefinition();
410      else if(pdgCode==95000000) theDefinition = G4Lambda::LambdaDefinition();
411      else if(pdgCode==96000000) theDefinition = G4Lambda::LambdaDefinition();
412      else if(pdgCode==97000000) theDefinition = G4Lambda::LambdaDefinition();
413      else if(pdgCode==98000000) theDefinition = G4Lambda::LambdaDefinition();
414      else if(aZ == 0 && anN == 1) theDefinition = G4Neutron::Neutron();
415      else theDefinition = G4ParticleTable::GetParticleTable()->FindIon(aZ,anN+aZ,0,aZ);
416    }   
417    else
418    {
419      theDefinition = G4ParticleTable::GetParticleTable()->FindParticle(output->operator[](particle)->GetPDGCode());
420    }
421#ifdef CHIPSdebug
422    G4cout << "Particle code produced = "<< pdgCode <<G4endl;
423#endif
424
425    theSec = new G4ReactionProduct(theDefinition);
426    G4LorentzVector current4Mom = output->operator[](particle)->Get4Momentum();
427    current4Mom = toLab*current4Mom;
428    current4Mom.boost(targ4Mom.boostVector());
429    theSec->SetTotalEnergy(current4Mom.t());
430    theSec->SetMomentum(current4Mom.vect());
431    theResult->push_back(theSec);
432   
433#ifdef CHIPSdebug
434    G4cout <<"CHIPS particles "<<theDefinition->GetPDGCharge()<<" "
435           << theDefinition->GetPDGEncoding()<<" "
436           << current4Mom <<G4endl; 
437#endif
438
439    delete output->operator[](particle);
440  }
441  delete output;
442#ifdef CHIPSdebug
443  G4cout << "Number of particles"<<theResult->size()<<G4endl;
444  G4cout << G4endl;
445  // @@ G4QContent has even the out option!
446  G4cout << "QUASMON preparation info "
447         << 1./MeV*proj4Mom<<" "
448         << 1./MeV*targ4Mom<<" "
449         << nD<<" "<<nU<<" "<<nS<<" "<<nAD<<" "<<nAU<<" "<<nAS<<" "
450         << hitCount<<" "
451         << particleCount<<" "
452         << theLow<<" "
453         << theHigh<<" "
454         << G4endl;
455#endif
456
457  return theResult;
458} 
Note: See TracBrowser for help on using the repository browser.