QwGeant4
QweakSimVDCRotator.cc
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // ---------------------------
4 // | Doxygen File Information |
5 // ---------------------------
6 //
7 /**
8 
9 
10  \file QweakSimVDCRotator.cc
11 
12  $Revision: 1.2 $
13  $Date: 2006/05/05 21:17:42 $
14 
15  \author Klaus Hans Grimm
16 
17 */
18 //=============================================================================
19 
20 //=============================================================================
21 // -----------------------
22 // | CVS File Information |
23 // -----------------------
24 //
25 // Last Update: $Author: grimm $
26 // Update Date: $Date: 2006/05/05 21:17:42 $
27 // CVS/RCS Revision: $Revision: 1.2 $
28 // Status: $State: Exp $
29 //
30 // ===================================
31 // CVS Revision Log at end of file !!
32 // ===================================
33 //
34 //============================================================================
35 
36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
37 
38 #include "QweakSimVDCRotator.hh"
39 
40 // geant4 includes
41 #include "G4LogicalVolume.hh"
42 #include "G4RotationMatrix.hh"
43 
44 // user includes
45 #include "QweakSimMaterial.hh"
46 #include "QweakSimVDC.hh"
47 #include "QweakSimVDCMessenger.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 // QweakSimVDCRotator::QweakSimVDCRotator(QweakSimVDC* theVDC)
51 // : DualVDC(theVDC)
53 {
54  G4cout << G4endl << "###### Calling QweakSimVDCRotator::QweakCollimatorSupport() " << G4endl << G4endl;
55 
56  theMotherVolume = NULL;
57 
58  kAngle_GlobalRotation = 90.0*degree;
59 
60  // Upstream Ring
61  UpstreamRing_Logical = NULL;
62  UpstreamRing_Physical = NULL;
63 
66 
67  kRing_RadiusMax = 1168.0*mm;
68  kRing_RadiusMin = 1016.0*mm;
69  kRing_FullThickness = 2.0*2.54*cm;
70  kRing_PhiAngleStart = 0.0*degree;
71  kRing_PhiAngleEnd = 360.0*degree;
72 
75  UpstreamRing_CenterZPosition = 4310.36*mm;
76 
79  DownstreamRing_CenterZPosition = 5088.23*mm;
80 
81  //==========
82  // Rails
83  //==========
84 
85  Rail_Logical = NULL;
86  LeftRail_Physical = NULL;
87  RightRail_Physical = NULL;
88 
89  Rotation_Rail = NULL;
90 
91  kRail_FullLength_X = 1.75*2.54*cm;
92  kRail_FullLength_Y = 114.00*2.54*cm;
93  kRail_FullLength_Z = 5.00*2.54*cm;
94 
95  kRail_CenterPositionInR = (49.1314*2.54*cm + 0.5*kRail_FullLength_X);
97 
98 
99 
100  //==================
101  // Rods: Left/Right
102  //==================
103 
104  Rod_LeftRight_Logical = NULL;
105  Rotation_Rod_LR = NULL;
106 
107  kRod_LR_RadiusMin = 0.0*cm;
108  kRod_LR_RadiusMax = 1.0220*2.54*cm;
109  kRod_LR_FullThickness = 2.8250*2.54*cm;
110  kRod_LR_PhiAngleStart = 0.0*degree;
111  kRod_LR_PhiAngleEnd = 360.0*degree;
112 
113  //----------------------
114  // [0]: Upstream,Left rod
115  // [1]: Downstream,Left rod
116  // [2]: Upstream,Right rod
117  // [3]: Downstream,Right rod
118  //----------------------
119  kRod_LR_StubLength = 2.8250*2.54*cm;
120  kRod_LR_Distance = 12.5000*2.54*cm;
121 
122  kRod_LR_CenterPositionInX.clear();
123  kRod_LR_CenterPositionInX.resize(4);
124  kRod_LR_CenterPositionInX[0] = -1.0*(61.0371*2.54*cm - 0.5*kRod_LR_StubLength);
125  kRod_LR_CenterPositionInX[1] = -1.0*(61.0371*2.54*cm - 0.5*kRod_LR_StubLength);
126  kRod_LR_CenterPositionInX[2] = 1.0*(61.0371*2.54*cm - 0.5*kRod_LR_StubLength);
127  kRod_LR_CenterPositionInX[3] = 1.0*(61.0371*2.54*cm - 0.5*kRod_LR_StubLength);
128 
129  kRod_LR_CenterPositionInY.clear();
130  kRod_LR_CenterPositionInY.resize(4);
131  kRod_LR_CenterPositionInY[0] = 111.7677*2.54*cm;
132  kRod_LR_CenterPositionInY[1] = 111.7677*2.54*cm;
133  kRod_LR_CenterPositionInY[2] = 111.7677*2.54*cm;
134  kRod_LR_CenterPositionInY[3] = 111.7677*2.54*cm;
135 
136  kRod_LR_CenterPositionInZ.clear();
137  kRod_LR_CenterPositionInZ.resize(4);
138  kRod_LR_CenterPositionInZ[0] = 178.8866*2.54*cm;
139  kRod_LR_CenterPositionInZ[1] = 178.8866*2.54*cm + kRod_LR_Distance;
140  kRod_LR_CenterPositionInZ[2] = 178.8866*2.54*cm;
141  kRod_LR_CenterPositionInZ[3] = 178.8866*2.54*cm + kRod_LR_Distance;
142 
143  //----------------------
144  // [0]: Upstream rod
145  // [1]: Downstream rod
146  //----------------------
147  //
148  Rod_LeftRight_Physical.clear();
149  Rod_LeftRight_Physical.resize(4);
150 
151 
152  //===============
153  // Slider Support
154  //===============
155  kSliderSupport_FullLength_X = 203.20*mm;
156  kSliderSupport_FullLength_Y = 1930.40*mm;
157  kSliderSupport_FullLength_Z = 356.97*mm;
158 
162 
165 
168  SliderSupportLeft_Physical.resize(2);
169 
172  SliderSupportRight_Physical.resize(2);
173 
174  // needed for shaping
177 
178 
179  //==================================
180  // get access to material definition
181  //==================================
182  //
184 
185  G4cout << G4endl << "###### Leaving QweakSimVDCRotator::QweakCollimatorSupport() " << G4endl << G4endl;
186 }
187 
188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
190 
191 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
193 {
194  G4cout << G4endl << "###### Calling QweakSimVDCRotator::RotatorMasterContainer() " << G4endl << G4endl;
195 
196  G4Box* RotatorMasterContainer_Solid = new G4Box("RotatorMasterContainer_Solid",
197  0.5 * (6.6*m),
198  0.5 * (2.0*kRail_CenterPositionInR+50.0*cm),
199  0.5 * (kSliderSupport_FullLength_Z +2.0*cm ));
200 
201  G4LogicalVolume* RotatorMasterContainer_Logical = new G4LogicalVolume( RotatorMasterContainer_Solid,
202  pMaterial->GetMaterial("Air"),
203  "RotatorMasterContainer_Logical",
204  0,
205  0,0);
206 
207  G4Colour aluminum ( 169/255. , 172/255. , 182/255.);
208  G4VisAttributes* RotatorMasterContainer_VisAtt = new G4VisAttributes(aluminum);
209  RotatorMasterContainer_VisAtt->SetForceWireframe(true);
210  RotatorMasterContainer_VisAtt->SetVisibility(false);
211  RotatorMasterContainer_Logical->SetVisAttributes(RotatorMasterContainer_VisAtt);
212 
213  // Place the physical volume into theMotherVolume
214 
215  G4ThreeVector Translation_RotatorMasterContainer;
216  Translation_RotatorMasterContainer.setZ(kRail_CenterPositionInZ);
217 
218  G4RotationMatrix* Rotation_RotatorMasterContainer = new G4RotationMatrix();
219  Rotation_RotatorMasterContainer->rotateZ(kAngle_GlobalRotation);
220 
221  RotatorMasterContainer_Physical = new G4PVPlacement(Rotation_RotatorMasterContainer,
222  Translation_RotatorMasterContainer,
223  "RotatorMasterContainer_Physical",
224  RotatorMasterContainer_Logical,
226  false,
227  0,
228  pSurfChk);
229 
230 }
231 
232 
233 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
235 {
236  G4cout << G4endl << "###### Calling QweakSimVDCRotator::ConstructSupport() " << G4endl << G4endl;
237 
238  // assign material
239  G4Material* Ring_Material = pMaterial->GetMaterial("StainlessSteel");
240 
241 
242  //===============
243  // Upstream Ring
244  //===============
245  G4ThreeVector positionUpstreamRing(UpstreamRing_CenterXPosition,
248 
249  //**********************************************************************************
250  //Construct
251  G4Tubs* UpstreamRing_Solid = new G4Tubs("UpstreamRing_Sol",
257  );
258 
259  //**********************************************************************************
260  // Define UpstreamRing logical and physical volumes
261 
262  UpstreamRing_Logical = new G4LogicalVolume( UpstreamRing_Solid,
263  Ring_Material,
264  "UpstreamRing_Log",
265  0,0,0);
266 
267  UpstreamRing_Physical = new G4PVPlacement(0,
268  positionUpstreamRing,
269  "UpstreamRing",
272  false,
273  0,
274  pSurfChk);
275 
276  //**********************************************************************************
277 
278  //===============
279  // Downstream Ring
280  //===============
281  G4ThreeVector positionDownstreamRing(DownstreamRing_CenterXPosition,
284 
285  //**********************************************************************************
286  //Construct
287  G4Tubs* DownstreamRing_Solid = new G4Tubs("DownstreamRing_Sol",
293  );
294 
295  //**********************************************************************************
296  // Define DownsreamRing logical and physical volumes
297 
298  DownstreamRing_Logical = new G4LogicalVolume( DownstreamRing_Solid,
299  Ring_Material,
300  "DownstreamRing_Log",
301  0,0,0);
302 
303  DownstreamRing_Physical = new G4PVPlacement(0,
304  positionDownstreamRing,
305  "UpstreamRing",
308  false,
309  0,
310  pSurfChk);
311 
312  //Make it pretty...
313  G4Colour blue (0.,0.,1.);
314  G4Colour mangenta (237/255.,173/255.,255/255.);
315  G4Colour mangenta1 (104/255., 49/255., 94/255.);
316  G4Colour aluminum ( 169/255. , 172/255. , 182/255.);
317  G4Color lightsteelblue ( 176/255. , 196/255. , 222/255.);
318 
319  //**********************************************************************************
320  G4VisAttributes* Ring_VisAtt = new G4VisAttributes(aluminum);
321  Ring_VisAtt->SetVisibility(true);
322  // Ring_VisAtt->SetForceSolid(true);
323  // Ring_VisAtt->SetForceWireframe(true);
324  UpstreamRing_Logical ->SetVisAttributes(Ring_VisAtt);
325  DownstreamRing_Logical ->SetVisAttributes(Ring_VisAtt);
326  //**********************************************************************************
327 
328 
329  G4cout << G4endl << "###### Leaving QweakSimVDCRotator::ConstructSupport() " << G4endl << G4endl;
330 
331 }
332 
333 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
335 {
336  G4cout << G4endl << "###### Calling QweakSimVDCRotator::ConstructRails() " << G4endl << G4endl;
337 
338  // assign material
339  G4Material* Rail_Material = pMaterial->GetMaterial("StainlessSteel");
340 
341 
342  G4Box* Rail_Solid = new G4Box("Rail_Solid",
343  0.5 * kRail_FullLength_X ,
344  0.5 * kRail_FullLength_Y ,
345  0.5 * kRail_FullLength_Z );
346 
347 
348  Rail_Logical = new G4LogicalVolume( Rail_Solid,
349  Rail_Material,
350  "Rail_Logical",
351  0,
352  0,0);
353 
354  //Make it pretty...
355  G4Colour blue (0.,0.,1.);
356  G4Colour mangenta (237/255.,173/255.,255/255.);
357  G4Colour mangenta1 (104/255., 49/255., 94/255.);
358  G4Colour aluminum ( 169/255. , 172/255. , 182/255.);
359  G4Color lightsteelblue ( 176/255. , 196/255. , 222/255.);
360  //**********************************************************************************
361  G4VisAttributes* Rails_VisAtt = new G4VisAttributes(blue);
362  Rails_VisAtt->SetVisibility(true);
363  // Rails_VisAtt->SetForceSolid(true);
364  // Ring_VisAtt->SetForceWireframe(true);
365  Rail_Logical ->SetVisAttributes(Rails_VisAtt);
366  //**********************************************************************************
367 
368  // Place the physical volume of the rails into theMotherVolume
369  PlacePVRails();
370 
371 } // end of ConstructRails()
372 
373 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
375 {
376 
377  G4ThreeVector* CenterRailLeft = new G4ThreeVector();
378  G4ThreeVector* CenterRailRight = new G4ThreeVector();
379 
380  CenterRailLeft->setX(-1.0*kRail_CenterPositionInR);
381  CenterRailLeft->setY(0.0*cm);
382  CenterRailLeft->setZ(0.0*cm);
383 
384  CenterRailRight->setX(1.0*kRail_CenterPositionInR);
385  CenterRailRight->setY(0.0*cm);
386  CenterRailRight->setZ(0.0*cm);
387 
388  // rotate center vectors of rails
389  // CenterRailLeft ->rotateZ(kAngle_GlobalRotation);
390  // CenterRailRight ->rotateZ(kAngle_GlobalRotation);
391 
392  Translation_LeftRail.setX( CenterRailLeft->y() );
393  Translation_LeftRail.setY( CenterRailLeft->x() );
394  //Translation_LeftRail.setZ(kRail_CenterPositionInZ);
395 
396  Translation_RightRail.setX( CenterRailRight->y() );
397  Translation_RightRail.setY( CenterRailRight->x() );
398  //Translation_RightRail.setZ(kRail_CenterPositionInZ);
399 
400  // since the SingleCoil_ClampPlate_Logical is defined for a vertical orientation
401  // but the translation assumes a horizontal orinetation, we have to subtract 90*deg
402  Rotation_Rail = new G4RotationMatrix();
403  //Rotation_Rail->rotateZ(kAngle_GlobalRotation -90*degree);
404  Rotation_Rail->rotateZ( -90*degree);
405 
406 
407  LeftRail_Physical = new G4PVPlacement(Rotation_Rail,
409  "LeftRail_Physical",
410  Rail_Logical,
412  false,
413  0,
414  pSurfChk);
415 
416  RightRail_Physical = new G4PVPlacement(Rotation_Rail,
418  "RightRail_Physical",
419  Rail_Logical,
421  false,
422  0,
423  pSurfChk);
424 }
425 
426 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
428 {
429 
430  G4cout << G4endl << "###### Calling QweakSimVDCRotator::ConstructMount() " << G4endl << G4endl;
431 
432  // assign material
433  G4Material* Rod_LeftRight_Material = pMaterial->GetMaterial("StainlessSteel");
434 
435 
436 
437  //**********************************************************************************
438  //Construct
439  G4Tubs* Rod_LeftRight_Solid = new G4Tubs("Rod_LR_Sol",
445  );
446 
447  //**********************************************************************************
448  // Define UpstreamRing logical and physical volumes
449 
450  Rod_LeftRight_Logical = new G4LogicalVolume( Rod_LeftRight_Solid,
451  Rod_LeftRight_Material,
452  "Rod_LeftRight_Logical",
453  0,
454  0,0);
455 
456  //**********************************************************************************
457 
458  //Make it pretty...
459  G4Colour blue (0.,0.,1.);
460  G4Colour mangenta (237/255.,173/255.,255/255.);
461  G4Colour mangenta1 (104/255., 49/255., 94/255.);
462  G4Colour aluminum ( 169/255. , 172/255. , 182/255.);
463  G4Color lightsteelblue ( 176/255. , 196/255. , 222/255.);
464  //**********************************************************************************
465  G4VisAttributes* Rod_LeftRight_VisAtt = new G4VisAttributes(mangenta);
466  Rod_LeftRight_VisAtt ->SetVisibility(true);
467  Rod_LeftRight_Logical ->SetVisAttributes(Rod_LeftRight_VisAtt);
468  //**********************************************************************************
469 
470  // Place the physical volume(s) into the MotherVolume
471  PlacePVMount();
472 
473 } // end of ConstructMount()
474 
475 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
477 {
478 
479  G4ThreeVector* CenterRodLeftUpstream = new G4ThreeVector();
480  G4ThreeVector* CenterRodLeftDownstream = new G4ThreeVector();
481 
482  G4ThreeVector* CenterRodRightUpstream = new G4ThreeVector();
483  G4ThreeVector* CenterRodRightDownstream = new G4ThreeVector();
484 
485 
486  CenterRodLeftUpstream->setX(kRod_LR_CenterPositionInX[0]);
487  CenterRodLeftUpstream->setY(kRod_LR_CenterPositionInY[0]);
488  //CenterRodLeftUpstream->setZ(kRod_LR_CenterPositionInZ[0]);
489  //
490  CenterRodLeftDownstream->setX(kRod_LR_CenterPositionInX[1]);
491  CenterRodLeftDownstream->setY(kRod_LR_CenterPositionInY[1]);
492  //CenterRodLeftDownstream->setZ(kRod_LR_CenterPositionInZ[1]);
493 
494 
495  CenterRodRightUpstream->setX(kRod_LR_CenterPositionInX[2]);
496  CenterRodRightUpstream->setY(kRod_LR_CenterPositionInY[2]);
497  //CenterRodRightUpstream->setZ(kRod_LR_CenterPositionInZ[2]);
498  //
499  CenterRodRightDownstream->setX(kRod_LR_CenterPositionInX[3]);
500  CenterRodRightDownstream->setY(kRod_LR_CenterPositionInY[3]);
501  //CenterRodRightDownstream->setZ(kRod_LR_CenterPositionInZ[3]);
502 
503 
504 
505  // rotate center vectors of rails
506 // CenterRodLeftUpstream ->rotateZ(kAngle_GlobalRotation);
507 // CenterRodLeftDownstream ->rotateZ(kAngle_GlobalRotation);
508 // CenterRodRightUpstream ->rotateZ(kAngle_GlobalRotation);
509 // CenterRodRightDownstream ->rotateZ(kAngle_GlobalRotation);
510 
511 
512  Translation_RodLeftUpstream.setX( CenterRodLeftUpstream->y() );
513  Translation_RodLeftUpstream.setY( CenterRodLeftUpstream->x() );
514  //Translation_RodLeftUpstream.setZ( CenterRodLeftUpstream->z() );
515  //
516  Translation_RodLeftDownstream.setX( CenterRodLeftDownstream->y() );
517  Translation_RodLeftDownstream.setY( CenterRodLeftDownstream->x() );
518  //Translation_RodLeftDownstream.setZ( CenterRodLeftDownstream->z() );
519 
520 
521  Translation_RodRightUpstream.setX( CenterRodRightUpstream->y() );
522  Translation_RodRightUpstream.setY( CenterRodRightUpstream->x() );
523  //Translation_RodRightUpstream.setZ( CenterRodRightUpstream->z() );
524  //
525  Translation_RodRightDownstream.setX( CenterRodRightDownstream->y() );
526  Translation_RodRightDownstream.setY( CenterRodRightDownstream->x() );
527  //Translation_RodRightDownstream.setZ( CenterRodRightDownstream->z() );
528 
529 
530 
531  Rotation_Rod_LR = new G4RotationMatrix();
532  Rotation_Rod_LR->rotateY(90*degree);
533  //Rotation_Rod_LR->rotateX(kAngle_GlobalRotation -90*degree);
534  Rotation_Rod_LR->rotateX(-90*degree);
535 
536 
537 
538  Rod_LeftRight_Physical[0] = new G4PVPlacement(Rotation_Rod_LR,
540  "RodLR_LeftUpstream_Physical",
543  false,
544  0,
545  pSurfChk);
546 
547  Rod_LeftRight_Physical[1] = new G4PVPlacement(Rotation_Rod_LR,
549  "RodLR_RightUpstream_Physical",
552  false,
553  0,
554  pSurfChk);
555 
556  Rod_LeftRight_Physical[2] = new G4PVPlacement(Rotation_Rod_LR,
558  "RodLR_LeftDownstream_Physical",
561  false,
562  0,
563  pSurfChk);
564 
565  Rod_LeftRight_Physical[3] = new G4PVPlacement(Rotation_Rod_LR,
567  "RodLR_RightDownstream_Physical",
570  false,
571  0,
572  pSurfChk);
573 
574 } // end of PlacePVMount()
575 
576 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
578 {
579  G4cout << G4endl << "###### Calling QweakSimVDCRotator::ConstructSliderSupport() " << G4endl << G4endl;
580 
581  // assign material
582  G4Material* SliderSupport_Material = pMaterial->GetMaterial("StainlessSteel");
583 
584 
585  G4Box* SliderSupportLeft_Solid = new G4Box("SliderSupportLeft_Solid",
589 
590  G4Box* SliderSupportRight_Solid = new G4Box("SliderSupportRight_Solid",
594 
595 
596  //-------------------------------------------------------------------------------------------------------------------------------
597 
598  G4Box* SubtractInnerBox_Solid = new G4Box("SubtractInnerBox_Solid",
599  0.5 * 2*4.00*2.54*cm,
600  0.5 * kSliderSupport_FullLength_Y +0.1*mm,
601  0.5 * 3.50*2.54*cm);
602 
603 
604  std::vector< G4ThreeVector > LocalTranslation_InnerBox_Subtract;
605  LocalTranslation_InnerBox_Subtract.clear();
606  LocalTranslation_InnerBox_Subtract.resize(4);
607 
608  // Left Slider: Upstream Inner Box
609  LocalTranslation_InnerBox_Subtract[0].setX(-1.0*(0.5*203.20*mm));
610  LocalTranslation_InnerBox_Subtract[0].setY(0.0*cm);
611  LocalTranslation_InnerBox_Subtract[0].setZ(-1.0*(1.0+0.5*3.50)*2.54*cm);
612 
613  // Left Slider: Downstream Inner Box
614  LocalTranslation_InnerBox_Subtract[1].setX(-1.0*(0.5*203.20*mm));
615  LocalTranslation_InnerBox_Subtract[1].setY(0.0*cm);
616  LocalTranslation_InnerBox_Subtract[1].setZ(+1.0*(1.0+0.5*3.50)*2.54*cm);
617 
618 
619  // Right Slider: Upstream Inner Box
620  LocalTranslation_InnerBox_Subtract[2].setX(+1.0*(0.5*203.20*mm));
621  LocalTranslation_InnerBox_Subtract[2].setY(0.0*cm);
622  LocalTranslation_InnerBox_Subtract[2].setZ(-1.0*(1.0+0.5*3.50)*2.54*cm);
623 
624  // Right Slider: Downstream Inner Box
625  LocalTranslation_InnerBox_Subtract[3].setX(+1.0*(0.5*203.20*mm));
626  LocalTranslation_InnerBox_Subtract[3].setY(0.0*cm);
627  LocalTranslation_InnerBox_Subtract[3].setZ(+1.0*(1.0+0.5*3.50)*2.54*cm);
628 
629 
630  // dummy rotation matrix
631  G4RotationMatrix LocalRotation_InnerBox_Subtraction;
632 
633  G4Transform3D Transform3D_InnerUpstreamSubtraction_LeftSlider(LocalRotation_InnerBox_Subtraction, LocalTranslation_InnerBox_Subtract[0] );
634  //
635  SliderSupportSubtraction_TempSolid[4] = new G4SubtractionSolid ("SliderLeft-InnerUpstreamBox",
636  SliderSupportLeft_Solid,
637  //SliderSupportSubtraction_TempSolid[1],
638  SubtractInnerBox_Solid,
639  Transform3D_InnerUpstreamSubtraction_LeftSlider);
640 
641  G4Transform3D Transform3D_InnerUpstreamSubtraction_RightSlider(LocalRotation_InnerBox_Subtraction, LocalTranslation_InnerBox_Subtract[2] );
642  //
643  SliderSupportSubtraction_TempSolid[5] = new G4SubtractionSolid ("SliderRight-InnerUpstreamBox",
644  SliderSupportRight_Solid,
645  //SliderSupportSubtraction_TempSolid[1],
646  SubtractInnerBox_Solid,
647  Transform3D_InnerUpstreamSubtraction_RightSlider);
648 
649 
650  G4Transform3D Transform3D_InnerDownstreamSubtraction_LeftSlider(LocalRotation_InnerBox_Subtraction, LocalTranslation_InnerBox_Subtract[1] );
651  //
652  SliderSupportSubtraction_TempSolid[6] = new G4SubtractionSolid ("SliderLeft-InnerDownstreamBox",
654  SubtractInnerBox_Solid,
655  Transform3D_InnerDownstreamSubtraction_LeftSlider);
656 
657  G4Transform3D Transform3D_InnerDownstreamSubtraction_RightSlider(LocalRotation_InnerBox_Subtraction, LocalTranslation_InnerBox_Subtract[3] );
658  //
659  SliderSupportSubtraction_TempSolid[7] = new G4SubtractionSolid ("SliderRight-InnerDownstreamBox",
661  SubtractInnerBox_Solid,
662  Transform3D_InnerDownstreamSubtraction_RightSlider);
663 
664 
665  //-------------------------------------------------------------------------------------------------------------------------------
666  G4Box* SubtractBottomBox_Solid = new G4Box("SubtractBottomBox_Solid",
667  0.5 * 2*3.25*2.54*cm,
668  0.5 * kSliderSupport_FullLength_Y +0.1*mm,
669  0.5 * 9.00*2.54*cm);
670 
671 
672  std::vector< G4ThreeVector > LocalTranslation_BottomBox_Subtract;
673  LocalTranslation_BottomBox_Subtract.clear();
674  LocalTranslation_BottomBox_Subtract.resize(2);
675 
676  // Left Slider: Bottom Box
677  LocalTranslation_BottomBox_Subtract[0].setX(+1.0*(0.5*203.20*mm));
678  LocalTranslation_BottomBox_Subtract[0].setY(0.0*cm);
679  LocalTranslation_BottomBox_Subtract[0].setZ(0.0*cm);
680 
681  // Right Slider: Bottom Box
682  LocalTranslation_BottomBox_Subtract[1].setX(-1.0*(0.5*203.20*mm));
683  LocalTranslation_BottomBox_Subtract[1].setY(0.0*cm);
684  LocalTranslation_BottomBox_Subtract[1].setZ(0.0*cm);
685 
686 
687 
688  // dummy rotation matrix
689  G4RotationMatrix LocalRotation_BottomBox_Subtraction;
690 
691  G4Transform3D Transform3D_BottomSubtraction_LeftSlider(LocalRotation_BottomBox_Subtraction, LocalTranslation_BottomBox_Subtract[0] );
692  //
693  SliderSupportSubtraction_TempSolid[8] = new G4SubtractionSolid ("SliderLeft-BottomBox",
694  //SliderSupportLeft_Solid,
696  SubtractBottomBox_Solid,
697  Transform3D_BottomSubtraction_LeftSlider);
698 
699  G4Transform3D Transform3D_BottomSubtraction_RightSlider(LocalRotation_BottomBox_Subtraction, LocalTranslation_BottomBox_Subtract[1] );
700  //
701  SliderSupportSubtraction_TempSolid[9] = new G4SubtractionSolid ("SliderRight-BottomBox",
702  //SliderSupportRight_Solid,
704  SubtractBottomBox_Solid,
705  Transform3D_BottomSubtraction_RightSlider);
706  //-------------------------------------------------------------------------------------------------------------------------------
707  G4Box* SubtractOuterBox_Solid = new G4Box("SubtractOuterBox_Solid",
708  0.5 * 6.82*2.54*cm + 0.1*mm,
709  0.5 * kSliderSupport_FullLength_Y +0.1*mm,
710  0.5 * (2*1.937)*2.54*cm);
711 
712 
713  std::vector< G4ThreeVector > LocalTranslation_OuterBox_Subtract;
714  LocalTranslation_OuterBox_Subtract.clear();
715  LocalTranslation_OuterBox_Subtract.resize(2);
716 
717  // Upstream Outer Box
718  LocalTranslation_OuterBox_Subtract[0].setX(0.0*cm);
719  LocalTranslation_OuterBox_Subtract[0].setY(0.0*cm);
720  LocalTranslation_OuterBox_Subtract[0].setZ(-1.0*(4.50+2.527)*2.54*cm);
721 
722  // Downstream Outer Box
723  LocalTranslation_OuterBox_Subtract[1].setX(0.0*cm);
724  LocalTranslation_OuterBox_Subtract[1].setY(0.0*cm);
725  LocalTranslation_OuterBox_Subtract[1].setZ(+1.0*(4.50+2.527)*2.54*cm);
726 
727 
728  // dummy rotation matrix
729  G4RotationMatrix LocalRotation_OuterBox_Subtraction;
730 
731  G4Transform3D Transform3D_OuterUpstreamSubtraction(LocalRotation_OuterBox_Subtraction, LocalTranslation_OuterBox_Subtract[0] );
732 
733  SliderSupportSubtraction_TempSolid[0] = new G4SubtractionSolid ("SliderLeft-OuterUpstreamBox",
734  //SliderSupportLeft_Solid,
736  SubtractOuterBox_Solid,
737  Transform3D_OuterUpstreamSubtraction);
738 
739  SliderSupportSubtraction_TempSolid[1] = new G4SubtractionSolid ("SliderRight-OuterUpstreamBox",
740  //SliderSupportRight_Solid,
742  SubtractOuterBox_Solid,
743  Transform3D_OuterUpstreamSubtraction);
744 
745  G4Transform3D Transform3D_OuterDownstreamSubtraction(LocalRotation_OuterBox_Subtraction, LocalTranslation_OuterBox_Subtract[1] );
746 
747  SliderSupportSubtraction_TempSolid[2] = new G4SubtractionSolid ("SliderLeft-OuterDownstreamBox",
749  SubtractOuterBox_Solid,
750  Transform3D_OuterDownstreamSubtraction);
751 
752  SliderSupportSubtraction_TempSolid[3] = new G4SubtractionSolid ("SliderRight-OuterDownstreamBox",
754  SubtractOuterBox_Solid,
755  Transform3D_OuterDownstreamSubtraction);
756 
757 
758  //-------------------------------------------------------------------------------------------------------------------------------
759 
760 
761 
762  //==================================================================================================
763  // Define final SliderSupport logical volume
764  //==================================================================================================
765  G4cout << G4endl << "###### QweakSimVDCRotator: Define SliderSupport_Logical " << G4endl << G4endl;
766 
768  SliderSupport_Material,
769  "SliderSupportLeft_Logical",
770  0,
771  0,0);
772 
774  SliderSupport_Material,
775  "SliderSupportRight_Logical",
776  0,
777  0,0);
778  //==================================================================================================
779 
780  //Make it pretty...
781  G4Colour blue (0.,0.,1.);
782  G4Colour mangenta (237/255.,173/255.,255/255.);
783  G4Colour mangenta1 (104/255., 49/255., 94/255.);
784  G4Colour aluminum ( 169/255. , 172/255. , 182/255.);
785  G4Color lightsteelblue ( 176/255. , 196/255. , 222/255.);
786  //**********************************************************************************
787  G4VisAttributes* SliderSupport_VisAtt = new G4VisAttributes(lightsteelblue);
788  SliderSupport_VisAtt ->SetVisibility(true);
789  SliderSupportLeft_Logical ->SetVisAttributes(SliderSupport_VisAtt);
790  SliderSupportRight_Logical ->SetVisAttributes(SliderSupport_VisAtt);
791  //**********************************************************************************
792 
795 
796 } // end of ConstructSliderSupport()
797 
798 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
799 
800 // pkg = 1 or pkg = 2
801 
803 {
804 
805  G4ThreeVector* leftcenter = new G4ThreeVector();
806  G4ThreeVector* rightcenter = new G4ThreeVector();
807 
808 
809  // set the vectors to the center of left and right slider support
810  // located at 12 o'clock. Then rotate these vectors to the final
811  // positions and extract the new vector components
812  // This procedure is easier than the calculation by hand
813 
814 
815  leftcenter->setX(-1.0*kSliderSupport_CenterPositionInX);
816  leftcenter->setY( kSliderSupport_CenterPositionInY);
817  //leftcenter->setZ( kSliderSupport_CenterPositionInZ);
818 
819  rightcenter->setX( kSliderSupport_CenterPositionInX);
820  rightcenter->setY( kSliderSupport_CenterPositionInY);
821  //rightcenter->setZ( kSliderSupport_CenterPositionInZ);
822 
823  // rotate center vector to coils
824  //leftcenter ->rotateZ(kAngle_GlobalRotation);
825  //rightcenter ->rotateZ(kAngle_GlobalRotation);
826 
827 
828  double reverser = 1.0;
829  if(pkg == 2)
830  reverser = -1.0;
831 
832  Translation_LeftSliderSupport.setX( reverser*leftcenter->y() );
833  Translation_LeftSliderSupport.setY( reverser*leftcenter->x() );
834  //Translation_LeftSliderSupport.setZ( leftcenter->z() );
835 
836  Translation_RightSliderSupport.setX( reverser*rightcenter->y() );
837  Translation_RightSliderSupport.setY( reverser*rightcenter->x() );
838  //Translation_RightSliderSupport.setZ( rightcenter->z() );
839 
840 
841  // since the SingleCoil_ClampPlate_Logical is defined for a vertical orientation
842  // but the translation assumes a horizontal orinetation, we have to subtract 90*deg
843  Rotation_SliderSupportLeft = new G4RotationMatrix();
844  //Rotation_SliderSupportLeft->rotateZ(kAngle_GlobalRotation -90*degree + (pkg-1)*180.0*degree);
845  Rotation_SliderSupportLeft->rotateZ( -90*degree + (pkg-1)*180.0*degree);
846 
847  Rotation_SliderSupportRight = new G4RotationMatrix();
848  //Rotation_SliderSupportRight->rotateZ(kAngle_GlobalRotation -90*degree + (pkg-1)*180.0*degree);
849  Rotation_SliderSupportRight->rotateZ( -90*degree + (pkg-1)*180.0*degree);
850 
851 
852  //place sliders for package 1, 2
853 
854  SliderSupportLeft_Physical.at(pkg-1) = new G4PVPlacement(Rotation_SliderSupportLeft,
856  Form("SliderSupportLeft_Pkg%d_Physical",pkg),
859  false,
860  0,
861  pSurfChk);
862 
863  SliderSupportRight_Physical.at(pkg-1) = new G4PVPlacement(Rotation_SliderSupportRight,
865  Form("SliderSupportRight_Pkg%d_Physical",pkg),
868  false,
869  0,
870  pSurfChk);
871 
872 } // end of PlacePV_SliderSupport()
873 
874 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
875 void QweakSimVDCRotator::SetRingMaterial(G4String materialName)
876 {
877 //---------------------------------------------------------------------------------------------
878 //! Sets the material of the skider rings
879  /*!
880 
881  \param materialName Name of the material defined in class QweakSimG4Material
882 
883  */
884 //---------------------------------------------------------------------------------------------
885 
886  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
887 
888  if (pttoMaterial)
889  {
890  UpstreamRing_Logical ->SetMaterial(pttoMaterial);
891  DownstreamRing_Logical ->SetMaterial(pttoMaterial);
892  }
893 }
894 
895 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
896 void QweakSimVDCRotator::SetRotationAngleInPhi(G4double vdc_phiangle)
897 {
898  G4cout << G4endl << "###### Calling QweakSimVDCRotator::SetRotationAngleInPhi() " << G4endl << G4endl;
899 
900  kAngle_GlobalRotation = vdc_phiangle -90.0*degree;
901 
902  G4RotationMatrix* Rotation_RotatorMasterContainer = new G4RotationMatrix();
903  Rotation_RotatorMasterContainer->setPhi(vdc_phiangle);
904  RotatorMasterContainer_Physical->SetRotation(Rotation_RotatorMasterContainer);
905 
906 }
907 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
908 
909 
910 //=======================================================
911 // -----------------------
912 // | CVS File Information |
913 // -----------------------
914 //
915 // $Revisions$
916 // $Log: QweakSimVDCRotator.cc,v $
917 // Revision 1.2 2006/05/05 21:17:42 grimm
918 // - The orientation of the rod for Left/Right alignment works now for all Phi angles
919 // - More realistic G0 slider : subtraction of solids for building slider profile
920 //
921 // Revision 1.1 2006/05/02 00:47:21 grimm
922 // Initial Implementation of the VDC Rotator based on the design of Paulo Medeiros.
923 //
924 
G4double DownstreamRing_CenterYPosition
G4LogicalVolume * DownstreamRing_Logical
G4RotationMatrix * Rotation_Rail
G4LogicalVolume * SliderSupportRight_Logical
std::vector< G4double > kRod_LR_CenterPositionInX
G4VPhysicalVolume * LeftRail_Physical
static QweakSimMaterial * GetInstance()
QweakSimMaterial * pMaterial
G4double kSliderSupport_FullLength_Z
void PlacePVSliderSupport(int pkg)
std::vector< G4SubtractionSolid * > SliderSupportSubtraction_TempSolid
std::vector< G4VPhysicalVolume * > SliderSupportRight_Physical
G4RotationMatrix * Rotation_Rod_LR
G4double DownstreamRing_CenterXPosition
G4VPhysicalVolume * theMotherVolume
std::vector< G4double > kRod_LR_CenterPositionInZ
G4ThreeVector Translation_RodRightUpstream
G4double UpstreamRing_CenterZPosition
G4double UpstreamRing_CenterXPosition
std::vector< G4double > kRod_LR_CenterPositionInY
G4double kSliderSupport_CenterPositionInX
G4VPhysicalVolume * RightRail_Physical
G4RotationMatrix * Rotation_SliderSupportRight
void SetRotationAngleInPhi(G4double vdc_phiangle)
G4double kSliderSupport_FullLength_X
std::vector< G4VPhysicalVolume * > Rod_LeftRight_Physical
G4ThreeVector Translation_RodLeftUpstream
QweakSimVDCRotator()
Constructor.
G4ThreeVector Translation_RightSliderSupport
G4Material * GetMaterial(G4String material)
G4double kSliderSupport_CenterPositionInY
G4LogicalVolume * Rail_Logical
G4ThreeVector Translation_RightRail
G4ThreeVector Translation_LeftRail
G4VPhysicalVolume * RotatorMasterContainer_Physical
void SetRingMaterial(G4String)
std::vector< G4VPhysicalVolume * > SliderSupportLeft_Physical
G4VPhysicalVolume * UpstreamRing_Physical
~QweakSimVDCRotator()
Destructor.
G4ThreeVector Translation_LeftSliderSupport
G4double kSliderSupport_FullLength_Y
G4ThreeVector Translation_RodRightDownstream
G4RotationMatrix * Rotation_SliderSupportLeft
G4double DownstreamRing_CenterZPosition
static const G4bool pSurfChk
G4double kSliderSupport_CenterPositionInZ
G4double UpstreamRing_CenterYPosition
G4LogicalVolume * UpstreamRing_Logical
G4LogicalVolume * SliderSupportLeft_Logical
G4ThreeVector Translation_RodLeftDownstream
G4LogicalVolume * Rod_LeftRight_Logical
G4VPhysicalVolume * DownstreamRing_Physical