00001
00002 #include "musrForwardParameterisation.hh"
00003
00004 #include "G4VPhysicalVolume.hh"
00005 #include "G4ThreeVector.hh"
00006 #include "G4Box.hh"
00007 #include "G4Trd.hh"
00008
00009
00010 musrForwardParameterisation::musrForwardParameterisation(
00011 G4int NoRadialPixels,
00012 G4int NoLengthPixels,
00013 G4double X1Pixel,
00014 G4double X2Pixel,
00015 G4double Y1Pixel,
00016 G4double Y2Pixel,
00017 G4double ZPixel,
00018 G4double ArrayLength,
00019 G4double TiltAngle,
00020 G4double LRadius)
00021 {
00022 fNoRadialPixels = NoRadialPixels;
00023 fNoLengthPixels = NoLengthPixels;
00024 fPixelWidthX1 = X1Pixel;
00025 fPixelWidthX2 = X2Pixel;
00026 fPixelWidthY1 = Y1Pixel;
00027 fPixelWidthY2 = Y2Pixel;
00028 fPixelWidthZ = ZPixel;
00029 fArrayLength = ArrayLength;
00030 fTiltAngle = TiltAngle;
00031 fLRadius = LRadius;
00032
00033
00034
00035 }
00036
00037
00038
00039 musrForwardParameterisation::~musrForwardParameterisation()
00040 {
00041
00042 }
00043
00044
00045
00046 void musrForwardParameterisation::ComputeTransformation
00047 (const G4int copyNo, G4VPhysicalVolume* physVol) const
00048 {
00049 G4int j;
00050 G4double ftheta;
00051 G4double fRadius;
00052 G4double fZDist;
00053 G4double hArrayLength=0.5*fArrayLength;
00054 G4double fhZStep;
00055
00056 j=int(copyNo/fNoRadialPixels);
00057
00058 G4RotationMatrix* fRotFdeg= new G4RotationMatrix();
00059 G4ThreeVector fTa;
00060
00061
00062 fhZStep = (fArrayLength/(2*fNoLengthPixels));
00063 fZDist=j*fArrayLength/fNoLengthPixels;
00064
00065 fTa.setZ(fZDist-(hArrayLength-fhZStep));
00066
00067 fRadius=fLRadius-(fZDist+fhZStep)*tan(fTiltAngle);
00068
00069 ftheta=(360*(copyNo-1)/fNoRadialPixels)*deg;
00070 fTa.setX(fRadius*cos(ftheta)*mm);
00071 fTa.setY(fRadius*sin(ftheta)*mm);
00072
00073 fRotFdeg->rotateZ(-ftheta);
00074 fRotFdeg->rotateY(fTiltAngle);
00075
00076
00077
00078 G4RotationMatrix* rmold = physVol->GetRotation();
00079 delete rmold;
00080
00081
00082 physVol->SetTranslation(fTa);
00083 physVol->SetRotation(fRotFdeg);
00084
00085
00086 }
00087
00088
00089
00090 void musrForwardParameterisation::ComputeDimensions
00091 (G4Trd& PixelForward, const G4int copyNo, const G4VPhysicalVolume*) const
00092 {
00093
00094 G4int j;
00095 G4double fNewWidthX1;
00096 G4double fNewWidthX2;
00097 G4double fNewWidthY1;
00098 G4double fNewWidthY2;
00099 G4double fNewWidthZ;
00100
00101 G4double fRadiusAtY1;
00102 G4double fRadiusAtY2;
00103 G4double fZDist;
00104 G4double fZStep;
00105 G4double hArrayLength=0.5*fArrayLength;
00106 G4double hDetectorGap=1.2*mm;
00107
00108
00109
00110 j=int(copyNo/fNoRadialPixels);
00111
00112 fNewWidthZ=(hArrayLength/(cos(fTiltAngle)*fNoLengthPixels))-hDetectorGap;;
00113 fZStep = (fArrayLength/fNoLengthPixels);
00114 fZDist=j*fArrayLength/fNoLengthPixels;
00115
00116 fRadiusAtY1=fLRadius-(fZDist)*tan(fTiltAngle);
00117 fRadiusAtY2=fLRadius-(fZDist+fZStep)*tan(fTiltAngle);
00118
00119 fNewWidthY1=(fRadiusAtY1*tan(2*pi/(2*fNoRadialPixels)))-hDetectorGap;;
00120 fNewWidthY2=(fRadiusAtY2*tan(2*pi/(2*fNoRadialPixels)))-hDetectorGap;;
00121 fNewWidthX1=fPixelWidthX1;
00122 fNewWidthX2=fPixelWidthX2;
00123
00124 PixelForward.CheckAndSetAllParameters(fPixelWidthX1,fPixelWidthX1,
00125 fNewWidthY1,fNewWidthY2,
00126 fNewWidthZ);
00127 }
00128
00129