70{
71
73
74
76
77
79
80 if(M0projectile < projectile->GetDefinition()->GetPDGMass())
81 {
82 PutOnMassShell=1;
83 M0projectile=projectile->GetDefinition()->GetPDGMass();
84 }
85
86 G4double Mprojectile2 = M0projectile * M0projectile;
87
88 G4int PDGcode=projectile->GetDefinition()->GetPDGEncoding();
89 G4int absPDGcode=std::abs(PDGcode);
92
93 if( absPDGcode > 1000 )
94 {
95 ProjectileDiffCut = 1.1;
96 AveragePt2 = 0.3;
97 }
98 else if( absPDGcode == 211 || PDGcode == 111)
99 {
100 ProjectileDiffCut = 1.0;
101 AveragePt2 = 0.3;
102 }
103 else if( absPDGcode == 321 || PDGcode == -311)
104 {
105 ProjectileDiffCut = 1.1;
106 AveragePt2 = 0.3;
107 }
108 else
109 {
110 ProjectileDiffCut = 1.1;
111 AveragePt2 = 0.3;
112 };
113
114 ProjectileDiffCut = ProjectileDiffCut * GeV;
115 AveragePt2 = AveragePt2 * GeV*GeV;
116
117
119
121
122 if(M0target < target->GetDefinition()->GetPDGMass())
123 {
124 PutOnMassShell=1;
125 M0target=target->GetDefinition()->GetPDGMass();
126 }
127
128 G4double Mtarget2 = M0target * M0target;
129
130 G4double NuclearNucleonDiffCut = 1.1*GeV;
131
132 G4double ProjectileDiffCut2 = ProjectileDiffCut * ProjectileDiffCut;
133 G4double NuclearNucleonDiffCut2 = NuclearNucleonDiffCut * NuclearNucleonDiffCut;
134
135
136
138 Psum=Pprojectile+Ptarget;
139
141
143
144 if ( Ptmp.
pz() <= 0. )
145 {
146
147
148 return false;
149 }
150
153
155
156 Pprojectile.transform(toCms);
157 Ptarget.transform(toCms);
158
164
167
168 if(SqrtS < 2200*MeV) {return false;}
169
170
171 PZcms2=(S*S+Mprojectile2*Mprojectile2+Mtarget2*Mtarget2-
172 2*S*Mprojectile2-2*S*Mtarget2-2*Mprojectile2*Mtarget2)/4./S;
173 if(PZcms2 < 0)
174 {return false;}
175
176 PZcms = std::sqrt(PZcms2);
177
178 if(PutOnMassShell)
179 {
180 if(Pprojectile.z() > 0.)
181 {
182 Pprojectile.setPz( PZcms);
183 Ptarget.setPz( -PZcms);
184 }
185 else
186 {
187 Pprojectile.setPz(-PZcms);
188 Ptarget.setPz( PZcms);
189 };
190
191 Pprojectile.setE(std::sqrt(Mprojectile2+
192 Pprojectile.x()*Pprojectile.x()+
193 Pprojectile.y()*Pprojectile.y()+
194 PZcms2));
195 Ptarget.setE(std::sqrt( Mtarget2 +
196 Ptarget.x()*Ptarget.x()+
197 Ptarget.y()*Ptarget.y()+
198 PZcms2));
199 }
200
202
203
204
205
206
207
208
209
210
211
214
215
217 do {
218
219
220 if (whilecount++ >= 500 && (whilecount%100)==0)
221
222
223
224 if (whilecount > 1000 )
225 {
227 return false;
228 }
229
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
252 ProjMassT2=Mprojectile2+Pt2;
253 ProjMassT =std::sqrt(ProjMassT2);
254
255 TargMassT2=Mtarget2+Pt2;
256 TargMassT =std::sqrt(TargMassT2);
257
258 PZcms2=(S*S+ProjMassT2*ProjMassT2+
259 TargMassT2*TargMassT2-
260 2.*S*ProjMassT2-2.*S*TargMassT2-
261 2.*ProjMassT2*TargMassT2)/4./S;
262 if(PZcms2 < 0 ) {PZcms2=0;};
263 PZcms =std::sqrt(PZcms2);
264
265 G4double PMinusMin=std::sqrt(ProjMassT2+PZcms2)-PZcms;
267
268 PMinusNew=ChooseP(PMinusMin,PMinusMax);
269 Qminus=PMinusNew-Pprojectile.minus();
270
271 G4double TPlusMin=std::sqrt(TargMassT2+PZcms2)-PZcms;
273
274 TPlusNew=ChooseP(TPlusMin, TPlusMax);
275 Qplus=-(TPlusNew-Ptarget.plus());
276
277 Qmomentum.
setPz( (Qplus-Qminus)/2 );
278 Qmomentum.
setE( (Qplus+Qminus)/2 );
279
280
281
282
283
284
285
286
287
288
289
290
291 } while (( (Pprojectile+Qmomentum).mag2() < Mprojectile2 ||
292 (Ptarget -Qmomentum).mag2() < Mtarget2 ) ||
293 ( (Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2 &&
294 (Ptarget -Qmomentum).mag2() < NuclearNucleonDiffCut2) );
295
296 if((Ptarget-Qmomentum).mag2() < NuclearNucleonDiffCut2)
297 {
299 Qminus=Ptarget.minus()-TMinusNew;
300 TPlusNew=TargMassT2/TMinusNew;
301 Qplus=Ptarget.plus()-TPlusNew;
302
303 Qmomentum.
setPz( (Qplus-Qminus)/2 );
304 Qmomentum.
setE( (Qplus+Qminus)/2 );
305 }
306 else if((Pprojectile+Qmomentum).mag2() < ProjectileDiffCut2)
307 {
309 Qplus=PPlusNew-Pprojectile.plus();
310 PMinusNew=ProjMassT2/PPlusNew;
311 Qminus=PMinusNew-Pprojectile.minus();
312
313 Qmomentum.
setPz( (Qplus-Qminus)/2 );
314 Qmomentum.
setE( (Qplus+Qminus)/2 );
315 };
316
317 Pprojectile += Qmomentum;
318 Ptarget -= Qmomentum;
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
339
340
341
342
343
344
345 target->Set4Momentum(Ptarget);
346
347
348
349 projectile->Set4Momentum(Pprojectile);
350
351 return true;
352}
CLHEP::HepLorentzVector G4LorentzVector
CLHEP::Hep3Vector G4ThreeVector
Hep3Vector boostVector() const
HepLorentzVector & rotateZ(double)
HepLorentzVector & rotateY(double)
HepLorentzVector & transform(const HepRotation &)