|
|
Re: MasterToLocal transformation [message #4692 is a reply to message #4687] |
Wed, 18 July 2007 17:50 |
Ralf Kliemt
Messages: 507 Registered: May 2007 Location: GSI, Darmstadt
|
first-grade participant |
From: 141.30.85*
|
|
Hi again,
I put here an example how to transform your geometric objects between their local frame and the laboratory system.
void MvdIdealRecoTask::smearLocal(TVector3& pos, const MvdPoint* mvdpoint)
{
/// smear a 3d vector in the local sensor plane
gGeoManager->cd(mvdpoint->GetDetName());
TGeoHMatrix* transMat = gGeoManager->GetCurrentMatrix();
Double_t posLab[3], posSens[3];
posLab[0]=pos.x(); posLab[1]=pos.y(); posLab[2]=pos.z();
transMat->MasterToLocal(posLab,posSens);
pos.SetXYZ(posSens[0],posSens[1],posSens[2]);
smear(pos); // apply a gaussian
posSens[0]=pos.x(); posSens[1]=pos.y(); posSens[2]=pos.z();
transMat->LocalToMaster(posSens,posLab);
pos.SetXYZ(posLab[0],posLab[1],posLab[2]);
return;
}
If I'm not mistaken, you have your sensors (the geo objects we spaek of) defined in a *.geo file. One entry is a box:
BOX
silicon
22.5 -15 -22.5
22.5 15 -22.5
-22.5 15 -22.5
-22.5 -15 -22.5
22.5 -15 22.5
22.5 15 22.5
-22.5 15 22.5
-22.5 -15 22.5
15 22.5 -755
1. 0. 0. 0. 1. 0. 0. 0. 1.
If I read this correctly it has a dimension of (x,y,z)=(45,30,45). This is in the local (sensor) frame.
This is translated by (15,22.5,-755) and not rotated into the lab frame. These two last lines will be in the TGeoHMatrix of your object.
I hope this helps.
Byebye, Ralf.
|
|
|
|
|