12 #include <G4Material.hh> 13 #include <G4LogicalVolume.hh> 14 #include <G4VPhysicalVolume.hh> 15 #include <G4PVPlacement.hh> 16 #include <G4VisAttributes.hh> 18 #include <G4Polycone.hh> 20 #include <G4SystemOfUnits.hh> 21 #include <G4PhysicalConstants.hh> 37 =
new G4UIcmdWithADoubleAndUnit(
CommandName(
"argonDepth"),
this);
38 fArgonDepthCMD->SetGuidance(
39 "Set the distance between the flange and the liquid argon.");
40 fArgonDepthCMD->SetParameterName(
"depth",
false);
41 fArgonDepthCMD->SetUnitCategory(
"Length");
44 =
new G4UIcmdWithADoubleAndUnit(
CommandName(
"tpcDepth"),
this);
45 fTPCDepthCMD->SetGuidance(
46 "Set the distance between the flange and TPC origin.");
47 fTPCDepthCMD->SetParameterName(
"depth",
false);
48 fTPCDepthCMD->SetUnitCategory(
"Length");
51 =
new G4UIcmdWithAString(
CommandName(
"vessel"),
this);
52 fVesselTypeCMD->SetGuidance(
53 "Set the type of vessel to be built.");
54 fVesselTypeCMD->SetCandidates(
"CAPTAIN mCAPTAIN");
64 if (cmd==fArgonDepthCMD) {
66 fArgonDepthCMD->GetNewDoubleValue(val));
68 else if (cmd==fTPCDepthCMD) {
70 fTPCDepthCMD->GetNewDoubleValue(val));
72 else if (cmd==fVesselTypeCMD) {
84 SetVesselType(
"CAPTAIN");
86 SetSensitiveDetector(
"cryo",
"segment");
97 return G4ThreeVector(0,0,0);
101 return G4ThreeVector(0,0,-GetTPCDepth());
106 SetTPCDepth(GetArgonDepth()+25*
CLHEP::mm);
108 fInnerVessel.clear();
111 fOuterVessel.clear();
114 for (Shape::reverse_iterator
p = fOuterVessel.rbegin();
115 p != fOuterVessel.rend(); ++
p) {
116 fVesselEnvelope.push_back(*
p);
118 for (Shape::reverse_iterator
p = fInnerVessel.rbegin();
119 p != fInnerVessel.rend(); ++
p) {
120 if (
p->fZ >= fVesselEnvelope.back().fZ)
continue;
121 fVesselEnvelope.push_back(*
p);
123 std::reverse(fVesselEnvelope.begin(), fVesselEnvelope.end());
129 SetTPCDepth(GetArgonDepth()+25*
CLHEP::mm);
131 fInnerVessel.clear();
134 fOuterVessel.clear();
137 for (Shape::reverse_iterator
p = fOuterVessel.rbegin();
138 p != fOuterVessel.rend(); ++
p) {
139 fVesselEnvelope.push_back(*
p);
141 for (Shape::reverse_iterator
p = fInnerVessel.rbegin();
142 p != fInnerVessel.rend(); ++
p) {
143 if (
p->fZ >= fVesselEnvelope.back().fZ)
continue;
144 fVesselEnvelope.push_back(*
p);
146 std::reverse(fVesselEnvelope.begin(), fVesselEnvelope.end());
152 if (fVesselType ==
"CAPTAIN") {
153 DefineCAPTAINVessel();
155 else if (fVesselType ==
"mCAPTAIN") {
156 DefineMiniCAPTAINVessel();
159 std::cout <<
"Undefine vessel type: " << fVesselType <<
std::endl;
163 std::vector<double> conePlanes;
164 std::vector<double> coneMax;
165 std::vector<double> coneMin;
170 for (Shape::reverse_iterator
p = fVesselEnvelope.rbegin();
171 p != fVesselEnvelope.rend();
173 conePlanes.push_back(-
p->fZ);
175 coneMin.push_back(0.0);
178 G4LogicalVolume* logVolume
179 =
new G4LogicalVolume(
180 new G4Polycone(GetName(),
183 coneMin.data(), coneMax.data()),
186 logVolume->SetVisAttributes(G4VisAttributes::Invisible);
194 for (Shape::reverse_iterator
p = fOuterVessel.rbegin();
195 p != fOuterVessel.rend();
197 conePlanes.push_back(-
p->fZ);
198 coneMin.push_back(
p->fInner);
199 coneMax.push_back(
p->fOuter);
202 G4LogicalVolume* logOuterVessel
203 =
new G4LogicalVolume(
204 new G4Polycone(GetName()+
"/OuterVessel",
207 coneMin.data(), coneMax.data()),
208 FindMaterial(
"SS_304"),
209 GetName()+
"/OuterVessel");
210 logOuterVessel->SetVisAttributes(GetColor(logOuterVessel));
212 new G4PVPlacement(NULL,
213 G4ThreeVector(0,0,0),
215 logOuterVessel->GetName(),
228 for (Shape::reverse_iterator
p = fInnerVessel.rbegin();
229 p != fInnerVessel.rend();
231 conePlanes.push_back(-
p->fZ);
232 coneMin.push_back(
p->fInner);
233 coneMax.push_back(
p->fOuter);
236 G4LogicalVolume* logInnerVessel
237 =
new G4LogicalVolume(
238 new G4Polycone(GetName()+
"/InnerVessel",
241 coneMin.data(), coneMax.data()),
242 FindMaterial(
"SS_304"),
243 GetName()+
"/InnerVessel");
244 logInnerVessel->SetVisAttributes(GetColor(logInnerVessel));
246 new G4PVPlacement(NULL,
247 G4ThreeVector(0,0,0),
249 logInnerVessel->GetName(),
261 for (Shape::reverse_iterator
p = fInnerVessel.rbegin();
262 p != fInnerVessel.rend();
264 if (
p->fZ < GetArgonDepth())
continue;
265 conePlanes.push_back(-
p->fZ);
266 coneMin.push_back(0.0);
267 coneMax.push_back(
p->fInner);
269 if (conePlanes.back() < -GetArgonDepth()) {
270 conePlanes.push_back(- GetArgonDepth());
271 coneMin.push_back(0.0);
272 coneMax.push_back(coneMax.back());
276 =
new G4LogicalVolume(
277 new G4Polycone(GetName()+
"/Liquid",
280 coneMin.data(), coneMax.data()),
281 FindMaterial(
"Argon_Liquid"),
282 GetName()+
"/Liquid");
283 fLiquidVolume->SetVisAttributes(GetColor(fLiquidVolume));
285 new G4PVPlacement(NULL,
286 G4ThreeVector(0,0,0),
288 fLiquidVolume->GetName()+
"/Liquid",
294 if (fVesselType ==
"CAPTAIN") {
296 G4LogicalVolume* logImmersed = immersed.
GetPiece();
297 G4ThreeVector
p = GetTPCOffset() - immersed.
GetOffset();
298 new G4PVPlacement(NULL,
301 logImmersed->GetName(),
307 else if (fVesselType ==
"mCAPTAIN") {
309 = Get<MiniCaptImmersedBuilder>(
"mImmersed");
310 G4LogicalVolume* logImmersed = immersed.
GetPiece();
311 G4ThreeVector
p = GetTPCOffset() - immersed.
GetOffset();
312 new G4PVPlacement(NULL,
315 logImmersed->GetName(),
322 std::cout <<
"Undefined immersed volume" <<
std::endl;
333 for (Shape::reverse_iterator
p = fInnerVessel.rbegin();
334 p != fInnerVessel.rend();
336 if (
p->fZ >= GetArgonDepth()-1*
CLHEP::mm)
continue;
337 if (conePlanes.empty() ) {
338 conePlanes.push_back(-GetArgonDepth()+1*
CLHEP::um);
339 coneMin.push_back(0.0);
340 coneMax.push_back(
p->fInner);
342 conePlanes.push_back(-
p->fZ);
343 coneMin.push_back(0.0);
344 coneMax.push_back(
p->fInner);
348 =
new G4LogicalVolume(
349 new G4Polycone(GetName()+
"/Ullage",
352 coneMin.data(), coneMax.data()),
353 FindMaterial(
"Argon_Gas"),
354 GetName()+
"/Ullage");
355 fUllageVolume->SetVisAttributes(GetColor(fUllageVolume));
357 new G4PVPlacement(NULL,
358 G4ThreeVector(0,0,0),
360 fUllageVolume->GetName(),
366 if (fVesselType ==
"CAPTAIN") {
368 G4LogicalVolume* logExposed = exposed.
GetPiece();
369 G4ThreeVector
p(0.0,0.0,-GetArgonDepth());
371 new G4PVPlacement(NULL,
374 logExposed->GetName(),
380 else if (fVesselType ==
"mCAPTAIN") {
382 = Get<MiniCaptExposedBuilder>(
"mExposed");
383 G4LogicalVolume* logExposed = exposed.
GetPiece();
385 G4ThreeVector
p(0.0,0.0,-GetArgonDepth());
387 new G4PVPlacement(NULL,
390 logExposed->GetName(),
398 std::cout <<
"Undefined exposed volume" <<
std::endl;
static constexpr double cm
G4ThreeVector GetOffset()
void SetNewValue(G4UIcommand *cmd, G4String val)
void DefineMiniCAPTAINVessel()
Fill the vessel definition with values for miniCAPTAIN.
G4UIcmdWithADoubleAndUnit * fArgonDepthCMD
CaptCryostatBuilder * fBuilder
G4ThreeVector GetOffset()
G4ThreeVector GetOffset()
G4UIcmdWithAString * fVesselTypeCMD
void SetArgonDepth(double v)
Construct a module from components.
BuilderMessenger(EDepSim::Builder *c, const char *guide=NULL)
void SetTPCDepth(double v)
void DefineCAPTAINVessel()
Fill the vessel definition with values for CAPTAIN.
void SetNewValue(G4UIcommand *cmd, G4String val)
G4ThreeVector GetTPCOffset()
virtual G4LogicalVolume * GetPiece(void)
virtual ~CaptCryostatMessenger()
static unsigned int reverse(QString &chars, unsigned char *level, unsigned int a, unsigned int b)
virtual G4LogicalVolume * GetPiece(void)
static constexpr double mm
virtual ~CaptCryostatBuilder()
G4ThreeVector GetOffset()
G4ThreeVector GetOffset()
virtual G4LogicalVolume * GetPiece(void)
static constexpr double degree
CaptCryostatMessenger(CaptCryostatBuilder *c)
G4String CommandName(G4String cmd)
Build a command name with the directory prefix.
G4UIcmdWithADoubleAndUnit * fTPCDepthCMD
void SetVesselType(std::string v)
virtual G4LogicalVolume * GetPiece(void)
QTextStream & endl(QTextStream &s)
virtual G4LogicalVolume * GetPiece(void)