26 #include "StFtpcLaserTrafo.hh"
28 #include "StMessMgr.h"
30 #include "PhysicalConstants.h"
32 const float normgas = 50.0;
33 const Float_t Grad2Rad=1/(180/TMath::Pi());
36 StFtpcLaserTrafo::StFtpcLaserTrafo()
42 StFtpcLaserTrafo::StFtpcLaserTrafo(
StFtpcDbReader *getdb,
StFtpcParamReader *getparam,
float getdeltat0,
float getdeltagas,
float getmicropertime,
float getdeltap,
float getmbfield,
float getTZero)
44 LOG_INFO<<
"StFtpcLaserTrafo..."<<endm;
45 mDb=getdb; mParam=getparam;
53 LOG_INFO<<
"d_t0 = "<<deltat0<<
" | d_gas(Ar) = "<<(float) deltagas<<endm;
54 micropertime = getmicropertime;
55 LOG_INFO<<
"Microseconds per timebin = "<<micropertime<<endm;
56 LOG_INFO<<
"==============================="<<endm;
61 pradius =
new Double_t[mParam->numberOfDriftSteps()
62 *mDb->numberOfPadrowsPerSide()];
63 pdeflection =
new Double_t[mParam->numberOfDriftSteps()
64 *mDb->numberOfPadrowsPerSide()];
69 StFtpcLaserTrafo::~StFtpcLaserTrafo()
86 double StFtpcLaserTrafo::vd_gas(
float rad)
89 return vd_gas_slope(rad)*deltagas;
94 double StFtpcLaserTrafo::vd_gas_slope(
float rad)
105 if ( abs(mBField) == 1) {
111 return (p0*1/TMath::Power(rad,p1)+p2);
116 double StFtpcLaserTrafo::vd_gas_y(
float rad)
121 return p0*1/TMath::Power(rad,p1);
134 double StFtpcLaserTrafo::lor_gas(
float rad)
137 return lor_gas_slope(rad)*deltagas;
142 double StFtpcLaserTrafo::lor_gas_slope(
float rad)
148 if ( mBField == 0 ) {
153 if ( abs(mBField) == 1) {
159 return (p0*1/TMath::Power(rad,p1)+p2);
165 double StFtpcLaserTrafo::lor_gas_y(
float rad)
175 double p5=-1.281/1000000;
177 return p0+p1*rad+p2*TMath::Power(rad,2)+p3*TMath::Power(rad,3)+p4*TMath::Power(rad,4)+p5*TMath::Power(rad,5);
183 int StFtpcLaserTrafo::calcpadtrans()
185 int i, j, v_buf, padrow;
186 double t_last, t_next, r_last, r_next, e_now, v_now, psi_now;
189 LOG_INFO<<
"calcpadtrans ..."<<endm;
191 step_size=((float) mDb->numberOfTimebins()
192 / (float) mParam->numberOfDriftSteps());
195 LOG_INFO<<
"Pressure & temperature correction = "<<deltap<<endm;
196 LOG_INFO<<
"======================================================"<<endm;
199 LOG_INFO<<
"RadiusTimesField = "<<mDb->radiusTimesField()<<endm;
200 LOG_INFO<<
"vdrift(0,0) = "<<mDb->magboltzVDrift(0,0)<<endm;
201 LOG_INFO<<
"lorangle(0,0) = "<<mDb->magboltzDeflection(0,0)<<endm;
204 for (padrow=0; padrow<mDb->numberOfPadrowsPerSide(); padrow++)
209 r_last=mDb->sensitiveVolumeOuterRadius();
210 pradius[padrow]=mDb->sensitiveVolumeOuterRadius();
211 pdeflection[padrow]=0;
212 e_now = mDb->radiusTimesField() / (0.5*r_last);
213 for(j=v_buf; mDb->magboltzEField(j) < e_now
214 && j<(mDb->numberOfMagboltzBins()-1); j++);
215 if(j<1 || j>mDb->numberOfMagboltzBins())
217 gMessMgr->Message(
"",
"E",
"OST") <<
"Error 1: j=" << j <<
", v_buf=" << v_buf <<
" e_drift=" << mDb->magboltzEField(j) <<
", e_now=" << e_now << endm;
221 v_now=((mDb->magboltzVDrift(v_buf, padrow)
222 +deltap*mDb->magboltzdVDriftdP(v_buf, padrow))
223 *(mDb->magboltzEField(j)-e_now)
224 +(mDb->magboltzVDrift(j, padrow)
225 +deltap*mDb->magboltzdVDriftdP(j, padrow))
226 *(e_now-mDb->magboltzEField(v_buf)))
227 /(mDb->magboltzEField(j)-mDb->magboltzEField(v_buf));
228 psi_now=((mDb->magboltzDeflection(v_buf,padrow)
229 +deltap*mDb->magboltzdDeflectiondP(v_buf,padrow))
230 *mParam->lorentzAngleFactor()
231 *(mDb->magboltzEField(j)-e_now)
232 +(mDb->magboltzDeflection(j,padrow)
233 +deltap*mDb->magboltzdDeflectiondP(j,padrow))
234 *mParam->lorentzAngleFactor()
235 *(e_now-mDb->magboltzEField(v_buf)))
236 /(mDb->magboltzEField(j)-mDb->magboltzEField(v_buf));
244 v_now=v_now+vd_gas(r_last);
253 psi_now=psi_now-lor_gas(r_last);
254 else if (mBField == 0 || mBField == 1 )
255 psi_now=psi_now+lor_gas(r_last);
257 LOG_ERROR<<
"psi_now not defined for mBField = "<<mBField<<endm;
269 for (i=0; i<mParam->numberOfDriftSteps()
270 && e_now < mDb->magboltzEField(mDb->numberOfMagboltzBins()-2)
273 t_next = t_last + step_size;
276 r_next = r_last - v_now * step_size * micropertime;
277 e_now = mDb->radiusTimesField() / (0.5*(r_last+r_next));
279 for(j=v_buf; mDb->magboltzEField(j) < e_now
280 && (j<mDb->numberOfMagboltzBins()-1); j++);
282 if(j<1 || j>mDb->numberOfMagboltzBins())
284 gMessMgr->Message(
"",
"E",
"OST") <<
"Error 2: j=" << j <<
", v_buf=" << v_buf <<
" e_drift=" << mDb->magboltzEField(j) <<
", e_now=" << e_now << endm;
289 v_now=((mDb->magboltzVDrift(v_buf, padrow)
290 +deltap*mDb->magboltzdVDriftdP(v_buf, padrow))
291 *(mDb->magboltzEField(j)-e_now)
292 +(mDb->magboltzVDrift(j, padrow)
293 +deltap*mDb->magboltzdVDriftdP(j, padrow))
294 *(e_now-mDb->magboltzEField(v_buf)))
295 /(mDb->magboltzEField(j)-mDb->magboltzEField(v_buf));
296 psi_now=((mDb->magboltzDeflection(v_buf,padrow)
297 +deltap*mDb->magboltzdDeflectiondP(v_buf,padrow))
298 *mParam->lorentzAngleFactor()
299 *(mDb->magboltzEField(j)-e_now)
300 +(mDb->magboltzDeflection(j,padrow)
301 +deltap*mDb->magboltzdDeflectiondP(j,padrow))
302 *mParam->lorentzAngleFactor()
303 *(e_now-mDb->magboltzEField(v_buf)))
304 /(mDb->magboltzEField(j)-mDb->magboltzEField(v_buf));
310 v_now=v_now+vd_gas(r_last);
317 psi_now=psi_now+lor_gas(r_last);
326 r_next = r_last - v_now * step_size * micropertime;
327 pradius[padrow+mDb->numberOfPadrowsPerSide()*(i+1)]=r_next;
329 pdeflection[padrow+mDb->numberOfPadrowsPerSide()*(i+1)]
330 =pdeflection[padrow+mDb->numberOfPadrowsPerSide()*i]
331 +((r_last-r_next)*tan(degree * psi_now)/r_last);
342 int StFtpcLaserTrafo::padtrans(
int iRow,
int iSec,
float timepos,
float padpos,
float *x1,
float *y1)
344 int PadtransPerTimebin;
346 float PhiDeflect, TimeCoordinate;
350 TimeCoordinate = timepos + 0.5; ;
355 TimeCoordinate += (tZero+deltat0)/micropertime;
359 PadtransPerTimebin = (int) mParam->numberOfDriftSteps() / mDb->numberOfTimebins();
360 PadtransLower= (int) (TimeCoordinate*PadtransPerTimebin);
362 float Rad=pradius[iRow + mDb->numberOfPadrowsPerSide() * PadtransLower]
363 -(pradius[iRow + mDb->numberOfPadrowsPerSide()*(PadtransLower)]
364 -pradius[iRow + mDb->numberOfPadrowsPerSide() * (PadtransLower+1)])/2;
367 PhiDeflect=pdeflection[iRow + mDb->numberOfPadrowsPerSide() * PadtransLower]
368 +(pdeflection[iRow + mDb->numberOfPadrowsPerSide() * (PadtransLower+1)]
369 -pdeflection[iRow + mDb->numberOfPadrowsPerSide() * PadtransLower])/2;
380 Phi = mDb->radiansPerBoundary() / 2
381 + ((padpos-1) + 0.5) * mDb->radiansPerPad()
382 + PhiDeflect + iSec * (mDb->numberOfPads() * mDb->radiansPerPad()
383 + mDb->radiansPerBoundary())+halfpi;
394 Phi = mDb->radiansPerBoundary() / 2
395 + (159.5-(padpos-1)) * mDb->radiansPerPad()
396 -PhiDeflect + iSec * (mDb->numberOfPads() * mDb->radiansPerPad()
397 + mDb->radiansPerBoundary())+halfpi;
408 (*x1) = Rad*cos(Phi);
413 (*y1) = Rad*sin(Phi);