00001
00002
00003
00004 #ifndef FROOT_FIN_PHYS
00005 #define FROOT_FIN_PHYS
00006
00008
00010
00011 #include <TString.h>
00012 #include <TMath.h>
00013 #include <TROOT.h>
00014
00015 namespace FIN_PHYS {
00016
00017 enum E_FndDataTaking {
00018 DTAK_2003_2004 = 0,
00019 DTAK_2006_2007 = 1,
00020 };
00021
00022 enum E_FndFidaVersion {
00023 FIDAVER_521 = 0,
00024 FIDAVER_601 = 1,
00025 FIDAVER_603 = 2,
00026 FIDAVER_END = 3,
00027 };
00028
00029 enum E_FinPhys_BhabhaPart_ID{
00030 FPh_BhaElec_id = 0,
00031 FPh_BhaPosit_id = 1,
00032 };
00033
00034 enum E_FinPhys_HypePart_ID{
00035 FPh_HypKmin_id = 0,
00036 FPh_HypKplu_id = 1,
00037 };
00038
00039 enum E_Fnd_PID {
00040 FPh_PID_Positron = 2,
00041 FPh_PID_Electron = 3,
00042
00043 FPh_PID_Muon_plu = 5,
00044 FPh_PID_Muon_min = 6,
00045
00046 FPh_PID_Pi_zero = 7,
00047 FPh_PID_Pi_plu = 8,
00048 FPh_PID_Pi_min = 9,
00049
00050 FPh_PID_Kaon_Long = 10,
00051 FPh_PID_Kaon_Short = 16,
00052 FPh_PID_Kaon_plu = 11,
00053 FPh_PID_Kaon_min = 12,
00054
00055 FPh_PID_Neutron = 13,
00056 FPh_PID_Proton = 14,
00057 FPh_PID_AProton = 15,
00058 FPh_PID_ANeutron = 25,
00059
00060 FPh_PID_Lambda = 18,
00061 FPh_PID_ALambda = 26,
00062
00063 FPh_PID_Sigma_plu = 19,
00064 FPh_PID_Sigma_zero = 20,
00065 FPh_PID_Sigma_min = 21,
00066 FPh_PID_ASigma_plu = 29,
00067 FPh_PID_ASigma_zero = 28,
00068 FPh_PID_ASigma_min = 27,
00069
00070 FPh_PID_Gamma = 1,
00071 FPh_PID_Deuteron = 45,
00072 FPh_PID_Tritium = 46,
00073 FPh_PID_Alpha = 47,
00074
00075 };
00076
00077
00078
00079 TString FidaVer_Name(E_FndFidaVersion ver = FIDAVER_603);
00080 Int_t FidaVer_ID(E_FndFidaVersion ver = FIDAVER_603);
00081
00082 Double_t TrackRad2Mom(Double_t B=1);
00083 Double_t TrackMom2Rad(Double_t B=1);
00084 Double_t TrackRad_FromMom(Double_t mom,Double_t lam,Double_t B=1);
00085
00086 Double_t GetBhaRate_Lumin_Factor();
00087
00088 Double_t GetParticleMass(E_Fnd_PID pid);
00089
00090 Double_t Sum(const Float_t &mod1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00091 const Float_t &mod2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2,
00092 Double_t &cdx_res,Double_t &cdy_res,Double_t &cdz_res);
00093
00094 void ScalarProduct(const Float_t &mod1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00095 const Float_t &mod2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2,
00096 Double_t &module,Double_t &angle_rad);
00097
00098 Double_t ParticleEnergy_2(E_Fnd_PID pid,const Float_t &mom);
00099 Double_t ParticleEnergy(E_Fnd_PID pid,const Float_t &mom);
00100
00101 Double_t KineticEnergy_2(const Float_t &mom1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00102 const Float_t &mom2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2);
00103 Double_t KineticEnergy(const Float_t &mom1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00104 const Float_t &mom2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2);
00105
00106 Double_t CenterMassEnergy(E_Fnd_PID pid1, const Float_t &mom1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00107 E_Fnd_PID pid2, const Float_t &mom2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2);
00108
00109
00110
00111 void RefSys_CosDir_To_Spheric(const Double_t &cx,const Double_t &cy,const Double_t &cz,Double_t &theta,Double_t &phi);
00112 void RefSys_Sphere_To_CosDir(const Double_t &theta,const Double_t &phi,Double_t &cx,Double_t &cy,Double_t &cz);
00113
00114 TString HolleritToString(Int_t hollerit_in);
00115
00117
00119
00120 Double_t Dedxfunc(Double_t Momentum, Double_t Mass, Double_t Charge, Double_t Zval, Double_t Aval, Double_t Ival);
00121 Double_t DedxfuncSi(Double_t Momentum, Double_t Mass, Double_t Charge);
00122 Double_t DedxfuncCh(Double_t Momentum, Double_t Mass, Double_t Charge);
00123
00124 Double_t Tenevsmom(Double_t Momentum, Double_t Mass);
00125
00126 };
00127
00129
00131
00132
00133 inline Int_t FIN_PHYS::FidaVer_ID(E_FndFidaVersion ver){
00134
00135 return (Int_t) ver;
00136 }
00137
00138
00139 inline TString FIN_PHYS::FidaVer_Name(E_FndFidaVersion ver){
00140
00141 switch (ver){
00142 case FIDAVER_521: return "v_521";
00143 case FIDAVER_601: return "v_601";
00144 case FIDAVER_603: return "v_603";
00145 default: return "";
00146 }
00147 }
00148
00149
00150 inline Double_t FIN_PHYS::TrackRad2Mom(Double_t B){
00151
00152
00153
00154
00155
00156
00157
00158 return (Double_t)(0.00300 * B);
00159 }
00160
00161
00162 inline Double_t FIN_PHYS::TrackMom2Rad(Double_t B){
00163
00164
00165 return (Double_t)( 1. / TrackRad2Mom(B) );
00166 }
00167
00168
00169 inline Double_t FIN_PHYS::TrackRad_FromMom(Double_t mom,Double_t lam,Double_t B){
00170
00171 Double_t mom_transv = mom * TMath::Cos(lam);
00172 Double_t rad = mom_transv * TrackMom2Rad(B);
00173 return rad;
00174 }
00175
00176
00177 inline Double_t FIN_PHYS::GetBhaRate_Lumin_Factor(){
00178
00179
00180
00181 return 1.4e+30;
00182 }
00183
00184
00185 inline Double_t FIN_PHYS::GetParticleMass(E_Fnd_PID pid){
00186
00187
00188
00189 switch(pid){
00190 case FPh_PID_Positron : return 0.00051099906;
00191 case FPh_PID_Electron : return 0.00051099906;
00192
00193 case FPh_PID_Muon_plu : return 0.105658389;
00194 case FPh_PID_Muon_min : return 0.105658389;
00195
00196 case FPh_PID_Pi_zero : return 0.1349764;
00197 case FPh_PID_Pi_plu : return 0.1395700;
00198 case FPh_PID_Pi_min : return 0.1395700;
00199
00200 case FPh_PID_Kaon_Long : return 0.497672;
00201 case FPh_PID_Kaon_Short : return 0.497672;
00202 case FPh_PID_Kaon_plu : return 0.493677;
00203 case FPh_PID_Kaon_min : return 0.493677;
00204
00205 case FPh_PID_Neutron : return 0.93956563;
00206 case FPh_PID_Proton : return 0.93827231;
00207 case FPh_PID_AProton : return 0.93827231;
00208 case FPh_PID_ANeutron : return 0.93956563;
00209
00210 case FPh_PID_Lambda : return 1.115684;
00211 case FPh_PID_ALambda : return 1.115684;
00212
00213 case FPh_PID_Sigma_plu : return 1.18937;
00214 case FPh_PID_Sigma_zero : return 1.19255;
00215 case FPh_PID_Sigma_min : return 1.197436;
00216 case FPh_PID_ASigma_plu : return 1.197436;
00217 case FPh_PID_ASigma_zero : return 1.19255;
00218 case FPh_PID_ASigma_min : return 1.18937;
00219
00220 case FPh_PID_Gamma : return 0;
00221 case FPh_PID_Deuteron : return 1.875613;
00222 case FPh_PID_Tritium : return 2.80925;
00223 case FPh_PID_Alpha : return 3.727417;
00224
00225 default:
00226 gROOT->Warning("FIN_PHYS::GetParticleMass","PID not suported (%d)",pid);
00227 return -1;
00228 }
00229 }
00230
00231
00232 inline Double_t FIN_PHYS::Sum(const Float_t &mod1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00233 const Float_t &mod2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2,
00234 Double_t &cdx_res,Double_t &cdy_res,Double_t &cdz_res){
00235
00236
00237
00238
00239 Double_t module = TMath::Sqrt(
00240 mod1*mod1 + mod2*mod2 +
00241 2 * (mod1*cdx1*mod2*cdx2+mod1*cdy1*mod2*cdy2+mod1*cdz1*mod2*cdz2)
00242 );
00243
00244 cdx_res = (Double_t) cdx1 + cdx2;
00245 cdy_res = (Double_t) cdy1 + cdy2;
00246 cdz_res = (Double_t) cdz1 + cdz2;
00247
00248 return module;
00249
00250 }
00251
00252
00253 inline void FIN_PHYS::ScalarProduct(const Float_t &mod1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00254 const Float_t &mod2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2,
00255 Double_t &module,Double_t &angle_rad){
00256
00257
00258
00259 if(! mod1 || !mod2){
00260 module = 0;
00261 angle_rad = -999;
00262 return;
00263 }
00264
00265 module = (Double_t) (
00266 mod1 * cdx1 * mod2 * cdx2 +
00267 mod1 * cdy1 * mod2 * cdy2 +
00268 mod1 * cdz1 * mod2 * cdz2
00269 );
00270
00271 Double_t cos_ang = module / ( (Double_t) (mod1*mod2) );
00272 if(module != 0){
00273 angle_rad = TMath::ACos(cos_ang);
00274 }
00275 else angle_rad = -999;
00276
00277
00278 module = TMath::Abs(module);
00279
00280
00281 return;
00282 }
00283
00284
00285 inline Double_t FIN_PHYS::KineticEnergy_2(const Float_t &mom1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00286 const Float_t &mom2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2){
00287
00288
00289
00290 Double_t kin_en = ((mom1*cdx1 + mom2*cdx2) * (mom1*cdx1 + mom2*cdx2) +
00291 (mom1*cdy1 + mom2*cdy2) * (mom1*cdy1 + mom2*cdy2) +
00292 (mom1*cdz1 + mom2*cdz2) * (mom1*cdz1 + mom2*cdz2)
00293 );
00294 return kin_en;
00295
00296 }
00297
00298
00299 inline Double_t FIN_PHYS::KineticEnergy(const Float_t &mom1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00300 const Float_t &mom2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2){
00301
00302
00303
00304 return TMath::Sqrt( KineticEnergy_2(mom1,cdx1,cdy1,cdz1,mom2,cdx2,cdy2,cdz2) );
00305 }
00306
00307
00308 inline Double_t FIN_PHYS::CenterMassEnergy(E_Fnd_PID pid1,
00309 const Float_t &mom1,const Float_t &cdx1,const Float_t &cdy1,const Float_t &cdz1,
00310 E_Fnd_PID pid2,
00311 const Float_t &mom2,const Float_t &cdx2,const Float_t &cdy2,const Float_t &cdz2){
00312
00313
00314
00315 Double_t ene1 = ParticleEnergy(pid1,mom1);
00316 Double_t ene2 = ParticleEnergy(pid2,mom2);
00317
00318 if(ene1 == 0 || ene2 ==0) return 0;
00319
00320 Double_t Imass = TMath::Sqrt(
00321 (ene1+ene2)*(ene1+ene2) -
00322 KineticEnergy_2(mom1,cdx1,cdy1,cdz1,mom2,cdx2,cdy2,cdz2)
00323 );
00324
00325 return Imass;
00326
00327 }
00328
00329
00330 inline Double_t FIN_PHYS::ParticleEnergy_2(E_Fnd_PID pid,const Float_t &mom){
00331
00332
00333
00334 Double_t mass = GetParticleMass(pid);
00335
00336 Double_t energy_2 = (Double_t) ( (mass * mass) + (mom * mom) );
00337 return energy_2;
00338 }
00339
00340
00341 inline Double_t FIN_PHYS::ParticleEnergy(E_Fnd_PID pid,const Float_t &mom){
00342
00343
00344
00345 return TMath::Sqrt( ParticleEnergy_2(pid,mom) );
00346 }
00347
00348
00349 inline TString FIN_PHYS::HolleritToString(Int_t hollerit_in){
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360 TString res = "";
00361 res += (Char_t) ((hollerit_in >> 0) & 0xFF);
00362 res += (Char_t) ((hollerit_in >> 8) & 0xFF);
00363 res += (Char_t) ((hollerit_in >> 16) & 0xFF);
00364 res += (Char_t) ((hollerit_in >> 24) & 0xFF);
00365 res.Resize(4);
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 return res;
00376
00377 }
00378
00379
00380
00381
00382 inline void FIN_PHYS::RefSys_CosDir_To_Spheric(const Double_t &cx,const Double_t &cy,const Double_t &cz,Double_t &theta,Double_t &phi){
00383
00384
00385
00386
00387
00388 theta = (Double_t)TMath::ACos(cz);
00389
00390 if(cx != 0){
00391 phi = (Double_t) TMath::ATan(cy/cx);
00392 if(cx < 0) phi = (Double_t)(TMath::Pi()) + phi;
00393 }
00394 else{
00395 Double_t signe = (cy > 0) ? +1 : -1;
00396 phi = signe * (Double_t)(TMath::Pi() / 2);
00397 }
00398
00399 }
00400
00401
00402 inline void FIN_PHYS::RefSys_Sphere_To_CosDir(const Double_t &theta,const Double_t &phi,Double_t &cx,Double_t &cy,Double_t &cz){
00403
00404
00405
00406
00407
00408 cx = (Double_t) ( TMath::Sin(theta) * TMath::Cos(phi) );
00409 cy = (Double_t) ( TMath::Sin(theta) * TMath::Sin(phi) );
00410 cz = (Double_t) ( TMath::Cos(theta) );
00411 }
00412
00414
00416
00417
00418 inline Double_t FIN_PHYS::Dedxfunc(Double_t Momentum, Double_t Mass, Double_t Charge, Double_t Zval, Double_t Aval, Double_t Ival)
00419 {
00420
00421 Momentum *= 1000.;
00422 Mass *= 1000. ;
00423
00424
00425
00426
00427 Double_t Energy = TMath::Sqrt(TMath::Power(Momentum,2.) + TMath::Power(Mass,2.));
00428 Double_t Beta = Momentum / Energy;
00429 Double_t Beta2 = TMath::Power(Beta,2.);
00430 Double_t Gamma = Energy / Mass;
00431 Double_t Gamma2 = TMath::Power(Gamma,2.);
00432 Double_t Dcons = 0.30707;
00433
00434 Double_t melect = GetParticleMass(FPh_PID_Electron) * 1000.;
00435
00436 Double_t ZA = Zval/Aval;
00437 Double_t I2 = TMath::Power(Ival,2.);
00438
00439 Double_t Bethe = Dcons * ZA * TMath::Power(Charge,2.) / Beta2;
00440 Double_t TMax = (2*melect*Beta2*Gamma2);
00441 TMax /= ((1+2*Gamma*melect/Mass)+(TMath::Power((melect/Mass),2)));
00442 Double_t ArgLog = (2*melect*Beta2*Gamma2*TMax/I2);
00443 Bethe *= (0.5 * TMath::Log(ArgLog) - Beta2);
00444 return Bethe;
00445 }
00446
00447
00448 inline Double_t FIN_PHYS::DedxfuncSi(Double_t Momentum, Double_t Mass, Double_t Charge)
00449 {
00450
00451
00452 Double_t Zval = 14.;
00453 Double_t Aval = 28.0855;
00454 Double_t Ival = 173.0E-6;
00455
00456 return Dedxfunc(Momentum, Mass, Charge, Zval, Aval, Ival);
00457 }
00458
00459
00460 inline Double_t FIN_PHYS::DedxfuncCh(Double_t Momentum, Double_t Mass, Double_t Charge)
00461 {
00462
00463
00464 Double_t Zval = 11.6;
00465 Double_t Aval = 20.2;
00466 Double_t Ival = 278.9E-6;
00467
00468 return Dedxfunc(Momentum, Mass, Charge, Zval, Aval, Ival);
00469 }
00470
00471
00472 inline Double_t FIN_PHYS::Tenevsmom(Double_t Momentum, Double_t Mass)
00473 {
00474 return TMath::Sqrt(TMath::Power(Momentum,2.)+TMath::Power(Mass,2.)) - Mass;
00475 }
00476
00477
00478 #endif // FROOT_FIN_PHYS