23 #include "TClonesArray.h"
24 #include "TMatrixFSym.h"
35 fListRICHImPlanePoint(NULL),
92 fDetZ = detPosLab.
Z() + detPosCen.
Z();
93 fDetY = detPosLab.
Y() + detPosCen.
Y();
94 fDetX = detPosLab.
X() + detPosCen.
X();
117 fPhiDet = -1.*TMath::ASin(fdetR(2));
119 cout <<
"---------------------- RICH Projection Producer ---------------------------------------" << endl;
120 cout <<
" detector position in (x,y,z): " <<
fDetX <<
" " <<
fDetY <<
" " <<
fDetZ << endl;
122 cout <<
" detector tilting angle (around x): " <<
fThetaDet*180./TMath::Pi() <<
" degrees" << endl;
123 cout <<
" detector tilting angle (around y): " <<
fPhiDet*180./TMath::Pi() <<
" degrees" << endl;
142 Double_t spheTheta = TMath::Abs(90. - fmirA->At(2));
143 Double_t sphePhi = TMath::Abs(90. - fmirA->At(4));
150 Double_t thetaM = -1.*TMath::ASin(fmirR(5)) - TMath::Pi()/2 ;
154 cout <<
"Mirror center (x,y,z): " <<
fXm <<
" " <<
fYm <<
" " <<
fZm << endl;
155 cout <<
"Mirror radius: " <<
fR << endl;
156 cout <<
"Mirror tilting angle: " << thetaM*180./TMath::Pi() <<
" degrees" << endl;
161 if (
fZflag == 1) cout <<
" use tracks in imaginary plane for projection to photodetector plane" << endl;
162 if (
fZflag == 2) cout <<
" use tracks in RICH mirror for projection to photodetector plane" << endl;
164 cout <<
"-W- CbmRichProjectionProducer::Init: No Rich Z-Point array!" << endl;
169 TClonesArray* richProj)
172 cout <<
"CbmRichProjectionProducer: event " <<
fEvent << endl;
175 TMatrixFSym covMat(5);
176 for(Int_t i = 0; i < 5; i++){
177 for(Int_t j=0; j<=i; j++){
181 covMat(0,0) = covMat(1,1) = covMat(2,2) = covMat(3,3) = covMat(4,4) = 1.e-4;
185 new((*richProj)[j])
FairTrackParam(0., 0., 0., 0., 0., 0., covMat);
188 if (point->
GetX() == 0 && point->
GetY() == 0 && point->
GetZ() == 0 &&
189 point->
GetTx() == 0 && point->
GetTy() ==0)
continue;
190 if (point->
GetQp()==0)
continue;
201 TVector3 startP, momP, crossP, centerP;
205 Double_t
p = 1./TMath::Abs(point->
GetQp());
210 cout <<
" -E- RichProjectionProducer: strange value for calculating pz: " <<
214 Double_t px = pz*point->
GetTx();
215 Double_t py = pz*point->
GetTy();
216 momP.SetXYZ(px,py,pz);
228 Double_t RxP=(momP.x()*(startP.x()-
fXm)+momP.y()*(startP.y()-
fYm)+momP.z()*(startP.z()-
fZm));
229 Double_t normP2=(momP.x()*momP.x()+momP.y()*momP.y()+momP.z()*momP.z());
230 Double_t dist=(startP.x()*startP.x()+
fXm*
fXm+startP.y()*startP.y()+
fYm*
fYm+startP.z()*startP.z()+
fZm*
fZm-2*startP.x()*
fXm-2*startP.y()*
fYm-2*startP.z()*
fZm-
fR*
fR);
232 if ((RxP*RxP-normP2*dist) > 0.) {
233 if (normP2!=0.) rho1=(-RxP+TMath::Sqrt(RxP*RxP-normP2*dist))/normP2;
234 if (normP2 == 0) cout <<
" Error in track extrapolation: momentum = 0 " << endl;
236 cout <<
" -E- RichProjectionProducer: RxP*RxP-normP2*dist = " << RxP*RxP-normP2*dist << endl;
239 Double_t crossPx = startP.x() + rho1*momP.x();
240 Double_t crossPy = startP.y() + rho1*momP.y();
241 Double_t crossPz = startP.z() + rho1*momP.z();
242 crossP.SetXYZ(crossPx, crossPy, crossPz);
246 if ((
fYm*crossP.y())<0) {
248 RxP=(momP.x()*(startP.x()-
fXm)+momP.y()*(startP.y()-
fYm)+momP.z()*(startP.z()-
fZm));
249 normP2=(momP.x()*momP.x()+momP.y()*momP.y()+momP.z()*momP.z());
250 dist=(startP.x()*startP.x()+
fXm*
fXm+startP.y()*startP.y()+
fYm*
fYm+startP.z()*startP.z()+
fZm*
fZm-2*startP.x()*
fXm-2*startP.y()*
fYm-2*startP.z()*
fZm-
fR*
fR);
252 if ((RxP*RxP-normP2*dist) > 0.) {
253 if (normP2!=0.) rho1=(-RxP+TMath::Sqrt(RxP*RxP-normP2*dist))/normP2;
254 if (normP2 == 0) cout <<
" Error in track extrapolation: momentum = 0 " << endl;
256 cout <<
" -E- RichProjectionProducer: RxP*RxP-normP2*dist = " << RxP*RxP-normP2*dist << endl;
259 crossPx=startP.x()+rho1*momP.x();
260 crossPy=startP.y()+rho1*momP.y();
261 crossPz=startP.z()+rho1*momP.z();
262 crossP.SetXYZ(crossPx,crossPy,crossPz);
270 Double_t
p = 1./TMath::Abs(point->
GetQp());
275 cout <<
" -E- RichProjectionProducer: strange value for calculating pz: " <<
279 Double_t px = pz*point->
GetTx();
280 Double_t py = pz*point->
GetTy();
281 momP.SetXYZ(px,py,pz);
289 TVector3 normP(crossP.x()-centerP.x(),crossP.y()-centerP.y(),crossP.z()-centerP.z());
292 if ((normP.z()*momP.z())<0.) normP = TVector3(-1.*normP.x(),-1.*normP.y(),-1.*normP.z());
295 Double_t np=normP.x()*momP.x()+normP.y()*momP.y()+normP.z()*momP.z();
297 Double_t refX = 2*np*normP.x()-momP.x();
298 Double_t refY = 2*np*normP.y()-momP.y();
299 Double_t refZ = 2*np*normP.z()-momP.z();
313 if (centerP.y() > 0){
319 if (centerP.y() < 0){
327 Double_t xX = crossP.x() + refX * rho2;
328 Double_t yY = crossP.y() + refY * rho2;
329 Double_t zZ = crossP.z() + refZ * rho2;
332 if (centerP.y() > 0){
338 if (centerP.y() < 0){
345 xX = crossP.x() + refX * rho2;
346 yY = crossP.y() + refY * rho2;
347 zZ = crossP.z() + refZ * rho2;
352 TVector3 inPos(xX, yY, zZ);
355 Double_t xDet = outPos.X();
356 Double_t yDet = outPos.Y();
357 Double_t zDet = outPos.Z();