57 #include "StSvtElectronCloud.hh"
65 : mSigX(-1956), mSigY(-1956), mSigXY(-1956)
66 , mChargeNow(-1956), mTotCharge(-1956), mEnergy(-1956)
67 , mTheta(-1956) , mPhi(-1956), mInitPhi(-1956)
68 , mDriftVel(-1956) , mTimBinSize(-1956),mSDD_thickness(-1956)
69 , mTrapConst(-1956), mDiffusionConst(-1956)
72 , mSi_DielConst(-1956), mSi_EnergyGap(-1956)
83 for(
int i = 0; i < 4; i++)
91 StSvtElectronCloud::~StSvtElectronCloud()
99 mSDD_thickness = 0.28;
101 mLifeTime = 1000000.0;
103 mDiffusionConst=0.0035;
108 mSi_DielConst = 12.0;
111 mPermitivity = 55263.46959983512;
112 mSi_Mobility = 0.135;
118 void StSvtElectronCloud::setElectronLifeTime(
double tLife)
127 void StSvtElectronCloud::CalculateDiffXY()
129 mDiffConstX = mDiffusionConst;
130 mDiffConstY = mDiffusionConst;
132 mDiffConstX +=mTrapConst*pow(mDriftVel,2);
136 void StSvtElectronCloud::setDiffusionConst(
double diffConst)
138 mDiffusionConst=diffConst;
142 void StSvtElectronCloud::setDriftVelocity(
double driftVel)
144 mDriftVel = driftVel;
148 void StSvtElectronCloud::setTrappingConst(
double trapConst)
151 mTrapConst = trapConst;
156 void StSvtElectronCloud::setPar(
double energy,
double theta,
double phi,
double timBinSize,
int trackId)
159 mTimBinSize = timBinSize;
166 mTotCharge = mEnergy*0.27777777777777;
167 mTotCharge = mTotCharge*(1- 2*mInitHitSize*fabs(sin(mTheta))/(3*mSDD_thickness));
171 void StSvtElectronCloud::setInitWidths(
double w1,
double w2)
174 double tSigMaj,tSigMin;
175 mSigX=0; mSigY=0; mSigXY=0;
178 tSigMaj = 0.288675134*(fabs(mSDD_thickness*tan(mTheta))+2*w1*cos(mTheta));
187 if ((1. - tSigMin/tSigMaj) < 0.001 || (fabs(mPhi)< 0.001)) mPhi=0.;
198 mSigX = sqrt(fabs(tSigMaj*tSigMaj*C2*C2 + tSigMin*tSigMin*S2*S2));
199 mSigY = sqrt(fabs(tSigMaj*tSigMaj*S2*S2 + tSigMin*tSigMin*C2*C2));
200 mSigXY =sqrt(fabs(C2*S2*(tSigMaj*tSigMaj-tSigMin*tSigMin)));
201 if(((1. - tSigMin/tSigMaj) < 0.001) || (fabs(mPhi)< 0.001)){
214 for(
int i = 0; i < 4; i++)
221 GetDerivatives( m_dSigX[0],m_dSigY[0], m_dSigXY[0],mSigX,mSigY,mSigXY,0.);
224 void StSvtElectronCloud::CalcExpansion(
double mTc)
228 const int AdBashDiv=30;
229 const int RungeDiv =200;
233 double sign = (mInitPhi<0.)?-1.:1.;
235 int quad=(int)floor(mPhi/TMath::PiOver2());
240 mPhi=TMath::Pi()-mPhi;
243 mPhi=mPhi-TMath::Pi();
246 mPhi=TMath::TwoPi()-mPhi;
249 mPhi=asin(sin(mPhi));
258 setInitWidths(mInitHitSize,mInitHitSize);
260 double steps=mTc*AdBashDiv*RungeDiv;
261 int isteps=(int)floor(steps + 0.5);
268 if (isteps<=3*RungeDiv){
270 runge_kutta4(isteps,0., mTimBinSize/((
double)AdBashDiv*(
double)RungeDiv),0);
276 int tAdBashSteps=isteps/RungeDiv;
277 int firstNumStep=isteps-tAdBashSteps*RungeDiv;
279 double steplen=mTimBinSize/((double)AdBashDiv*(
double)RungeDiv);
282 cout<<
" runge-kutta: firstNumSteps="<<firstNumStep<<
" steplen="<<steplen<<endl;
284 runge_kutta4(firstNumStep, 0.,steplen,0);
285 runge_kutta4(RungeDiv,steplen*(
double)firstNumStep ,steplen,1);
286 runge_kutta4(RungeDiv, steplen*((
double)firstNumStep+(
double)RungeDiv), steplen,2);
287 runge_kutta4(RungeDiv, steplen*((
double)firstNumStep+2.*(
double)RungeDiv), steplen,3);
291 cout<<
" going for adamsBushFort: steps:="<<tAdBashSteps<<endl;
293 double Adsteplen=mTimBinSize/(double)AdBashDiv;
295 cout<<
"T0="<<steplen*((double)firstNumStep+3.*(
double)RungeDiv)<<endl;
297 adamsBushFort(tAdBashSteps,steplen*((
double)firstNumStep+3.*(
double)RungeDiv),Adsteplen);
303 mPhi=TMath::Pi()-mPhi;
306 mPhi=mPhi+TMath::Pi();
309 mPhi=TMath::TwoPi()-mPhi;
318 void StSvtElectronCloud::GetDerivatives(
double &dSx,
double &dSy,
double &dSxy,
double SX,
double SY,
double SXY,
double time)
324 cout<<
"SX, SY, SXY : "<<SX<<
", "<<SY<<
", "<<SXY<<endl;
328 double R=SX*SX + SY*SY;
329 double S=sqrt(pow((SX*SX - SY*SY),2) + 4.*pow(SXY*SXY,2));
330 double sigMaj = sqrt(0.5*fabs(R + S));
331 double sigMin = sqrt(0.5*fabs(R - S));
333 if ((1. - sigMin/sigMaj) < 0.001)phi=0;
336 double ar=(SX*SX-SY*SY)/(sigMaj*sigMaj-sigMin*sigMin);
338 cout<<
" ar="<<(double)ar<<endl;
340 if (ar>.999999) ar=(double)1e0;
341 if (ar<-.999999) ar=(double)-1e0;
345 cout<<
" R S sigMaj sigMin phi: "<<S<<
", "<< sigMaj<<
", "<< sigMin<<
", "<< phi<<endl;
348 const double K1 = 0.43;
349 const double K2 = 0.25;
350 const double K3 = 0.58;
352 mChargeNow = mTotCharge*exp(-time/mLifeTime);
354 double multFactor = 0.00000001619961;
357 double vd=sigMin/mSDD_thickness;
358 double r = sigMin/sigMaj;
362 tmp=1. + pow(tmp,1.5);
363 double denominator=pow(tmp,2./3.);
366 double numerator = K1*pow(r,2./3.) - (K3/4.)*log(r2*r2 + 1./(tmp*tmp));
368 cout<<
" vd="<<vd<<
" r2="<<r2<<
" den="<<denominator<<
" num1="<<numerator;
370 double f1 = multFactor*mChargeNow*(numerator/denominator);
373 numerator = K3 - (K3-K1)*sqrt(r);
374 double f2 = multFactor*mChargeNow*(numerator/denominator);
376 cout<<
" num2="<<numerator<<endl;
378 double sumFunc=f1+f2;
379 double diffFunc=f1-f2;
380 double C=cos(2.*phi);
382 dSx = 1.5*SX*(2*mDiffConstX + 0.5*(sumFunc + diffFunc*C));
383 dSy = 1.5*SY*(2*mDiffConstY + 0.5*(sumFunc - diffFunc*C));
384 dSxy = 1.5*SXY*(2.*(sin(2*phi)/C)*(mDiffConstX*pow(sin(phi),2) - mDiffConstY*pow(cos(phi),2))
385 + 0.5*diffFunc*sin(2.*phi));
387 cout<<
" dSx,dSy,dSxy= "<<dSx<<
","<<dSy<<
","<<dSxy<<
","<<endl;
397 void StSvtElectronCloud::runge_kutta4(
int steps,
double t0,
double steplen,
int save)
400 double m1 = 0.0, m2 = 0.0, m3 = 0.0, m4 = 0.0;
401 double n1 = 0.0, n2 = 0.0, n3 = 0.0, n4 = 0.0;
402 double o1 = 0.0, o2 = 0.0, o3 = 0.0, o4 = 0.0;
418 const double third=1./3.;
420 for(
int i = 1; i <= steps; i++)
427 double xx=mSigX*mSigX*mSigX;
428 double yy=mSigY*mSigY*mSigY;
429 double xy=mSigXY*mSigXY*mSigXY;
431 GetDerivatives(m1,n1,o1,mSigX,mSigY,mSigXY,tim);
434 double tmpX=pow(fabs(xx+ 0.5*steplen*m1),third);
435 double tmpY=pow(fabs(yy+ 0.5*steplen*n1),third);
436 double tmpXY=pow(fabs(xy+ 0.5*steplen*o1),third);
437 GetDerivatives(m2,n2,o2,tmpX,tmpY,tmpXY,tim+0.5*steplen);
439 tmpX=pow(fabs(xx+0.5*steplen*m2),third);
440 tmpY=pow(fabs(yy+ 0.5*steplen*n2),third);
441 tmpXY=pow(fabs(xy+ 0.5*steplen*o2),third);
442 GetDerivatives(m3,n3,o3,tmpX,tmpY,tmpXY,tim+0.5*steplen);
444 tmpX=pow(fabs(xx+steplen*m3),third);
445 tmpY=pow(fabs(yy+ steplen*n3),third);
446 tmpXY=pow(fabs(xy+ steplen*o3),third);
447 GetDerivatives(m4,n4,o4,tmpX,tmpY,tmpXY,tim+steplen);
450 mSigX = pow(fabs(xx + ((steplen/6.)*(m1 + 2.*(m2 + m3) + m4))),third);
451 mSigY = pow(fabs(yy + ((steplen/6.)*(n1 + 2.*(n2 + n3) + n4))),third);
452 mSigXY = pow(fabs(xy + ((steplen/6.)*(o1 + 2.*(o2 + o3) + o4))),third);
460 if ((mPhi==0.)||(mPhi==TMath::PiOver2()))mSigXY = 0.;
463 double R=mSigX*mSigX + mSigY*mSigY;
464 double S=sqrt(pow((mSigX*mSigX - mSigY*mSigY),2) + 4.*pow(mSigXY*mSigXY,2));
465 double sigMaj2 = 0.5*fabs(R + S);
466 double sigMin2 = 0.5*fabs(R - S);
467 if (((1. - sigMin2/sigMaj2) < 0.00001)|| (fabs(mPhi)< 0.001))mPhi=0;
469 double ar=(mSigX*mSigX-mSigY*mSigY)/(sigMaj2-sigMin2);
470 if (ar>.999999) ar=(double)1e0;
471 if (ar<-.999999) ar=(double)-1e0;
485 GetDerivatives(m1,n1,o1,mSigX,mSigY,mSigXY,tim);
490 mChargeNow = mTotCharge*exp(-tim/mLifeTime);
493 void StSvtElectronCloud::adamsBushFort(
int steps,
double t0,
double steplen)
496 const double third=1./3.;
501 cout<<
"time ="<<tim<<endl;
503 double xx=mSigX*mSigX*mSigX;
504 double yy=mSigY*mSigY*mSigY;
505 double xy=mSigXY*mSigXY*mSigXY;
507 cout<<
"sigX="<<mSigX<<
" sigY="<<mSigY<<
" sigXY="<<mSigXY<<endl;
510 double preX = pow(fabs(xx + (steplen/24.)*(-9.0*m_dSigX[0] + 37.0*m_dSigX[1] - 59.0*m_dSigX[2] + 55.0*m_dSigX[3])),third);
511 double preY = pow(fabs(yy + (steplen/24.)*(-9.0*m_dSigY[0] + 37.0*m_dSigY[1] - 59.0*m_dSigY[2] + 55.0*m_dSigY[3])),third);
512 double preXY = pow(fabs(xy + (steplen/24.)*(-9.0*m_dSigXY[0] + 37.0*m_dSigXY[1] - 59.0*m_dSigXY[2] + 55.0*m_dSigXY[3])),third);
514 cout<<
"preX="<<preX<<
" preY="<<preY<<
" preXY="<<preXY<<endl;
521 GetDerivatives(dX,dY,dXY,preX,preY,preXY,tim);
524 mSigX=pow(fabs( xx + (steplen/24.)*(m_dSigX[1]-5.0*m_dSigX[2] + 19.0*m_dSigX[3] + 9.0*dX)),third);
525 mSigY=pow(fabs( yy + (steplen/24.)*(m_dSigY[1]-5.0*m_dSigY[2] + 19.0*m_dSigY[3] + 9.0*dY)),third);
526 mSigXY=pow(fabs( xy + (steplen/24.)*(m_dSigXY[1]-5.0*m_dSigXY[2] + 19.0*m_dSigXY[3] + 9.0*dXY)),third);
530 GetDerivatives(dX,dY,dXY,mSigX,mSigY,mSigXY,tim);
533 mSigX=pow(fabs( xx + (steplen/24.)*(m_dSigX[1]-5.0*m_dSigX[2] + 19.0*m_dSigX[3] + 9.0*dX)),third);
534 mSigY=pow(fabs( yy + (steplen/24.)*(m_dSigY[1]-5.0*m_dSigY[2] + 19.0*m_dSigY[3] + 9.0*dY)),third);
535 mSigXY=pow(fabs( xy + (steplen/24.)*(m_dSigXY[1]-5.0*m_dSigXY[2] + 19.0*m_dSigXY[3] + 9.0*dXY)),third);
539 GetDerivatives(dX,dY,dXY,mSigX,mSigY,mSigXY,tim);
545 for(
int i = 0; i < 3; i++){
546 m_dSigX[i] = m_dSigX[i+1];
547 m_dSigY[i] = m_dSigY[i+1];
548 m_dSigXY[i] = m_dSigXY[i+1];
551 mChargeNow = mTotCharge*exp(-tim/mLifeTime);
556 if (mPhi==0.||(mPhi==TMath::PiOver2())) mSigXY = 0.;
559 double R=mSigX*mSigX + mSigY*mSigY;
560 double S=sqrt(pow((mSigX*mSigX - mSigY*mSigY),2) + 4.*pow(mSigXY*mSigXY,2));
561 double sigMaj2 = 0.5*fabs(R + S);
562 double sigMin2 = 0.5*fabs(R - S);
563 if (((1. - sigMin2/sigMaj2) < 0.00001)|| (fabs(mPhi)< 0.001))mPhi=0;
565 double ar=(mSigX*mSigX-mSigY*mSigY)/(sigMaj2-sigMin2);
566 if (ar>.999999) ar=(double)1e0;
567 if (ar<-.999999) ar=(double)-1e0;
575 double StSvtElectronCloud::getPhi()
580 double StSvtElectronCloud::getChargeAtAnode()
588 double StSvtElectronCloud::getSigmaDrift()
593 double StSvtElectronCloud::getSigmaAnode()
598 double StSvtElectronCloud::getSigmaCorr()
603 double StSvtElectronCloud::getSigmaMajor()
605 double c2f=mSigX*mSigX + mSigY*mSigY;
606 double s2f=sqrt(pow((mSigX*mSigX - mSigY*mSigY),2) + 4.*pow(mSigXY*mSigXY,2));
607 return sqrt(0.5*fabs(c2f+s2f));
610 double StSvtElectronCloud::getSigmaMinor()
613 return sqrt(0.5*fabs(((mSigX*mSigX + mSigY*mSigY) - sqrt(pow((mSigX*mSigX - mSigY*mSigY),2) + 4.*pow(mSigXY*mSigXY,2)))));
SVT electron cloud expansion routines Simulates electron cloud expansion inside of the silicon wafer...