QwGeant4
QweakSimWShutters.cc
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // File QweakSimWShutters.cc
4 // Revision 1.0
5 // Date 02/06/2012
6 // Author Kurtis Bartlett
7 //
8 //=============================================================================
9 
10 
11 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
12 
13 #include "QweakSimWShutters.hh"
14 
15 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
17 {
18  WShutters_Logical = NULL;
19  WShutters_Physical = NULL;
20  WShutters_Box = NULL;
21  WShutters_Trap = NULL;
22  WShutters_Solid = NULL;
23  WShutters_Material = NULL;
24  WShutters_VisAtt = NULL;
25 
26  Rot = NULL;
27  WRot = NULL;
28 
29  WShutters_Length_X = 2.687*inch;
32 
33 
34 
38 
40 
41  // get access to material definition
43 }
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
48 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
49 void QweakSimWShutters::ConstructWShutters(G4VPhysicalVolume* MotherVolume)
50 {
51 
52  // assign material
53  WShutters_Material = pMaterial->GetMaterial("TungstenAlloy");
54 
55  G4ThreeVector positionWShutters;
56  G4ThreeVector Trans;
57 
58 
59 
60  Rot = new G4RotationMatrix;
61  Rot->rotateY(-M_PI/2*rad);
62  Trans = G4ThreeVector(-2.688*inch,0,0);
63 
64  WShutters_Box = new G4Box("WShutters_Box", WShutters_Length_X*0.5, WShutters_Length_Y*0.5, WShutters_Length_Z*0.5);
65  WShutters_Trap = new G4Trap("WShutters_Trap", 0.5*WShutters_Length_Z, 0.5*WShutters_Length_Z, 0.5*2.125*inch, 0.5*WShutters_Length_Y,0.5*2.688*inch);
66  WShutters_Solid = new G4UnionSolid("WShutters_Box+WShutters_Trap", WShutters_Box, WShutters_Trap, Rot, Trans);
67 
68  WRot = new G4RotationMatrix;
69  WRot->rotateZ(M_PI*rad);
70 
71  //***************************************************************************
72  // Define WShutters logical and physical volumes
73 
74  WShutters_Logical = new G4LogicalVolume(WShutters_Solid,
76  "WShutters_Log",
77  0,0,0);
78 
79  positionWShutters = G4ThreeVector(WShutters_CenterXPosition,
82 
83  if(WShutterNum==1){
84  WShutters_Physical = new G4PVPlacement(0,
85  positionWShutters,
86  "WShutters",
88  MotherVolume,
89  false,
90  0,
91  pSurfChk);
92  }else if(WShutterNum==2){
93  WShutters_Physical = new G4PVPlacement(WRot,
94  positionWShutters,
95  "WShutters",
97  MotherVolume,
98  false,
99  0,
100  pSurfChk);
101  }
102  //***************************************************************************
103 
104  // Formating
105  G4Color blue (0.,0.,1.);
106 
107  WShutters_VisAtt = new G4VisAttributes(blue);
108  WShutters_VisAtt->SetVisibility(true);
109  WShutters_Logical->SetVisAttributes(WShutters_VisAtt);
110 
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 void QweakSimWShutters::SetWShuttersMaterial(G4String materialName)
115 {
116  // Sets WShutters material
117  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
118  if (pttoMaterial)
119  WShutters_Logical->SetMaterial(pttoMaterial);
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
124 {
125  // Sets X position of the WShutters
127  WShutters_Physical->SetTranslation(G4ThreeVector(WShutters_CenterXPosition,
130 }
131 
132 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
134 {
135  // Sets Y position of the WShutters
137  WShutters_Physical->SetTranslation(G4ThreeVector(WShutters_CenterXPosition,
140 }
141 
142 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
144 {
145  // Sets Z position of the WShutters
147  WShutters_Physical->SetTranslation(G4ThreeVector(WShutters_CenterXPosition,
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153 
154 void QweakSimWShutters::SetWShutters_Material(G4String materialName)
155 {
156  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
157  WShutters_Logical->SetMaterial(pttoMaterial);
158 }
159 
160 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
161 
163 {
164  // Enables the WShutters
165  WShutters_VisAtt->SetVisibility(true);
167  WShutters_Physical->SetTranslation(G4ThreeVector(WShutters_CenterXPosition,
170 
171 
172 }
173 
174 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
175 
177 {
178  // Disables the WShutters by changing the material to air,
179  // moving the wall 5m into the floor and hiding it.
180  WShutters_VisAtt->SetVisibility(true);
181  SetWShutters_Material("Air");
182  WShutters_Physical->SetTranslation(G4ThreeVector(WShutters_CenterXPosition,
183  WShutters_CenterYPosition + 200*cm,
185 
186 }
G4VPhysicalVolume * WShutters_Physical
G4LogicalVolume * WShutters_Logical
QweakSimWShuttersMessenger * WShutters_Messenger
G4double WShutters_CenterXPosition
static QweakSimMaterial * GetInstance()
G4VSolid * WShutters_Solid
G4RotationMatrix * WRot
void SetWShutters_CenterPositionInX(G4double xPos)
G4double WShutters_CenterZPosition
QweakSimMaterial * pMaterial
static const G4bool pSurfChk
~QweakSimWShutters()
Destructor.
G4RotationMatrix * Rot
void ConstructWShutters(G4VPhysicalVolume *)
static const G4double inch
G4double WShutters_CenterYPosition
G4Material * WShutters_Material
void SetWShutters_CenterPositionInY(G4double yPos)
G4Material * GetMaterial(G4String material)
void SetWShutters_CenterPositionInZ(G4double zPos)
QweakSimWShutters(G4int n)
Constructor.
G4VisAttributes * WShutters_VisAtt
void SetWShuttersMaterial(G4String)
void SetWShutters_Material(G4String)