#include <BesTofDigitizerEcV4.hh>
Public Member Functions | |
StripStruct () | |
void | initial () |
void | print () |
void | avalanche () |
void | calFirstHit () |
long int | calNextN (int num) |
long int | multiply (double rdm) |
double | calSigma () |
void | setPar (double V, double threshold, bool saturationFlag=true) |
double | getAlpha (double E) |
double | getEta (double E) |
double | getV (double E) |
Public Attributes | |
Param | m_param |
vector< HitStruct > | hitStructCol |
int | strip |
int | trkIndex |
double | tStart |
double | tPropagate_sphi |
double | tPropagate_xphi |
double | tThreshold |
double | charge |
double | E |
double | alpha |
double | eta |
long int | threshold |
double | v_drift |
bool | saturationFlag |
Definition at line 101 of file BesTofDigitizerEcV4.hh.
BesTofDigitizerEcV4::StripStruct::StripStruct | ( | ) |
Definition at line 657 of file BesTofDigitizerEcV4.cc.
References initial().
00658 { 00659 initial(); 00660 }
void BesTofDigitizerEcV4::StripStruct::avalanche | ( | ) |
Definition at line 458 of file BesTofDigitizerEcV4.cc.
References calNextN(), BesTofDigitizerEcV4::Param::gapWidth, hitStructCol, genRecEmupikp::i, ganga-rec::j, m_param, BesTofDigitizerEcV4::Param::nstep, saturationFlag, and BesTofDigitizerEcV4::Param::stepWidth.
Referenced by BesTofDigitizerEcV4::Digitize().
00459 { 00460 //process each hit 00461 for(unsigned int i=0; i<hitStructCol.size(); i++) 00462 { 00463 hitStructCol[i].ava_pos.clear(); 00464 hitStructCol[i].ava_num.clear(); 00465 00466 hitStructCol[i].ava_pos[0] = hitStructCol[i].calAvaLength(); 00467 hitStructCol[i].ava_num[0] = hitStructCol[i].ions; 00468 //cout<<"i= "<<i<<" gap= "<<hitStructCol[i].gap<<" initial pos= "<<hitStructCol[i].ava_pos[0]<<endl; 00469 for(int j=1; j<m_param.nstep; j++) 00470 { 00471 hitStructCol[i].ava_pos[j] = hitStructCol[i].ava_pos[j-1] + m_param.stepWidth; 00472 if(saturationFlag==true && hitStructCol[i].ava_num[j-1]>1.5e+07) //saturation e+07~e+08, ~2pC, Reather limit 00473 { 00474 hitStructCol[i].ava_num[j] = hitStructCol[i].ava_num[j-1]; 00475 } 00476 else 00477 { 00478 hitStructCol[i].ava_num[j] = calNextN(hitStructCol[i].ava_num[j-1]); 00479 } 00480 if(hitStructCol[i].ava_pos[j]>m_param.gapWidth) break; 00481 } 00482 } 00483 00484 //decide threshold and charge 00485 bool over_threshold = false; 00486 long int sum = 0; 00487 for(int i=0; i<m_param.nstep; i++) 00488 { 00489 for(unsigned int j=0; j<hitStructCol.size(); j++) 00490 { 00491 if(i<hitStructCol[j].ava_pos.size() && hitStructCol[j].ava_pos[i]<m_param.gapWidth) 00492 { 00493 sum += hitStructCol[j].ava_num[i]; 00494 } 00495 } 00496 //cout<<"sum= "<<sum<<" avaSize= "<<hitStructCol.size()<<endl; 00497 00498 if(over_threshold==false) 00499 { 00500 if(sum>threshold) 00501 { 00502 over_threshold = true; 00503 tThreshold = (m_param.gapWidth)/(m_param.nstep)/v_drift*(i+1); 00504 } 00505 } 00506 } 00507 00508 charge = sum*(m_param.E_weight)*(v_drift)*(m_param.eCharge)*(m_param.gapWidth)/(m_param.nstep)/v_drift; 00509 }
void BesTofDigitizerEcV4::StripStruct::calFirstHit | ( | ) |
Definition at line 410 of file BesTofDigitizerEcV4.cc.
References hitStructCol, genRecEmupikp::i, tPropagate_sphi, tPropagate_xphi, trkIndex, and tStart.
Referenced by BesTofDigitizerEcV4::Digitize().
00411 { 00412 for(unsigned int i=0; i<hitStructCol.size(); i++) 00413 { 00414 if(hitStructCol[i].glbTime<tStart) 00415 { 00416 tStart = hitStructCol[i].glbTime; 00417 trkIndex = hitStructCol[i].trkIndex; 00418 hitStructCol[i].calTPropagate(); 00419 tPropagate_sphi = hitStructCol[i].tPropagate_sphi; 00420 tPropagate_xphi = hitStructCol[i].tPropagate_xphi; 00421 } 00422 } 00423 }
long int BesTofDigitizerEcV4::StripStruct::calNextN | ( | int | num | ) |
Definition at line 512 of file BesTofDigitizerEcV4.cc.
References alpha, calSigma(), eta, exp(), genRecEmupikp::i, m_param, multiply(), and BesTofDigitizerEcV4::Param::stepWidth.
Referenced by avalanche().
00513 { 00514 if(num<150) 00515 { 00516 long int nextN = 0; 00517 double rdm; 00518 for(int i=0; i<num; i++) 00519 { 00520 rdm = G4UniformRand(); 00521 nextN += multiply(rdm); 00522 } 00523 return nextN; 00524 } 00525 else 00526 { 00527 double nbar = exp((alpha-eta)*m_param.stepWidth); 00528 double sigma = calSigma(); 00529 double mean = num*nbar; 00530 double resolution = G4RandGauss::shoot(0,(sqrt(num)*sigma)); 00531 long int nextN = mean+resolution; 00532 return nextN; 00533 } 00534 }
double BesTofDigitizerEcV4::StripStruct::calSigma | ( | ) |
Definition at line 552 of file BesTofDigitizerEcV4.cc.
References alpha, eta, exp(), m_param, and BesTofDigitizerEcV4::Param::stepWidth.
Referenced by calNextN().
00553 { 00554 double nbar = exp((alpha-eta)*m_param.stepWidth); 00555 double k = eta/alpha; 00556 double sigma = sqrt((1+k)/(1-k)*nbar*(nbar-1)); 00557 return sigma; 00558 }
double BesTofDigitizerEcV4::StripStruct::getAlpha | ( | double | E | ) |
Definition at line 727 of file BesTofDigitizerEcV4.cc.
References alpha.
Referenced by setPar().
00728 { 00729 //electric field: kV/cm; alpha: mm-1 00730 //kV/cm 00731 double e[22] = 00732 { 00733 65, 00734 70 , 00735 75 , 00736 80 , 00737 85 , 00738 90 , 00739 95 , 00740 100 , 00741 102 , 00742 104 , 00743 106 , 00744 108 , 00745 110 , 00746 112 , 00747 114 , 00748 116 , 00749 118 , 00750 120 , 00751 125 , 00752 130 , 00753 135 , 00754 140 00755 }; 00756 00757 //mm-1 00758 double alpha[22]= 00759 { 00760 383.5/10 , 00761 471 /10 , 00762 564.5/10 , 00763 663.6/10 , 00764 777.1/10 , 00765 877 /10 , 00766 990.8/10 , 00767 1106 /10 , 00768 1154 /10 , 00769 1199 /10 , 00770 1253 /10 , 00771 1296 /10 , 00772 1344 /10 , 00773 1396 /10 , 00774 1448 /10 , 00775 1502 /10 , 00776 1545 /10 , 00777 1597 /10 , 00778 1726 /10 , 00779 1858 /10 , 00780 1992 /10 , 00781 2124 /10 , 00782 }; 00783 00784 TSpline3* sp_alpha = new TSpline3("sp_alpha", e, alpha, 22); 00785 double alphaVal = sp_alpha->Eval(E); 00786 return alphaVal; 00787 }
double BesTofDigitizerEcV4::StripStruct::getEta | ( | double | E | ) |
Definition at line 789 of file BesTofDigitizerEcV4.cc.
References eta.
Referenced by setPar().
00790 { 00791 //electric field: kV/cm; eta: mm-1 00792 //kV/cm 00793 double e[22] = 00794 { 00795 65, 00796 70 , 00797 75 , 00798 80 , 00799 85 , 00800 90 , 00801 95 , 00802 100 , 00803 102 , 00804 104 , 00805 106 , 00806 108 , 00807 110 , 00808 112 , 00809 114 , 00810 116 , 00811 118 , 00812 120 , 00813 125 , 00814 130 , 00815 135 , 00816 140 00817 }; 00818 00819 //mm-1 00820 double eta[22]= 00821 { 00822 132.6/10 , 00823 117.2/10 , 00824 102.6/10 , 00825 88.26/10 , 00826 79.81/10 , 00827 74.0 /10 , 00828 66.7 /10 , 00829 62.7 /10 , 00830 61.4 /10 , 00831 57.4 /10 , 00832 55.45/10 , 00833 54.35/10 , 00834 52.48/10 , 00835 51.3 /10 , 00836 50.1 /10 , 00837 48.3 /10 , 00838 48.28/10 , 00839 46.00/10 , 00840 44.08/10 , 00841 41.67/10 , 00842 39.97/10 , 00843 38.04/10 00844 }; 00845 00846 TSpline3* sp_eta = new TSpline3("sp_eta", e, eta, 22); 00847 double etaVal = sp_eta->Eval(E); 00848 return etaVal; 00849 }
double BesTofDigitizerEcV4::StripStruct::getV | ( | double | E | ) |
Definition at line 851 of file BesTofDigitizerEcV4.cc.
References v.
Referenced by setPar().
00852 { 00853 //electric field: kV/cm; velocity: mm/ns 00854 //kV/cm 00855 double e[22] = 00856 { 00857 65, 00858 70 , 00859 75 , 00860 80 , 00861 85 , 00862 90 , 00863 95 , 00864 100 , 00865 102 , 00866 104 , 00867 106 , 00868 108 , 00869 110 , 00870 112 , 00871 114 , 00872 116 , 00873 118 , 00874 120 , 00875 125 , 00876 130 , 00877 135 , 00878 140 00879 }; 00880 00881 //mm/ns 00882 double v[22]= 00883 { 00884 130.2/1000 , 00885 138.5/1000 , 00886 146.7/1000 , 00887 155.0/1000 , 00888 163.3/1000 , 00889 171.4/1000 , 00890 179.7/1000 , 00891 187.7/1000 , 00892 191.2/1000 , 00893 194.5/1000 , 00894 197.9/1000 , 00895 201.2/1000 , 00896 204.5/1000 , 00897 207.6/1000 , 00898 210.9/1000 , 00899 214.4/1000 , 00900 217.5/1000 , 00901 220.9/1000 , 00902 228.8/1000 , 00903 237.0/1000 , 00904 244.7/1000 , 00905 252.9/1000 00906 }; 00907 00908 TSpline3* sp_v = new TSpline3("sp_v", e, v, 22); 00909 double vVal = sp_v->Eval(E); 00910 return vVal; 00911 }
void BesTofDigitizerEcV4::StripStruct::initial | ( | ) |
Definition at line 662 of file BesTofDigitizerEcV4.cc.
References alpha, E, eta, hitStructCol, strip, threshold, tPropagate_sphi, tPropagate_xphi, trkIndex, tStart, tThreshold, and v_drift.
Referenced by StripStruct().
00663 { 00664 //properties to get 00665 strip = -999.0; 00666 trkIndex = -999.0; 00667 tStart = 99999.0; 00668 tPropagate_sphi = -999.0; 00669 tPropagate_xphi = -999.0; 00670 tThreshold = -999.0; 00671 charge = -999.0; 00672 00673 //parameters to tune 00674 E = 106; 00675 alpha = 144800./1000; //-999.0; /mm^-1 00676 eta = 5013./1000; //-999.0; /mm^-1 00677 threshold = 1.5e+08; //Correspond to induced charge of 15 fC 00678 v_drift = 210.9e-3; // mm/ns 00679 00680 hitStructCol.clear(); 00681 }
long int BesTofDigitizerEcV4::StripStruct::multiply | ( | double | rdm | ) |
Definition at line 536 of file BesTofDigitizerEcV4.cc.
References alpha, eta, exp(), m_param, and BesTofDigitizerEcV4::Param::stepWidth.
Referenced by calNextN().
00537 { 00538 double nbar = exp((alpha-eta)*m_param.stepWidth); 00539 double k = eta/alpha; 00540 double rdm_border = k*(nbar-1)/(nbar-k); 00541 if(rdm<rdm_border) 00542 { 00543 return 0; 00544 } 00545 else 00546 { 00547 long int number = 1.+1./log((nbar-1.)/(nbar-k))*log((nbar-k)*(rdm-1)/(k-1)/nbar); 00548 return number; 00549 } 00550 }
void BesTofDigitizerEcV4::StripStruct::print | ( | ) |
Definition at line 963 of file BesTofDigitizerEcV4.cc.
References alpha, E, eta, strip, threshold, tPropagate_sphi, tPropagate_xphi, trkIndex, tStart, tThreshold, and v_drift.
00964 { 00965 cout<<"Strip information: "<<endl; 00966 cout<<" strip= "<<strip 00967 <<" trkIndex= "<<trkIndex 00968 <<" tStart= "<<tStart 00969 <<" tPropagate_sphi= "<<tPropagate_sphi 00970 <<" tPropagate_xphi= "<<tPropagate_xphi 00971 <<" tThreshold "<<tThreshold 00972 <<" charge= "<<charge 00973 <<" E= "<<E 00974 <<" alpha= "<<alpha 00975 <<" eta= "<<eta 00976 <<" threshold= "<<threshold 00977 <<" v_drift= "<<v_drift 00978 <<endl; 00979 }
void BesTofDigitizerEcV4::StripStruct::setPar | ( | double | V, | |
double | threshold, | |||
bool | saturationFlag = true | |||
) |
Definition at line 683 of file BesTofDigitizerEcV4.cc.
References alpha, E, eta, BesTofDigitizerEcV4::Param::gapWidth, getAlpha(), getEta(), getV(), m_param, saturationFlag, threshold, and v_drift.
Referenced by BesTofDigitizerEcV4::Digitize().
00684 { 00685 threshold = threshold_n; 00686 E = E_V/1000*2/6/(m_param.gapWidth/10); //kV/cm 00687 alpha = getAlpha(E); //mm^-1 00688 eta = getEta(E); //mm^-1 00689 v_drift = getV(E); // mm/ns 00690 00691 saturationFlag = saturationFlag_n; 00692 }
Definition at line 131 of file BesTofDigitizerEcV4.hh.
Referenced by calNextN(), calSigma(), getAlpha(), initial(), multiply(), print(), and setPar().
Definition at line 127 of file BesTofDigitizerEcV4.hh.
Referenced by BesTofDigitizerEcV4::Digitize().
Definition at line 130 of file BesTofDigitizerEcV4.hh.
Definition at line 132 of file BesTofDigitizerEcV4.hh.
Referenced by calNextN(), calSigma(), getEta(), initial(), multiply(), print(), and setPar().
Definition at line 118 of file BesTofDigitizerEcV4.hh.
Referenced by avalanche(), calFirstHit(), BesTofDigitizerEcV4::Digitize(), and initial().
Definition at line 117 of file BesTofDigitizerEcV4.hh.
Referenced by avalanche(), calNextN(), calSigma(), multiply(), and setPar().
Definition at line 121 of file BesTofDigitizerEcV4.hh.
Referenced by BesTofDigitizerEcV4::Digitize(), initial(), and print().
Definition at line 133 of file BesTofDigitizerEcV4.hh.
Definition at line 124 of file BesTofDigitizerEcV4.hh.
Referenced by calFirstHit(), BesTofDigitizerEcV4::Digitize(), initial(), and print().
Definition at line 125 of file BesTofDigitizerEcV4.hh.
Referenced by calFirstHit(), BesTofDigitizerEcV4::Digitize(), initial(), and print().
Definition at line 122 of file BesTofDigitizerEcV4.hh.
Referenced by calFirstHit(), BesTofDigitizerEcV4::Digitize(), initial(), and print().
Definition at line 123 of file BesTofDigitizerEcV4.hh.
Referenced by calFirstHit(), BesTofDigitizerEcV4::Digitize(), initial(), and print().
Definition at line 126 of file BesTofDigitizerEcV4.hh.
Referenced by BesTofDigitizerEcV4::Digitize(), initial(), and print().
Definition at line 134 of file BesTofDigitizerEcV4.hh.