63 #ifdef debug_G4ExcitedStringDecay
65 G4cout<<
"--------------------------- G4ExcitedStringDecay ----------------------"<<
G4endl;
66 G4cout<<
"Hadronization of Excited Strings: theStrings->size() "<<theStrings->size()<<
G4endl;
69 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
73 if ( theStrings->operator[](astring)->IsExcited() )
74 {KTsum+= theStrings->operator[](astring)->Get4Momentum();}
75 else {KTsum+=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();}
83 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
86 if ( theStrings->operator[](astring)->IsExcited() )
88 Ptmp=toCms * theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
89 theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
91 Ptmp=toCms * theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
92 theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
94 KTsum+= theStrings->operator[](astring)->Get4Momentum();
98 Ptmp=toCms * theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
99 theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
100 KTsum+= theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
110 G4bool NeedEnergyCorrector=
false;
112 #ifdef debug_G4ExcitedStringDecay
113 G4cout<<
"New try No "<<attempts<<
" to hadronize strings"<<
G4endl;
122 NeedEnergyCorrector=
false;
124 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
129 #ifdef debug_G4ExcitedStringDecay
130 G4cout<<
"String No "<<astring+1<<
" Excited? "<<theStrings->operator[](astring)->IsExcited()<<
G4endl;
132 G4cout<<
"String No "<<astring+1<<
" 4Momentum "<<theStrings->operator[](astring)->Get4Momentum()
133 <<
" "<<theStrings->operator[](astring)->Get4Momentum().mag()<<
G4endl;
137 if ( theStrings->operator[](astring)->IsExcited() )
139 #ifdef debug_G4ExcitedStringDecay
140 G4cout<<
"Fragment String with partons: "
141 <<theStrings->operator[](astring)->GetLeftParton()->GetPDGcode() <<
" "
142 <<theStrings->operator[](astring)->GetRightParton()->GetPDGcode()<<
" "
143 <<
"Direction "<<theStrings->operator[](astring)->GetDirection()<<
G4endl;
145 generatedKineticTracks=FragmentString(*theStrings->operator[](astring));
146 #ifdef debug_G4ExcitedStringDecay
147 G4cout<<
"(G4ExcitedStringDecay) Number of produced hadrons = "
148 <<generatedKineticTracks->size()<<
G4endl;
151 #ifdef debug_G4ExcitedStringDecay
154 G4LorentzVector Mom=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
156 theStrings->operator[](astring)->GetKineticTrack()->GetDefinition(),
157 theStrings->operator[](astring)->GetKineticTrack()->GetFormationTime(),
160 aTrack->
SetPosition(theStrings->operator[](astring)->GetKineticTrack()->GetPosition());
162 #ifdef debug_G4ExcitedStringDecay
167 generatedKineticTracks->push_back(aTrack);
170 if (generatedKineticTracks ==
nullptr || generatedKineticTracks->size() == 0)
177 for (
unsigned int aTrack=0; aTrack<generatedKineticTracks->size();aTrack++)
179 #ifdef debug_G4ExcitedStringDecay
180 G4cout<<
"Prod part No. "<<aTrack+1<<
" "
181 <<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<
" "
182 <<(*generatedKineticTracks)[aTrack]->Get4Momentum()
183 <<(*generatedKineticTracks)[aTrack]->Get4Momentum().mag()<<
G4endl;
186 TrackDefinition = (*generatedKineticTracks)[aTrack]->GetDefinition();
197 (*generatedKineticTracks)[aTrack]->Set4Momentum(Tmp);
199 #ifdef debug_G4ExcitedStringDecay
200 G4cout<<
"Resonance *** "<<aTrack+1<<
" "
201 <<(*generatedKineticTracks)[aTrack]->GetDefinition()->GetParticleName()<<
" "
202 <<(*generatedKineticTracks)[aTrack]->Get4Momentum()
203 <<(*generatedKineticTracks)[aTrack]->Get4Momentum().mag()<<
G4endl;
208 theResult->push_back(generatedKineticTracks->operator[](aTrack));
209 KTsum1+= (*generatedKineticTracks)[aTrack]->Get4Momentum();
211 KTsecondaries+=KTsum1;
213 #ifdef debug_G4ExcitedStringDecay
214 G4cout <<
"String secondaries(" <<generatedKineticTracks->size()<<
")"<<
G4endl
215 <<
"Init string momentum: "<< theStrings->operator[](astring)->Get4Momentum()<<
G4endl
216 <<
"Final hadrons momentum: "<< KTsum1 <<
G4endl;
219 if ( KTsum1.
e() > 0 &&
220 std::abs((KTsum1.
e()-theStrings->operator[](astring)->Get4Momentum().e()) / KTsum1.
e()) > perMillion )
222 NeedEnergyCorrector=
true;
225 #ifdef debug_G4ExcitedStringDecay
226 G4cout<<
"NeedEnergyCorrection yes/no "<<NeedEnergyCorrector<<
G4endl;
230 delete generatedKineticTracks;
234 if ( NeedEnergyCorrector ) success=EnergyAndMomentumCorrector(theResult, KTsum);
235 }
while (!success && (attempts < 100));
237 for (
unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
239 Ptmp=(*theResult)[aTrack]->Get4Momentum();
241 (*theResult)[aTrack]->Set4Momentum(Ptmp);
244 #ifdef debug_G4ExcitedStringDecay
245 G4cout<<
"End of the strings fragmentation (G4ExcitedStringDecay)"<<
G4endl;
249 for (
unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
251 G4cout <<
" corrected tracks .. " << (*theResult)[aTrack]->GetDefinition()->GetParticleName()
252 <<
" " << (*theResult)[aTrack]->Get4Momentum()
253 <<
" " << (*theResult)[aTrack]->Get4Momentum().mag()<<
G4endl;
254 KTsum1+= (*theResult)[aTrack]->Get4Momentum();
257 G4cout <<
"Needcorrector/success " << NeedEnergyCorrector <<
"/" << success
258 <<
", Corrected total 4 momentum " << KTsum1 <<
G4endl;
259 if ( ! success )
G4cout <<
"failed to correct E/p" <<
G4endl;
261 G4cout<<
"End of the Hadronization (G4ExcitedStringDecay)"<<
G4endl;
266 if (theResult->size() != 0)
270 delete theResult; theResult=0;
272 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
275 if ( theStrings->operator[](astring)->IsExcited() )
277 Ptmp=theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
279 theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
281 Ptmp=theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
283 theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
287 Ptmp=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
289 theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);