3 #include "G4UIdirectory.hh" 4 #include "G4UIcmdWithAString.hh" 5 #include "G4UIcmdWithABool.hh" 6 #include "G4UIcmdWithAnInteger.hh" 7 #include "G4UIcmdWithADoubleAndUnit.hh" 8 #include "G4UIcmdWithoutParameter.hh" 9 #include "G4UnitsTable.hh" 11 #include "G4Material.hh" 14 #include "G4Polycone.hh" 18 #include "G4LogicalVolume.hh" 19 #include "G4ThreeVector.hh" 20 #include "G4PVPlacement.hh" 21 #include "G4SubtractionSolid.hh" 22 #include "G4UnionSolid.hh" 23 #include "G4VisAttributes.hh" 25 #include "G4Transform3D.hh" 26 #include "G4RotationMatrix.hh" 27 #include "G4PVReplica.hh" 28 #include "G4AssemblyVolume.hh" 30 #include "G4PhysicalVolumeStore.hh" 31 #include "G4LogicalVolumeStore.hh" 32 #include "G4PVPlacement.hh" 33 #include "G4RegionStore.hh" 34 #include "G4SolidStore.hh" 35 #include "G4GeometryManager.hh" 36 #include "G4FieldManager.hh" 40 #include "G4VisExtent.hh" 53 Create(
"Horn1TargetDownstrHeContainer");
71 posTmp[2] = -1.0*plM1->
fParams[2]/2.0 + infoTmpRLeft.
fParams[2]/2. + 1.0*CLHEP::mm;
73 int copyNumberHere = 0;
74 bool transitionDone =
false;
76 if (!transitionDone) {
79 if (posTmp[2] > plM1->
fParams[2]/2.0) {
80 transitionDone =
true;
85 std::ostringstream cNumStrStr; cNumStrStr <<
"_P" << copyNumber;
88 posTmp[2] -= 10.0*CLHEP::mm;
90 new G4PVPlacement((G4RotationMatrix *) 0,
91 posTmp, infoTmpRLeft.
fCurrent, G4String(
"TargetAlignmentRingLeft")+cNumStrStr.str(),
93 new G4PVPlacement((G4RotationMatrix *) 0,
94 posTmp, infoTmpRRight.
fCurrent, G4String(
"TargetAlignmentRingRight")+ cNumStrStr.str(),
97 copyNumber++; copyNumberHere++;
104 infoTargSegFirst =
Create(
"Horn1TargetSegmentFirst");
105 G4PVPlacement *vTargSegFirst =
PlaceFinal(
"Horn1TargetSegmentFirst", vMHe);
106 Create(
"Horn1TargetFinVertFirst");
108 Create(
"Horn1TargetCoolingTubeFirstWater");
110 G4PVPlacement *vTubeUp =
new G4PVPlacement((G4RotationMatrix *) 0,
111 posTmp, plCoolingTubeFirst->
fCurrent,
112 G4String(
"Horn1TargetSegmentCoolingTubeFirst_PTop"),
115 G4PVPlacement *vTubeDown =
new G4PVPlacement((G4RotationMatrix *) 0,
116 posTmp, plCoolingTubeFirst->
fCurrent,
117 G4String(
"Horn1TargetSegmentCoolingTubeFirst_PBottom"),
119 PlaceFinal(
"Horn1TargetCoolingTubeFirstWater", vTubeDown);
120 PlaceFinal(
"Horn1TargetCoolingTubeFirstWater", vTubeUp);
121 PlaceFinal(
"Horn1TargetFinVertFirst", vTargSegFirst);
126 Create(G4String(
"TargetFinVertCornerDownstrFirstUpLeft"));
128 Create(G4String(
"TargetFinVertCornerDownstrFirstUpRight"));
130 Create(G4String(
"TargetFinVertCornerDownstrFirstDwnLeft"));
132 Create(G4String(
"TargetFinVertCornerDownstrFirstDwnRight"));
137 new G4PVPlacement((G4RotationMatrix *) 0,
138 posTmp, plTargetFinCorDFUpLeft->
fCurrent,
139 G4String(
"Horn1TargetFinVertCornerDownstrFirstUpLeft_P"),
142 new G4PVPlacement((G4RotationMatrix *) 0,
143 posTmp, plTargetFinCorDFUpRight->
fCurrent,
144 G4String(
"Horn1TargetFinVertCornerDownstrFirstUpRight_P"),
148 new G4PVPlacement((G4RotationMatrix *) 0,
149 posTmp, plTargetFinCorDFDwnLeft->
fCurrent,
150 G4String(
"Horn1TargetFinVertCornerDownstrFirstDwnLeft_P"),
153 new G4PVPlacement((G4RotationMatrix *) 0,
154 posTmp, plTargetFinCorDFDwnRight->
fCurrent,
155 G4String(
"Horn1TargetFinVertCornerDownstrFirstDwnRight_P"),
165 double zCoordTmp = (infoTargSegFirst == 0) ?
166 (-1.0*plDowstrHe->
fParams[2]/2. + plTargetUpstrDownstrSegment->
fParams[2]/2. + 0.005*CLHEP::mm) :
168 plTargetUpstrDownstrSegment->
fParams[2]/2. + 0.002*CLHEP::mm);
170 posTmp[0] = 0.; posTmp[1] = 0.;
171 posTmp[2] = zCoordTmp;
173 std::ostringstream cNumStrStr; cNumStrStr <<
"_P" << iSeg;
174 new G4PVPlacement((G4RotationMatrix *) 0,
175 posTmp, plTargetUpstrDownstrSegment->
fCurrent,
176 G4String(
"Horn1TargetSegment")+cNumStrStr.str(),
182 posTmp[0] = 0.; posTmp[1] = 0.;
183 posTmp[2] = plDowstrHe->
fParams[2]/2 -
186 new G4PVPlacement(&plCoolingTubeReturn->
fRotation,
187 posTmp, plCoolingTubeReturn->
fCurrent,
188 G4String(
"Horn1TargetCoolingTubeDwnRetTit_PFront"),
191 new G4PVPlacement(&plCoolingTubeReturn->
fRotation,
192 posTmp, plCoolingTubeReturn->
fCurrent,
193 G4String(
"Horn1TargetCoolingTubeDwnRetTit_PBack"),
196 Create(
"Horn1TargetCoolingTubeDwnRetWater");
197 PlaceFinal(
"Horn1TargetCoolingTubeDwnRetWater", vMHe);
199 Create(
"Horn1TargetDownstrHeContainerCap");
200 PlaceFinal(
"Horn1TargetDownstrHeContainerCap", vMHe);
209 G4Exception(
"LBNEVolumePlacements::RescaleHorn1Lengthwise",
"",
210 FatalErrorInArgument,
" This method can only be called once per job ");
259 G4Exception(
"LBNEVolumePlacements::RescaleHorn1Radially",
"",
260 FatalErrorInArgument,
" This method can only be called once per job ");
308 const double in = 2.54*CLHEP::cm;
437 const double in = 2.54*CLHEP::cm;
440 const double epsilR = 0.050*CLHEP::mm;
441 double zCurrent = 0.;
446 zCurrent += 5.752*in; ;
449 const int numSectEq1 = 5;
450 const double lengthEq1 = 12.896*in/numSectEq1;
451 double zz1 = 3.316*in;
452 for(
int iSect1 = 0; iSect1 != numSectEq1; iSect1++) {
454 const double rr1 =
fHorn1Equations[0].GetVal(zz1) - epsilR - 0.300*CLHEP::mm -0.050*CLHEP::mm*iSect1;
455 zCurrent += lengthEq1;
460 const int numSectEq2 = 8;
461 const double lengthEq2 = (4.9799*in + 9.2262*in)/numSectEq2;
462 for(
int iSect2 = 0; iSect2 != numSectEq2; iSect2++) {
464 const double rr2 =
fHorn1Equations[1].GetVal(zz1) - epsilR - 0.8*CLHEP::mm - 0.1*CLHEP::mm*iSect2;
466 zCurrent += lengthEq2;
472 const double neckRadius = 0.709*in/2.;
475 zCurrent += 1.568*in; zz1 += 1.568*in;
480 const int numSectEq4 = 4;
481 const double lengthEq4 = (36.2709 - 31.8827)*in/numSectEq4;
482 for(
int iSect4 = 0; iSect4 != numSectEq4; iSect4++) {
484 double rr4 =
fHorn1Equations[3].GetVal(zz1) - epsilR - 0.2*CLHEP::mm - 0.1*CLHEP::mm*iSect4;
486 if (iSect4 == 0) rr4 = (rr4 + neckRadius)/2.0;
487 zCurrent += lengthEq4;
493 const int numSectEq5 = 20;
494 const double lengthEq5 = (117.126 - 36.27097)*in/numSectEq5;
495 double rLastParabolic = 0.;
496 for(
int iSect5 = 0; iSect5 != numSectEq5; iSect5++) {
498 const double rr5 =
fHorn1Equations[4].GetVal(zz1) - epsilR - 1.0*CLHEP::mm - 0.1*CLHEP::mm*iSect5;
500 zCurrent += lengthEq5;
504 rLastParabolic = rr5;
506 zCurrent += 14.244*in + 3.0*CLHEP::cm;
512 const double rOut = 16.25*in + 15.0*in + 2.5*CLHEP::cm;
535 const double in = 2.54*CLHEP::cm;
565 std::ostringstream messStrStr;
566 messStrStr <<
" Helium Tube target hitting the neck! zEnd " << zEnd <<
"\n";
567 G4String messStr(messStrStr.str());
568 G4Exception(
"LBNEVolumePlacements::CreateHorn1TopLevelUpstr",
" ",
569 FatalErrorInArgument, messStr.c_str());
572 return this->
Create(
"Horn1TopLevelUpstr");
580 const double in = 2.54*CLHEP::cm;
583 plSmallRing = this->
Find(G4String(
"Check"),
584 G4String(
"TargetNoSplitHeContainer"),
585 G4String(
"LBNEVolumePlacements::CheckHorn1InnerConductAndTargetRadii"));
587 plLargeRing = this->
Find(G4String(
"Check"),
588 G4String(
"Horn1PolyM1"),
589 G4String(
"LBNEVolumePlacements::CheckHorn1InnerConductAndTargetRadii"));
591 const double xOffS = plSmallRing->
fPosition[0] +
594 const double yOffS = plSmallRing->
fPosition[1] +
599 double xOffL = plLargeRing->
fPosition[0] +
602 double yOffL = plLargeRing->
fPosition[1] +
605 double maxLength = -100000.0*
CLHEP::m;
607 if (*il > maxLength ) maxLength = *il;
611 const double xOff = xOffS - xOffL;
612 const double yOff = yOffS - yOffL;
614 const double rSmall = plSmallRing->
fParams[1];
620 const double rLarge = rMinEqn2*ratio0vs1 + (1.0-ratio0vs1)*rMinEqn1;
626 G4String messHeader(
" The downstream end target is touching (or nearly touching) the Horn1 inner conductor \n");
627 if ((
std::abs(xOff) < 0.002*CLHEP::mm) && (
std::abs(yOff) < 0.002*CLHEP::mm)) {
630 std::ostringstream messStrStr;
631 messStrStr << messHeader <<
" Helium Tube radius " << rSmall
632 <<
" Inner cond. radius " << rLarge <<
" \n";
633 messStrStr << messHeader <<
" Suggestion: Reduce fTargetLengthIntoHorn, currently set to " <<
635 G4String messStr(messStrStr.str());
636 G4Exception(
"LBNEVolumePlacements::CheckHorn1InnerConductAndTargetRadii",
" ",
637 FatalErrorInArgument, messStr.c_str());
647 const double rMaxDev = std::sqrt(xOff*xOff + yOff*yOff);
651 std::ostringstream messStrStr;
652 messStrStr << messHeader <<
" Helium Tube radius " << rSmall
653 <<
" Inner cond. radius " << rLarge <<
" \n";
654 messStrStr << messHeader <<
" Tranvser Offset between the two rings " << xOff <<
" / " << yOff <<
"\n";
655 G4String messStr(messStrStr.str());
656 G4Exception(
"LBNEVolumePlacements::CheckHorn1InnerConductAndTargetRadii",
" ",
657 FatalErrorInArgument, messStr.c_str());
671 const double zLengthTotal = z2 - z1;
672 double zLength = zLengthTotal;
679 if (
std::abs(rMid - 0.5*(r0+r1)) < 0.050*CLHEP::mm)
break;
684 if (numSubSect > nMax) {
685 G4Exception(
"LBNEVolumePlacements::GetNumberOfInnerHornSubSections",
" ", FatalErrorInArgument,
" Crazy subdivision! ");
696 double zLocTweakedDC,
double zPosMotherVolume,
697 G4PVPlacement *vMother ) {
699 const double in = 2.54*CLHEP::cm;
700 G4String nameStr(nameStrH);nameStr += G4String(
"Ring");
702 const int eqnNum = (zLocTweakedDC < (41.076*fHorn1LongRescale*in)) ? 5 : 7;
703 const double zSignLength = (eqnNum == 5) ? -1.0 : 1.0;
705 double rTmp1 =
fHorn1Equations[eqnNum].GetVal(zLocTweakedDC + length*zSignLength)
708 const double rr =
fHorn1Equations[eqnNum].GetVal(zLocTweakedDC + length*zSignLength);
711 const double rTmp2 = rTmp1 + 0.24*in;
712 G4Tubs *aTubs =
new G4Tubs(nameStr, rTmp1, rTmp2,
713 length/2. , 0., 360.0*CLHEP::degree);
714 G4LogicalVolume *pCurrent =
new G4LogicalVolume(aTubs, G4Material::GetMaterial(
fHorn1InnerCondMat), nameStr);
715 G4ThreeVector posTmp; posTmp[0] = 0.; posTmp[1] = 0.;
716 posTmp[2] = zPosMotherVolume;
717 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrent, nameStr +
std::string(
"_P"),
722 G4String nameStr2(nameStrH); nameStr2 += G4String(
"Riser");
723 const double heightRiser = 0.333*in - 0.020*CLHEP::mm;
724 const double widthH = 1.5*in;
725 const double thickH = 0.184*2*in;
726 G4Box *aBoxRiser =
new G4Box(nameStr2, widthH/2., heightRiser/2.0, thickH/2.0);
727 G4LogicalVolume *pCurrentRiser =
728 new G4LogicalVolume(aBoxRiser, G4Material::GetMaterial(
fHorn1InnerCondMat), nameStr2);
730 G4String nameStr3(nameStrH); nameStr3 += G4String(
"Hanger");
732 const double widthH2 = 1.0*in;
734 const double thickH2 = 0.031*in;
735 G4Box *aBoxHanger =
new G4Box(nameStr3, widthH2/2., heightH/2.0, thickH2/2.0);
736 G4LogicalVolume *pCurrentHanger =
737 new G4LogicalVolume(aBoxHanger, G4Material::GetMaterial(
fHorn1InnerCondMat), nameStr3);
739 for (
int iRot=0; iRot != 3; iRot++) {
740 std::ostringstream rnStrStr; rnStrStr <<
"_" << (iRot+1);
741 G4String rnStr(rnStrStr.str());
743 G4RotationMatrix * rMatPr = 0;
745 rMatPr =
new G4RotationMatrix;
746 rMatPr->rotateZ(2.0*M_PI/3.);
747 }
else if (iRot == 2) {
748 rMatPr =
new G4RotationMatrix;
749 rMatPr->rotateZ(-2.0*M_PI/3.);
752 const double dHRiser = rTmp2 + 0.010*CLHEP::mm + heightRiser/2.;
753 posTmp[0] = 0.; posTmp[1] = dHRiser;
755 posTmp[0] = dHRiser*rMatPr->xy();
756 posTmp[1] = dHRiser*rMatPr->yy();
759 new G4PVPlacement(rMatPr, posTmp, pCurrentRiser, nameStr2 +
std::string(
"_P") + rnStr,
762 new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentRiser, nameStr2 +
std::string(
"_P") + rnStr,
767 const double dHHanger = rTmp2 + 0.010*CLHEP::mm + 0.5*CLHEP::mm + heightRiser + heightH/2.;
768 posTmp[0] = 0.; posTmp[1] = dHHanger;
770 posTmp[0] = dHHanger*rMatPr->xy();
771 posTmp[1] = dHHanger*rMatPr->yy();
775 new G4PVPlacement(rMatPr, posTmp, pCurrentHanger, nameStr3 +
std::string(
"_P") + rnStr,
778 new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentHanger, nameStr3 +
std::string(
"_P") + rnStr,
790 const double in = 2.54*CLHEP::cm;
843 int numSctTr = 3 + 2;
845 const double radIOTrOut = 2.184*in;
846 const double radIOTrIn = 1.869*in;
847 const double radIOTrAv = 0.5*(radIOTrOut + radIOTrIn);
848 const double deltaRadIOTr = radIOTrOut - radIOTrIn;
850 const double surfXSect = (M_PI - thetaIOTRStart)*(radIOTrOut*radIOTrOut - radIOTrIn*radIOTrIn);
851 const double surfXSectPart = surfXSect/(numSctTr-2);
852 const double bigRadIOTr = 12.756*in;
864 const double zMaxElemZeroUpstr = deltaRadIOTr + 0.010*CLHEP::mm;
919 G4Exception(
"LBNEVolumePlacements::RescaleHorn2Lengthwise",
"",
920 FatalErrorInArgument,
" This method can only be called once per job ");
1002 const double in = 2.54*CLHEP::cm;
1004 G4PVPlacement *vH2 =
PlaceFinal(
"Horn2TopLevel", vH2Hall);
1008 G4ThreeVector posTmp; posTmp[0] =0.; posTmp[1] =0.;
1010 G4LogicalVolume *plugl =
new G4LogicalVolume(plugTube, G4Material::GetMaterial(
fPlugMaterial.c_str()),
"Plug");
1012 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, plugl,
"Plug_P",
1022 double zStartDrawing = 0.;
1029 std::ostringstream nStrStr; nStrStr <<
"Horn2Part" << kPart;
1030 G4String nStr(nStrStr.str());
1031 G4Tubs* tubsPart =
new G4Tubs(nStr, H2InnerRadius,
fHorn2PartsRadii[kPart],
1033 G4LogicalVolume *tubsL =
new G4LogicalVolume(tubsPart, G4Material::GetMaterial(gasMaterial.c_str()), nStr);
1034 G4ThreeVector posTmp; posTmp[0] =0.; posTmp[1] =0.;
1036 posTmp[2] = zPosPart;
1038 G4PVPlacement *vPart =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsL, nStr + std::string(
"_P"),
1050 const double deltaZ = (zEndDrawing - zStartDrawing)/numSubSect;
1053 for (
int iSub = 0; iSub != numSubSect; iSub++) {
1054 const double zzBegin = zStartDrawing + iSub*deltaZ;
1055 const double zzEnd = zzBegin + deltaZ;
1056 std::ostringstream nameStrStr; nameStrStr <<
"Horn2InnerPartIOTransSub" << iSub;
1057 G4String nameStr(nameStrStr.str());
1063 G4Cons *aCons =
new G4Cons(nameStr, rMin1, rMax1,rMin2, rMax2,
1064 (deltaZ - 0.005*CLHEP::mm)/2., 0., 360.0*CLHEP::degree);
1068 G4LogicalVolume *pCurrent =
new G4LogicalVolume(aCons, G4Material::GetMaterial(
fHorn2InnerCondMat), nameStr);
1069 posTmp[0] = 0.; posTmp[1] = 0.;
1070 posTmp[2] = zzBegin + zShiftDrawingIOTrans + deltaZ/2.;
1071 G4PVPlacement *vSub =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrent, nameStr + std::string(
"_P"),
1075 nameStrStr.str(
""); nameStrStr.clear(); nameStrStr <<
"Horn2InnerPartIOTransSub" << iSub <<
"Water";
1076 nameStr = nameStrStr.str();
1079 (deltaZ - 0.0075*CLHEP::mm)/2., 0., 360.0*CLHEP::degree);
1080 G4LogicalVolume *pCurrentW2 =
new G4LogicalVolume(aConsW2, G4Material::GetMaterial(std::string(
"Water")), nameStr);
1081 posTmp[0] = 0.; posTmp[1] = 0.; posTmp[2] =0.;
1082 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrentW2, nameStr + std::string(
"_P"),
1088 std::ostringstream nStrStrTR3; nStrStrTR3 <<
"Horn2IOTransOuterPart" << kOut;
1089 G4String nStrTR3(nStrStrTR3.str());
1093 G4LogicalVolume *tubsLTR3 =
new G4LogicalVolume(tubsPartTR3, G4Material::GetMaterial(
fHorn2AllCondMat), nStr);
1094 posTmp[0] =0.; posTmp[1] =0.;
1096 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLTR3, nStrTR3 + std::string(
"_P"),
1101 G4String nStrTW4(
"Horn2IOTransWeld");
1103 const double weldLength = 0.386*in;
1104 const double zzEnd =
fHorn2LongRescale*5.8610*in - weldLength - 0.050*CLHEP::mm;
1106 const double thick = 0.0775*in;
1107 G4Tubs* tubsPartTW4 =
new G4Tubs(nStrTW4, radius, (radius+thick), weldLength/2., 0., 360.0*CLHEP::degree);
1108 G4LogicalVolume *tubsLTW4 =
new G4LogicalVolume(tubsPartTW4, G4Material::GetMaterial(
fHorn2InnerCondMat), nStr);
1109 posTmp[0] = 0.; posTmp[1] =0.;
1111 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLTW4, nStrTW4 + std::string(
"_P"),
1127 G4String nStrPN2(
"Horn2Part2Neck");
1132 G4Tubs* tubsPartPN2 =
new G4Tubs(nStrPN2, radiusInner, radiusOuter, lengthNeck/2., 0., 360.0*CLHEP::degree );
1133 G4LogicalVolume *tubsLPN2 =
new G4LogicalVolume(tubsPartPN2, G4Material::GetMaterial(
fHorn2InnerCondMat), nStr);
1134 posTmp[0] = 0.; posTmp[1] =0.;
1137 G4PVPlacement *vNeck =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLPN2, nStrPN2 + std::string(
"_P"),
1140 G4String nameStrW5(nStr); nameStrW5 +=
std::string(
"Water");
1142 radiusOuter - 0.001*CLHEP::mm ,
1143 lengthNeck/2. - 0.002*CLHEP::mm, 0., 360.0*CLHEP::degree);
1144 G4LogicalVolume *pCurrentW5 =
new G4LogicalVolume(tubsPartW5, G4Material::GetMaterial(std::string(
"Water")), nameStrW5);
1145 posTmp[0] = 0.; posTmp[1] = 0.; posTmp[2] =0.;
1146 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrentW5, nameStrW5 + std::string(
"_P"),
1153 double zStartDrawingsSubP2[] = {29.800, 36.8888, 41.0248, 43.3660};
1155 double zEndDrawingsSubP2[] = {36.8888, 38.6138, 43.3660, 49.820};
1156 size_t eqnInner[] = {6, 6, 7, 7};
1157 size_t eqnOuter[] = {0, 1, 2 ,3};
1159 for (
size_t kSub=0; kSub!=4; kSub++) {
1165 const double zShiftTmp = zStartDrawingPP2 -
fHorn2LongRescale*zStartDrawingsSubP2[0]*in;
1167 const double deltaZ = (zEndDrawingPP2 - zStartDrawingPP2)/numSubSect;
1171 for (
int iSub = 0; iSub != numSubSect; iSub++) {
1172 const double zzBegin = zStartDrawingPP2 + iSub*deltaZ;
1173 const double zzEnd = zzBegin + deltaZ;
1174 std::ostringstream nameStrStr;
1175 nameStrStr <<
"Horn2InnerPart" << kPart <<
"NeckkSub" << kSub <<
"iSub" << iSub;
1176 G4String nameStr(nameStrStr.str());
1184 G4Cons *aCons =
new G4Cons(nameStr, rMin1, rMax1,rMin2, rMax2,
1185 (deltaZ - 0.005*CLHEP::mm)/2., 0., 360.0*CLHEP::degree);
1187 G4LogicalVolume *pCurrent =
new G4LogicalVolume(aCons, G4Material::GetMaterial(
fHorn2InnerCondMat), nameStr);
1188 posTmp[0] = 0.; posTmp[1] = 0.;
1190 G4PVPlacement *vSub =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrent, nameStr + std::string(
"_P"),
1194 G4String nameStrW6(nameStr); nameStrW6 +=
std::string(
"Water");
1197 (deltaZ - 0.0075*CLHEP::mm)/2., 0., 360.0*CLHEP::degree);
1198 G4LogicalVolume *pCurrentW6 =
new G4LogicalVolume(aConsW6, G4Material::GetMaterial(std::string(
"Water")), nameStrW6);
1199 posTmp[0] = 0.; posTmp[1] = 0.; posTmp[2] =0.;
1200 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrentW6, nameStrW6 + std::string(
"_P"),
1208 std::ostringstream nameStrStr; nameStrStr <<
"Horn2NeckPart" << kPart <<
"WeldDownstr";
1209 G4String nameStr(nameStrStr.str());
1211 const double weldLength = 2.0 * 0.386*in;
1212 const double zzEndForWeld =
fHorn2LongRescale*zEndDrawingsSubP2[3]*in + 0.50*CLHEP::mm;
1216 const double thick = 0.0775*in;
1217 G4Tubs* tubsPartN2P2 =
new G4Tubs(nameStr, radius, (radius+thick), weldLength/2., 0., 360.0*CLHEP::degree);
1218 G4LogicalVolume *tubsLN2P2 =
new G4LogicalVolume(tubsPartN2P2, G4Material::GetMaterial(
fHorn2InnerCondMat), nameStr);
1219 posTmp[0] = 0.; posTmp[1] =0.;
1221 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLN2P2, nameStr + std::string(
"_P"),
1231 G4String nameStr(
"Horn2DownstrPart6");
1235 G4Tubs* tubsDP6 =
new G4Tubs(nameStr, radInner, radOuter, length/2., 0., 360.0*CLHEP::degree);
1236 G4LogicalVolume *tubsLDP6 =
new G4LogicalVolume(tubsDP6, G4Material::GetMaterial(
fHorn2InnerCondMat), nameStr);
1237 posTmp[0] = 0.; posTmp[1] =0.;
1240 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLDP6, nameStr + std::string(
"_P"),
1246 G4String nameStr(
"Horn2DownstrPart6Flange");
1250 G4Tubs* tubsFL6 =
new G4Tubs(nameStr, radInner, radOuter, length/2., 0., 360.0*CLHEP::degree);
1251 G4LogicalVolume *tubsLFL6 =
new G4LogicalVolume(tubsFL6, G4Material::GetMaterial(
fHorn2InnerCondMat), nameStr);
1252 posTmp[0] = 0.; posTmp[1] =0.;
1255 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLFL6, nameStr + std::string(
"_P"),
1264 size_t eqnInner = 6;
1265 size_t eqnOuter = 0;
1270 }
else if (kPart == 4) {
1274 }
else if (kPart == 5) {
1282 const double deltaZ = (zEndDrawing - zStartDrawing)/numSubSect;
1285 double zzEndForWeld = 0.;
1286 for (
int iSub = 0; iSub != numSubSect; iSub++) {
1287 const double zzBegin = zStartDrawing + iSub*deltaZ;
1288 const double zzEnd = zzBegin + deltaZ;
1289 zzEndForWeld = zzEnd;
1290 std::ostringstream nameStrStr; nameStrStr <<
"Horn2InnerPart" << kPart <<
"Sub" << iSub;
1291 G4String nameStr(nameStrStr.str());
1297 G4Cons *aCons =
new G4Cons(nameStr, rMin1, rMax1,rMin2, rMax2,
1298 (deltaZ - 0.005*CLHEP::mm)/2., 0., 360.0*CLHEP::degree);
1300 G4LogicalVolume *pCurrent =
new G4LogicalVolume(aCons,
1302 posTmp[0] = 0.; posTmp[1] = 0.;
1303 posTmp[2] = -fHorn2PartsLengths[kPart]/2 + iSub*deltaZ + deltaZ/2.;
1304 G4PVPlacement *vSub =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrent, nameStr + std::string(
"_P"),
1308 G4String nameStrW(nameStr); nameStrW +=
std::string(
"Water");
1311 (deltaZ - 0.0075*CLHEP::mm)/2., 0., 360.0*CLHEP::degree);
1313 G4LogicalVolume *pCurrentW7 =
new G4LogicalVolume(aConsW7, G4Material::GetMaterial(std::string(
"Water")), nameStrW);
1314 posTmp[0] = 0.; posTmp[1] = 0.; posTmp[2] =0.;
1315 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrentW7, nameStrW + std::string(
"_P"),
1322 std::ostringstream nameStrStr; nameStrStr <<
"Horn2InnerPart" << kPart <<
"Weld";
1323 G4String nameStr(nameStrStr.str());
1325 const double weldLength = 2.0 * 0.386*in;
1326 if (kPart == 1) zzEndForWeld -= weldLength - 0.50*CLHEP::mm;
1327 else zzEndForWeld += 0.50*CLHEP::mm;
1329 const double thick = 0.0775*in;
1332 G4Tubs* tubsPartWe7 =
new G4Tubs(nameStr, radius, (radius+thick), weldLength/2., 0., 360.0*CLHEP::degree);
1333 G4LogicalVolume *tubsLWe7 =
new G4LogicalVolume(tubsPartWe7, G4Material::GetMaterial(
fHorn2InnerCondMat), nameStr);
1334 posTmp[0] = 0.; posTmp[1] =0.;
1335 posTmp[2] = fHorn2PartsLengths[kPart]/2 - weldLength/2. - 0.025*CLHEP::mm;
1336 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLWe7, nameStr + std::string(
"_P"),
1340 zStartDrawing += fHorn2PartsLengths[kPart];
1345 std::ostringstream nStrStrOU; nStrStrOU <<
"Horn2OuterConductor" << kPart;
1346 G4String nStrOU(nStrStrOU.str());
1349 leffOU/2.0, 0., 360.0*CLHEP::degree);
1350 G4LogicalVolume *tubsLOU =
new G4LogicalVolume(tubsPartOU, G4Material::GetMaterial(
fHorn2AllCondMat), nStrOU);
1351 posTmp[0] =0.; posTmp[1] =0.; posTmp[2] =0.;
1352 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLOU, nStrOU + std::string(
"_P"),
1359 std::ostringstream nStrStrOU2; nStrStrOU2 <<
"Horn2OuterConductor" << kPart <<
"Extra";
1360 G4String nStrOU2(nStrStr.str());
1363 leffOU2/2.0, 0., 360.0*CLHEP::degree);
1364 G4LogicalVolume *tubsLOU2 =
new G4LogicalVolume(tubsPartOU2, G4Material::GetMaterial(
fHorn2AllCondMat), nStrOU2);
1365 posTmp[0] =0.; posTmp[1] =0.;
1367 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsLOU2, nStrOU2 + std::string(
"_P"),
1377 G4String nStr(
"Horn2DownstrOuterFlange");
1380 G4LogicalVolume *tubsL =
new G4LogicalVolume(tubsOF1, G4Material::GetMaterial(
fHorn2AllCondMat), nStr);
1381 G4ThreeVector posTmp; posTmp[0] =0.; posTmp[1] =0.;
1383 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, tubsL, nStr + std::string(
"_P"),
1390 const double in = 2.54*CLHEP::cm;
1391 G4PVPlacement* vTop = this->
PlaceFinal(G4String(
"DecayPipeSnout"), tunnel);
1393 G4String(
"LBNEVolumePlacements::PlaceFinalDecayPipeSnout"));
1401 G4RotationMatrix *beamAngleRot =
new G4RotationMatrix;
1402 beamAngleRot->rotateX(-angle);
1405 double boxX = 50.0*in + 0.1*CLHEP::mm;
1406 double boxY = 48.0*in + 0.1*CLHEP::mm;
1407 double boxZ = 24.0*in + 0.1*CLHEP::mm;
1408 G4String boxCStr(
"DecayPipeUpstrWindowCont");
1409 G4Box* aBoxC =
new G4Box(boxCStr, boxX/2., boxY/2., boxZ/2.);
1410 G4LogicalVolume *contL =
new G4LogicalVolume(aBoxC, G4Material::GetMaterial(
"DecayPipeGas"), boxCStr);
1411 G4ThreeVector posTmp; posTmp[0] =0.; posTmp[1] =0.;
1412 posTmp[2] = -plInfoTop->
fParams[2]/2 + boxZ/2. + 0.5*CLHEP::cm;
1413 posTmp[2] += 25.0*in*
std::abs( beamAngleRot->yz());
1415 G4PVPlacement *vCont =
new G4PVPlacement(beamAngleRot, posTmp, contL, boxCStr +
std::string(
"_P"),
1421 boxX -= 0.1*CLHEP::mm;
1422 boxY -= 0.1*CLHEP::mm;
1423 boxZ -= 0.1*CLHEP::mm;
1424 G4String boxFStr(
"DecayPipeUpstrWindowFrame");
1425 G4Box* aBoxF =
new G4Box(boxFStr, boxX/2., boxY/2., boxZ/2.);
1426 G4LogicalVolume *frameL =
new G4LogicalVolume(aBoxF, G4Material::GetMaterial(
"Aluminum"), boxFStr);
1427 posTmp[0] =0.; posTmp[1] =0.; posTmp[2] =0.;
1428 G4PVPlacement *vFrame =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp,
1432 G4String holeFStr(
"DecayPipeUpstrWindowHole");
1434 G4Tubs* holeR =
new G4Tubs(holeFStr, 0., holeRadius, boxZ/2., 0., 360.0*CLHEP::degree);
1436 G4LogicalVolume *holeL =
new G4LogicalVolume(holeR, G4Material::GetMaterial(
"Air"),holeFStr);
1437 G4PVPlacement *vHole =
new G4PVPlacement((G4RotationMatrix *) 0, posTmp,
1441 G4String windAlumStr(
"DecayPipeUpstrWindowAlum");
1445 G4LogicalVolume *windAlumL =
new G4LogicalVolume(windAlum, G4Material::GetMaterial(
"Aluminum"), windAlumStr);
1446 posTmp[2] = -boxZ/2. + 17.1*in + 3.0*CLHEP::mm;
1447 new G4PVPlacement((G4RotationMatrix *) 0, posTmp,
1451 G4String windBerylStr(
"DecayPipeUpstrWindowBeryl");
1452 G4Tubs* windBeryl =
new G4Tubs(windBerylStr, 0.,
1455 G4LogicalVolume *windBerylL =
new G4LogicalVolume(windBeryl, G4Material::GetMaterial(
"Beryllium"), windBerylStr);
1456 posTmp[2] = -boxZ/2. + 17.1*in + 1.0*CLHEP::mm;
1457 new G4PVPlacement((G4RotationMatrix *) 0, posTmp,
1466 const double zLengthTotal = z2 - z1;
1467 double zLength = zLengthTotal;
1474 if (
std::abs(rMid - 0.5*(r0+r1)) < 0.050*CLHEP::mm)
break;
1477 zEnd = z1 + zLength;
1479 if (numSubSect > nMax) {
1480 G4Exception(
"LBNEVolumePlacements::PlaceFinalHorn2",
" ", FatalErrorInArgument,
" Crazy subdivision! ");
1490 const double in = 2.54*CLHEP::cm;
1491 G4String nameStr(nameStrH);nameStr += G4String(
"Ring");
1494 const int eqnNum = 3;
1495 const double zLocDrawing = fHorn2LongRescale*60.4681*in;
1504 G4Tubs *aTubs =
new G4Tubs(nameStr, rTmp1, rTmp2, length/2. , 0., 360.0*CLHEP::degree);
1505 G4LogicalVolume *pCurrent =
new G4LogicalVolume(aTubs, G4Material::GetMaterial(
fHorn2AllCondMat), nameStr);
1506 G4ThreeVector posTmp; posTmp[0] = 0.; posTmp[1] = 0.;
1507 posTmp[2] = fHorn2LongRescale*in*(-0.0180);
1508 new G4PVPlacement((G4RotationMatrix *) 0, posTmp, pCurrent, nameStr +
std::string(
"_P"),
1513 G4String nameStr2(nameStrH); nameStr2 += G4String(
"Riser");
1514 const double heightRiser = 0.333*in - 0.020*CLHEP::mm;
1515 const double widthH = 1.5*in;
1516 const double thickH = 0.184*2*in;
1517 G4Box *aBoxRiser =
new G4Box(nameStr2, widthH/2., heightRiser/2.0, thickH/2.0);
1518 G4LogicalVolume *pCurrentRiser =
1519 new G4LogicalVolume(aBoxRiser, G4Material::GetMaterial(
fHorn2AllCondMat), nameStr2);
1521 G4String nameStr3(nameStrH); nameStr3 += G4String(
"Hanger");
1523 const double widthH2 = 1.0*in;
1525 const double thickH2 = 0.031*in;
1526 G4Box *aBoxHanger =
new G4Box(nameStr3, widthH2/2., heightH/2.0, thickH2/2.0);
1527 G4LogicalVolume *pCurrentHanger =
1528 new G4LogicalVolume(aBoxHanger, G4Material::GetMaterial(
fHorn2AllCondMat), nameStr3);
1530 for (
int iRot=0; iRot != 3; iRot++) {
1531 std::ostringstream rnStrStr; rnStrStr <<
"_" << (iRot+1);
1532 G4String rnStr(rnStrStr.str());
1534 G4RotationMatrix * rMatPr = 0;
1536 rMatPr =
new G4RotationMatrix;
1537 rMatPr->rotateZ(2.0*M_PI/3.);
1538 }
else if (iRot == 2) {
1539 rMatPr =
new G4RotationMatrix;
1540 rMatPr->rotateZ(-2.0*M_PI/3.);
1543 const double dHRiser = rTmp2 + 0.010*CLHEP::mm + heightRiser/2.;
1544 posTmp[0] = 0.; posTmp[1] = dHRiser;
1546 posTmp[0] = dHRiser*rMatPr->xy();
1547 posTmp[1] = dHRiser*rMatPr->yy();
1550 new G4PVPlacement(rMatPr, posTmp, pCurrentRiser, nameStr2 +
std::string(
"_P") + rnStr,
1553 new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentRiser, nameStr2 +
std::string(
"_P") + rnStr,
1558 const double dHHanger = rTmp2 + 0.010*CLHEP::mm + 0.5*CLHEP::mm + heightRiser + heightH/2.;
1559 posTmp[0] = 0.; posTmp[1] = dHHanger;
1561 posTmp[0] = dHHanger*rMatPr->xy();
1562 posTmp[1] = dHHanger*rMatPr->yy();
1566 new G4PVPlacement(rMatPr, posTmp, pCurrentHanger, nameStr3 +
std::string(
"_P") + rnStr,
1569 new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentHanger, nameStr3 +
std::string(
"_P") + rnStr,
1587 std::cerr <<
" LBNEVolumePlacements::ExtendChaseLengthForHorn2, moving beginning of decay pipe downstream by " 1598 parabolic(isParabolic),
1616 std::ostringstream mStrStr; mStrStr <<
" Negative argument, z = " << z
1618 G4String mStr(mStrStr.str());
1619 G4Exception(
"LBNEHornRadialEquation::GetVal",
" ", FatalErrorInArgument, mStr.c_str());
1621 const double radius =
parabolic ? (std::sqrt(argR) +
rOff) : argR;
1629 const double argZ = (3.2645 + 17.876 - 0.031);
1630 const double rTest = this->
GetVal(argZ*25.4*CLHEP::mm*
zResc);
1631 std::cerr <<
" LBNEHornRadialEquation::test1, argZ " << argZ <<
" rTest (mm) " << rTest <<
std::endl;
1633 const double delta = 2.0*rTest - 1.6326*25.4*CLHEP::mm*
rResc;
1634 std::cerr <<
" delta (mm) " << delta <<
" zResc " << zResc <<
" rResc " << rResc <<
std::endl;
1635 if (
std::abs(delta) > 0.127*CLHEP::mm) {
1636 G4Exception(
"LBNEHornRadialEquation::test1",
" ", FatalErrorInArgument,
1637 " Horn1 Equation 0 inconsistent with drawing 363104");
int GetNumberOfInnerHornSubSections(size_t eqn, double z1, double z2, int nMax) const
G4double fPlugInnerRadius
std::vector< G4double > fHorn2UpstrOuterIOTransRadsTwo
std::vector< double > fMotherHorn1AllLengths
std::vector< LBNEHornRadialEquation > fHorn1Equations
G4double fTargetFinHeight
std::vector< G4double > fTargetHorn1ZPositions
int GetNumberOfInnerHorn2SubSections(size_t eqn, double z1, double z2, int nMax) const
void Horn1InstallSpiderHanger(const G4String &name, double zFromStartInnerConduct, double zPos, G4PVPlacement *vMother)
void PlaceFinalDownstrTarget1p2MW(G4PVPlacement *mother)
G4double fHorn2NeckOuterRadius
G4double fHorn2RadialRescale
const LBNEVolumePlacementData * Find(const G4String &name, const char *motherName, const char *method) const
void Horn2InstallSpiderHanger(const G4String &name, G4PVPlacement *vMother)
G4double fHorn2OuterTubeOuterRadMax
G4double fTargetHeContTubeLengthInHorn
std::vector< G4double > fHorn1UpstrOuterIOTransPositions
G4LogicalVolume * fCurrent
G4double fDecayPipeWindowThickAlum
std::vector< G4double > fHorn1UpstrOuterIOTransLengths
G4double fHorn1TopUpstrOuterRad
void setMotherVolumeForHorn1()
G4double GetBeamlineAngle() const
G4double fHorn1IOTransInnerRad
bool fHorn1RadiusBigEnough
G4double fTargetCTubeReturnDownstrThickTitanium
G4String fHorn1AllCondMat
void RescaleHorn2Radially()
G4double fTargetFinLengthSplitDwnstr
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4String fHorn1InnerCondMat
std::vector< G4double > fHorn2UpstrOuterIOTransPositions
G4double fHorn1IOTransLength
G4int fHorn2RadialRescaleCnt
G4double fHorn1TopUpstrLength
void PlaceFinalDownstrTarget(G4PVPlacement *mother)
std::vector< G4double > fHorn2ZEqnChanges
std::vector< G4double > fTargetHorn1InnerRadsUpstr
G4int fHorn1LongRescaleCnt
G4RotationMatrix fRotation
LBNEVolumePlacementData * CreateHorn1TopLevelUpstr()
G4double fPlugOuterRadius
std::map< G4String, LBNEVolumePlacementData > fSubVolumes
G4double fHorn2LengthNominal
std::vector< G4double > fHorn1UpstrOuterIOTransInnerRads
void ExtendChaseLengthForHorn2()
G4double fHorn1TopDownstrOuterRad
std::vector< G4double > fHorn2PartsRadii
G4String fHorn2InnerCondMat
std::vector< G4String > fHorn2IC
G4double fTargetCTubeOuterRadius
G4double fHorn1OuterTubeOuterRad
G4double fHorn2LengthMargin
std::vector< double > fParams
std::vector< G4double > fTargetHorn1Lengths
std::vector< LBNEHornRadialEquation > fHorn2Equations
void RescaleHorn1Radially()
std::string fPlugMaterial
G4double fHorn2DeltaZEntranceToZOrigin
void ShiftHorn2Radially()
std::vector< G4double > fHorn2PartsLengths
G4double fTargetFinLength
G4double fHorn2LongPosition
G4double fDecayPipeLongPosition
void CheckHorn1InnerConductAndTargetRadii()
std::vector< G4double > fHorn2UpstrOuterIOTransLengths
LBNEVolumePlacementData * Create(const G4String &name)
G4int fHorn1RadialRescaleCnt
void PlaceFinalHorn2(G4PVPlacement *mother)
G4double fHorn1RadialSafetyMargin
bool fRemoveTargetAlltogether
std::vector< G4double > fHorn1UpstrInnerRadsOuterUpstr
void RescaleHorn2Lengthwise()
G4double fHorn2NeckZPosition
G4double fHorn1RadialRescale
G4double fDecayPipeWindowRadiusAlum
G4double fHorn2OuterTubeInnerRad
std::vector< G4double > fHorn1UpstrInnerRadsOuterDownstr
bool fCheckVolumeOverLapWC
G4double fHorn1OuterConnectorLength
G4double fTargetCTubeReturnDownstrThickWater
std::vector< G4double > fHorn1UpstrOuterIOTransThicks
G4double fHorn1TopUpstrInnerRad
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
G4double fHorn1IOTransOuterRad
G4double fDecayPipeWindowThickBeryl
G4double fDecayPipeWindowZLocation
std::vector< G4double > fHorn1UpstrInnerRadsDownstr
G4double fHorn1NeckLength
G4double fTargetFinSpacingLength
G4double fHorn1TopDownstrLength
std::vector< G4double > fTargetHorn1TransThick
std::vector< G4double > fHorn1UpstrZPositions
G4double fHorn1LongRescale
std::vector< G4double > fHorn1UpstrInnerRadsUpstr
G4PVPlacement * PlaceFinal(const G4String &name, G4VPhysicalVolume *mother)
G4double fHorn1NeckZPosition
std::vector< G4double > fHorn1UpstrLengths
G4double fHorn2InnerIOTransLength
G4double fHorn2LongRescale
void RescaleHorn1Lengthwise()
std::vector< double > fMotherHorn1AllRads
G4double fHorn1InnerConnectorLength
G4String fHorn2AllCondMat
G4double fHorn2RadialRescaleCst
G4int fHorn2LongRescaleCnt
G4double fWaterLayerThickInHorns
G4double fHorn2NeckInnerRadius
void PlaceFinalDecayPipeSnout(G4PVPlacement *mother)
G4double fHorn2NeckLength
std::vector< G4double > fTargetHorn1InnerRadsDownstr
double GetVal(double z) const
std::vector< G4double > fHorn2UpstrOuterIOTransRadsOne
G4double fHorn2OuterTubeOuterRad
G4double fHorn1OuterTubeInnerRad
G4double fTargetAlignRingSpacing
G4double fTargetLengthIntoHorn
G4double fDecayPipeWindowRadiusBeryl
QTextStream & endl(QTextStream &s)
G4int fTargetNumFinsInHorn
G4double fHorn2OffsetIOTr1
G4double fDecayPipeLength