00001 #ifndef RAD_TEvent
00002 #define RAD_TEvent
00003
00004 #include "TConstants.h"
00005 #include "TPhoton.h"
00006 #include "TRandom.h"
00007 #include "TLorentzVector.h"
00008 #include <iostream>
00009 #define Ne 0
00010 #define Np 1
00011 #define Ng1 2
00012
00013 class TEvent{
00014 protected:
00015 double fen[3];
00016 double fp[3];
00017 double fY[3];
00018
00019
00020 double fth[3];
00021 double fcth[3];
00022 double fsth[3];
00023
00024 double fph[3];
00025 double fcph[3];
00026 double fsph[3];
00027 bool fIsSmear;
00028 double fdPar[9];
00029 double fxg[4];
00030 double fCosPsi;
00031 unsigned int fNSelStat;
00032 unsigned int *fSelStat;
00033 public:
00034 TEvent();
00035 virtual ~TEvent();
00036 void Init();
00037
00038 bool MakeEvent(const double &, const double &, const double &,
00039 const double &, const double &, const double &,
00040 const double &, const double &);
00041
00042 bool MakeEvent(const double &, const double &, const double &);
00043 bool MakeEventgg(const double &, const double &, const double &);
00044
00045 bool MakeEventN(const double &, const double &);
00046
00047 bool MakeEvent(const double &, const double &, const double &,
00048 const double &, const double &);
00049
00050 bool MakeEvent(const double &);
00051
00052 bool MakeEvent(const double &, TPhoton*, const unsigned int);
00053
00054 bool Select();
00055 bool Selectgg();
00056 inline void GetEvent(double &p0, double &t0, double &ph0,
00057 double &p1, double &t1, double &ph1){
00058 p0 = fp[Ne]; t0 = fth[Ne]; ph0 = fph[Ne];
00059 p1 = fp[Np]; t1 = fth[Np]; ph1 = fph[Np];
00060 }
00061 inline double GetPhi(){return gRandom->Rndm()*2*gConst->Pi();}
00062 inline double GetY(unsigned int i){return fY[i];}
00063 void Print();
00064 void PrintSelectStat(){
00065 for(unsigned int i=0; i<fNSelStat; i++)std::cout<<"Cut #"<<i<<" "<<fSelStat[i]<<std::endl;
00066 }
00067 inline double GetCosPsi(){return fCosPsi;};
00068 inline void GetPPar(unsigned int i, double &e, double &p, double &c){
00069 e = fen[i]; p = fp[i]; c = fcth[i];
00070 }
00071 inline TLorentzVector Get4Vector(unsigned int i){
00072 return TLorentzVector(fp[i]*fsth[i]*fcph[i],fp[i]*fsth[i]*fsph[i],fp[i]*fcth[i],fen[i]);
00073 }
00074 inline double GetChiPrime(unsigned int i){
00075 return fen[i]*fen[Ng1] - fp[i]*fp[Ng1]*(fsth[i]*fsth[Ng1]*(fcph[i]*fcph[Ng1]+fsph[i]*fsph[Ng1])+fcth[i]*fcth[Ng1]);
00076 }
00077 inline double GetSumComponent(unsigned int i){
00078 switch(i){
00079 case 0:
00080 return fen[Ne] + fen[Np] + fen[Ng1];
00081 break;
00082 case 1:
00083 return fp[Ne]*fsth[Ne]*fcph[Ne] + fp[Np]*fsth[Np]*fcph[Np] + fp[Ng1]*fsth[Ng1]*fcph[Ng1];
00084 break;
00085 case 2:
00086 return fp[Ne]*fsth[Ne]*fsph[Ne] + fp[Np]*fsth[Np]*fsph[Np] + fp[Ng1]*fsth[Ng1]*fsph[Ng1];
00087 break;
00088 case 3:
00089 return fp[Ne]*fcth[Ne] + fp[Np]*fcth[Np] + fp[Ng1]*fcth[Ng1];
00090 break;
00091 }
00092 return 0;
00093 }
00094 void Swap();
00095 void CosPrint();
00096 void SetdPar(double *p){
00097 fIsSmear = true;
00098 for(int i=0; i<9; i++) fdPar[i] = p[i];
00099 }
00100
00101 inline double dDeltaTheta(){
00102 if ( !fIsSmear ) return 0;
00103 double sigma = 0;
00104 if(gRandom->Rndm()<fdPar[0])
00105 sigma = fdPar[1];
00106 else
00107 sigma = fdPar[2];
00108 return gRandom->Gaus(0,sigma);
00109 }
00110 inline double dDeltaPhi(){
00111 if ( !fIsSmear ) return 0;
00112 double sigma = 0;
00113 if(gRandom->Rndm()<fdPar[3])
00114 sigma = fdPar[4];
00115 else
00116 sigma = fdPar[5];
00117 return gRandom->Gaus(0,sigma);
00118 }
00119 inline double dATheta(){
00120 if ( !fIsSmear ) return 0;
00121 double sigma = 0;
00122 if(gRandom->Rndm()<fdPar[6])
00123 sigma = fdPar[7];
00124 else
00125 sigma = fdPar[8];
00126 return gRandom->Gaus(0,sigma);
00127 }
00128 void GetEvent(double*, int&);
00129 };
00130
00131 #endif //#ifndef RAD_TEvent