[Lowq] C++ routine for EC (X,Y,Z) -> (U,V,W)
fxgirod at jlab.org
fxgirod at jlab.org
Tue Jan 4 15:32:25 EST 2011
Dear Dave,
I copied/passed below my C-code for computing (U,V,W) coordinates of the
hit from (X,Y,Z) in ECPB.
IIRC the code originally came from Stepan.
My understanding is that it is best to cut on (U,W,W) recomputed from ECPB
because sometimes one of the layer may be missing (maybe Stepan can
confirm).
The first three arguments (x,y,z) are input from ECPB. The last 5 are
output (u,v,w) coordinates as well as (xi,yi) in the sector
base-coordinates.
I hope it is clear. Please let me know if you have questions.
Best regards,
FX
///////////////
void ConvertEC_XYZ_UVW(Float_t x, Float_t y, Float_t z, Float_t & u,
Float_t & v, Float_t & w, Float_t & xi, Float_t & yi) {
Float_t phi = 0.0; // azimuthal angle
Float_t ecPhi = 0.0; // azimuthal angle in EC system
Float_t rot[3][3]; // Eulerian rotation matrix
Float_t ecTheta = 0.4363323; // 25 deg between clas center and ec plane
Float_t yLow = -182.974; // min yi coord from bottom of ec to ec center
Float_t yHigh = 189.956; // max yi coord from top of ec to ec center
Float_t tanRho = 1.95325; // 62.889 deg between each side of ec triangle
Float_t sinRho = 0.8901256;
Float_t cosRho = 0.455715;
Float_t zi = 0.0; // depth of the particle hit from ec surface
phi = TMath::ATan2(y,x) * TMath::RadToDeg();
if(phi<0.0)phi+=360.0;
phi += 30.0;
if (phi >= 360.0) {
phi = phi - 360;
}
ecPhi = Int_t(phi/60.0) * 1.0471975;
rot[0][0] = cos(ecTheta) * cos(ecPhi);
rot[0][1] = - sin(ecPhi);
rot[0][2] = sin(ecTheta) * cos(ecPhi);
rot[1][0] = cos(ecTheta) * sin(ecPhi);
rot[1][1] = cos(ecPhi);
rot[1][2] = sin(ecTheta) * sin(ecPhi);
rot[2][0] = - sin(ecTheta);
rot[2][1] = 0.0;
rot[2][2] = cos(ecTheta);
yi = (x * rot[0][0]) + (y * rot[1][0]) + (z * rot[2][0]);
xi = (x * rot[0][1]) + (y * rot[1][1]) + (z * rot[2][1]);
zi = (x * rot[0][2]) + (y * rot[1][2]) + (z * rot[2][2]);
zi = zi - 510.32; // 510.32 is distance of all ECs from clas center
u = (yi - yLow) / sinRho;
v = ((yHigh - yLow) / tanRho) - xi + ((yHigh - yi) / tanRho);
w = (((yHigh - yLow) / tanRho) + xi + ((yHigh - yi) /
tanRho))/(2.0*cosRho);
return;
}
More information about the Lowq
mailing list