12 #include "StFgtSlowSimuMaker.h"
13 #include "HexLatice.h"
19 StFgtSlowSimuMaker::initFrankModel(TString fname){
20 memset(meLossTab,0,
sizeof(meLossTab));
22 LOG_INFO<<
"::initFrankModel() load:"<<fname<< endm;
23 FILE *fd=fopen(fname,
"r");
29 for (
int i = 0; i <eLossDim ; i++) {
30 char * ret=fgets(buf,mx,fd);
33 float cl1, cl2, cl3, cl4, cl5, cl6, cl7;
34 int ret1=sscanf(buf,
"%f %f %f %f %f %f %f ",&cl1, &cl2, &cl3, &cl4, &cl5, &cl6, &cl7);
38 LOG_INFO<<
"::initFrankModel() OK"<<endm;
49 StFgtSlowSimuMaker::responseFrankModel(TVector3 Rloc, TVector3 Dloc){
50 static const double dPi=4*acos(0.);
63 double par_pairsPerCm = 40.;
64 double zLocEnd=Rloc.z()+Dloc.z();
65 double pathLength=Dloc.Mag();
66 TVector3 rv=Dloc; rv=rv.Unit();
70 double totalEnergy_eV = 0;
78 double stepLength = - TMath::Log(mRnd->Uniform()) / par_pairsPerCm;
80 if (path > pathLength)
break;
83 int rndBin = ((int) (10000.0 * mRnd->Uniform()));
85 if(rndBin > par_cutoffOfBichel) rndBin = par_cutoffOfBichel;
86 double eL_eV = meLossTab[rndBin];
87 int nAnyPair = 1 + ((int) ((eL_eV-15.4)/26.));
88 totalEnergy_eV += eL_eV;
89 if (nAnyPair < 0)
continue;
91 TVector3 r=Rloc+ path*rv;
96 if(par_transDiffusionPerPath>0.001) {
97 double zDrift=zLocEnd-r.z();
106 if(zDrift < 0) zDrift *= -1.0;
108 double perpDiffRms=par_transDiffusionPerPath*sqrt(zDrift);
109 double phi=mRnd->Uniform(dPi);
110 double perp=mRnd->Gaus(0,perpDiffRms);
111 TVector3 dR; dR.SetPtThetaPhi(perp,0.,phi);
114 hA[27]->Fill(zDrift*10);
115 hA[28]->Fill( dR.x()*1e4, dR.y()*1e4);
120 TVector2 r2=r.XYvector();
int kU,kV;
121 TVector2 r2s= hexLat->snap(r2,kU,kV);
122 r.SetX(r2s.X()); r.SetY(r2s.Y());
130 hA[21]->Fill(nPrimPair );
131 hA[22]->Fill(totalEnergy_eV/ 1000.);
132 hA[23]->Fill(nTotPair );
133 hA[24]->Fill(path*10 );
134 double meanPath=sum2/sum1;
135 double meanTpath=meanPath*rvT;
137 hA[25]->Fill(meanPath*10);
138 hA[26]->Fill(meanTpath*10);
147 StFgtSlowSimuMaker::responseLinearModel(TVector3 r1, TVector3 Dloc){
152 TVector3 rv=Dloc; rv.Unit();
162 for(is=0;is<ns;is++) {
163 TVector3 rLoc=r1+ (is+0.5)*ddS*rv;
174 StFgtSlowSimuMaker::addHit(TVector3 rLoc,
double ampl) {
178 float xH=fabs(rLoc.x());
179 float yH=fabs(rLoc.y());
185 TAxis *axX=digXY->GetXaxis();
186 int ixH=axX->FindFixBin(xH);
187 int mxX=axX->GetNbins();
188 int ix1=ixH-par_binStep,ix2=ixH+par_binStep;
192 TAxis *axY=digXY->GetYaxis();
193 int iyH=axY->FindFixBin(yH);
194 int mxY=axY->GetNbins();
195 int iy1=iyH-par_binStep,iy2=iyH+par_binStep;
202 for(ix=ix1;ix<=ix2;ix++) {
203 float x=axX->GetBinCenter(ix);
204 float val_x=amplF->Eval(x-xH);
206 for(iy=iy1;iy<=iy2;iy++) {
207 float y=axY->GetBinCenter(iy);
208 float val_y=amplF->Eval(y-yH);
209 float val2D=ampl*val_x*val_y;
211 digXY->Fill(x,y,val2D);
212 digXYAll->Fill(x,y,val2D);
213 if(valMax<val2D) valMax=val2D;
223 bool ok=geom->localXYtoStripID(iQuad,rLoc.x(),rLoc.y(),iRadID, iPhiID);
225 hA[31]->Fill(iRadID);
226 hA[32]->Fill(iPhiID);