EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Collimator.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Collimator.cxx
1 
2 //_____________________________________________________________________________
3 //
4 // collimator between photon exit window and dipole magnet
5 //
6 //_____________________________________________________________________________
7 
8 //local headers
9 #include "Collimator.h"
10 
11 //Geant headers
12 #include <Geant4/G4LogicalVolume.hh>
13 #include <Geant4/G4NistManager.hh>
14 #include <Geant4/G4Box.hh>
15 #include <Geant4/G4SubtractionSolid.hh>
16 #include <Geant4/G4SystemOfUnits.hh>
17 #include <Geant4/G4PVPlacement.hh>
18 #include <Geant4/G4VisAttributes.hh>
19 
20 
21 //_____________________________________________________________________________
22 Collimator::Collimator(G4double zpos, G4LogicalVolume *top) {
23 
24  //inner aperture in x and y
25  G4double dx = 9.6*cm;
26  G4double dy = 7*cm;
27 
28  //length
29  G4double len = 30*cm;
30 
31  //outer size
32  G4double siz = 50*cm;
33 
34  //collimator shape
35  G4String nam = "Collimator";
36  G4Box *outer = new G4Box(nam, siz/2, siz/2, len/2);
37  G4Box *inner = new G4Box(nam, dx/2, dy/2, len/2);
38  G4SubtractionSolid *shape = new G4SubtractionSolid(nam, outer, inner);
39 
40  //collimator volume
41  G4Material *mat = G4NistManager::Instance()->FindOrBuildMaterial("G4_STAINLESS-STEEL");
42  G4LogicalVolume *vol = new G4LogicalVolume(shape, mat, nam);
43 
44  G4VisAttributes *vis = new G4VisAttributes();
45  vis->SetColor(1, 1, 0);
46  //vis->SetLineWidth(2);
47  vol->SetVisAttributes(vis);
48 
49  //put the collimator to the top volume
50  new G4PVPlacement(0, G4ThreeVector(0, 0, zpos-len/2), vol, nam, top, false, 0);
51 
52 }//Collimator
53 
54 
55 
56 
57 
58 
59 
60 
61 
62 
63 
64 
65 
66 
67 
68 
69 
70 
71 
72 
73