00001 #include <iostream>
00002 #include <cmath>
00003 #if (defined(__ICC) || defined(__ICL) || defined(__ECC) || defined(__ECL))
00004 # include <mathimf.h>
00005 #endif
00006 #include "TEvent.h"
00007 #include "TRadGlobal.h"
00008 #include "TKinemCut.h"
00009
00010 using namespace std;
00011 #define INRANGE(x) if ( x < 0 ) x += 2*gConst->Pi(); else if( x > 2*gConst->Pi() ) x -= 2*gConst->Pi()
00012
00013 TEvent::TEvent(){
00014 fNSelStat = 9;
00015 fSelStat = new unsigned int[fNSelStat];
00016 Init();
00017 }
00018
00019 void TEvent::Init(){
00020 for(unsigned int i=0;i<fNSelStat;i++){
00021 fSelStat[i] = 0;
00022 }
00023 fIsSmear = false;
00024 for(unsigned int i=0;i<6;i++){
00025 fdPar[i] = 0;
00026 }
00027 }
00028
00029 TEvent::~TEvent(){
00030 delete [] fSelStat;
00031 }
00032
00033 void lorbck(double *pcm, double *pincm, double *pinlab){
00034 double beta[3];
00035 for(int i=0;i<3;i++)
00036 beta[i] = pcm[i]/pcm[3];
00037 double gamma = 1./sqrt(1 - beta[0]*beta[0] - beta[1]*beta[1] - beta[2]*beta[2]);
00038 double bdotp = beta[0]*pincm[0] + beta[1]*pincm[1] + beta[2]*pincm[2];
00039 double fact = gamma*bdotp/(1 + gamma) + pincm[3];
00040
00041 for(int i=0; i<3; i++)
00042 pinlab[i] = pincm[i] + beta[i]*fact*gamma;
00043 pinlab[3] = gamma*(pincm[3] + bdotp);
00044 }
00045
00046 bool TEvent::Selectgg(){
00047
00048 int in[] = { 0, 1, 2};
00049 for(int i=0;i<3;i++)
00050 for(int j=i+1;j<3;j++)
00051 if(fen[in[i]]<fen[in[j]]){
00052 int t = in[i];
00053 in[i] = in[j];
00054 in[j] = t;
00055 }
00056
00057 int i0 = in[0], i1 = in[1];
00058
00059 if ( fth[i0] < gCut->AverageThetaMin() ) return false;
00060 if ( fth[i0] > gCut->AverageThetaMax() ) return false;
00061
00062 if ( fth[i1] < gCut->AverageThetaMin() ) return false;
00063 if ( fth[i1] > gCut->AverageThetaMax() ) return false;
00064
00065 double delta_theta = fth[i0] + fth[i1] - gConst->Pi() + dDeltaTheta();
00066 if ( fabs( delta_theta ) > gCut->DeltaTheta() ) return false;
00067
00068 double delta_phi = fabs(fph[i0]-fph[i1]) - gConst->Pi() + dDeltaPhi();
00069 if ( fabs( delta_phi ) > gCut->DeltaPhi() ) return false;
00070
00071 double cos_psi = fsth[i0]*fsth[i1]*(fcph[i0]*fcph[i1] + fsph[i0]*fsph[i1]) +
00072 fcth[i0]*fcth[i1];
00073 if ( cos_psi > gCut->CosPsi() ) return false;
00074
00075
00076 return true;
00077 }
00078
00079 bool TEvent::Select(){
00080
00081
00082
00083 if ( fth[Np] < gCut->ThetaMinP() || fth[Np] > gCut->ThetaMaxP() ) {fSelStat[0]++; return false;}
00084
00085 double theta_aver = 0.5*(fth[Ne] + gConst->Pi() - fth[Np]) + dATheta();
00086 if ( theta_aver < gCut->AverageThetaMin() || theta_aver > gCut->AverageThetaMax() ) {fSelStat[6]++; return false;}
00087 double delta_theta = fth[Ne] + fth[Np] - gConst->Pi() + dDeltaTheta();
00088 if ( fabs( delta_theta ) > gCut->DeltaTheta() ) {fSelStat[3]++; return false;}
00089
00090 if ( fen[Ne] < gCut->EMin() || fen[Np] < gCut->EMin() ) {fSelStat[2]++; return false;}
00091
00092 double delta_phi = fabs(fph[Ne]-fph[Np]) - gConst->Pi() + dDeltaPhi();
00093 if ( fabs( delta_phi ) > gCut->DeltaPhi() ) {fSelStat[4]++; return false;}
00094
00095 if ( (fp[Ne]*fsth[Ne] < gCut->PCross() ) || (fp[Np]*fsth[Np] < gCut->PCross() )) {fSelStat[5]++; return false;}
00096
00097 if ( fth[Ne] < gCut->ThetaMinM() || fth[Ne] > gCut->ThetaMaxM() ) {fSelStat[1]++; return false;}
00098
00099 if ( fth[Np] < gCut->ThetaMinP() || fth[Np] > gCut->ThetaMaxP() ) {fSelStat[1]++; return false;}
00100
00101 if ( 0.5*(fp[Ne] + fp[Np]) < gCut->PAverage() ) {fSelStat[7]++; return false;}
00102
00104
00105
00107
00108 double cos_psi = (fsth[Ne]*fsth[Np]*(fcph[Ne]*fcph[Np] + fsph[Ne]*fsph[Np]) + fcth[Ne]*fcth[Np]);
00109
00110 if ( cos_psi > gCut->CosPsi() ) {fSelStat[8]++; return false;}
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 return true;
00184 }
00185
00186 bool TEvent::MakeEvent(const double &x1g, const double &cos1g, const double &phi1g,
00187 const double &x2g, const double &cos2g, const double &phi2g,
00188 const double &c, const double &phi)
00189 {
00190 double pen1 = x1g;
00191 double pcosth1 = cos1g;
00192 double psinth1 = sqrt(1-pcosth1*pcosth1);
00193 double pphi1 = phi1g;
00194 double pcosph1 = cos(pphi1);
00195 double psinph1 = sin(pphi1);
00196
00197 double pen2 = x2g;
00198 double pcosth2 = cos2g;
00199 double psinth2 = sqrt(1-pcosth2*pcosth2);
00200 double pphi2 = phi2g;
00201 double pcosph2 = cos(pphi2);
00202 double psinph2 = sin(pphi2);
00203
00204 double px = pen1*psinth1*pcosph1 + pen2*psinth2*pcosph2;
00205 double py = pen1*psinth1*psinph1 + pen2*psinth2*psinph2;
00206 double pz = pen1*pcosth1 + pen2*pcosth2;
00207 double k2 = px*px+py*py+pz*pz;
00208
00209 fcth[Ne] = c;
00210 fth[Ne] = acos(fcth[Ne]);
00211 fsth[Ne] = sqrt(1-c*c);
00212
00213 fph[Ne] = phi;
00214 fcph[Ne] = cos(fph[Ne]);
00215 fsph[Ne] = sin(fph[Ne]);
00216
00217 double kcospsi = (px*fcph[Ne]+py*fsph[Ne])*fsth[Ne] + pz*fcth[Ne];
00218 double t = 2 - pen1 - pen2;
00219 double ap = kcospsi*kcospsi-t*t;
00220 double b = t*t - k2;
00221 double d = 4*gGlobal->Get_MF2()*ap + b*b;
00222 if ( d > 0 ) {
00223
00224 fen[Ne] = 0.5*( -t*b + kcospsi*sqrt(d) )/ap;
00225 fen[Np] = t - fen[Ne];
00226
00227 fp[Ne] = sqrt(fen[Ne]*fen[Ne]-gGlobal->Get_MF2());
00228 fp[Np] = sqrt(fen[Np]*fen[Np]-gGlobal->Get_MF2());
00229
00230 fcth[Np] = -(pz + fp[Ne]*fcth[Ne])/fp[Np];
00231 if ( fabs(fcth[Np]) <= 1){
00232 fsth[Np] = sqrt(1-fcth[Np]*fcth[Np]);
00233 fth[Np] = acos(fcth[Np]);
00234 fcph[Np] = -(fp[Ne]*fsth[Ne]*fcph[Ne]+px)/(fp[Np]*fsth[Np]);
00235 fsph[Np] = -(fp[Ne]*fsth[Ne]*fsph[Ne]+py)/(fp[Np]*fsth[Np]);
00236 fph[Np] = atan2(fsph[Np],fcph[Np]);
00237 INRANGE(fph[Np]);
00238 } else
00239 return false;
00240 } else
00241 return false;
00242
00243 return Select();
00244 }
00245
00246
00247 bool TEvent::MakeEvent( const double &c, TPhoton *Ph, const unsigned int SType){
00248 #ifdef FIXP
00249 double c1g = 0.98;
00250 Ph->SetCosTheta(c1g);
00251 #else
00252 double c1g;
00253 if(SType == 0)
00254 c1g = Ph->GetCosThetaF();
00255 else
00256 c1g = Ph->GetCosTheta();
00257 #endif
00258 if( SType == 1 && fabs(c1g)<gGlobal->Get_CosThetaInt()) return false;
00259 double s1g = sqrt(1-c1g*c1g);
00260
00261 #ifdef FIXP
00262 double p1g = 1.2;
00263 #else
00264 double p1g = Ph->GetPhi();
00265 #endif
00266 double cp1g, sp1g;
00267
00268 sincos(p1g, &sp1g, &cp1g);
00269
00270 fcth[Ne] = c;
00271 fsth[Ne] = sqrt(1-fcth[Ne]*fcth[Ne]);
00272
00273 #ifdef FIXP
00274 fph[Ne] = 0.;
00275 #else
00276 fph[Ne] = GetPhi();
00277 #endif
00278
00279 sincos(fph[Ne], &fsph[Ne], &fcph[Ne]);
00280 double nx,ny,nz;
00281 if( SType == 0){
00282
00283
00284 nz = fcth[Ne]*c1g + fsth[Ne]*s1g*cp1g;
00285
00286 if ( fabs(nz) > gGlobal->Get_CosThetaInt() ) return false;
00287 fcth[Ng1] = nz;
00288 fsth[Ng1] = sqrt(1-fcth[Ng1]*fcth[Ng1]);
00289
00290 double nxp = fsth[Ne]*c1g - fcth[Ne]*s1g*cp1g;
00291 double nyp =-s1g*sp1g;
00292 nx = fcph[Ne]*nxp - fsph[Ne]*nyp;
00293 ny = fsph[Ne]*nxp + fcph[Ne]*nyp;
00294
00295 double norm = 1/fsth[Ng1];
00296 fcph[Ng1] = nx*norm;
00297 fsph[Ng1] = ny*norm;
00298
00299 fCosPsi = c1g;
00300 }else{
00301
00302 fcth[Ng1] = c1g;
00303 fsth[Ng1] = s1g;
00304
00305 fph[Ng1] = p1g;
00306 fcph[Ng1] = cp1g;
00307 fsph[Ng1] = sp1g;
00308
00309 nx = fsth[Ng1]*fcph[Ng1];
00310 ny = fsth[Ng1]*fsph[Ng1];
00311 nz = fcth[Ng1];
00312 fCosPsi = (nx*fcph[Ne]+ny*fsph[Ne])*fsth[Ne] + nz*fcth[Ne];
00313 if(SType == 1){
00314 if ( fCosPsi > gGlobal->Get_CosTheta0() ) return false;
00315 }
00316 }
00317
00318 #ifdef FIXP
00319 fen[Ng1] = fp[Ng1] = 0.1;
00320 Ph->SetEnergy(fen[Ng1]);
00321 #else
00322 fen[Ng1] = fp[Ng1] = Ph->GetEnergy();
00323 if (SType == 3 && fen[Ng1] > 0.5 ) return false;
00324 #endif
00325
00326 double k2 = fen[Ng1]*fen[Ng1];
00327 double t = 2 - fen[Ng1];
00328 double b = t*t - k2;
00329
00330
00331
00332 if ( b<4*gGlobal->Get_MF2() ) return false;
00333
00334 double kcospsi = fen[Ng1]*fCosPsi;
00335 double ap = kcospsi*kcospsi-t*t;
00336 double d = 4*gGlobal->Get_MF2()*ap + b*b;
00337
00338 if ( d < 0 ) return false;
00339
00340
00341 fen[Ne] = 0.5*( -t*b + kcospsi*sqrt(d) )/ap;
00342 fen[Np] = t - fen[Ne];
00343 if(SType == 3 && fen[Ne] < gGlobal->Get_XMin()) return false;
00344 if(SType == 3 && fen[Np] < gGlobal->Get_XMin()) return false;
00345
00346 fp[Ne] = sqrt(fen[Ne]*fen[Ne] - gGlobal->Get_MF2());
00347 fp[Np] = sqrt(fen[Np]*fen[Np] - gGlobal->Get_MF2());
00348
00349 fcth[Np] = -(fen[Ng1]*nz + fp[Ne]*fcth[Ne])/fp[Np];
00350
00351
00352
00353
00354 if ( SType != 3 && fabs(fcth[Np]) > gGlobal->Get_CosThetaMin() ) return false;
00355 if ( SType == 3 && fabs(fcth[Np]) > gGlobal->Get_CosTheta0() ) return false;
00356
00357
00358
00359
00360
00361 fsth[Np] = sqrt(1-fcth[Np]*fcth[Np]);
00362
00363 double inv = 1/(fp[Np]*fsth[Np]);
00364 fcph[Np] = -(fp[Ne]*fsth[Ne]*fcph[Ne] + fen[Ng1]*nx)*inv;
00365
00366 if ( fabs(fcph[Np]) > 1 + 1e-10 ) return false;
00367 fsph[Np] = -(fp[Ne]*fsth[Ne]*fsph[Ne] + fen[Ng1]*ny)*inv;
00368
00369 if ( fabs(fsph[Np]) > 1 + 1e-10 ) return false;
00370
00371 if(SType == 1 || SType == 0){
00372
00373 double cos_psi_p = (nx*fcph[Np]+ny*fsph[Np])*fsth[Np] + nz*fcth[Np];
00374
00375 if ( cos_psi_p > gGlobal->Get_CosTheta0() ) {
00376
00377 return false;
00378 }
00379 }
00380
00381 fth[Ne] = acos(fcth[Ne]);
00382 fth[Np] = acos(fcth[Np]);
00383 fth[Ng1] = acos(fcth[Ng1]);
00384
00385 fph[Np] = atan2(fsph[Np],fcph[Np]);
00386 fph[Ng1] = atan2(fsph[Ng1],fcph[Ng1]);
00387
00388
00389 INRANGE(fph[Np]);
00390
00391 return (SType<3)?Select():Selectgg();
00392 }
00393
00394 bool TEvent::MakeEvent(const double &c, const double &x1g, const double &x2g){
00395
00396
00397
00398 fen[Ng1] = 0;
00399 fxg[0] = x1g;
00400 fxg[1] = x2g;
00401 fxg[2] = 0;
00402 fxg[3] = 0;
00403
00404 fcth[Ne] = c;
00405 fsth[Ne] = sqrt(1-fcth[Ne]*fcth[Ne]);
00406
00407 double pz = x1g - x2g;
00408 double kcospsi = pz*fcth[Ne];
00409 double t = 2 - x1g - x2g;
00410 double ap = kcospsi*kcospsi-t*t;
00411 double b = t*t - pz*pz;
00412 double d = 4*gGlobal->Get_MF2()*ap + b*b;
00413
00414 if ( d < 0 ) return false;
00415
00416 fY[Ne] = fen[Ne] = 0.5*( -t*b + kcospsi*sqrt(d) )/ap;
00417 fY[Np] = fen[Np] = t - fen[Ne];
00418
00419 fp[Ne] = sqrt(fen[Ne]*fen[Ne]-gGlobal->Get_MF2());
00420 fp[Np] = sqrt(fen[Np]*fen[Np]-gGlobal->Get_MF2());
00421
00422 fcth[Np] = -(pz + fp[Ne]*fcth[Ne])/fp[Np];
00423 if ( fabs(fcth[Np]) > gGlobal->Get_CosThetaMin() ) return false;
00424
00425 fsth[Np] = sqrt(1-fcth[Np]*fcth[Np]);
00426 fth[Ne] = acos(fcth[Ne]);
00427 fth[Np] = acos(fcth[Np]);
00428
00429 fph[Ne] = GetPhi();
00430
00431 sincos(fph[Ne], &fsph[Ne], &fcph[Ne]);
00432
00433 fcph[Np] = -fcph[Ne];
00434 fsph[Np] = -fsph[Ne];
00435 fph[Np] = fph[Ne] + gConst->Pi();
00436 INRANGE(fph[Np]);
00437
00438 return Select();
00439 }
00440
00441 bool TEvent::MakeEventgg(const double &c, const double &x1g, const double &x2g){
00442
00443
00444
00445 fen[Ng1] = 0;
00446 fxg[0] = x1g;
00447 fxg[1] = x2g;
00448 fxg[2] = 0;
00449 fxg[3] = 0;
00450
00451 fcth[Ne] = c;
00452 fsth[Ne] = sqrt(1-fcth[Ne]*fcth[Ne]);
00453
00454 double pz = x1g - x2g;
00455 double kcospsi = pz*fcth[Ne];
00456 double t = 2 - x1g - x2g;
00457 double ap = kcospsi*kcospsi-t*t;
00458 double b = t*t - pz*pz;
00459
00460 fp[Ne] = fY[Ne] = fen[Ne] = 0.5*b*(kcospsi - t)/ap;
00461 fp[Np] = fY[Np] = fen[Np] = t - fen[Ne];
00462
00463 fcth[Np] = -(pz + fp[Ne]*fcth[Ne])/fp[Np];
00464 if ( fabs(fcth[Np]) > gGlobal->Get_CosThetaMin() ) return false;
00465
00466 fsth[Np] = sqrt(1-fcth[Np]*fcth[Np]);
00467 fth[Ne] = acos(fcth[Ne]);
00468 fth[Np] = acos(fcth[Np]);
00469
00470 fph[Ne] = GetPhi();
00471
00472 sincos(fph[Ne], &fsph[Ne], &fcph[Ne]);
00473
00474 fcph[Np] = -fcph[Ne];
00475 fsph[Np] = -fsph[Ne];
00476 fph[Np] = fph[Ne] + gConst->Pi();
00477 INRANGE(fph[Np]);
00478
00479 return Selectgg();
00480 }
00481
00482 bool TEvent::MakeEvent(const double &c,
00483 const double &x1g, const double &x2g,
00484 const double &x3g, const double &x4g){
00485
00486 fen[Ng1] = 0;
00487 fxg[0] = x1g;
00488 fxg[1] = x2g;
00489 fxg[2] = x3g;
00490 fxg[3] = x4g;
00491
00492 fcth[Ne] = c;
00493
00494 double e = 2 - x1g - x2g;
00495 fY[Ne] = 2*(1-x1g)*(1-x2g)/(e-fcth[Ne]*(x2g-x1g));
00496 fY[Np] = e - fY[Ne];
00497
00498 fen[Ne] = fY[Ne]*(1 - x3g);
00499 fen[Np] = fY[Np]*(1 - x4g);
00500
00501 if( fen[Ne] < 0 || fen[Np] < 0 ) return false;
00502 fp[Ne] = fen[Ne];
00503 fp[Np] = fen[Np];
00504
00505 fsth[Ne] = sqrt(1-fcth[Ne]*fcth[Ne]);
00506 fth[Ne] = acos(fcth[Ne]);
00507
00508 fph[Ne] = GetPhi();
00509 fcph[Ne] = cos(fph[Ne]);
00510 fsph[Ne] = sin(fph[Ne]);
00511
00512 double inv = 1/fY[Np];
00513 fcth[Np] = (x2g-x1g-fY[Ne]*fcth[Ne])*inv;
00514 fsth[Np] = fsth[Ne]*fY[Ne]*inv;
00515 fth[Np] = acos(fcth[Np]);
00516
00517 fph[Np] = fph[Ne] + gConst->Pi();
00518
00519 INRANGE(fph[Np]);
00520
00521 fcph[Np] = -fcph[Ne];
00522 fsph[Np] = -fsph[Ne];
00523
00524 if(fIsSmear)
00525 return 1;
00526 else
00527 return Select();
00528 }
00529
00530 bool TEvent::MakeEventN(const double &x3g, const double &x4g){
00531
00532 fen[Ng1] = 0;
00533 fxg[2] = x3g;
00534 fxg[3] = x4g;
00535
00536 fen[Ne] = fY[Ne]*(1 - x3g);
00537 fen[Np] = fY[Np]*(1 - x4g);
00538
00539 fp[Ne] = fen[Ne];
00540 fp[Np] = fen[Np];
00541
00542
00543
00544
00545
00546
00547
00548 return Select();
00549 }
00550
00551 void TEvent::Print(){
00552 printf("Electron en=%f, p=%f, th=%f, phi=%f\n",fen[Ne],fp[Ne],fth[Ne],fph[Ne]);
00553 printf("Positron en=%f, p=%f, th=%f, phi=%f\n",fen[Np],fp[Np],fth[Np],fph[Np]);
00554 printf("Gamma en=%f, p=%f, th=%f, phi=%f\n",fen[Ng1],fp[Ng1],fth[Ng1],fph[Ng1]);
00555 printf("Sum en=%g, px=%g, py=%g, pz=%g\n",fen[Ne]+fen[Np]+fen[Ng1],
00556 fp[Ne]*sin(fth[Ne])*cos(fph[Ne])+fp[Np]*sin(fth[Np])*cos(fph[Np])+fp[Ng1]*sin(fth[Ng1])*cos(fph[Ng1]),
00557 fp[Ne]*sin(fth[Ne])*sin(fph[Ne])+fp[Np]*sin(fth[Np])*sin(fph[Np])+fp[Ng1]*sin(fth[Ng1])*sin(fph[Ng1]),
00558 fp[Ne]*cos(fth[Ne])+fp[Np]*cos(fth[Np])+fp[Ng1]*cos(fth[Ng1]));
00559 }
00560
00561 bool TEvent::MakeEvent(const double &c){
00562
00563 fen[Ng1] = 0;
00564 fxg[0] = 0;
00565 fxg[1] = 0;
00566 fxg[2] = 0;
00567 fxg[3] = 0;
00568
00569 fY[Ne] = 1;
00570 fen[Ne] = 1;
00571 fp[Ne] = gGlobal->Get_BetaF();
00572 fcth[Ne] = c;
00573 fsth[Ne] = sqrt(1-fcth[Ne]*fcth[Ne]);
00574 fth[Ne] = acos(fcth[Ne]);
00575 fph[Ne] = GetPhi();
00576 fcph[Ne] = cos(fph[Ne]);
00577 fsph[Ne] = sin(fph[Ne]);
00578
00579 fY[Np] = 1;
00580 fen[Np] = 1;
00581 fp[Np] = gGlobal->Get_BetaF();
00582 fcth[Np] = -fcth[Ne];
00583 fsth[Np] = fsth[Ne];
00584 fth[Np] = gConst->Pi() - fth[Ne];
00585 fph[Np] = fph[Ne] + gConst->Pi();
00586 INRANGE(fph[Np]);
00587 fcph[Np] = -fcph[Ne];
00588 fsph[Np] = -fsph[Ne];
00589
00590 return Select();
00591 }
00592
00593 #define swap(x) {double t = x[Ne]; x[Ne] = x[Np]; x[Np] = t;}
00594 void TEvent::Swap(){
00595 swap(fen);
00596 swap(fp);
00597 swap(fY);
00598
00599 swap(fth);
00600 swap(fcth);
00601 swap(fsth);
00602
00603 swap(fph);
00604 swap(fcph);
00605 swap(fsph);
00606
00607
00608 }
00609 #undef swap
00610
00611 void TEvent::CosPrint(){
00612 double pm[3],pp[3],pg[3];
00613
00614 pm[0] = fp[Ne]*fcph[Ne]*fsth[Ne];
00615 pm[1] = fp[Ne]*fsph[Ne]*fsth[Ne];
00616 pm[2] = fp[Ne]*fcth[Ne];
00617
00618 pp[0] = fp[Np]*fcph[Np]*fsth[Np];
00619 pp[1] = fp[Np]*fsph[Np]*fsth[Np];
00620 pp[2] = fp[Np]*fcth[Np];
00621
00622 pg[0] = fp[Ng1]*fcph[Ng1]*fsth[Ng1];
00623 pg[1] = fp[Ng1]*fsph[Ng1]*fsth[Ng1];
00624 pg[2] = fp[Ng1]*fcth[Ng1];
00625
00626 double cos_m = (pm[0]*pg[0] + pm[1]*pg[1] + pm[2]*pg[2])/(fp[Ne]*fp[Ng1]);
00627 double cos_p = (pp[0]*pg[0] + pp[1]*pg[1] + pp[2]*pg[2])/(fp[Np]*fp[Ng1]);
00628
00629 std::cout<<"cos "<<cos_m<<" "<<cos_p<<std::endl;
00630
00631 }
00632
00633 void TEvent::GetEvent(double *mom, int &npart){
00634 const double MeV2GeV = 0.001;
00635 npart = 0;
00636
00637 mom[4*npart+0] = fsth[Ne]*fcph[Ne];
00638 mom[4*npart+1] = fsth[Ne]*fsph[Ne];
00639 mom[4*npart+2] = fcth[Ne];
00640 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fp[Ne];
00641 npart++;
00642
00643 mom[4*npart+0] = fsth[Np]*fcph[Np];
00644 mom[4*npart+1] = fsth[Np]*fsph[Np];
00645 mom[4*npart+2] = fcth[Np];
00646 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fp[Np];
00647 npart++;
00648
00649 if(fen[Ng1]>0){
00650 mom[4*npart+0] = fsth[Ng1]*fcph[Ng1];
00651 mom[4*npart+1] = fsth[Ng1]*fsph[Ng1];
00652 mom[4*npart+2] = fcth[Ng1];
00653 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fp[Ng1];
00654 npart++;
00655 } else {
00656 if(fxg[0]>0){
00657 mom[4*npart+0] = 0;
00658 mom[4*npart+1] = 0;
00659 mom[4*npart+2] = 0.999999;
00660 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fxg[0];
00661 npart++;
00662 }
00663 if(fxg[1]>0){
00664 mom[4*npart+0] = 0;
00665 mom[4*npart+1] = 0;
00666 mom[4*npart+2] = -0.999999;
00667 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fxg[1];
00668 npart++;
00669 }
00670 if(fxg[2]>0){
00671 mom[4*npart+0] = fsth[Ne]*fcph[Ne];
00672 mom[4*npart+1] = fsth[Ne]*fsph[Ne];
00673 mom[4*npart+2] = fcth[Ne];
00674 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fY[Ne]*fxg[2];
00675 npart++;
00676 }
00677 if(fxg[3]>0){
00678 mom[4*npart+0] = fsth[Np]*fcph[Np];
00679 mom[4*npart+1] = fsth[Np]*fsph[Np];
00680 mom[4*npart+2] = fcth[Np];
00681 mom[4*npart+3] = MeV2GeV*gGlobal->Get_E()*fY[Np]*fxg[3];
00682 npart++;
00683 }
00684 }
00685 }