QwGeant4
QweakSimCollimator.cc
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // ---------------------------
4 // | Doxygen File Information |
5 // ---------------------------
6 //
7 /**
8 
9  \file QweakSimCollimator.cc
10 
11  $Revision: 1.10 $
12  $Date: 2005/12/28 22:40:43 $
13 
14  \author Klaus Hans Grimm
15 
16 */
17 //=============================================================================
18 
19 // jpan:
20 // collimator 1: z=-575.7895+/-7.62 cm
21 // 2: z=-378.2195+/-7.50 cm
22 // 3: z=-266.244+/-5.615 cm
23 
24 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
25 
26 #include "QweakSimCollimator.hh"
27 
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30 {
33 
34 
35  CollimatorHousing_CenterZPosition = -575.375*cm;//default US collimator location
36  CollimatorHousing_FullLength_X = 120.0*cm;//should be update to 86.36*cm
37  CollimatorHousing_FullLength_Y = 120.0*cm;//86.36*cm
39 
40  BeamlineCutoutDiameter = 8.3*cm;//8.0*cm
41 
42  OctantCutOutFrontFullLength_Y = 5.04*cm;//3.28*cm
43  OctantCutOutFrontFullLength_X1 = 6.38*cm;//7.66*cm
44  OctantCutOutFrontFullLength_X2 = 6.38*cm;//7.66*cm
45  OctantCutOutBackFullLength_Y = 5.83*cm;//6.25*cm
46  OctantCutOutBackFullLength_X1 = 7.30*cm;//7.66*cm
47  OctantCutOutBackFullLength_X2 = 7.30*cm;//7.66*cm
48  OctantCutOutFrontInnerDiameter = 10.42*cm;//10.0*cm
49  OctantCutOutFrontOuterDiameter = 21.38*cm;//26.14*cm
50  OctantCutOutBackInnerDiameter = 14.06*cm;//12.40*cm
51  OctantCutOutBackOuterDiameter = 25.26*cm;//26.14*cm
52  OctantCutOutStartingPhiAngle = (-16.61 + 90.0)*degree;//(-16.344+90)*degree
53  OctantCutOutDeltaPhiAngle = 2.0*16.61*degree;//2.0*16.344*degree
54  OctantCutOutRadialOffset = 0.0*cm;
55 
56  // get access to material definition
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
63 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 {
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 void QweakSimCollimator::ConstructCollimator(G4VPhysicalVolume* MotherVolume)
70 {
71 
72  //---------------------------------------------------------------------------------------------
73  //! Creates a Collimator with 8 cutouts
74  /**
75 
76  \param MotherVolume The physical volume in which the collimator will be placed
77 
78  */
79  //---------------------------------------------------------------------------------------------
80 
81  G4double PI = 3.14159265359; //probably defined
82  //somewhere else, but
83  //what the heck
84 
85  // assign material
86  G4Material* CollimatorHousing_Material = pMaterial->GetMaterial("PBA");
87 
88 
89  std::vector< G4SubtractionSolid* > Solids;
90  Solids.clear();
91  Solids.resize(17); //1 for beamline 2*8 for acceptance cutouts
92  G4ThreeVector positionCollimatorHousing;
93 
94 
95  //**********************************************************************************
96  //Construct collimator main volume
97  G4Box* CollimatorHousing_Solid = new G4Box("CollimatorHousing_Sol",
98  0.5 * CollimatorHousing_FullLength_X - 0.05*cm,
99  0.5 * CollimatorHousing_FullLength_Y - 0.05*cm,
100  0.5 * CollimatorHousing_FullLength_Z - 0.05*cm);
101  //**********************************************************************************
102 
103 
104 
105 
106  //**********************************************************************************
107  //Construct beam line cutout
108  G4Tubs* BeamlimeHole = new G4Tubs("Beamline_cut",0.0*cm,
111  0.0*degree,360.0*degree);
112  //**********************************************************************************
113 
114 
115 
116  //**********************************************************************************
117  //Construct the pie shape cutout for collimator acceptance
118  G4double zPlanes[2] = {-1.0*CollimatorHousing_FullLength_Z/2.0,
120  G4double rInner[2] = {OctantCutOutFrontInnerDiameter/2.0,
122  G4double rOuter[2] = {OctantCutOutFrontOuterDiameter/2.0,
124  G4Polyhedra *Octant1Acceptance_p1 = new G4Polyhedra("Oct1Accept_p1",
127  1,2,zPlanes,rInner,rOuter);
128  //**********************************************************************************
129 
130 
131 
132 
133 
134  //**********************************************************************************
135  //Construct weired shape cutout on top of pie, for collimator acceptance
136 
137  // G4double theta = std::atan((OctantCutOutBackFullLength_Y-
138 // OctantCutOutFrontFullLength_Y)/
139 // CollimatorHousing_FullLength_Z/2.0)*180/PI*degree;
140 
142  CollimatorHousing_FullLength_Z/2.0)*180/PI*degree;
143  //Theta here should be defined as the polar angle of the line joining the centres of the faces at +/-Dz of the trapezoid - corrected by Jie Pan 2009/06/17
144 
145  G4double phi = 90.0*degree;
146  G4double alpha1 = 0.0*degree;
147  G4double alpha2 = 0.0*degree;
148 
149  G4double radLoc = (OctantCutOutRadialOffset - 0.01*cm +
152  std::tan(theta)*CollimatorHousing_FullLength_Z)/2.0);
153 
154  // Keep this to cuddle up to on rainy days...
155  //
156  // G4Trap *Octant1Acceptance_p2 = new G4Trap("Oct1Accept_p2",
157  // OctantCutOutFrontFullLength_X,
158  // CollimatorHousing_FullLength_Z+0.2*mm,
159  // OctantCutOutBackFullLength_Y,
160  // OctantCutOutFrontFullLength_Y); //must rotate around z by 90 degrees
161 
162  G4Trap *Octant1Acceptance_p2 = new G4Trap("Oct1Accept_p2",
164  theta,phi,
168  alpha1,
172  alpha2);
173  //**********************************************************************************
174 
175 
176 
177 
178  //**********************************************************************************
179  //**********************************************************************************
180  //Place cutouts w.r.t. main collimator volume and subtract
181 
182  //**********************************************************************************
183  //Do Beamline first
184  Solids[0] = new G4SubtractionSolid("Beamline_Hole",
185  CollimatorHousing_Solid,
186  BeamlimeHole);
187  //**********************************************************************************
188 
189 
190  //**********************************************************************************
191  //Cutouts
192  char Name[50];
193  int cnt = 0;
194  G4ThreeVector Translation;
195  G4RotationMatrix *Rotation[16];
196 
197  printf("Octant Rotation1 Solid1 Rotation2 Solid2\n\n");
198 
199  for(int oct = 0; oct < 8; oct++){
200  G4double zRot = (oct*45.0)*degree;
201 
202  Translation.setX(std::sin(zRot)*OctantCutOutRadialOffset);
203  Translation.setY(std::cos(zRot)*OctantCutOutRadialOffset);
204  Translation.setZ(0.0*cm-0.01*cm);
205  Rotation[2*oct] = new G4RotationMatrix();
206  Rotation[2*oct]->rotateZ(zRot);
207 
208  sprintf(Name,"Coll_%d_Oct_%d_1",GetCollimatorNumber(),oct+1);
209  Solids[2*oct+1] = new G4SubtractionSolid(Name,Solids[2*oct],Octant1Acceptance_p1,
210  Rotation[2*oct],Translation);
211 
212 
213  Translation.setX(std::sin(zRot)*radLoc);
214  Translation.setY(std::cos(zRot)*radLoc);
215  Translation.setZ(0.0*cm+0.01*cm);
216  Rotation[2*oct+1] = new G4RotationMatrix();
217  Rotation[2*oct+1]->rotateZ(zRot);
218 
219  sprintf(Name,"Coll_%d_Oct_%d_2",GetCollimatorNumber(),oct+1);
220  Solids[2*oct+2] = new G4SubtractionSolid(Name,Solids[2*oct+1],Octant1Acceptance_p2,
221  Rotation[2*oct+1],Translation);
222 // printf("Octant Rotation1 Solid1 Rotation2 Solid2\n\n");
223  printf(" %d %02d %02d %02d %02d\n",oct,2*oct,2*oct+1,2*oct+1,2*oct+2);
224  cnt++;
225  }
226  //End cutouts
227  //**********************************************************************************
228 
229 
230 
231  //**********************************************************************************
232  // Define collimator logical and physical volumes
233 
234  CollimatorHousing_Logical = new G4LogicalVolume(Solids[2*cnt],
235  CollimatorHousing_Material,
236  "CollimatorHousing_Log",
237  0,0,0);
238 
239  positionCollimatorHousing = G4ThreeVector(0,0,CollimatorHousing_CenterZPosition);
240  CollimatorHousing_Physical = new G4PVPlacement(0,
241  positionCollimatorHousing,
242  "CollimatorHousing",
244  MotherVolume,
245  false,
246  0,
247  pSurfChk);
248 
249  //**********************************************************************************
250  //Make it pretty...
251  G4Colour red (1.,0.,0.);
252  G4Colour blue (0.,0.,1.);
253  G4Colour mangenta (237/255.,173/255.,255/255.);
254  G4Colour mangenta1 (104/255., 49/255., 94/255.);
255 
256  G4VisAttributes* CollimatorHousingVisAtt = new G4VisAttributes(mangenta1);
257  CollimatorHousingVisAtt->SetVisibility(true);
258  //CollimatorHousingVisAtt->SetForceSolid(true);//comment out by Jie
259  //CollimatorHousingVisAtt->SetForceWireframe(true);
260  CollimatorHousing_Logical->SetVisAttributes(CollimatorHousingVisAtt);
261 
262 }
263 
264 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
266 {
267 //---------------------------------------------------------------------------------------------
268 //! Sets the material of the Collimator Housing
269  /*!
270 
271  \param materialName Name of the material defined in class QweakSimG4Material
272 
273  */
274 //---------------------------------------------------------------------------------------------
275 
276 
277 
278  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
279  if (pttoMaterial)
280  CollimatorHousing_Logical->SetMaterial(pttoMaterial);
281 }
282 
283 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
285 {
286 //---------------------------------------------------------------------------------------------
287 //! Sets the Z position of the Collimator Housing Center
288  /*!
289 
290  \param zPos Z position along beam line
291 
292  */
293 //---------------------------------------------------------------------------------------------
294 
296 
297  CollimatorHousing_Physical->SetTranslation(G4ThreeVector(0.,0., CollimatorHousing_CenterZPosition));
298 }
299 
300 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
301 
G4double OctantCutOutBackFullLength_X2
static QweakSimMaterial * GetInstance()
G4double OctantCutOutBackOuterDiameter
G4double CollimatorHousing_CenterZPosition
void SetCollimatorHousing_CenterPositionInZ(G4double zPos)
void SetCollimatorHousingMaterial(G4String)
G4double CollimatorHousing_FullLength_Y
static const G4bool pSurfChk
G4double OctantCutOutBackInnerDiameter
G4double OctantCutOutFrontOuterDiameter
G4double OctantCutOutFrontFullLength_Y
QweakSimMaterial * pMaterial
G4Material * GetMaterial(G4String material)
G4double OctantCutOutBackFullLength_X1
G4double OctantCutOutStartingPhiAngle
G4double OctantCutOutBackFullLength_Y
G4double OctantCutOutFrontFullLength_X2
G4double CollimatorHousing_FullLength_Z
G4double OctantCutOutFrontFullLength_X1
~QweakSimCollimator()
Destructor.
G4double OctantCutOutFrontInnerDiameter
void ConstructCollimator(G4VPhysicalVolume *)
G4VPhysicalVolume * CollimatorHousing_Physical
G4LogicalVolume * CollimatorHousing_Logical
QweakSimCollimator()
Constructor.
G4double OctantCutOutDeltaPhiAngle
G4double CollimatorHousing_FullLength_X