#include <CSecAndLum.h>
Public Member Functions | |
void | AvgLum () |
bool | Calculation (const Channels *num, Channels *&res) |
float | CalLumEE (const unsigned int n) |
float | CalLumGG (const unsigned int n) |
float | CalLumUU (const unsigned int n) |
const float | CalPhyCSec (const unsigned int n, const int type, const float eff=-1) |
void | CrossSection (const int mtype=0) |
CSecAndLum (const float ecm, const char *dir=NULL) | |
CSecAndLum (const char *dir=NULL) | |
void | Efficiency () |
bool | execute () |
bool | finalize () |
const float | GetCSec (const int ctype, const float ecm, const int mtype=0) |
const float | GetCSecEE () |
const float | GetCSecGG () |
const Channels | GetCSecs () |
const float | GetCSecUU () |
const float | GetEff (const int type, const float ecm) |
const Channels | GetEffs () |
const float | GetLumAvg () |
const float | GetLumEE () |
const float | GetLumGG () |
const Channels | GetLums () |
const float | GetLumUU () |
bool | initialize () |
void | SetBeamEnergy (const float e) |
void | SetCSec (const int ichannel, const float csec) |
void | SetEff (const int ichannel, const float eff) |
~CSecAndLum () | |
Private Attributes | |
float | m_csecEE |
float | m_csecGG |
float | m_csecH |
float | m_csecUU |
vector< Channels > | m_csecVec |
std::string | m_csfile |
float | m_ecm |
float | m_effEE |
std::string | m_efffile |
float | m_effGG |
float | m_effH |
float | m_effUU |
vector< Channels > | m_effVec |
float | m_lumAvg |
float | m_lumEE |
float | m_lumGG |
float | m_lumUU |
unsigned int | m_nEE |
unsigned int | m_nGG |
unsigned int | m_nH |
unsigned int | m_nUU |
|
00010 :m_ecm(3.097), 00011 m_lumGG(0),m_lumEE(0),m_lumUU(0),m_lumAvg(0), 00012 m_csecGG(0),m_csecEE(0),m_csecUU(0),m_csecH(0), 00013 m_effGG(0),m_effEE(0),m_effUU(0),m_effH(0), 00014 m_nGG(0),m_nEE(0),m_nUU(0),m_nH(0), 00015 m_csecVec(0),m_effVec(0) 00016 { 00017 //string m_csfile,m_efffile; 00018 if(dir!=NULL){ 00019 m_csfile=string(dir)+"/CrossSection.dat"; 00020 m_efffile=string(dir)+"/efficiency.dat"; 00021 } 00022 else{ 00023 m_csfile="./CrossSection.dat"; 00024 m_efffile="./efficiency.dat"; 00025 } 00026 cout << "CSecAndLum::CSecAndLum " << m_csfile<<endl 00027 << " " << m_efffile<<endl 00028 << "Default energy of beam " << 0.5*m_ecm <<endl; 00029 initialize(); 00030 Efficiency(); 00031 CrossSection(); 00032 }
|
|
00035 :m_ecm(2.*eb), 00036 m_lumGG(0),m_lumEE(0),m_lumUU(0),m_lumAvg(0), 00037 m_csecGG(0),m_csecEE(0),m_csecUU(0), 00038 m_effGG(0),m_effEE(0),m_effUU(0),m_effH(0), 00039 m_nGG(0),m_nEE(0),m_nUU(0),m_nH(0), 00040 m_csecVec(0),m_effVec(0) 00041 { 00042 if(dir!=NULL){ 00043 m_csfile=string(dir)+"/CrossSection.dat"; 00044 m_efffile=string(dir)+"/efficiency.dat"; 00045 } 00046 else{ 00047 m_csfile="./CrossSection.dat"; 00048 m_efffile="./efficiency.dat"; 00049 } 00050 cout << "CSecAndLum::CSecAndLum " << m_csfile<<endl 00051 << " " << m_efffile<<endl 00052 << " set Ebeam=" << 0.5*m_ecm<<endl; 00053 00054 initialize(); 00055 Efficiency(); 00056 CrossSection(); 00057 }
|
|
00059 { 00060 00061 }
|
|
00273 { 00274 float denominator=0.,numerator=0.; 00275 if(m_nGG>0&&m_lumGG>0){ 00276 denominator+=m_nGG/m_lumGG/m_lumGG; 00277 numerator +=m_nGG/m_lumGG; 00278 } 00279 if(m_nEE>0&&m_lumEE>0){ 00280 denominator+=m_nEE/m_lumEE/m_lumEE; 00281 numerator +=m_nEE/m_lumEE; 00282 } 00283 if(m_nUU>0&&m_lumUU>0){ 00284 denominator+=m_nUU/m_lumUU/m_lumUU; 00285 numerator +=m_nUU/m_lumUU; 00286 } 00287 m_lumAvg=numerator/denominator; 00288 return; 00289 }
|
|
00135 { 00136 SetBeamEnergy(0.5*num->ecm); 00137 if(num->ee<0||num->uu<0||num->gg<0||num->etc<0){ 00138 cout <<"CSecAndLum::Calculation" 00139 <<" Nevent<0===>calculation break!"<<endl; 00140 return false; 00141 } 00142 unsigned int nee=num->ee; 00143 unsigned int nuu=num->uu; 00144 unsigned int ngg=num->gg; 00145 unsigned int nh =num->etc; 00146 00147 res->ee=CalLumEE(nee); 00148 res->uu=CalLumUU(nuu); 00149 res->gg=CalLumGG(ngg); 00150 res->etc=CalPhyCSec(nh,4,-1); 00151 res->ecm= m_lumAvg; 00152 00153 return true; 00154 }
|
|
00078 { 00079 m_nEE=n; 00080 m_lumEE=n/m_csecEE/GetEff(1,m_ecm); 00081 AvgLum(); 00082 return m_lumEE; 00083 };
|
|
00071 { 00072 m_nGG=n; 00073 m_lumGG=n/m_csecGG/GetEff(3,m_ecm); 00074 AvgLum(); 00075 return m_lumGG; 00076 };
|
|
00085 { 00086 m_nUU=n; 00087 m_lumUU=n/m_csecUU/GetEff(2,m_ecm); 00088 AvgLum(); 00089 return m_lumUU; 00090 };
|
|
00156 { 00157 00158 m_nH=n; 00159 00160 float eff0=eff; 00161 if(eff<0||eff>1){ 00162 eff0=GetEff(4,m_ecm); 00163 } 00164 if(type==1){ 00165 if(m_lumEE<=0){ 00166 cerr << "CSecAndLum::CalPhyCSec" <<" luminosity<=0!("<<type<<")"<<endl; 00167 return 0; 00168 } 00169 return m_csecH=n/eff0/m_lumEE; 00170 } 00171 else if(type==2){ 00172 if(m_lumUU<=0){ 00173 cerr << "CSecAndLum::CalPhyCSec"<<" luminosity<=0!("<<type<<")"<<endl; 00174 return 0; 00175 } 00176 return m_csecH=n/eff0/m_lumUU; 00177 } 00178 else if(type==3){ 00179 if(m_lumGG<=0){ 00180 cerr << "CSecAndLum::CalPhyCSec"<<" luminosity<=0!("<<type<<")"<<endl; 00181 return 0; 00182 } 00183 return m_csecH=n/eff0/m_lumGG; 00184 } 00185 else { 00186 if(m_lumAvg<=0){ 00187 cerr << "CSecAndLum::CalPhyCSec"<<" luminosity<=0!("<<type<<")"<<endl; 00188 return 0; 00189 } 00190 return m_csecH=n/eff0/m_lumAvg; 00191 } 00192 return 0; 00193 }
|
|
00195 { 00196 m_csecEE=GetCSec(1,m_ecm,mtype); 00197 m_csecUU=GetCSec(2,m_ecm,mtype); 00198 m_csecGG=GetCSec(3,m_ecm,mtype); 00199 }
|
|
00237 { 00238 m_effEE=GetEff(1,m_ecm); 00239 m_effUU=GetEff(2,m_ecm); 00240 m_effGG=GetEff(3,m_ecm); 00241 m_effH =GetEff(4,m_ecm); 00242 }
|
|
00113 { 00114 return true; 00115 }
|
|
|
|
00200 { 00201 if(mtype!=1){ 00202 // Interpolation method 00203 vector<Channels>::iterator it1,it2=m_csecVec.begin(); 00204 while(it2!=m_csecVec.end()){ 00205 if(ecm<(*it2).ecm) break; 00206 it1=it2; 00207 it2++; 00208 } 00209 if(it2==m_csecVec.end()){ 00210 it2=it1; 00211 it1--; 00212 } 00213 if(it2==m_csecVec.begin()){ 00214 it1=it2; 00215 it2++; 00216 } 00217 if(ctype==1){ 00218 return (*it1).ee+((*it2).ee-(*it1).ee)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00219 } 00220 else if(ctype==2){ 00221 return (*it1).uu+((*it2).uu-(*it1).uu)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00222 } 00223 else if(ctype==3){ 00224 return (*it1).gg+((*it2).gg-(*it1).gg)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00225 } 00226 else if(ctype==4){ 00227 return (*it1).etc+((*it2).etc-(*it1).etc)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00228 } 00229 else return 1000000.; 00230 } 00231 else{ 00232 //function method 00233 return 1.; 00234 } 00235 }
|
|
00099 {return m_csecEE;};
|
|
00097 {return m_csecGG;};
|
|
00103 { 00104 Channels csec={m_ecm,m_csecEE,m_csecUU,m_csecGG,m_csecH}; 00105 return csec; 00106 };
|
|
00101 {return m_csecUU;};
|
|
00243 { 00244 vector<Channels>::iterator it1,it2=m_effVec.begin(); 00245 while(it2!=m_csecVec.end()){ 00246 if(ecm<(*it2).ecm) break; 00247 it1=it2; 00248 it2++; 00249 } 00250 if(it2==m_csecVec.end()){ 00251 it2=it1; 00252 it1--; 00253 } 00254 if(it2==m_csecVec.begin()){ 00255 it1=it2; 00256 it2++; 00257 } 00258 if(type==1){ 00259 return (*it1).ee+((*it2).ee-(*it1).ee)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00260 } 00261 else if(type==2){ 00262 return (*it1).uu+((*it2).uu-(*it1).uu)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00263 } 00264 else if(type==3){ 00265 return (*it1).gg+((*it2).gg-(*it1).gg)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00266 } 00267 else if(type==4){ 00268 return (*it1).etc+((*it2).etc-(*it1).etc)/((*it2).ecm-(*it1).ecm)*((*it2).ecm-ecm); 00269 } 00270 return -1.; 00271 }
|
|
00116 { 00117 Channels eff={m_ecm,m_effEE,m_effUU,m_effGG,m_effH}; 00118 return eff; 00119 };
|
|
00067 {return m_lumAvg;};
|
|
00063 {return m_lumEE;};
|
|
00061 {return m_lumGG;};
|
|
00092 { 00093 Channels lum={m_ecm,m_lumEE,m_lumUU,m_lumGG,m_lumAvg}; 00094 return lum; 00095 };
|
|
00065 {return m_lumUU;};
|
|
00063 { 00064 00065 // Read in values of cross section and efficiency at energy points 00066 ifstream csfile,efffile; 00067 Channels csec,eff; 00068 //char line[255]; 00069 00070 csfile.open(m_csfile.c_str(),ios_base::in); 00071 if(csfile){ 00072 while((csfile>>csec.ecm>>csec.ee>>csec.uu>>csec.gg)){ 00073 m_csecVec.push_back(csec); 00074 } 00075 } 00076 else{ 00077 cout <<"CSecAndLum::initialize()" 00078 <<" can't open "<<m_csfile<<endl; 00079 return false; 00080 } 00081 csfile.close(); 00082 #ifdef OnlineLumCheck 00083 vector<Channels>::iterator it=m_csecVec.begin(); 00084 for(;it!=m_csecVec.end();it++){ 00085 cout<< (*it).ecm << " " << (*it).ee << " " 00086 << (*it).uu << " " << (*it).gg << endl; 00087 } 00088 #endif 00089 00090 efffile.open(m_efffile.c_str(),ios_base::in); 00091 if(efffile){ 00092 while((efffile>>eff.ecm>>eff.ee>>eff.uu>>eff.gg>>eff.etc)){ 00093 m_effVec.push_back(eff); 00094 } 00095 } 00096 else{ 00097 cout <<"CSecAndLum::initialize()" 00098 <<" can't open "<<m_efffile<<endl; 00099 return false; 00100 } 00101 efffile.close(); 00102 #ifdef OnlineLumCheck 00103 it=m_effVec.begin(); 00104 for(;it!=m_effVec.end();it++){ 00105 cout<< (*it).ecm << " " << (*it).ee << " " 00106 << (*it).uu << " " << (*it).gg << " " << (*it).etc <<endl; 00107 } 00108 #endif 00109 00110 return true; 00111 }
|
|
00123 { 00124 if(m_ecm<=0){ 00125 cerr << "CSecAndLum::SetBeamEnergy" << " energy<=0!"<<endl; 00126 } 00127 else{ 00128 m_ecm=2.*e; //approximate while non-headon colliding 00129 cout << "CSecAndLum::SetBeamEnergy set Ebeam= " << 0.5*m_ecm<<endl; 00130 Efficiency(); 00131 CrossSection(); 00132 } 00133 }
|
|
00047 { 00048 if(ichannel==1) m_csecEE=csec; 00049 else if(ichannel==2) m_csecUU=csec; 00050 else if(ichannel==3) m_csecGG=csec; 00051 else if(ichannel==4) m_csecH =csec; 00052 return; 00053 }
|
|
00036 { 00037 if(ichannel==1) m_effEE=eff; 00038 else if(ichannel==2) m_effUU=eff; 00039 else if(ichannel==3) m_effGG=eff; 00040 else if(ichannel==4) m_effH =eff; 00041 return; 00042 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|