source: trunk/source/processes/hadronic/models/parton_string/management/src/G4VPartonStringModel.cc@ 1201

Last change on this file since 1201 was 1196, checked in by garnier, 16 years ago

update CVS release candidate geant4.9.3.01

File size: 5.1 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//
27// $Id: G4VPartonStringModel.cc,v 1.6 2009/10/05 12:52:48 vuzhinsk Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//// ------------------------------------------------------------
31// GEANT 4 class implementation file
32//
33// ---------------- G4VPartonStringModel ----------------
34// by Gunter Folger, May 1998.
35// abstract class for all Parton String Models
36// ------------------------------------------------------------
37// debug switch
38//#define debug_PartonStringModel
39
40
41#include "G4VPartonStringModel.hh"
42#include "G4ios.hh"
43#include "G4ShortLivedConstructor.hh"
44
45
46G4VPartonStringModel::G4VPartonStringModel()
47{
48// Make shure Shotrylived partyicles are constructed.
49 G4ShortLivedConstructor ShortLived;
50 ShortLived.ConstructParticle();
51}
52
53G4VPartonStringModel::G4VPartonStringModel(const G4VPartonStringModel &) : G4VHighEnergyGenerator()
54{
55}
56
57
58G4VPartonStringModel::~G4VPartonStringModel()
59{
60}
61
62
63const G4VPartonStringModel & G4VPartonStringModel::operator=(const G4VPartonStringModel &)
64{
65 throw G4HadronicException(__FILE__, __LINE__, "G4VPartonStringModel::operator= meant to not be accessable");
66 return *this;
67}
68
69
70int G4VPartonStringModel::operator==(const G4VPartonStringModel &) const
71{
72 return 0;
73}
74
75int G4VPartonStringModel::operator!=(const G4VPartonStringModel &) const
76{
77 return 1;
78}
79
80G4KineticTrackVector * G4VPartonStringModel::Scatter(const G4Nucleus &theNucleus,
81 const G4DynamicParticle &aPrimary)
82{
83 G4ExcitedStringVector * strings = NULL;
84
85 G4DynamicParticle thePrimary=aPrimary;
86
87 G4LorentzRotation toZ;
88 G4LorentzVector Ptmp=thePrimary.Get4Momentum();
89 toZ.rotateZ(-1*Ptmp.phi());
90 toZ.rotateY(-1*Ptmp.theta());
91 thePrimary.Set4Momentum(toZ*Ptmp);
92 G4LorentzRotation toLab(toZ.inverse());
93
94 G4int attempts = 0, maxAttempts=20;
95 while ( strings == NULL )
96 {
97 if (attempts++ > maxAttempts )
98 {
99 throw G4HadronicException(__FILE__, __LINE__, "G4VPartonStringModel::Scatter(): fails to generate strings");
100 }
101 theThis->Init(theNucleus,thePrimary);
102 strings = GetStrings();
103 }
104
105 G4KineticTrackVector * theResult = 0;
106 G4double stringEnergy(0);
107
108 for ( unsigned int astring=0; astring < strings->size(); astring++)
109 {
110// rotate string to lab frame, models have it aligned to z
111 stringEnergy += (*strings)[astring]->GetLeftParton()->Get4Momentum().t();
112 stringEnergy += (*strings)[astring]->GetRightParton()->Get4Momentum().t();
113 (*strings)[astring]->LorentzRotate(toLab);
114 }
115
116#ifdef debug_PartonStringModel
117 G4V3DNucleus * fancynucleus=theThis->GetWoundedNucleus();
118
119 // loop over wounded nucleus
120 G4int hits(0);
121 G4Nucleon * theCurrentNucleon = fancynucleus->StartLoop() ? fancynucleus->GetNextNucleon() : NULL;
122 while(theCurrentNucleon != NULL)
123 {
124 if(theCurrentNucleon->AreYouHit())
125 {
126 hits++;
127 }
128 theCurrentNucleon = fancynucleus->GetNextNucleon();
129 }
130
131 G4cout << " strE, nucleons, inE "
132 << stringEnergy << " "
133 << hits << " "
134 << Ptmp.e() << " "
135 << stringEnergy - 939.*hits - Ptmp.e()<< G4endl;
136#endif
137
138 theResult = stringFragmentationModel->FragmentStrings(strings);
139/*
140G4cout<<"Size "<<theResult->size()<<G4endl;
141 for ( unsigned int i=0; i < theResult->size(); i++)
142 {
143
144G4cout<<(*theResult)[i]->Get4Momentum()<<" "<<(*theResult)[i]->Get4Momentum().mag()<<G4endl;;
145 }
146*/
147 std::for_each(strings->begin(), strings->end(), DeleteString() );
148 delete strings;
149
150 return theResult;
151}
152
Note: See TracBrowser for help on using the repository browser.