80 #ifdef debug_G4ExcitedStringDecay
82 G4cout<<
"--------------------------- G4ExcitedStringDecay ----------------------"<<
G4endl;
83 G4cout<<
"Hadronization of Excited Strings: theStrings->size() "<<theStrings->size()<<
G4endl;
86 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
88 if ( theStrings->operator[](astring)->IsExcited() ) {
89 KTsum+= theStrings->operator[](astring)->Get4Momentum();
91 KTsum+=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
99 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
101 if ( theStrings->operator[](astring)->IsExcited() ) {
102 Ptmp=toCms * theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
103 theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
105 Ptmp=toCms * theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
106 theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
108 KTsum+= theStrings->operator[](astring)->Get4Momentum();
110 Ptmp=toCms * theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
111 theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
112 KTsum+= theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
119 G4bool NeedEnergyCorrector=
false;
121 #ifdef debug_G4ExcitedStringDecay
122 G4cout<<
"New try No "<<attempts<<
" to hadronize strings"<<
G4endl;
131 NeedEnergyCorrector=
false;
133 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
135 #ifdef debug_G4ExcitedStringDecay
136 G4cout<<
"String No "<<astring+1<<
" Excited? "<<theStrings->operator[](astring)->IsExcited()<<
G4endl;
138 G4cout<<
"String No "<<astring+1<<
" 4Momentum "<<theStrings->operator[](astring)->Get4Momentum()
139 <<
" "<<theStrings->operator[](astring)->Get4Momentum().mag()<<
G4endl;
143 if ( theStrings->operator[](astring)->IsExcited() )
145 #ifdef debug_G4ExcitedStringDecay
146 G4cout<<
"Fragment String with partons: "
147 <<theStrings->operator[](astring)->GetLeftParton()->GetPDGcode() <<
" "
148 <<theStrings->operator[](astring)->GetRightParton()->GetPDGcode()<<
" "
149 <<
"Direction "<<theStrings->operator[](astring)->GetDirection()<<
G4endl;
151 generatedKineticTracks=FragmentString(*theStrings->operator[](astring));
152 #ifdef debug_G4ExcitedStringDecay
153 G4cout<<
"(G4ExcitedStringDecay) Number of produced hadrons = "<<generatedKineticTracks->size()<<
G4endl;
156 #ifdef debug_G4ExcitedStringDecay
159 G4LorentzVector Mom=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
161 theStrings->operator[](astring)->GetKineticTrack()->GetDefinition(),
162 theStrings->operator[](astring)->GetKineticTrack()->GetFormationTime(),
165 aTrack->
SetPosition(theStrings->operator[](astring)->GetKineticTrack()->GetPosition());
167 #ifdef debug_G4ExcitedStringDecay
172 generatedKineticTracks->push_back(aTrack);
176 if (generatedKineticTracks->size() == 0)
180 success=
false; NeedEnergyCorrector=
false;
break;
184 for (
unsigned int aTrack=0; aTrack<generatedKineticTracks->size();aTrack++)
186 #ifdef debug_G4ExcitedStringDecay
187 G4cout<<
"Prod part No. "<<aTrack+1<<
" "
189 <<(*generatedKineticTracks)[aTrack]->Get4Momentum()<<
G4endl;
191 theResult->push_back(generatedKineticTracks->operator[](aTrack));
192 KTsum1+= (*generatedKineticTracks)[aTrack]->Get4Momentum();
194 KTsecondaries+=KTsum1;
196 #ifdef debug_G4ExcitedStringDecay
197 G4cout <<
"String secondaries(" <<generatedKineticTracks->size()<<
")"<<G4endl
198 <<
"Init string momentum: "<< theStrings->operator[](astring)->Get4Momentum()<<G4endl
199 <<
"Final hadrons momentum: "<< KTsum1 <<
G4endl;
202 if ( KTsum1.e() > 0 && std::abs((KTsum1.e()-theStrings->operator[](astring)->Get4Momentum().e()) / KTsum1.e()) >
perMillion )
204 NeedEnergyCorrector=
true;
207 #ifdef debug_G4ExcitedStringDecay
208 G4cout<<
"NeedEnergyCorrection yes/no "<<NeedEnergyCorrector<<
G4endl;
212 delete generatedKineticTracks;
218 if ( NeedEnergyCorrector ) success=EnergyAndMomentumCorrector(theResult, KTsum);
219 }
while(!success && (attempts < 100));
221 for (
unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
223 Ptmp=(*theResult)[aTrack]->Get4Momentum();
224 Ptmp.transform( toLab);
225 (*theResult)[aTrack]->Set4Momentum(Ptmp);
228 #ifdef debug_G4ExcitedStringDecay
229 G4cout<<
"End of the strings fragmentation (G4ExcitedStringDecay)"<<
G4endl;
233 for (
unsigned int aTrack=0; aTrack<theResult->size();aTrack++)
235 G4cout <<
" corrected tracks .. " << (*theResult)[aTrack]->GetDefinition()->GetParticleName()
236 <<
" " << (*theResult)[aTrack]->Get4Momentum()
237 <<
" " << (*theResult)[aTrack]->Get4Momentum().mag()<<
G4endl;
238 KTsum1+= (*theResult)[aTrack]->Get4Momentum();
241 G4cout <<
"Needcorrector/success " << NeedEnergyCorrector <<
"/" << success
242 <<
", Corrected total 4 momentum " << KTsum1 <<
G4endl;
243 if ( ! success )
G4cout <<
"failed to correct E/p" <<
G4endl;
245 G4cout<<
"End of the Hadronization (G4ExcitedStringDecay)"<<
G4endl;
248 for (
unsigned int astring=0; astring < theStrings->size(); astring++)
250 if ( theStrings->operator[](astring)->IsExcited() ) {
251 Ptmp=theStrings->operator[](astring)->GetLeftParton()->Get4Momentum();
252 Ptmp.transform( toLab);
253 theStrings->operator[](astring)->GetLeftParton()->Set4Momentum(Ptmp);
255 Ptmp=theStrings->operator[](astring)->GetRightParton()->Get4Momentum();
256 Ptmp.transform( toLab);
257 theStrings->operator[](astring)->GetRightParton()->Set4Momentum(Ptmp);
259 Ptmp=theStrings->operator[](astring)->GetKineticTrack()->Get4Momentum();
260 Ptmp.transform( toLab);
261 theStrings->operator[](astring)->GetKineticTrack()->Set4Momentum(Ptmp);
static constexpr double perMillion
CLHEP::Hep3Vector G4ThreeVector
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
void SetPosition(const G4ThreeVector aPosition)
const G4ParticleDefinition * GetDefinition() const
CLHEP::HepLorentzVector G4LorentzVector