musrBackwardParameterisation.cc

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

Generated on Mon Mar 27 12:19:54 2006 for MUSR by  doxygen 1.4.6