68 if (horizontalWidth <= 0)
69 {
throw BDSException(__METHOD_NAME__,
"option \"horizontalWidth\" is not defined or must be greater than 0 for element \"" +
name +
"\"");}
72 {
throw BDSException(__METHOD_NAME__,
"option \"numberWedges\" is not defined or must be greater than 0 for element \"" +
name +
"\"");}
75 {
throw BDSException(__METHOD_NAME__,
"option \"wedgeLength\" is not defined or must be greater than 0 for element \"" +
name +
"\"");}
77 if (degraderHeight <= 0)
78 {
throw BDSException(__METHOD_NAME__,
"option \"degraderHeight\" is not defined or must be greater than 0 for element \"" +
name +
"\"");}
80 if (degraderHeight > (0.5*horizontalWidth))
81 {
throw BDSException(__METHOD_NAME__,
"option \"degraderHeight\" must be less than 0.5 times \"horizontalWidth\" for element \"" +
name +
"\"");}
83 if ((degraderOffset + baseWidth) > 0.5*horizontalWidth)
84 {
throw BDSException(__METHOD_NAME__,
"option \"degraderOffset\" must be less than (0.5 times \"horizontalWidth\", minus aper1) for element \"" +
name +
"\"");}
87 degraderOffset += baseWidth;
90 G4double minimumWidth = wedgeLength;
91 G4double containerWidth = degraderOffset;
92 if (degraderOffset < minimumWidth)
93 {containerWidth = minimumWidth;}
95 containerSolid =
new G4Box(
name +
"_container_solid",
100 containerLogicalVolume =
new G4LogicalVolume(containerSolid,
102 name +
"_container_lv");
114 G4double addedBasewidth = baseWidth* wedgeWidth/(2.0*wedgeLength) - 10*
lengthSafety;
116 std::vector<G4TwoVector> fullWedgeVertices;
117 std::vector<G4TwoVector> halfWedgeVertices;
120 fullWedgeVertices.push_back(G4TwoVector(0.5*wedgeWidth + addedBasewidth, 0));
121 fullWedgeVertices.push_back(G4TwoVector(0, wedgeLength+baseWidth));
122 fullWedgeVertices.push_back(G4TwoVector(-0.5*wedgeWidth - addedBasewidth, 0));
125 halfWedgeVertices.push_back(G4TwoVector(0, 0));
126 halfWedgeVertices.push_back(G4TwoVector(0.5*wedgeWidth + addedBasewidth, 0));
127 halfWedgeVertices.push_back(G4TwoVector(0, wedgeLength+baseWidth));
130 G4ExtrudedSolid* fullWedge =
new G4ExtrudedSolid(
name +
"_fullwedge_solid",
133 G4TwoVector(),1, G4TwoVector(), 1);
135 G4LogicalVolume* fullWedgeLV =
new G4LogicalVolume(fullWedge,
137 name +
"_fullwedge_lv");
141 G4ExtrudedSolid* halfWedge =
new G4ExtrudedSolid(
name +
"_halfwedge_solid",
144 G4TwoVector(),1, G4TwoVector(), 1);
146 G4LogicalVolume* halfWedgeLV =
new G4LogicalVolume(halfWedge,
148 name +
"_halfwedge_lv");
152 G4VisAttributes* degraderVisAttr =
new G4VisAttributes(colour);
153 fullWedgeLV->SetVisAttributes(degraderVisAttr);
154 halfWedgeLV->SetVisAttributes(degraderVisAttr);
158 G4RotationMatrix* rightRot =
new G4RotationMatrix();
159 rightRot->rotateY(-CLHEP::halfpi);
160 rightRot->rotateX(-CLHEP::halfpi);
163 G4RotationMatrix* leftRot =
new G4RotationMatrix();
164 leftRot->rotateY(CLHEP::halfpi);
165 leftRot->rotateX(-CLHEP::halfpi);
169 G4RotationMatrix* altRightRot =
new G4RotationMatrix();
170 altRightRot->rotateY(CLHEP::halfpi);
171 altRightRot->rotateX(CLHEP::halfpi);
175 for (G4int i = 0; i < (numberWedges + 1); i++)
177 G4String wedgeName =
name +
"_" + std::to_string(i)+
"_pv";
178 if (IsEven(numberWedges))
182 else if (i==numberWedges)
185 {
PlaceWedge(
true, i*wedgeWidth, wedgeName, fullWedgeLV, rightRot);}
187 {
PlaceWedge(
false, i*wedgeWidth, wedgeName, fullWedgeLV, leftRot);}
189 else if (IsOdd(numberWedges))
193 else if (i == numberWedges)
196 {
PlaceWedge(
false, i*wedgeWidth, wedgeName, fullWedgeLV, leftRot);}
198 {
PlaceWedge(
true, i*wedgeWidth, wedgeName, fullWedgeLV, rightRot);}