Public Member Functions | Private Member Functions | Private Attributes | List of all members
CaptWirePlaneBuilder Class Reference

#include <CaptWirePlaneBuilder.hh>

Inheritance diagram for CaptWirePlaneBuilder:
EDepSim::Builder

Public Member Functions

 CaptWirePlaneBuilder (G4String name, EDepSim::Builder *parent)
 
virtual ~CaptWirePlaneBuilder ()
 
virtual G4LogicalVolume * GetPiece (void)
 
void SetHeight (double v)
 
double GetHeight () const
 
void SetApothem (double v)
 
double GetApothem () const
 
void SetRadius (double v)
 
double GetRadius () const
 
void SetSpacing (double v)
 
double GetSpacing () const
 
void SetMaxWireCount (int v)
 
int GetMaxWireCount () const
 
- Public Member Functions inherited from EDepSim::Builder
 Builder (G4String n, EDepSim::UserDetectorConstruction *c)
 
 Builder (G4String n, EDepSim::Builder *parent)
 
virtual ~Builder ()
 
G4String GetName (void)
 Return the base name of the object that this builds. More...
 
G4String GetLocalName (void)
 Return the base name of the object that this builds. More...
 
void SetLocalName (const G4String &name)
 Set the base name of the logical volume that this builds. More...
 
void SetOpacity (double v)
 Set the relative opacity of the constructed object. More...
 
double GetOpacity (void) const
 Get the relative opacity of the constructed object. More...
 
void SetDaughterOpacity (double v)
 Set the relative opacity of the object daughters. More...
 
EDepSim::UserDetectorConstructionGetConstruction (void)
 Return the detector construction that is building this piece. More...
 
virtual void SetSensitiveDetector (G4VSensitiveDetector *s)
 Set the sensitive detector for this component. More...
 
virtual G4VSensitiveDetector * GetSensitiveDetector (void)
 Get the sensitive detector for this component. More...
 
virtual void SetSensitiveDetector (G4String name, G4String type)
 Set the sensitive detector for this component by name. More...
 
virtual void SetMaximumHitSagitta (double sagitta)
 
virtual void SetMaximumHitLength (double length)
 Set the maximum length of a single hit segment. More...
 
G4UImessenger * GetMessenger (void)
 Return the messenger for this constructor. More...
 
void SetMessenger (G4UImessenger *m)
 Set the messenger for this constructor. More...
 
void AddBuilder (EDepSim::Builder *c)
 
template<class T >
T & Get (G4String n)
 
template<class T >
T * Find (G4String n)
 
bool Check ()
 
void SetCheck (bool v)
 Set the check value. More...
 

Private Member Functions

void Init (void)
 

Private Attributes

double fApothem
 The radius of the circle that can fit inside the wire plane. More...
 
double fHeight
 The thickness of the wire plane. More...
 
double fSpacing
 The wire to wire spacing. More...
 
int fMaxWireCount
 The maximum number of wires in the plane. More...
 

Additional Inherited Members

- Protected Member Functions inherited from EDepSim::Builder
G4Material * FindMaterial (G4String m)
 
G4VisAttributes GetColor (G4LogicalVolume *volume, double opacity=0.0)
 
G4VisAttributes GetColor (G4Material *volume, double opacity=0.0)
 

Detailed Description

Construct an unrotated wire plane. In the local coordinate system, the wires are oriented along the Y axis, and the wire number increases from negative X to positive X. The electric field points along the Z axis, or in other words, into the drift region, and electrons drift from positive Z toward the planes (i.e. in the negative Z direction).

The wires are not "tubes", but are boxes that represent the area overwhich the wire will measure charge. The name of the wire planes is significant since captevent will assigned a geometry identifier based on the name "XPlane", "UPlane", "VPlane". There can only be one with each name.

Definition at line 19 of file CaptWirePlaneBuilder.hh.

Constructor & Destructor Documentation

CaptWirePlaneBuilder::CaptWirePlaneBuilder ( G4String  name,
EDepSim::Builder parent 
)
inline

Definition at line 21 of file CaptWirePlaneBuilder.hh.

22  : EDepSim::Builder(name,parent) {Init();};
static QCString name
Definition: declinfo.cpp:673
CaptWirePlaneBuilder::~CaptWirePlaneBuilder ( )
virtual

Definition at line 91 of file CaptWirePlaneBuilder.cc.

91 {}

Member Function Documentation

double CaptWirePlaneBuilder::GetApothem ( ) const
inline

Definition at line 41 of file CaptWirePlaneBuilder.hh.

41 {return fApothem;}
double fApothem
The radius of the circle that can fit inside the wire plane.
double CaptWirePlaneBuilder::GetHeight ( ) const
inline

Definition at line 34 of file CaptWirePlaneBuilder.hh.

34 {return fHeight;}
double fHeight
The thickness of the wire plane.
int CaptWirePlaneBuilder::GetMaxWireCount ( ) const
inline

Definition at line 63 of file CaptWirePlaneBuilder.hh.

63 {return fMaxWireCount;}
int fMaxWireCount
The maximum number of wires in the plane.
G4LogicalVolume * CaptWirePlaneBuilder::GetPiece ( void  )
virtual

Construct and return a G4 volume for the object. This is a pure virtual function, which means it must be implemented by the inheriting classes. This returns an unplaced logical volume which faces along the Z axis.

Implements EDepSim::Builder.

Definition at line 93 of file CaptWirePlaneBuilder.cc.

93  {
94 
95  double rInner[] = {0.0, 0.0};
96  double rOuter[] = {GetApothem(), GetApothem()};
97  double zPlane[] = {-GetHeight()/2, GetHeight()/2};
98 
99  G4LogicalVolume *logVolume
100  = new G4LogicalVolume(new G4Polyhedra(GetName(),
102  6, 2,
103  zPlane, rInner, rOuter),
104  FindMaterial("Argon_Liquid"),
105  GetName());
106  logVolume->SetVisAttributes(GetColor(FindMaterial("Captain_Wire"), 0.2));
107 
108  if (GetSensitiveDetector()) {
109  logVolume->SetSensitiveDetector(GetSensitiveDetector());
110  }
111 
112  // Determine the maximum (possible) wire length.
113  double maxLength = 2*GetApothem()/std::cos(30*CLHEP::degree);
114 
115  // Determine the number of wires. There is always at least one wire.
116  int wires = int (2.0*GetApothem()/GetSpacing());
117  if (wires<1) wires = 1;
118 
119  if (GetMaxWireCount()>0 && GetMaxWireCount()<wires) {
120  EDepSimLog("Reduce number of wires for " << GetName()
121  << " from " << wires
122  << " to " << GetMaxWireCount());
123  wires = GetMaxWireCount();
124  }
125 
126  EDepSimLog("Construct " << GetName()
127  << " with " << wires << " wires"
128  << " (spacing: " << GetSpacing()/CLHEP::mm << " mm)");
129 
130  if (wires<GetMaxWireCount()) {
131  EDepSimWarn(GetName() << ": Wire count is less than expected:"
132  << " " << wires
133  << " < " << GetMaxWireCount());
134  }
135 
136  G4RotationMatrix* wireRotation = NULL;
137 
138  // The core needs to be rotated into the wire volume. The core is not
139  // used inside the geometry.
140  G4RotationMatrix* coreRotation = new G4RotationMatrix();
141  coreRotation->rotateX(90*CLHEP::degree);
142 
143  // The offset of the first wire.
144  double baseOffset = - 0.5*GetSpacing()*(wires-1);
145  for (int wire = 0; wire<wires; ++wire) {
146  // The position of the wire.
147  double wireOffset = baseOffset + wire*GetSpacing();
148  double wireLength = maxLength-2*std::abs(wireOffset)*std::tan(30*CLHEP::degree);
149  double wireDiameter = std::min(GetHeight()/2, GetSpacing()/4);
150 
151  // Apply a correction to the length account for the corners of the
152  // wire box.
153  wireLength -= 2*GetSpacing()*std::cos(30*CLHEP::degree);
154 
155  G4LogicalVolume* logWire
156  = new G4LogicalVolume(new G4Box(GetName()+"/Wire",
157  GetSpacing()/2,
158  wireLength/2,
159  GetHeight()/2),
160  FindMaterial("Argon_Liquid"),
161  GetName()+"/Wire");
162  logWire->SetVisAttributes(G4VisAttributes::Invisible);
163 
164  if (GetSensitiveDetector()) {
165  logWire->SetSensitiveDetector(GetSensitiveDetector());
166  }
167 
168  new G4PVPlacement(wireRotation, // rotation.
169  G4ThreeVector(wireOffset,0,0), // position
170  logWire, // logical volume
171  logWire->GetName(), // name
172  logVolume, // mother volume
173  false, // (not used)
174  0, // Copy number (zero)
175  false); // Check overlaps.
176 
177  G4LogicalVolume* logCore
178  = new G4LogicalVolume(new G4Tubs(GetName()+"/Wire/Core",
179  0.0, wireDiameter/2.0,
180  wireLength/2,
182  FindMaterial("Captain_Wire"),
183  GetName()+"/Wire/Core");
184  // Draw this as if it was a wire plane.
185  logCore->SetVisAttributes(GetColor(logCore));
186 
187  new G4PVPlacement(coreRotation, // rotation.
188  G4ThreeVector(0,0,0), // position
189  logCore, // logical volume
190  logCore->GetName(), // name
191  logWire, // mother volume
192  false, // (not used)
193  0, // Copy number (zero)
194  false); // Check overlaps.
195 
196 
197 
198  }
199 
200  return logVolume;
201 }
#define EDepSimLog(outStream)
Definition: EDepSimLog.hh:717
G4String GetName(void)
Return the base name of the object that this builds.
virtual G4VSensitiveDetector * GetSensitiveDetector(void)
Get the sensitive detector for this component.
G4Material * FindMaterial(G4String m)
T abs(T value)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
#define EDepSimWarn(outStream)
Definition: EDepSimLog.hh:576
G4VisAttributes GetColor(G4LogicalVolume *volume, double opacity=0.0)
static constexpr double mm
Definition: Units.h:65
static constexpr double degree
Definition: Units.h:161
double CaptWirePlaneBuilder::GetRadius ( ) const
inline

Definition at line 49 of file CaptWirePlaneBuilder.hh.

49 {return fApothem/0.866025403784;}
double fApothem
The radius of the circle that can fit inside the wire plane.
double CaptWirePlaneBuilder::GetSpacing ( ) const
inline

Definition at line 55 of file CaptWirePlaneBuilder.hh.

55 {return fSpacing;}
double fSpacing
The wire to wire spacing.
void CaptWirePlaneBuilder::Init ( void  )
private

Definition at line 80 of file CaptWirePlaneBuilder.cc.

80  {
82  SetApothem(1000*mm);
83  SetSpacing(3*mm);
84  SetHeight(1*mm);
85  SetMaxWireCount(0); // default value used to see if limit is set.
86  SetSensitiveDetector("drift","segment");
89 }
virtual void SetMaximumHitLength(double length)
Set the maximum length of a single hit segment.
void SetMessenger(G4UImessenger *m)
Set the messenger for this constructor.
virtual void SetMaximumHitSagitta(double sagitta)
virtual void SetSensitiveDetector(G4VSensitiveDetector *s)
Set the sensitive detector for this component.
static constexpr double mm
Definition: Units.h:65
void CaptWirePlaneBuilder::SetApothem ( double  v)
inline

Set the radius of the largest cylinder that can be contained in the hexagonal wire plane. This is the maximum local X dimension.

Definition at line 40 of file CaptWirePlaneBuilder.hh.

40 {fApothem = v;}
double fApothem
The radius of the circle that can fit inside the wire plane.
void CaptWirePlaneBuilder::SetHeight ( double  v)
inline

Get the total height (thickness) of the drift region.

Definition at line 33 of file CaptWirePlaneBuilder.hh.

33 {fHeight = v;}
double fHeight
The thickness of the wire plane.
void CaptWirePlaneBuilder::SetMaxWireCount ( int  v)
inline

Get or set the maximum number of wires. The default number of wires is calculated based on the apothem and the wire spacing, but can be limited by SetMaxWireCount().

Definition at line 62 of file CaptWirePlaneBuilder.hh.

62 {fMaxWireCount = v;}
int fMaxWireCount
The maximum number of wires in the plane.
void CaptWirePlaneBuilder::SetRadius ( double  v)
inline

Set the radius of the smallest cylinder that contains the hexagonal wire plane. This is the maximum local Y dimension and is the apothem divided by the cosine of 30 degrees.

Definition at line 48 of file CaptWirePlaneBuilder.hh.

48 {fApothem = v*0.866025403784;}
double fApothem
The radius of the circle that can fit inside the wire plane.
void CaptWirePlaneBuilder::SetSpacing ( double  v)
inline

Get or set the distance between wires.

Definition at line 54 of file CaptWirePlaneBuilder.hh.

54 {fSpacing = v;}
double fSpacing
The wire to wire spacing.

Member Data Documentation

double CaptWirePlaneBuilder::fApothem
private

The radius of the circle that can fit inside the wire plane.

Definition at line 70 of file CaptWirePlaneBuilder.hh.

double CaptWirePlaneBuilder::fHeight
private

The thickness of the wire plane.

Definition at line 73 of file CaptWirePlaneBuilder.hh.

int CaptWirePlaneBuilder::fMaxWireCount
private

The maximum number of wires in the plane.

Definition at line 79 of file CaptWirePlaneBuilder.hh.

double CaptWirePlaneBuilder::fSpacing
private

The wire to wire spacing.

Definition at line 76 of file CaptWirePlaneBuilder.hh.


The documentation for this class was generated from the following files: