File indexing completed on 2024-09-27 07:03:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include <iostream>
0034 #include <fstream>
0035 #include <cmath>
0036 #include <vector>
0037
0038
0039 #include "starlightconstants.h"
0040 #include "gammagammasingle.h"
0041 #include "starlightconfig.h"
0042
0043 using namespace std;
0044
0045
0046
0047 Gammagammasingle::Gammagammasingle(const inputParameters& inputParametersInstance, beamBeamSystem& bbsystem)
0048 : eventChannel(inputParametersInstance, bbsystem)
0049 #ifdef ENABLE_PYTHIA
0050 ,_pyDecayer()
0051 #endif
0052 {
0053
0054 #ifdef ENABLE_PYTHIA
0055 _pyDecayer.init();
0056 #endif
0057
0058
0059 _GGsingInputnumw=inputParametersInstance.nmbWBins();
0060 _GGsingInputnumy=inputParametersInstance.nmbRapidityBins();
0061 _GGsingInputpidtest=inputParametersInstance.prodParticleType();
0062 _GGsingInputGamma_em=inputParametersInstance.beamLorentzGamma();
0063 _axionMass=inputParametersInstance.axionMass();
0064 cout<<"SINGLE MESON pid test: "<<_GGsingInputpidtest<<endl;
0065
0066 read();
0067
0068 singleCrossSection();
0069 }
0070
0071
0072
0073 Gammagammasingle::~Gammagammasingle()
0074 { }
0075
0076
0077
0078 void Gammagammasingle::singleCrossSection()
0079 {
0080
0081
0082 double _sigmaSum=0.,remainw=0.;
0083 int ivalw =0;
0084
0085 cout << "MASS " << getMass() << "\n";
0086 cout << "WIDTH " << getWidth() << "\n";
0087 _wdelta=getMass();
0088 for(int i=0;i<_GGsingInputnumw;i++){
0089 for(int j=0;j<_GGsingInputnumy;j++){
0090
0091 _sigmax[i][j]=(getSpin()*2.+1.)*4*starlightConstants::pi*starlightConstants::pi*getWidth()/
0092 (getMass()*getMass()*getMass())*_f_max*_Farray[i][j]*starlightConstants::hbarc*starlightConstants::hbarc/100.;
0093 }
0094 }
0095
0096
0097 for(int i=0;i<_GGsingInputnumw;i++){
0098 if(getMass()>_Warray[i]) ivalw=i;
0099 }
0100
0101 remainw = (getMass()-_Warray[ivalw])/(_Warray[ivalw+1]-_Warray[ivalw]);
0102 _ivalwd = ivalw;
0103 _remainwd = remainw;
0104
0105 switch(_GGsingInputpidtest){
0106 case starlightConstants::ZOVERZ03:
0107 _sigmaSum =0.;
0108 for(int j=0;j<_GGsingInputnumy-1;j++){
0109 _sigmaSum = _sigmaSum +(_Yarray[j+1]-_Yarray[j])*
0110 100.0E-9*(.1/getMass())*((1.-remainw)*_f_max*
0111 (_Farray[ivalw][j]+_Farray[ivalw][j])/2.+remainw*_f_max*
0112 (_Farray[ivalw+1][j]+_Farray[ivalw+1][j+1])/2.);
0113 }
0114 break;
0115 default:
0116
0117 _sigmaSum =0.;
0118 for(int j =0;j<_GGsingInputnumy-1;j++){
0119 _sigmaSum = _sigmaSum+
0120 (_Yarray[j+1]-_Yarray[j])*((1.-remainw)*
0121 (_sigmax[ivalw][j]+_sigmax[ivalw][j+1])/2.+remainw*
0122 (_sigmax[ivalw+1][j]+_sigmax[ivalw+1][j+1])/2.);
0123 }
0124 }
0125
0126
0127
0128 cout<<endl;
0129 if (_sigmaSum > 1.){
0130 cout << "Total cross section: "<<_sigmaSum<<" barn."<<endl;
0131 } else if (1000.*_sigmaSum > 1.){
0132 cout << "Total cross section: "<<1000.*_sigmaSum<<" mb."<<endl;
0133 } else if (1000000.*_sigmaSum > 1.){
0134 cout << "Total cross section: "<<1000000.*_sigmaSum<<" microbarn."<<endl;
0135 } else if (1.E9*_sigmaSum > 1.){
0136 cout << "Total cross section: "<<1.E9*_sigmaSum<<" nanobarn."<<endl;
0137 } else if (1.E12*_sigmaSum > 1.){
0138 cout << "Total cross section: "<<1.E12*_sigmaSum<<" picobarn."<<endl;
0139 } else {
0140 cout << "Total cross section: "<<1.E15*_sigmaSum<<" femtobarn."<<endl;
0141 }
0142 cout<<endl;
0143 setTotalChannelCrossSection(_sigmaSum);
0144
0145 return;
0146 }
0147
0148
0149
0150 void Gammagammasingle::pickw(double &w)
0151 {
0152
0153 double sgf=0.,signorm=0.,x=0.,remainarea=0.,remainw=0.,a=0.,b=0.,c=0.;
0154 int ivalw=0;
0155
0156 double * _sigofw;
0157 double * sgfint;
0158 _sigofw = new double[starlightLimits::MAXWBINS];
0159 sgfint = new double[starlightLimits::MAXYBINS];
0160
0161 if(_wdelta != 0){
0162 w=_wdelta;
0163 ivalw=_ivalwd;
0164 remainw=_remainwd;
0165 }
0166 else{
0167
0168
0169
0170
0171
0172 for(int i=0;i<_GGsingInputnumw;i++){
0173 _sigofw[i]=0.;
0174 for(int j=0;j<_GGsingInputnumy-1;j++){
0175 _sigofw[i] = _sigofw[i]+(_Yarray[j+1]-_Yarray[j])*(_sigmax[i][j+1]+_sigmax[i][j])/2.;
0176 }
0177 }
0178
0179 sgfint[0]=0.;
0180 for(int i=0;i<_GGsingInputnumw-1;i++){
0181 sgf=(_sigofw[i+1]+_sigofw[i])*(_Warray[i+1]-_Warray[i])/2.;
0182 sgfint[i+1]=sgfint[i]+sgf;
0183 }
0184
0185 signorm=sgfint[_GGsingInputnumw-1];
0186
0187 for(int i=0;i<_GGsingInputnumw;i++){
0188 sgfint[i]=sgfint[i]/signorm;
0189 }
0190
0191 x = _randy.Rndom();
0192
0193 for(int i=0;i<_GGsingInputnumw;i++){
0194 if(x > sgfint[i]) ivalw=i;
0195 }
0196
0197 remainarea = x - sgfint[ivalw];
0198
0199
0200 c = -remainarea*signorm/(_Warray[ivalw+1]-_Warray[ivalw]);
0201 b = _sigofw[ivalw];
0202 a = (_sigofw[ivalw+1]-_sigofw[ivalw])/2.;
0203 if(a==0.){
0204 remainw = -c/b;
0205 }
0206 else{
0207 remainw = (-b+sqrt(b*b-4.*a*c))/(2.*a);
0208 }
0209 _ivalwd = ivalw;
0210 _remainwd = remainw;
0211
0212 w = _Warray[ivalw]+(_Warray[ivalw+1]-_Warray[ivalw])*remainw;
0213 }
0214
0215 delete[] _sigofw;
0216 delete[] sgfint;
0217 }
0218
0219
0220
0221 void Gammagammasingle::picky(double &y)
0222 {
0223 double * sigofy;
0224 double * sgfint;
0225 sigofy = new double[starlightLimits::MAXYBINS];
0226 sgfint = new double[starlightLimits::MAXYBINS];
0227
0228 double remainw =0.,remainarea=0.,remainy=0.,a=0.,b=0.,c=0.,sgf=0.,signorm=0.,x=0.;
0229 int ivalw=0,ivaly=0;
0230
0231 ivalw=_ivalwd;
0232 remainw=_remainwd;
0233
0234 for(int j=0;j<_GGsingInputnumy;j++){
0235 sigofy[j]=_sigmax[ivalw][j]+(_sigmax[ivalw+1][j]-_sigmax[ivalw][j])*remainw;
0236 }
0237
0238
0239 sgfint[0]=0.;
0240 for(int j=0;j<_GGsingInputnumy-1;j++){
0241 sgf = (sigofy[j+1]+sigofy[j])/2.;
0242 sgfint[j+1]=sgfint[j]+sgf*(_Yarray[j+1]-_Yarray[j]);
0243 }
0244
0245
0246 signorm = sgfint[_GGsingInputnumy-1];
0247
0248 for(int j=0;j<_GGsingInputnumy;j++){
0249 sgfint[j]=sgfint[j]/signorm;
0250 }
0251
0252 x = _randy.Rndom();
0253
0254 for(int i=0;i<_GGsingInputnumy;i++){
0255 if(x > sgfint[i])
0256 ivaly = i;
0257 }
0258
0259 remainarea = x - sgfint[ivaly];
0260
0261 c = -remainarea*signorm/(_Yarray[ivaly+1]-_Yarray[ivaly]);
0262 b = sigofy[ivaly];
0263 a = (sigofy[ivaly+1]-sigofy[ivaly])/2.;
0264 if(a==0.){
0265 remainy = -c/b;
0266 }
0267 else{
0268 remainy = (-b + sqrt(b*b-4.*a*c))/(2.*a);
0269 }
0270
0271 y = _Yarray[ivaly]+(_Yarray[ivaly+1]-_Yarray[ivaly])*remainy;
0272 delete[] sigofy;
0273 delete[] sgfint;
0274 }
0275
0276
0277
0278 void Gammagammasingle::parentMomentum(double w,double y,double &E,double &px,double &py,double &pz)
0279 {
0280
0281 double anglepp1=0.,anglepp2=0.,ppp1=0.,ppp2=0.,E1=0.,E2=0.,signpx=0.,pt=0.;
0282
0283
0284 E1 = w*exp(y)/2.;
0285 E2 = w*exp(-y)/2.;
0286
0287
0288 anglepp1 = _randy.Rndom();
0289 anglepp2 = _randy.Rndom();
0290
0291 ppp1 = pp1(E1);
0292 ppp2 = pp2(E2);
0293 px = ppp1*cos(2.*starlightConstants::pi*anglepp1)+ppp2*cos(2.*starlightConstants::pi*anglepp2);
0294 py = ppp1*sin(2.*starlightConstants::pi*anglepp1)+ppp2*sin(2.*starlightConstants::pi*anglepp2);
0295
0296 pt = sqrt(px*px+py*py);
0297
0298 E = sqrt(w*w+pt*pt)*cosh(y);
0299 pz= sqrt(w*w+pt*pt)*sinh(y);
0300 signpx = _randy.Rndom();
0301
0302 if(signpx > 0.5)
0303 pz = -pz;
0304 }
0305
0306
0307
0308 double Gammagammasingle::pp1(double E)
0309 {
0310
0311
0312
0313
0314 double ereds =0.,Cm=0.,Coef=0.,x=0.,pp=0.,test=0.,u=0.;
0315 double singleformfactorCm=0.,singleformfactorpp1=0.,singleformfactorpp2=0.;
0316 int satisfy =0;
0317
0318 ereds = (E/_GGsingInputGamma_em)*(E/_GGsingInputGamma_em);
0319 Cm = sqrt(3.)*E/_GGsingInputGamma_em;
0320
0321 singleformfactorCm=_bbs.electronBeam().formFactor(Cm*Cm+ereds);
0322
0323 Coef = 3.0*(singleformfactorCm*singleformfactorCm*Cm*Cm*Cm)/((2.*(starlightConstants::pi)*(ereds+Cm*Cm))*(2.*(starlightConstants::pi)*(ereds+Cm*Cm)));
0324
0325
0326 x = _randy.Rndom();
0327 pp = x*5.*starlightConstants::hbarc/_bbs.electronBeam().nuclearRadius();
0328 singleformfactorpp1=_bbs.electronBeam().formFactor(pp*pp+ereds);
0329 test = (singleformfactorpp1*singleformfactorpp1)*pp*pp*pp/((2.*starlightConstants::pi*(ereds+pp*pp))*(2.*starlightConstants::pi*(ereds+pp*pp)));
0330
0331 while(satisfy==0){
0332 u = _randy.Rndom();
0333 if(u*Coef <= test){
0334 satisfy =1;
0335 }
0336 else{
0337 x =_randy.Rndom();
0338 pp = 5*starlightConstants::hbarc/_bbs.electronBeam().nuclearRadius()*x;
0339 singleformfactorpp2=_bbs.electronBeam().formFactor(pp*pp+ereds);
0340 test = (singleformfactorpp2*singleformfactorpp2)*pp*pp*pp/(2.*starlightConstants::pi*(ereds+pp*pp)*2.*starlightConstants::pi*(ereds+pp*pp));
0341 }
0342 }
0343 return pp;
0344 }
0345
0346
0347 double Gammagammasingle::pp2(double E)
0348 {
0349
0350
0351
0352
0353 double ereds =0.,Cm=0.,Coef=0.,x=0.,pp=0.,test=0.,u=0.;
0354 double singleformfactorCm=0.,singleformfactorpp1=0.,singleformfactorpp2=0.;
0355 int satisfy =0;
0356
0357 ereds = (E/_GGsingInputGamma_em)*(E/_GGsingInputGamma_em);
0358 Cm = sqrt(3.)*E/_GGsingInputGamma_em;
0359
0360 singleformfactorCm=_bbs.targetBeam().formFactor(Cm*Cm+ereds);
0361
0362 Coef = 3.0*(singleformfactorCm*singleformfactorCm*Cm*Cm*Cm)/((2.*(starlightConstants::pi)*(ereds+Cm*Cm))*(2.*(starlightConstants::pi)*(ereds+Cm*Cm)));
0363
0364
0365 x = _randy.Rndom();
0366 pp = x*5.*starlightConstants::hbarc/_bbs.targetBeam().nuclearRadius();
0367 singleformfactorpp1=_bbs.targetBeam().formFactor(pp*pp+ereds);
0368 test = (singleformfactorpp1*singleformfactorpp1)*pp*pp*pp/((2.*starlightConstants::pi*(ereds+pp*pp))*(2.*starlightConstants::pi*(ereds+pp*pp)));
0369
0370 while(satisfy==0){
0371 u = _randy.Rndom();
0372 if(u*Coef <= test){
0373 satisfy =1;
0374 }
0375 else{
0376 x =_randy.Rndom();
0377 pp = 5*starlightConstants::hbarc/_bbs.targetBeam().nuclearRadius()*x;
0378 singleformfactorpp2=_bbs.targetBeam().formFactor(pp*pp+ereds);
0379 test = (singleformfactorpp2*singleformfactorpp2)*pp*pp*pp/(2.*starlightConstants::pi*(ereds+pp*pp)*2.*starlightConstants::pi*(ereds+pp*pp));
0380 }
0381 }
0382 return pp;
0383 }
0384
0385
0386
0387 void Gammagammasingle::twoBodyDecay(starlightConstants::particleTypeEnum &ipid,double W,double px0,double py0,double pz0,double &px1,double &py1,double &pz1,double &px2,double &py2,double &pz2,int &iFbadevent)
0388 {
0389
0390
0391
0392 double mdec=0.,E1=0.,E2=0.;
0393 double pmag,ytest=0.;
0394 double phi,theta,xtest,dndtheta,Ecm;
0395 double betax,betay,betaz;
0396
0397
0398 switch(_GGsingInputpidtest){
0399 case starlightConstants::ZOVERZ03:
0400 case starlightConstants::F2:
0401 mdec = starlightConstants::pionChargedMass;
0402 break;
0403 case starlightConstants::AXION:
0404 mdec = 0;
0405 break;
0406 case starlightConstants::F2PRIME:
0407
0408 ytest = _randy.Rndom();
0409 if(ytest >= 0.5){
0410 mdec = starlightConstants::kaonChargedMass;
0411 }
0412 else{
0413 mdec = 0.493677;
0414 }
0415 break;
0416 default :
0417 cout<<"No default mass selected for single photon-photon particle, expect errant results"<<endl;
0418 }
0419
0420
0421 if(W < 2*mdec){
0422 cout<<" ERROR: W="<<W<<endl;
0423 iFbadevent = 1;
0424 return;
0425 }
0426 pmag = sqrt(W*W/4. - mdec*mdec);
0427
0428
0429
0430 phi = _randy.Rndom()*2.*starlightConstants::pi;
0431
0432
0433
0434
0435
0436 L300td:
0437 theta = starlightConstants::pi*_randy.Rndom();
0438 xtest = _randy.Rndom();
0439 dndtheta = sin(theta)*sin(theta)*sin(theta)*sin(theta)*sin(theta);
0440 if(xtest > dndtheta)
0441 goto L300td;
0442
0443
0444 px1 = sin(theta)*cos(phi)*pmag;
0445 py1 = sin(theta)*sin(phi)*pmag;
0446 pz1 = cos(theta)*pmag;
0447 px2 = -px1;
0448 py2 = -py1;
0449 pz2 = -pz1;
0450
0451
0452 Ecm = sqrt(W*W+px0*px0+py0*py0+pz0*pz0);
0453 E1 = sqrt(mdec*mdec+px1*px1+py1*py1+pz1*pz1);
0454 E2 = sqrt(mdec*mdec+px2*px2+py2*py2+pz2*pz2);
0455
0456
0457
0458 betax = -(px0/Ecm);
0459 betay = -(py0/Ecm);
0460 betaz = -(pz0/Ecm);
0461
0462 transform (betax,betay,betaz,E1,px1,py1,pz1,iFbadevent);
0463 transform (betax,betay,betaz,E2,px2,py2,pz2,iFbadevent);
0464
0465
0466 if(iFbadevent == 1)
0467 return;
0468
0469
0470
0471 switch(_GGsingInputpidtest){
0472
0473 case starlightConstants::ZOVERZ03:
0474 case starlightConstants::F2:
0475 ipid=starlightConstants::PION;
0476 break;
0477 case starlightConstants::AXION:
0478 ipid=starlightConstants::PHOTON;
0479 break;
0480 case starlightConstants::F2PRIME:
0481 if( ytest >= 0.5 )
0482 {
0483
0484 ipid=starlightConstants::KAONCHARGE;
0485 }
0486 else
0487 {
0488 ipid=starlightConstants::KAONNEUTRAL;
0489 }
0490 break;
0491 default:
0492 cout<<"Rethink the daughter particles"<<endl;
0493 }
0494 }
0495
0496
0497
0498 starlightConstants::event Gammagammasingle::produceEvent(int &)
0499 {
0500
0501 return starlightConstants::event();
0502 }
0503
0504
0505
0506 double Gammagammasingle::getMass()
0507 {
0508 using namespace starlightConstants;
0509 double singlemass=0.;
0510 switch(_GGsingInputpidtest){
0511 case starlightConstants::ETA:
0512 singlemass = starlightConstants::etaMass;
0513 break;
0514 case starlightConstants::ETAPRIME:
0515 singlemass = starlightConstants::etaPrimeMass;
0516 break;
0517 case starlightConstants::ETAC:
0518 singlemass = starlightConstants::etaCMass;
0519 break;
0520 case starlightConstants::F0:
0521 singlemass = starlightConstants::f0Mass;
0522 break;
0523 case starlightConstants::F2:
0524 singlemass = starlightConstants::f2Mass;
0525 break;
0526 case starlightConstants::A2:
0527 singlemass = starlightConstants::a2Mass;
0528 break;
0529 case starlightConstants::F2PRIME:
0530 singlemass = starlightConstants::f2PrimeMass;
0531 break;
0532 case starlightConstants::ZOVERZ03:
0533 singlemass = starlightConstants::zoverz03Mass;
0534 break;
0535 case starlightConstants::AXION:
0536 singlemass = _axionMass;
0537 break;
0538 default:
0539 cout<<"Not a recognized single particle, Gammagammasingle::getmass(), mass = 0."<<endl;
0540 }
0541 return singlemass;
0542 }
0543
0544
0545
0546 double Gammagammasingle::getWidth()
0547 {
0548
0549
0550 double singlewidth=0.;
0551 switch(_GGsingInputpidtest){
0552 case starlightConstants::ETA:
0553 singlewidth = starlightConstants::etaPartialggWidth;
0554 break;
0555 case starlightConstants::ETAPRIME:
0556 singlewidth = starlightConstants::etaPrimePartialggWidth;
0557 break;
0558 case starlightConstants::ETAC:
0559 singlewidth = starlightConstants::etaCPartialggWidth;
0560 break;
0561 case starlightConstants::F0:
0562 singlewidth = starlightConstants::f0PartialggWidth;
0563 break;
0564 case starlightConstants::F2:
0565 singlewidth = starlightConstants::f2PartialggWidth;
0566 break;
0567 case starlightConstants::A2:
0568 singlewidth = starlightConstants::a2PartialggWidth;
0569 break;
0570 case starlightConstants::F2PRIME:
0571 singlewidth = starlightConstants::f2PrimePartialggWidth;
0572 break;
0573 case starlightConstants::ZOVERZ03:
0574 singlewidth = starlightConstants::zoverz03PartialggWidth;
0575 break;
0576 case starlightConstants::AXION:
0577 singlewidth = 1/(64*starlightConstants::pi)*_axionMass*_axionMass*_axionMass/(1000*1000);
0578 break;
0579 default:
0580 cout<<"Not a recognized single particle, Gammagammasingle::getwidth(), width = 0."<<endl;
0581 }
0582 return singlewidth;
0583 }
0584
0585
0586
0587 double Gammagammasingle::getSpin()
0588 {
0589 double singlespin=0.5;
0590 switch(_GGsingInputpidtest){
0591 case starlightConstants::ETA:
0592 singlespin = starlightConstants::etaSpin;
0593 break;
0594 case starlightConstants::ETAPRIME:
0595 singlespin = starlightConstants::etaPrimeSpin;
0596 break;
0597 case starlightConstants::ETAC:
0598 singlespin = starlightConstants::etaCSpin;
0599 break;
0600 case starlightConstants::F0:
0601 singlespin = starlightConstants::f0Spin;
0602 break;
0603 case starlightConstants::F2:
0604 singlespin = starlightConstants::f2Spin;
0605 break;
0606 case starlightConstants::A2:
0607 singlespin = starlightConstants::a2Spin;
0608 break;
0609 case starlightConstants::F2PRIME:
0610 singlespin = starlightConstants::f2PrimeSpin;
0611 break;
0612 case starlightConstants::ZOVERZ03:
0613 singlespin = starlightConstants::zoverz03Spin;
0614 break;
0615 case starlightConstants::AXION:
0616 singlespin = starlightConstants::axionSpin;
0617 break;
0618 default:
0619 cout<<"Not a recognized single particle, Gammagammasingle::getspin(), spin = 0."<<endl;
0620 }
0621 return singlespin;
0622 }
0623 eXEvent Gammagammasingle::e_produceEvent()
0624 {
0625 eXEvent event;
0626 cout<< " Gamma+Gamma -> single particle is not implemente in current eSTARlight build. REturning empty event"<<endl;
0627 return event;
0628 }
0629
0630