Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ExcitedStringDecay Class Reference

#include <G4ExcitedStringDecay.hh>

+ Inheritance diagram for G4ExcitedStringDecay:

Public Member Functions

 G4ExcitedStringDecay ()
 
 G4ExcitedStringDecay (G4VLongitudinalStringDecay *aStringDecay)
 
virtual ~G4ExcitedStringDecay ()
 
virtual G4KineticTrackVectorFragmentStrings (const G4ExcitedStringVector *theStrings)
 
- Public Member Functions inherited from G4VStringFragmentation
 G4VStringFragmentation ()
 
virtual ~G4VStringFragmentation ()
 
virtual G4KineticTrackVectorFragmentStrings (const G4ExcitedStringVector *theStrings)=0
 

Detailed Description

Definition at line 38 of file G4ExcitedStringDecay.hh.

Constructor & Destructor Documentation

◆ G4ExcitedStringDecay() [1/2]

G4ExcitedStringDecay::G4ExcitedStringDecay ( )

Definition at line 32 of file G4ExcitedStringDecay.cc.

33 theStringDecay(0)
34{}

◆ G4ExcitedStringDecay() [2/2]

G4ExcitedStringDecay::G4ExcitedStringDecay ( G4VLongitudinalStringDecay aStringDecay)

Definition at line 36 of file G4ExcitedStringDecay.cc.

38 theStringDecay(aStringDecay)
39{}

◆ ~G4ExcitedStringDecay()

G4ExcitedStringDecay::~G4ExcitedStringDecay ( )
virtual

Definition at line 48 of file G4ExcitedStringDecay.cc.

49{
50}

Member Function Documentation

◆ FragmentStrings()

G4KineticTrackVector * G4ExcitedStringDecay::FragmentStrings ( const G4ExcitedStringVector theStrings)
virtual

Implements G4VStringFragmentation.

Definition at line 78 of file G4ExcitedStringDecay.cc.

80{
81 G4LorentzVector KTsum(0.,0.,0.,0.);
82
83//G4cout<<"theStrings->size() "<<theStrings->size()<<G4endl;
84 for ( unsigned int astring=0; astring < theStrings->size(); astring++)
85 {
86 KTsum+= theStrings->operator[](astring)->Get4Momentum();
87 }
88
90 G4int attempts(0);
91 G4bool success=false;
92 G4bool NeedEnergyCorrector=false;
93 do {
94 //G4cout<<"Check of momentum at string fragmentations. New try."<<G4endl;
95 std::for_each(theResult->begin() , theResult->end() , DeleteKineticTrack());
96 theResult->clear();
97
98 attempts++;
99 //G4cout<<G4endl<<"attempts "<<attempts<<G4endl;
100 G4LorentzVector KTsecondaries(0.,0.,0.,0.);
101 NeedEnergyCorrector=false;
102
103 for ( unsigned int astring=0; astring < theStrings->size(); astring++)
104 {
105 //G4cout<<"String No "<<astring+1<<" "<<theStrings->operator[](astring)->Get4Momentum().mag2()<<" "<<theStrings->operator[](astring)->GetRightParton()->GetPDGcode()<<" "<<theStrings->operator[](astring)->GetLeftParton()->GetPDGcode()<<" "<<theStrings->operator[](astring)->Get4Momentum()<<G4endl;
106 //G4int Uzhi; G4cin >>Uzhi;
107 G4KineticTrackVector * generatedKineticTracks = NULL;
108 if ( theStrings->operator[](astring)->IsExcited() )
109 {
110 //G4cout<<"Fragment String"<<G4endl;
111 generatedKineticTracks=FragmentString(*theStrings->operator[](astring));
112 } else {
113 generatedKineticTracks = new G4KineticTrackVector;
114 generatedKineticTracks->push_back(theStrings->operator[](astring)->GetKineticTrack());
115 }
116
117 if (generatedKineticTracks == NULL)
118 {
119 G4cerr << "G4VPartonStringModel:No KineticTracks produced" << G4endl;
120 continue;
121 }
122
123 G4LorentzVector KTsum1(0.,0.,0.,0.);
124 for ( unsigned int aTrack=0; aTrack<generatedKineticTracks->size();aTrack++)
125 {
126 //--debug-- G4cout<<"Prod part "<<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<" "<<(*generatedKineticTracks)[aTrack]->Get4Momentum()<<G4endl;
127 theResult->push_back(generatedKineticTracks->operator[](aTrack));
128 KTsum1+= (*generatedKineticTracks)[aTrack]->Get4Momentum();
129 }
130 KTsecondaries+=KTsum1;
131
132 //--debug--G4cout << "String secondaries(" <<generatedKineticTracks->size()<< ") momentum: "
133 //--debug--<< theStrings->operator[](astring)->Get4Momentum() << " " << KTsum1 << G4endl;
134 if ( KTsum1.e() > 0 && std::abs((KTsum1.e()-theStrings->operator[](astring)->Get4Momentum().e()) / KTsum1.e()) > perMillion )
135 {
136 //--debug-- G4cout << "String secondaries(" <<generatedKineticTracks->size()<< ") momentum: "
137 //--debug-- << theStrings->operator[](astring)->Get4Momentum() << " " << KTsum1 << G4endl;
138 NeedEnergyCorrector=true;
139 }
140
141// clean up
142 delete generatedKineticTracks;
143 }
144 //--debug G4cout << "Initial Strings / secondaries total 4 momentum " << KTsum << " " <<KTsecondaries << G4endl;
145
146 success=true;
147 //G4cout<<"success "<<success<<G4endl;
148 if ( NeedEnergyCorrector ) success=EnergyAndMomentumCorrector(theResult, KTsum);
149 //G4cout<<"success after Ecorr "<<success<<G4endl;
150 } while(!success && (attempts < 10)); // It was 100 !!! Uzhi
151 //G4cout<<"End frag string"<<G4endl;
152
153#ifdef debug_ExcitedStringDecay
154 G4LorentzVector KTsum1=0;
155 for ( unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
156 {
157 G4cout << " corrected tracks .. " << (*theResult)[aTrack]->GetDefinition()->GetParticleName()
158 <<" " << (*theResult)[aTrack]->Get4Momentum() << G4endl;
159 KTsum1+= (*theResult)[aTrack]->Get4Momentum();
160 }
161
162 G4cout << "Needcorrector/success " << NeedEnergyCorrector << "/" << success << ", Corrected total 4 momentum " << KTsum1 << G4endl;
163 if ( ! success ) G4cout << "failed to correct E/p" << G4endl;
164#endif
165
166 return theResult;
167}
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
#define G4endl
Definition: G4ios.hh:52
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout

The documentation for this class was generated from the following files: