]>
Commit | Line | Data |
---|---|---|
da32329d AM |
1 | /////////////////////////////////////////////////////////////////////////// |
2 | // | |
3 | // Copyright 2010 | |
4 | // | |
5 | // This file is part of starlight. | |
6 | // | |
7 | // starlight is free software: you can redistribute it and/or modify | |
8 | // it under the terms of the GNU General Public License as published by | |
9 | // the Free Software Foundation, either version 3 of the License, or | |
10 | // (at your option) any later version. | |
11 | // | |
12 | // starlight is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | // | |
17 | // You should have received a copy of the GNU General Public License | |
18 | // along with starlight. If not, see <http://www.gnu.org/licenses/>. | |
19 | // | |
20 | /////////////////////////////////////////////////////////////////////////// | |
21 | // | |
22 | // File and Version Information: | |
23 | // $Rev:: 164 $: revision of last commit | |
24 | // $Author:: odjuvsla $: author of last commit | |
25 | // $Date:: 2013-10-06 16:18:08 +0200 #$: date of last commit | |
26 | // | |
27 | // Description: | |
28 | // | |
29 | // | |
30 | // | |
31 | /////////////////////////////////////////////////////////////////////////// | |
32 | ||
33 | #include <iostream> | |
34 | #include <fstream> | |
35 | #include <cmath> | |
36 | #include <vector> | |
37 | ||
38 | ||
39 | #include "starlightconstants.h" | |
40 | #include "gammagammasingle.h" | |
41 | #include "starlightconfig.h" | |
42 | ||
43 | using namespace std; | |
44 | ||
45 | ||
46 | //______________________________________________________________________________ | |
47 | Gammagammasingle::Gammagammasingle(beamBeamSystem& bbsystem) | |
48 | : eventChannel(bbsystem) | |
49 | #ifdef ENABLE_PYTHIA | |
50 | ,_pyDecayer() | |
51 | #endif | |
52 | { | |
53 | ||
54 | #ifdef ENABLE_PYTHIA | |
55 | _pyDecayer.init(); | |
56 | #endif | |
57 | ||
58 | //Storing inputparameters into protected members for use | |
59 | _GGsingInputnumw=inputParametersInstance.nmbWBins(); | |
60 | _GGsingInputnumy=inputParametersInstance.nmbRapidityBins(); | |
61 | _GGsingInputpidtest=inputParametersInstance.prodParticleType(); | |
62 | _GGsingInputGamma_em=inputParametersInstance.beamLorentzGamma(); | |
63 | cout<<"SINGLE MESON pid test: "<<_GGsingInputpidtest<<endl; | |
64 | //reading in luminosity tables | |
65 | read(); | |
66 | //Now calculating crosssection | |
67 | singleCrossSection(); | |
68 | } | |
69 | ||
70 | ||
71 | //______________________________________________________________________________ | |
72 | Gammagammasingle::~Gammagammasingle() | |
73 | { } | |
74 | ||
75 | ||
76 | //______________________________________________________________________________ | |
77 | void Gammagammasingle::singleCrossSection() | |
78 | { | |
79 | //This function carries out a delta function cross-section calculation. For reference, see STAR Note 243, Eq. 8 | |
80 | //Multiply all _Farray[] by _f_max | |
81 | double _sigmaSum=0.,remainw=0.;//_remainwd=0.; | |
82 | int ivalw =0;//_ivalwd; | |
83 | //calculate the differential cross section and place in the sigma table | |
84 | _wdelta=getMass(); | |
85 | for(int i=0;i<_GGsingInputnumw;i++){ | |
86 | for(int j=0;j<_GGsingInputnumy;j++){ | |
87 | // Eq. 1 of starnote 347 | |
88 | _sigmax[i][j]=(getSpin()*2.+1.)*4*starlightConstants::pi*starlightConstants::pi*getWidth()/ | |
89 | (getMass()*getMass()*getMass())*_f_max*_Farray[i][j]*starlightConstants::hbarc*starlightConstants::hbarc/100.; | |
90 | } | |
91 | } | |
92 | //find the index, i,for the value of w just less than the mass because we want to use the value from the sigma table that has w=mass | |
93 | ||
94 | for(int i=0;i<_GGsingInputnumw;i++){ | |
95 | if(getMass()>_Warray[i]) ivalw=i; | |
96 | } | |
97 | ||
98 | remainw = (getMass()-_Warray[ivalw])/(_Warray[ivalw+1]-_Warray[ivalw+1]-_Warray[ivalw]); | |
99 | _ivalwd = ivalw; | |
100 | _remainwd = remainw; | |
101 | //if we are interested rho pairs at threshold, the just set sigma to 100nb | |
102 | switch(_GGsingInputpidtest){ | |
103 | case starlightConstants::ZOVERZ03: | |
104 | _sigmaSum =0.; | |
105 | for(int j=0;j<_GGsingInputnumy-1;j++){ | |
106 | _sigmaSum = _sigmaSum +(_Yarray[j+1]-_Yarray[j])* | |
107 | 100.0E-9*(.1/getMass())*((1.-remainw)*_f_max* | |
108 | (_Farray[ivalw][j]+_Farray[ivalw][j])/2.+remainw*_f_max* | |
109 | (_Farray[ivalw+1][j]+_Farray[ivalw+1][j+1])/2.); | |
110 | } | |
111 | break; | |
112 | default: | |
113 | //Sum to find the total cross-section | |
114 | _sigmaSum =0.; | |
115 | for(int j =0;j<_GGsingInputnumy-1;j++){ | |
116 | _sigmaSum = _sigmaSum+ | |
117 | (_Yarray[j+1]-_Yarray[j])*((1.-remainw)* | |
118 | (_sigmax[ivalw][j]+_sigmax[ivalw][j+1])/2.+remainw* | |
119 | (_sigmax[ivalw+1][j]+_sigmax[ivalw+1][j+1])/2.); | |
120 | } | |
121 | } | |
122 | if(_sigmaSum > 0.1) cout <<"The total cross-section is: "<<_sigmaSum<<" barns."<<endl; | |
123 | else if(_sigmaSum > 0.0001)cout <<"The total cross-section is: "<<_sigmaSum*1000<<" mb."<<endl; | |
124 | else cout <<"The total cross-section is: "<<_sigmaSum*1000000<<" ub."<<endl; | |
125 | ||
126 | ||
127 | return; | |
128 | } | |
129 | ||
130 | ||
131 | //______________________________________________________________________________ | |
132 | void Gammagammasingle::pickw(double &w) | |
133 | { | |
134 | //This function picks a w for the 2-photon calculation. | |
135 | double sgf=0.,signorm=0.,x=0.,remainarea=0.,remainw=0.,a=0.,b=0.,c=0.; | |
136 | int ivalw=0; | |
137 | ||
138 | double * _sigofw; | |
139 | double * sgfint; | |
140 | _sigofw = new double[starlightLimits::MAXWBINS]; | |
141 | sgfint = new double[starlightLimits::MAXYBINS]; | |
142 | ||
143 | if(_wdelta != 0){ | |
144 | w=_wdelta; | |
145 | ivalw=_ivalwd; | |
146 | remainw=_remainwd; | |
147 | } | |
148 | else{ | |
149 | //deal with the case where sigma is an array | |
150 | //_sigofw is simga integrated over y using a linear interpolation | |
151 | //sigint is the integral of sgfint, normalized | |
152 | ||
153 | //integrate sigma down to a function of just w | |
154 | for(int i=0;i<_GGsingInputnumw;i++){ | |
155 | _sigofw[i]=0.; | |
156 | for(int j=0;j<_GGsingInputnumy-1;j++){ | |
157 | _sigofw[i] = _sigofw[i]+(_Yarray[j+1]-_Yarray[j])*(_sigmax[i][j+1]+_sigmax[i][j])/2.; | |
158 | } | |
159 | } | |
160 | //calculate the unnormalized sgfint array | |
161 | sgfint[0]=0.; | |
162 | for(int i=0;i<_GGsingInputnumw-1;i++){ | |
163 | sgf=(_sigofw[i+1]+_sigofw[i])*(_Warray[i+1]-_Warray[i])/2.; | |
164 | sgfint[i+1]=sgfint[i]+sgf; | |
165 | } | |
166 | //normalize sgfint array | |
167 | signorm=sgfint[_GGsingInputnumw-1]; | |
168 | ||
169 | for(int i=0;i<_GGsingInputnumw;i++){ | |
170 | sgfint[i]=sgfint[i]/signorm; | |
171 | } | |
172 | //pick a random number | |
173 | x = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
174 | //compare x and sgfint to find the ivalue which is just less than the random number x | |
175 | for(int i=0;i<_GGsingInputnumw;i++){ | |
176 | if(x > sgfint[i]) ivalw=i; | |
177 | } | |
178 | //remainder above ivalw | |
179 | remainarea = x - sgfint[ivalw]; | |
180 | ||
181 | //figure out what point corresponds to the excess area in remainarea | |
182 | c = -remainarea*signorm/(_Warray[ivalw+1]-_Warray[ivalw]); | |
183 | b = _sigofw[ivalw]; | |
184 | a = (_sigofw[ivalw+1]-_sigofw[ivalw])/2.; | |
185 | if(a==0.){ | |
186 | remainw = -c/b; | |
187 | } | |
188 | else{ | |
189 | remainw = (-b+sqrt(b*b-4.*a*c))/(2.*a); | |
190 | } | |
191 | _ivalwd = ivalw; | |
192 | _remainwd = remainw; | |
193 | //calculate the w value | |
194 | w = _Warray[ivalw]+(_Warray[ivalw+1]-_Warray[ivalw])*remainw; | |
195 | } | |
196 | ||
197 | delete[] _sigofw; | |
198 | delete[] sgfint; | |
199 | } | |
200 | ||
201 | ||
202 | //______________________________________________________________________________ | |
203 | void Gammagammasingle::picky(double &y) | |
204 | { | |
205 | double * sigofy; | |
206 | double * sgfint; | |
207 | sigofy = new double[starlightLimits::MAXYBINS]; | |
208 | sgfint = new double[starlightLimits::MAXYBINS]; | |
209 | ||
210 | double remainw =0.,remainarea=0.,remainy=0.,a=0.,b=0.,c=0.,sgf=0.,signorm=0.,x=0.; | |
211 | int ivalw=0,ivaly=0; | |
212 | ||
213 | ivalw=_ivalwd; | |
214 | remainw=_remainwd; | |
215 | //average over two colums to get y array | |
216 | for(int j=0;j<_GGsingInputnumy;j++){ | |
217 | sigofy[j]=_sigmax[ivalw][j]+(_sigmax[ivalw+1][j]-_sigmax[ivalw][j])*remainw; | |
218 | } | |
219 | //calculate the unnormalized sgfint | |
220 | ||
221 | sgfint[0]=0.; | |
222 | for(int j=0;j<_GGsingInputnumy-1;j++){ | |
223 | sgf = (sigofy[j+1]+sigofy[j])/2.; | |
224 | sgfint[j+1]=sgfint[j]+sgf*(_Yarray[j+1]-_Yarray[j]); | |
225 | } | |
226 | ||
227 | //normalize the sgfint array | |
228 | signorm = sgfint[_GGsingInputnumy-1]; | |
229 | ||
230 | for(int j=0;j<_GGsingInputnumy;j++){ | |
231 | sgfint[j]=sgfint[j]/signorm; | |
232 | } | |
233 | //pick a random number | |
234 | x = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
235 | //compare x and sgfint to find the ivalue which is just less then the random number x | |
236 | for(int i=0;i<_GGsingInputnumy;i++){ | |
237 | if(x > sgfint[i]) | |
238 | ivaly = i; | |
239 | } | |
240 | //remainder above ivaly | |
241 | remainarea = x - sgfint[ivaly]; | |
242 | //figure what point corresponds to the leftover area in remainarea | |
243 | c = -remainarea*signorm/(_Yarray[ivaly+1]-_Yarray[ivaly]); | |
244 | b = sigofy[ivaly]; | |
245 | a = (sigofy[ivaly+1]-sigofy[ivaly])/2.; | |
246 | if(a==0.){ | |
247 | remainy = -c/b; | |
248 | } | |
249 | else{ | |
250 | remainy = (-b + sqrt(b*b-4.*a*c))/(2.*a); | |
251 | } | |
252 | //calculate the y value | |
253 | y = _Yarray[ivaly]+(_Yarray[ivaly+1]-_Yarray[ivaly])*remainy; | |
254 | delete[] sigofy; | |
255 | delete[] sgfint; | |
256 | } | |
257 | ||
258 | ||
259 | //______________________________________________________________________________ | |
260 | void Gammagammasingle::parentMomentum(double w,double y,double &E,double &px,double &py,double &pz) | |
261 | { | |
262 | //this function calculates px,py,pz,and E given w and y | |
263 | double anglepp1=0.,anglepp2=0.,pp1=0.,pp2=0.,E1=0.,E2=0.,signpx=0.,pt=0.; | |
264 | ||
265 | //E1 and E2 are for the 2 photons in the CM frame | |
266 | E1 = w*exp(y)/2.; | |
267 | E2 = w*exp(-y)/2.; | |
268 | //pz = E1-E2; | |
269 | //calculate px and py | |
270 | //to get x and y components-- phi is random between 0 and 2*pi | |
271 | anglepp1 = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
272 | anglepp2 = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
273 | ||
274 | pp1 = pp(E1); | |
275 | pp2 = pp(E2); | |
276 | px = pp1*cos(2.*starlightConstants::pi*anglepp1)+pp2*cos(2.*starlightConstants::pi*anglepp2); | |
277 | py = pp1*sin(2.*starlightConstants::pi*anglepp1)+pp2*sin(2.*starlightConstants::pi*anglepp2); | |
278 | //Compute vector sum Pt=Pt1+Pt2 to find pt for the produced particle | |
279 | pt = sqrt(px*px+py*py); | |
280 | //W is the mass of the produced particle (not necessarily on-mass-shell).Now compute its energy and pz | |
281 | E = sqrt(w*w+pt*pt)*cosh(y); | |
282 | pz= sqrt(w*w+pt*pt)*sinh(y); | |
283 | signpx = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
284 | //pick the z direction | |
285 | if(signpx > 0.5) | |
286 | pz = -pz; | |
287 | } | |
288 | ||
289 | ||
290 | //______________________________________________________________________________ | |
291 | double Gammagammasingle::pp(double E) | |
292 | { | |
293 | // will probably have to pass in beambeamsys? that way we can do beam1.formFactor(t) or beam2..., careful with the way sergey did it for asymmetry | |
294 | // returns on random draw from pp(E) distribution | |
295 | ||
296 | double ereds =0.,Cm=0.,Coef=0.,x=0.,pp=0.,test=0.,u=0.; | |
297 | double singleformfactorCm=0.,singleformfactorpp1=0.,singleformfactorpp2=0.; | |
298 | int satisfy =0; | |
299 | ||
300 | ereds = (E/_GGsingInputGamma_em)*(E/_GGsingInputGamma_em); | |
301 | Cm = sqrt(3.)*E/_GGsingInputGamma_em; | |
302 | //the amplitude of the p_t spectrum at the maximum | |
303 | singleformfactorCm=_bbs.beam1().formFactor(Cm*Cm+ereds); | |
304 | //Doing this once and then storing it as a double, which we square later...SYMMETRY?using beam1 for now. | |
305 | Coef = 3.0*(singleformfactorCm*singleformfactorCm*Cm*Cm*Cm)/((2.*(starlightConstants::pi)*(ereds+Cm*Cm))*(2.*(starlightConstants::pi)*(ereds+Cm*Cm))); | |
306 | ||
307 | //pick a test value pp, and find the amplitude there | |
308 | x = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
309 | pp = x*5.*starlightConstants::hbarc/_bbs.beam1().nuclearRadius(); //Will use nucleus #1, there should be two for symmetry//nextline | |
310 | singleformfactorpp1=_bbs.beam1().formFactor(pp*pp+ereds); | |
311 | test = (singleformfactorpp1*singleformfactorpp1)*pp*pp*pp/((2.*starlightConstants::pi*(ereds+pp*pp))*(2.*starlightConstants::pi*(ereds+pp*pp))); | |
312 | ||
313 | while(satisfy==0){ | |
314 | u = randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
315 | if(u*Coef <= test){ | |
316 | satisfy =1; | |
317 | } | |
318 | else{ | |
319 | x =randyInstance.Rndom();//random()/(RAND_MAX+1.0); | |
320 | pp = 5*starlightConstants::hbarc/_bbs.beam1().nuclearRadius()*x; | |
321 | singleformfactorpp2=_bbs.beam1().formFactor(pp*pp+ereds);//Symmetry | |
322 | test = (singleformfactorpp2*singleformfactorpp2)*pp*pp*pp/(2.*starlightConstants::pi*(ereds+pp*pp)*2.*starlightConstants::pi*(ereds+pp*pp)); | |
323 | } | |
324 | } | |
325 | return pp; | |
326 | } | |
327 | ||
328 | ||
329 | //______________________________________________________________________________ | |
75ce6a3a | 330 | void Gammagammasingle::twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double /*E*/,double W,double px0,double py0,double pz0,double &px1,double &py1,double &pz1,double &E1,double &px2,double &py2,double &pz2,double &E2, double &mdec,int &iFbadevent) |
da32329d AM |
331 | { |
332 | // This routine decays a particle into two particles of mass mdec, | |
333 | // taking spin into account | |
334 | ||
da32329d AM |
335 | double pmag,ytest=0.; |
336 | double phi,theta,xtest,dndtheta,Ecm; | |
337 | double betax,betay,betaz; | |
338 | ||
339 | // set the mass of the daughter particles | |
340 | switch(_GGsingInputpidtest){ | |
341 | case starlightConstants::ZOVERZ03: | |
342 | case starlightConstants::F2: | |
343 | mdec = starlightConstants::pionChargedMass; | |
344 | break; | |
345 | case starlightConstants::F2PRIME: | |
346 | // decays 50% to K+/K-, 50% to K_0's | |
347 | ytest = randyInstance.Rndom(); | |
348 | if(ytest >= 0.5){ | |
349 | mdec = starlightConstants::kaonChargedMass; | |
350 | } | |
351 | else{ | |
352 | mdec = 0.493677; | |
353 | } | |
354 | break; | |
355 | default : | |
356 | cout<<"No default mass selected for single photon-photon particle, expect errant results"<<endl; | |
357 | } | |
358 | ||
359 | //Calculating the momentum's magnitude | |
360 | //add switch for rho pairs at threshold and everything else. | |
361 | switch(_GGsingInputpidtest){ | |
362 | case starlightConstants::ZOVERZ03: //the rho pairs produced at threshold | |
363 | pmag = sqrt(getMass()*getMass()/4. - mdec*mdec); | |
364 | break; | |
365 | default : | |
366 | if(W < 2*mdec){ | |
367 | cout<<" ERROR: W="<<W<<endl; | |
368 | iFbadevent = 1; | |
369 | return; | |
370 | } | |
371 | pmag = sqrt(W*W/4. - mdec*mdec); | |
372 | } | |
373 | // pick an orientation, based on the spin | |
374 | // phi has a flat distribution in 2*pi | |
375 | phi = randyInstance.Rndom()*2.*starlightConstants::pi; //(random()/(RAND_MAX+1.0))* 2.*starlightConstants::pi; | |
376 | ||
377 | // find theta, the angle between one of the outgoing particles and | |
378 | // the beamline, in the frame of the two photons | |
379 | //this will depend on spin, F2,F2' and z/z03 all have spin 2, all other photonphoton-single mesons are handled by jetset | |
380 | //Applies to spin2 mesons. | |
381 | L300td: | |
382 | theta = starlightConstants::pi*randyInstance.Rndom(); | |
383 | xtest = randyInstance.Rndom(); | |
384 | dndtheta = sin(theta)*sin(theta)*sin(theta)*sin(theta)*sin(theta); | |
385 | if(xtest > dndtheta) | |
386 | goto L300td; | |
387 | ||
388 | // compute unboosted momenta | |
389 | px1 = sin(theta)*cos(phi)*pmag; | |
390 | py1 = sin(theta)*sin(phi)*pmag; | |
391 | pz1 = cos(theta)*pmag; | |
392 | px2 = -px1; | |
393 | py2 = -py1; | |
394 | pz2 = -pz1; | |
395 | // compute energies | |
396 | //Changed mass to W 11/9/2000 SRK | |
397 | Ecm = sqrt(W*W+px0*px0+py0*py0+pz0*pz0); | |
398 | E1 = sqrt(mdec*mdec+px1*px1+py1*py1+pz1*pz1); | |
399 | E2 = sqrt(mdec*mdec+px2*px2+py2*py2+pz2*pz2); | |
400 | ||
401 | // Lorentz transform into the lab frame | |
402 | // betax,betay,betaz are the boost of the complete system | |
403 | betax = -(px0/Ecm); | |
404 | betay = -(py0/Ecm); | |
405 | betaz = -(pz0/Ecm); | |
406 | ||
407 | transform (betax,betay,betaz,E1,px1,py1,pz1,iFbadevent); | |
408 | transform (betax,betay,betaz,E2,px2,py2,pz2,iFbadevent); | |
409 | ||
410 | ||
411 | if(iFbadevent == 1) | |
412 | return; | |
413 | ||
414 | // change particle id from that of parent to that of daughters | |
415 | ||
416 | switch(_GGsingInputpidtest){ | |
417 | //These decay into a pi+ pi- pair | |
418 | case starlightConstants::ZOVERZ03: | |
419 | case starlightConstants::F2: | |
420 | ipid=starlightConstants::PION; | |
421 | break; | |
422 | case starlightConstants::F2PRIME: | |
423 | if( ytest >= 0.5 ) | |
424 | { | |
425 | //Decays 50/50 into k+ k- or k_s k_l | |
426 | ipid=starlightConstants::KAONCHARGE; | |
427 | } | |
428 | else | |
429 | { | |
430 | ipid=starlightConstants::KAONNEUTRAL; | |
431 | } | |
432 | break; | |
433 | default: | |
434 | cout<<"Rethink the daughter particles"<<endl; | |
435 | } | |
436 | } | |
437 | ||
438 | ||
439 | //______________________________________________________________________________ | |
440 | starlightConstants::event Gammagammasingle::produceEvent(int &/*ievent*/) | |
441 | { | |
442 | // Not in use anymore, default event struct returned | |
443 | return starlightConstants::event(); | |
444 | } | |
445 | ||
446 | ||
447 | //______________________________________________________________________________ | |
448 | // fix it ... lost functionality | |
449 | //starlightConstants::event Gammagammasingle::produceEvent(int &ievent) | |
450 | upcEvent Gammagammasingle::produceEvent() | |
451 | { | |
75ce6a3a | 452 | upcEvent event; |
453 | ||
da32329d AM |
454 | // returns the vector with the decay particles inside. |
455 | // onedecayparticle single; | |
da32329d AM |
456 | double comenergy = 0.; |
457 | double rapidity = 0.; | |
458 | double parentE = 0.; | |
459 | double parentmomx=0.,parentmomy=0.,parentmomz=0.; | |
460 | ||
da32329d AM |
461 | pickw(comenergy); |
462 | picky(rapidity); | |
463 | parentMomentum(comenergy,rapidity,parentE,parentmomx,parentmomy,parentmomz); | |
75ce6a3a | 464 | |
da32329d AM |
465 | if(_GGsingInputpidtest != starlightConstants::F2 && _GGsingInputpidtest != starlightConstants::F2PRIME) |
466 | { | |
467 | #ifdef ENABLE_PYTHIA | |
468 | starlightParticle particle(parentmomx,parentmomy,parentmomz, parentE, getMass(),_GGsingInputpidtest , 0); | |
469 | ||
470 | _pyDecayer.addParticle(particle); | |
471 | ||
472 | return _pyDecayer.execute(); | |
473 | #endif | |
474 | } | |
475 | ||
476 | ||
da32329d | 477 | int iFbadevent=0; |
da32329d | 478 | // double theta=0.,phi=0.;//angles from jetset |
da32329d | 479 | switch(_GGsingInputpidtest){ |
75ce6a3a | 480 | case starlightConstants::ZOVERZ03: { |
da32329d | 481 | //Decays into two pairs. |
75ce6a3a | 482 | parentmomx /= 2.; |
483 | parentmomy /= 2.; | |
484 | parentmomz /= 2.; | |
485 | starlightConstants::particleTypeEnum ipid[2] = { starlightConstants::UNKNOWN }; | |
486 | double mdec[2] = { 0 }; | |
487 | double px[4] = { 0 }; | |
488 | double py[4] = { 0 }; | |
489 | double pz[4] = { 0 }; | |
490 | double pt[4] = { 0 }; | |
da32329d | 491 | //Pair #1 |
75ce6a3a | 492 | twoBodyDecay(ipid[0],parentE,comenergy, |
493 | parentmomx,parentmomy,parentmomz, | |
494 | px[0],py[0],pz[0],pt[0], | |
495 | px[1],py[1],pz[1],pt[1], | |
496 | mdec[0],iFbadevent); | |
da32329d | 497 | //Pair #2 |
75ce6a3a | 498 | twoBodyDecay(ipid[1],parentE,comenergy, |
499 | parentmomx,parentmomy,parentmomz, | |
500 | px[2],py[2],pz[2],pt[2], | |
501 | px[3],py[3],pz[3],pt[3], | |
502 | mdec[1],iFbadevent); | |
da32329d AM |
503 | //Now add them to vectors to be written out later. |
504 | ||
da32329d | 505 | if (iFbadevent==0){ |
da32329d | 506 | //Assigning charges randomly. |
75ce6a3a | 507 | const bool xtest(randyInstance.Rndom() < 0.5); |
508 | const bool ztest(randyInstance.Rndom() < 0.5); | |
509 | const int charges[4] = { | |
510 | ( xtest) ? +1 : -1, | |
511 | (!xtest) ? -1 : +1, | |
512 | ( ztest) ? +1 : -1, | |
513 | (!ztest) ? -1 : +1, | |
514 | }; | |
515 | for (int i=0; i<4; ++i) { | |
516 | starlightParticle particle(px[i], py[i], pz[i], pt[i], mdec[i/2], charges[i]*ipid[i/2], charges[i]); | |
517 | event.addParticle(particle); | |
518 | } | |
519 | } | |
da32329d | 520 | break; |
75ce6a3a | 521 | } |
da32329d | 522 | case starlightConstants::F2: |
75ce6a3a | 523 | case starlightConstants::F2PRIME: { |
524 | double px[2] = { 0 }; | |
525 | double py[2] = { 0 }; | |
526 | double pz[2] = { 0 }; | |
527 | double pt[2] = { 0 }; | |
528 | double mdec = 0; | |
529 | starlightConstants::particleTypeEnum ipid = starlightConstants::UNKNOWN; | |
530 | twoBodyDecay(ipid,parentE,comenergy, | |
531 | parentmomx,parentmomy,parentmomz, | |
532 | px[0],py[0],pz[0],pt[0], | |
533 | px[1],py[1],pz[1],pt[1], | |
534 | mdec,iFbadevent); | |
da32329d | 535 | |
75ce6a3a | 536 | if (iFbadevent==0) { |
537 | const double xtest = randyInstance.Rndom(); | |
538 | const int charges[2] = { | |
539 | (xtest < 0.5) ? +1 : -1, | |
540 | (xtest < 0.5) ? -1 : +1, | |
541 | }; | |
542 | for (int i=0; i<2; ++i) { | |
543 | starlightParticle particle(px[i], py[i], pz[i], pt[i], mdec, charges[i]*ipid, charges[i]); | |
544 | event.addParticle(particle); | |
da32329d | 545 | } |
da32329d AM |
546 | } |
547 | break; | |
75ce6a3a | 548 | } |
da32329d AM |
549 | default: |
550 | break; | |
551 | } | |
75ce6a3a | 552 | |
553 | return event; | |
da32329d AM |
554 | } |
555 | ||
556 | ||
557 | //______________________________________________________________________________ | |
558 | void Gammagammasingle::thephi(double W,double px,double py,double pz,double E,double &theta,double &phi) | |
559 | { | |
560 | // This subroutine calculates angles for channels decayed by jetset. | |
561 | // subroutine thephi(W,px,py,pz,E,theta,phi) | |
562 | E = sqrt (W*W+px*px+py*py+pz*pz); | |
563 | ||
564 | theta = acos(pz/sqrt(px*px+py*py+pz*pz)); | |
565 | phi = acos(px/sqrt(px*px+py*py)); | |
566 | ||
567 | if ((px == 0) && (py == 0)) | |
568 | phi = 0.; | |
569 | if (py < 0) | |
570 | phi = 2*starlightConstants::pi - phi; | |
571 | } | |
572 | ||
573 | ||
574 | //______________________________________________________________________________ | |
575 | double Gammagammasingle::getMass() | |
576 | { | |
577 | using namespace starlightConstants; | |
578 | double singlemass=0.; | |
579 | switch(_GGsingInputpidtest){ | |
580 | case starlightConstants::ETA: | |
581 | singlemass= etaMass; | |
582 | break; | |
583 | case starlightConstants::ETAPRIME: | |
584 | singlemass=etaPrimeMass; | |
585 | break; | |
586 | case starlightConstants::ETAC: | |
587 | singlemass=etaCMass; | |
588 | break; | |
589 | case starlightConstants::F0: | |
590 | singlemass=f0Mass; | |
591 | break; | |
592 | case starlightConstants::F2: | |
593 | singlemass=f2Mass; | |
594 | break; | |
595 | case starlightConstants::A2: | |
596 | singlemass=a2Mass; | |
597 | break; | |
598 | case starlightConstants::F2PRIME: | |
599 | singlemass=f2PrimeMass; | |
600 | break; | |
601 | case starlightConstants::ZOVERZ03: | |
602 | singlemass=1.540; | |
603 | break; | |
604 | default: | |
605 | cout<<"Not a recognized single particle, Gammagammasingle::getmass(), mass = 0."<<endl; | |
606 | } | |
607 | return singlemass; | |
608 | } | |
609 | ||
610 | ||
611 | //______________________________________________________________________________ | |
612 | double Gammagammasingle::getWidth() | |
613 | { | |
614 | double singlewidth=0.; | |
615 | switch(_GGsingInputpidtest){ | |
616 | case starlightConstants::ETA: | |
617 | singlewidth=1.E-6; | |
618 | break; | |
619 | case starlightConstants::ETAPRIME: | |
620 | singlewidth=5.E-6; | |
621 | break; | |
622 | case starlightConstants::ETAC: | |
623 | singlewidth=6.4E-6; | |
624 | break; | |
625 | case starlightConstants::F0: | |
626 | singlewidth=0.56E-6; | |
627 | break; | |
628 | case starlightConstants::F2: | |
629 | singlewidth=2.6E-6; | |
630 | break; | |
631 | case starlightConstants::A2: | |
632 | singlewidth=1.04E-6; | |
633 | break; | |
634 | case starlightConstants::F2PRIME: | |
635 | singlewidth=0.1E-6; | |
636 | break; | |
637 | case starlightConstants::ZOVERZ03: | |
638 | singlewidth=0.1E-6; | |
639 | break; | |
640 | default: | |
641 | cout<<"Not a recognized single particle, Gammagammasingle::getwidth(), width = 0."<<endl; | |
642 | } | |
643 | return singlewidth; | |
644 | } | |
645 | ||
646 | ||
647 | //______________________________________________________________________________ | |
648 | double Gammagammasingle::getSpin() | |
649 | { | |
650 | double singlespin=0.5; | |
651 | switch(_GGsingInputpidtest){ | |
652 | case starlightConstants::ETA: | |
653 | singlespin=0.0; | |
654 | break; | |
655 | case starlightConstants::ETAPRIME: | |
656 | singlespin=0.0; | |
657 | break; | |
658 | case starlightConstants::ETAC: | |
659 | singlespin=0.0; | |
660 | break; | |
661 | case starlightConstants::F0: | |
662 | singlespin=0.0; | |
663 | break; | |
664 | case starlightConstants::F2: | |
665 | singlespin=2.0; | |
666 | break; | |
667 | case starlightConstants::A2: | |
668 | singlespin=2.0; | |
669 | break; | |
670 | case starlightConstants::F2PRIME: | |
671 | singlespin=2.0; | |
672 | break; | |
673 | case starlightConstants::ZOVERZ03: | |
674 | singlespin=2.0; | |
675 | break; | |
676 | default: | |
677 | cout<<"Not a recognized single particle, Gammagammasingle::getspin(), spin = 0."<<endl; | |
678 | } | |
679 | return singlespin; | |
680 | } | |
681 | ||
682 | ||
683 |