12 #include <phparameter/PHParameters.h>
16 #include <Geant4/G4Box.hh>
17 #include <Geant4/G4Color.hh>
18 #include <Geant4/G4LogicalVolume.hh>
19 #include <Geant4/G4Material.hh>
20 #include <Geant4/G4RotationMatrix.hh>
21 #include <Geant4/G4PVPlacement.hh>
22 #include <Geant4/G4SubtractionSolid.hh>
23 #include <Geant4/G4MultiUnion.hh>
24 #include <Geant4/G4UnionSolid.hh>
25 #include <Geant4/G4SystemOfUnits.hh>
26 #include <Geant4/G4VisAttributes.hh>
27 #include <Geant4/G4TwoVector.hh>
28 #include <Geant4/G4ExtrudedSolid.hh>
48 const std::string &dnam,
const int lyr)
50 , m_Params(parameters)
93 if (
Verbosity() > 1) { std::cout <<
"Creating Roman Pots" << std::endl; }
112 if( tenSigma_X < 0.01 *
cm || tenSigma_Y < 0.01 *
cm ) {
113 tenSigma_X = 0.01 *
cm;
114 tenSigma_Y = 0.01 *
cm;
117 double virtPlaneDepth = 0.001 *
cm;
120 int NsegmentsOffCenter = int( (tenSigma_X - 0.5*sensorWidth) / sensorWidth + 0.5 );
121 int NhorizontalSegments = 4*NsegmentsOffCenter + 2;
123 double x1 = -sensorWidth/2.0;
124 double x2 = sensorWidth/2.0;
125 double y = tenSigma_Y;
128 std::vector<G4TwoVector> polygon;
130 if( NhorizontalSegments == 2 ) {
132 polygon.push_back({-tenSigma_X, y});
133 polygon.push_back({tenSigma_X, y});
134 polygon.push_back({tenSigma_X, -y});
135 polygon.push_back({-tenSigma_X, -y});
139 for(
int i = 1; i <= NhorizontalSegments; i++ ) {
142 else if( i <= 1 + NsegmentsOffCenter ) {
144 y = tenSigma_Y * sqrt(fabs( 1 - pow( x1/tenSigma_X, 2) ));
145 x2 = x1 + sensorWidth;
147 else if( i <= 1 + 2*NsegmentsOffCenter ) {
148 if( x1 > tenSigma_X ) { y *= -1; }
149 else { y = -tenSigma_Y * sqrt(fabs( 1 - pow( (x1-sensorWidth)/tenSigma_X, 2) ));}
150 x2 = x1 - sensorWidth;
152 else if( i == 2 + 2*NsegmentsOffCenter ) {
154 x2 = x1 - sensorWidth;
156 else if( i <= 2 + 3*NsegmentsOffCenter ) {
158 y = -tenSigma_Y * sqrt(fabs( 1 - pow( x1/tenSigma_X, 2) ));
159 x2 = x1 - sensorWidth;
162 if( x1 < -tenSigma_X ) { y *= -1; }
163 else { y = tenSigma_Y * sqrt(fabs( 1 - pow( (x1+sensorWidth)/tenSigma_X, 2) )); }
164 x2 = x1 + sensorWidth;
167 polygon.push_back({x1, y});
168 polygon.push_back({
x2, y});
175 std::vector<G4ExtrudedSolid::ZSection> zsections = {
176 {-0.51*sensorDepth, {0,0}, 1.0}, {+0.51*sensorDepth, {0,0}, 1.0} };
178 G4ExtrudedSolid *polygonCutOut =
new G4ExtrudedSolid(
"Extruded", polygon, zsections);
180 G4Box *FullPlate =
new G4Box(
"FullPlate",overallSize_X/2., overallSize_Y/2., sensorDepth/2.);
182 G4SubtractionSolid *solidRP =
new G4SubtractionSolid(
"EICG4RPSolid", FullPlate, polygonCutOut);
184 G4LogicalVolume *logicalRP =
new G4LogicalVolume( solidRP,
187 G4VisAttributes *vis =
new G4VisAttributes( G4Color(1.0, 1.0, 0.0, 1.0) );
188 vis->SetForceSolid(
true);
189 logicalRP->SetVisAttributes(vis);
191 G4RotationMatrix *rotm =
new G4RotationMatrix();
192 rotm->rotateY( rotAngle );
194 G4ThreeVector
position = G4ThreeVector(
197 center_Z - enclosureCenter );
199 G4VPhysicalVolume *physicalRP =
new G4PVPlacement( rotm, position, logicalRP,
"EICG4RP",
208 G4Box *CuPlate = (G4Box*)FullPlate->Clone();
209 CuPlate->SetZHalfLength( CuDepth/2.0 );
210 std::vector<G4ExtrudedSolid::ZSection> zsectionsCu = {
211 {-0.51*CuDepth, {0,0}, 1.0}, {+0.51*CuDepth, {0,0}, 1.0} };
212 G4ExtrudedSolid *polygonCutOutCu =
new G4ExtrudedSolid(
"ExtrudedCu", polygon, zsectionsCu);
213 G4SubtractionSolid *solidCu =
new G4SubtractionSolid(
"EICG4RPCuSolid", CuPlate, polygonCutOutCu);
214 G4LogicalVolume *logicalCu =
new G4LogicalVolume( solidCu,
217 G4VisAttributes *visCu =
new G4VisAttributes( G4Color(1.0, 0.0, 1.0, 0.5) );
218 visCu->SetForceSolid(
true);
219 logicalCu->SetVisAttributes(visCu);
220 G4ThreeVector positionCu = G4ThreeVector(
223 center_Z + sensorDepth + CuDepth/2.0 - enclosureCenter );
225 G4VPhysicalVolume *physicalCu =
new G4PVPlacement( rotm, positionCu, logicalCu,
"EICG4RPCu",
233 G4Box *VirtPlate =
new G4Box(
"VirtPlate",overallSize_X/2., overallSize_Y/2., virtPlaneDepth/2.);
234 G4LogicalVolume *logicalVirt =
new G4LogicalVolume( VirtPlate,
237 G4VisAttributes *visVirt =
new G4VisAttributes( G4Color(1.0, 1.0, 1.0, 0.0) );
238 visVirt->SetForceSolid(
true);
239 logicalVirt->SetVisAttributes(visVirt);
241 G4ThreeVector positionVirt = G4ThreeVector(
244 center_Z - sensorDepth/2.0 - virtPlaneDepth - enclosureCenter );
246 G4VPhysicalVolume *physicalVirt =
new G4PVPlacement( rotm, positionVirt, logicalVirt,
"EICG4RPVirt",
258 std::cout <<
"EICG4RP Detector:" << std::endl;
259 if (what ==
"ALL" || what ==
"VOLUME")
261 std::cout <<
"Version 0.1" << std::endl;
262 std::cout <<
"Parameters:" << std::endl;