CaptImmersedBuilder.cc
Go to the documentation of this file.
1 #include "CaptImmersedBuilder.hh"
3 
4 #include "EDepSimBuilder.hh"
5 
6 #include <EDepSimLog.hh>
7 
8 #include <globals.hh>
9 #include <G4Material.hh>
10 #include <G4LogicalVolume.hh>
11 #include <G4VPhysicalVolume.hh>
12 #include <G4PVPlacement.hh>
13 #include <G4VisAttributes.hh>
14 #include <G4Tubs.hh>
15 #include <G4Polyhedra.hh>
16 
17 #include <G4SystemOfUnits.hh>
18 #include <G4PhysicalConstants.hh>
19 
20 
22  : public EDepSim::BuilderMessenger {
23 private:
25 
26 public:
28  : EDepSim::BuilderMessenger(c,"Control the immersed geometry."),
29  fBuilder(c) {
30 
31  };
32 
34  };
35 
36  void SetNewValue(G4UIcommand *cmd, G4String val) {
38  };
39 };
40 
42  SetMessenger(new CaptImmersedMessenger(this));
43  SetSensitiveDetector("cryo","segment");
44 
45  AddBuilder(new CaptDriftRegionBuilder("Drift",this));
46 
47  /// Set the drift region parameters for CAPTAIN.
48  CaptDriftRegionBuilder& drift = Get<CaptDriftRegionBuilder>("Drift");
49  drift.SetApothem(1037.5*CLHEP::mm);
50  drift.SetDriftLength(1000*CLHEP::mm);
51  drift.SetWirePlaneSpacing(3.18*CLHEP::mm);
52 }
53 
55 
57  CaptDriftRegionBuilder& drift = Get<CaptDriftRegionBuilder>("Drift");
58  double radius = drift.GetRadius() + 2*CLHEP::cm;
59  return radius;
60 }
61 
63  CaptDriftRegionBuilder& drift = Get<CaptDriftRegionBuilder>("Drift");
64  double height = drift.GetHeight();
65  return height;
66 }
67 
68 G4LogicalVolume *CaptImmersedBuilder::GetPiece(void) {
69 
70  G4LogicalVolume* logVolume
71  = new G4LogicalVolume(new G4Tubs(GetName(),
72  0.0, GetRadius(), GetHeight()/2,
74  FindMaterial("Argon_Liquid"),
75  GetName());
76  logVolume->SetVisAttributes(GetColor(logVolume));
77  if (GetSensitiveDetector()) {
78  logVolume->SetSensitiveDetector(GetSensitiveDetector());
79  }
80 
81  G4ThreeVector center(0.0,0.0,GetHeight()/2);
82 
83  /// All the space above the drift region.
84  center -= G4ThreeVector(0.0,0.0,0.0);
85 
86  // Put in the drift region.
87  CaptDriftRegionBuilder& drift = Get<CaptDriftRegionBuilder>("Drift");
88  G4LogicalVolume* logDrift = drift.GetPiece();
89  center -= G4ThreeVector(0.0,0.0,drift.GetHeight()/2);
90  fOffset = center + drift.GetOffset();
91  new G4PVPlacement(NULL, // rotation.
92  center, // position
93  logDrift, // logical volume
94  logDrift->GetName(), // name
95  logVolume, // mother volume
96  false, // (not used)
97  0, // Copy number (zero)
98  Check()); // Check overlaps.
99 
100 
101  // Put in the field cage.
102  double fieldInner[] = {drift.GetApothem()+10*CLHEP::mm, drift.GetApothem()+10*CLHEP::mm};
103  double fieldOuter[] = {drift.GetApothem()+13*CLHEP::mm, drift.GetApothem()+13*CLHEP::mm};
104  double fieldPlane[] = {-drift.GetHeight()/2,
105  drift.GetHeight()/2-drift.GetGridPlaneOffset()};
106 
107  G4LogicalVolume *logFieldCage
108  = new G4LogicalVolume(new G4Polyhedra(GetName()+"/FieldCage",
110  6, 2,
111  fieldPlane,
112  fieldInner, fieldOuter),
113  FindMaterial("FR4_Copper"),
114  GetName()+"/FieldCage");
115  logFieldCage->SetVisAttributes(GetColor(logFieldCage));
116 
117  new G4PVPlacement(NULL, // rotation.
118  center, // position
119  logFieldCage, // logical volume
120  logFieldCage->GetName(), // name
121  logVolume, // mother volume
122  false, // (not used)
123  0, // Copy number (zero)
124  Check()); // Check overlaps.
125 
126  return logVolume;
127 }
static constexpr double cm
Definition: Units.h:68
double GetHeight()
Get the total height of the drift region.
double GetGridPlaneOffset()
Get the offset of the grid from the top of the drift region.
void SetNewValue(G4UIcommand *cmd, G4String val)
CaptImmersedBuilder * fBuilder
void SetWirePlaneSpacing(double v)
Set the spacing between the wire planes.
CaptImmersedMessenger(CaptImmersedBuilder *c)
Construct a module from components.
Definition: TG4HitSegment.h:10
BuilderMessenger(EDepSim::Builder *c, const char *guide=NULL)
void SetNewValue(G4UIcommand *cmd, G4String val)
virtual G4LogicalVolume * GetPiece(void)
double GetRadius()
Get the radius of the exposed region. This is calculated.
def center(depos, point)
Definition: depos.py:117
static constexpr double mm
Definition: Units.h:65
static constexpr double degree
Definition: Units.h:161
double GetHeight()
Get the height of the exposed region. This is calculated.
list cmd
Definition: getreco.py:22
virtual G4LogicalVolume * GetPiece(void)