LBNFConceptDesignHorns.cc
Go to the documentation of this file.
2 
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"
10 
11 #include "G4Material.hh"
12 #include "G4Box.hh"
13 #include "G4Tubs.hh"
14 #include "G4GenericPolycone.hh"
15 #include "G4Trap.hh"
16 #include "G4Cons.hh"
17 #include "G4Torus.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"
24 #include "globals.hh"
25 #include "G4Transform3D.hh"
26 #include "G4RotationMatrix.hh"
27 #include "G4PVReplica.hh"
28 #include "G4AssemblyVolume.hh"
29 #include "LBNEMagneticField.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"
37 
38 #include "LBNERunManager.hh"
39 
40 #include "G4VisExtent.hh"
42 #include "LBNESurveyor.hh"
43 
44 //--- Second file for geometry: the first one (LBNEVolumePlacements) was getting to long --//
45 
47 
48  std::cerr << " LBNEVolumePlacements::PlaceFinalLBNFConceptHornA.. See Integration Drawing F10068454 " << std::endl;
49  std::cerr << " ........... start with upstream IO/layer. " <<std::endl;
51  fZCoordCDRevisedHornA.clear();
52 
53  const bool installOuterConductor = true;
54 // const bool installDownstreamOCFlange = true;
55  const bool installDownstreamIOTransition = true;
56  const bool installCurrentEqualizer = false;
57 
58  const double in = 25.4*CLHEP::mm;
59  const LBNEVolumePlacementData *plDatMother = this->Find(G4String("LBNFConceptHornA"), "Horn1PolyM1",
60  "LBNEVolumePlacements::PlaceFinalLBNFConceptHornA");
61  G4LogicalVolume *volMother = plDatMother->fCurrent;
62  const double lengthMother=plDatMother->fParams[2];
63  const double zShiftMotherCoords = -0.5*lengthMother + fZShiftConceptHornAStartIC + 1.505*CLHEP::mm;
64  std::cerr << " .....Mother Volume name " << volMother->GetName()
65  << " zShiftMother " << zShiftMotherCoords << " lengthMother " << lengthMother << std::endl;
66  const size_t nSegUpstrIO = 6;
67  const double zStartUpstrIOC = -0.5*lengthMother + 1.0*CLHEP::mm; // 0.5 mm clearance,
68  const double deltaPhiUpstrIO = M_PI/(2.0*nSegUpstrIO);
69  const double radInnerUpstIO = 25.0*CLHEP::mm; // Drawing F10068456
70  const double radOuterUpstIO = 50.0*CLHEP::mm; // Drawing F10068456
71  // Out is now dfefined by the most upstream surface segment of the IO .
72  const double radInnerInnerCyl = 43.0*CLHEP::mm;
73  const double thickInner = 2.5*CLHEP::mm;
74  fThickICDRevisedHornA = thickInner; // For the magnetic field map.
75  std::vector<double> zTmps(30, 0.); std::vector<double> rTmps(30, 0.); // more room for later
76  G4ThreeVector zeroC(0., 0., 0.);
77  G4Material *myAlumIC = G4Material::GetMaterial(fHorn1InnerCondMat.c_str());
78  G4Material *myAlumOC = G4Material::GetMaterial(fHorn1AllCondMat.c_str());
79 // G4Material *myAlumina = G4Material::GetMaterial("Alumina");
80 // if (fHorn1AllCondMat.find("Alum") != std::string::npos)
81 // myAlumina = G4Material::GetMaterial(fHorn1AllCondMat.c_str());
82  size_t nSegUpstrIOBy2 = nSegUpstrIO/2;
83  fZCoordCDRevisedHornA.resize(nSegUpstrIOBy2);
84  fRInCoordCDRevisedHornA.resize(nSegUpstrIOBy2);
85 
86 
87  for (size_t kPhi = 0; kPhi != nSegUpstrIO; kPhi++ ) {
88  std::ostringstream aNStrStr; aNStrStr << "LBNFConceptHornAUpstrIOSect" << kPhi;
89  std::string aNStr(aNStrStr.str());
90  const double phi0 = kPhi*deltaPhiUpstrIO + 1.0e-4;
91  const double phi1 = (kPhi+1)*deltaPhiUpstrIO - 1.0e-4;
92  zTmps[0] = zStartUpstrIOC + radOuterUpstIO - radOuterUpstIO*std::sin(phi1);
93  zTmps[1] = zStartUpstrIOC + radOuterUpstIO - radOuterUpstIO*std::sin(phi0);
94  zTmps[2] = zStartUpstrIOC + radOuterUpstIO - radInnerUpstIO*std::sin(phi0);
95  zTmps[3] = zStartUpstrIOC + radOuterUpstIO - radInnerUpstIO*std::sin(phi1);
96  rTmps[0] = radInnerInnerCyl + radOuterUpstIO - radOuterUpstIO*std::cos(phi1);
97  rTmps[1] = radInnerInnerCyl + radOuterUpstIO - radOuterUpstIO*std::cos(phi0);
98  rTmps[2] = radInnerInnerCyl + thickInner + radInnerUpstIO - radInnerUpstIO*std::cos(phi0);
99  rTmps[3] = radInnerInnerCyl + thickInner + radInnerUpstIO - radInnerUpstIO*std::cos(phi1);
100 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
101 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
102 // zTmps[kk] << " " << std::endl;
103  if (kPhi == nSegUpstrIO-1) rTmps[3] =radInnerInnerCyl + 51.*CLHEP::mm - 0.25*CLHEP::mm;
104  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
105  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
106  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
107  volMother, false, 1, true);
108  if (kPhi < nSegUpstrIO/2) {
109  fRInCoordCDRevisedHornA[nSegUpstrIOBy2 - 1 - kPhi] = rTmps[1];
110  fZCoordCDRevisedHornA[nSegUpstrIOBy2 - 1 - kPhi] = zTmps[1]; // with respect to start of the mother volume
111  }
112 
113  }
114  //
115  // For sake of completenes, althought it should not matter, install the thick (25. ) piece of the IC the connects
116  // to the upstream Current Equalizer section.
117  //
118  // ZP: Make it 1in thick (Cory's email Jan 2019)
119  G4String aNStrTmp0("LBNFConceptHornAICFlangeUpstr");
120  fHorn1IC.push_back(aNStrTmp0);
121  const double radOutOuterCondInner = 220.*CLHEP::mm ; // in reality, a bit smaller, but it does not matter
122  // Ustream of the target.
123  G4Tubs* aVolICBulk = new G4Tubs(aNStrTmp0,
124  radInnerInnerCyl + 51.*CLHEP::mm, radOutOuterCondInner - 1.0*CLHEP::mm ,
125  1.*in/2., 0.0, 360.0*CLHEP::degree);
126  G4LogicalVolume *aVolICBulkG = new G4LogicalVolume(aVolICBulk, myAlumIC, aNStrTmp0);
127  G4ThreeVector posTmp0(0., 0., zStartUpstrIOC + 0.5*in);
128  new G4PVPlacement((G4RotationMatrix *) 0, posTmp0, aVolICBulkG, aNStrTmp0 + std::string("_P"),
129  volMother, false, 1, true);
130  //
131  // The Inner cylindrical section around the target.
132  //
133  const double lengthICCyl = 1170*CLHEP::mm - 0.005*CLHEP::mm;
134  const double radInnerOuter = radInnerInnerCyl + thickInner;
135  G4String aNStrTmp("LBNFConceptHornAICCyl");
136  fHorn1IC.push_back(aNStrTmp);
137  const double zZeroLocalCoord = zStartUpstrIOC + radOuterUpstIO + 0.1*CLHEP::mm;
138 // std::cerr << " ............. zZeroLocalCoord " << zZeroLocalCoord << " zStartUpstrIOC " << zStartUpstrIOC << std::endl;
139  G4Tubs* aVolIC0GT = new G4Tubs(aNStrTmp,
140  radInnerInnerCyl, radInnerOuter, 0.5*lengthICCyl, 0.0, 360.0*CLHEP::degree);
141  G4LogicalVolume *aVolIC0G = new G4LogicalVolume(aVolIC0GT, myAlumIC, aNStrTmp);
142  G4ThreeVector posTmp(0., 0., zZeroLocalCoord + 0.5*lengthICCyl);
143  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC0G, aNStrTmp + std::string("_P"),
144  volMother, false, 1, true);
145  fZCoordCDRevisedHornA.push_back(posTmp[2] - 0.5*lengthICCyl);
146  fRInCoordCDRevisedHornA.push_back(radInnerInnerCyl);
147  //
148  // The Inner concical section around the target, so-called tapered section
149  //
150  //Update using Cory's drawing (email sent to Laura and Zarko, January 2019)
151  //split the tapered section into two parts, taper to thicker bell
152 
153  const double thickInnerIC1 = thickInner; // From measurement tool. Difference of Outer/Ineer radius.
154  zTmps[0] = zZeroLocalCoord + lengthICCyl + 0.002*CLHEP::mm;
155  rTmps[0] = radInnerInnerCyl;
156  //const double lengthTaperedIC1 = 992.3*CLHEP::mm; // Minor correction, August 12 2016.., from 56 to this
157  const double lengthTaperedIC1_1 = 992.3*CLHEP::mm-1.75*in; //remove last part of the cone and make new volume for this
158  rTmps[1] = 33*CLHEP::mm;
159  aNStrTmp = std::string("LBNFConceptHornAICTaper_1");
160  fHorn1IC.push_back(aNStrTmp);
161  G4Cons* aVolIC1GCon_1 =
162  new G4Cons(aNStrTmp, rTmps[0], rTmps[0]+thickInnerIC1,
163  rTmps[1], rTmps[1]+thickInnerIC1, 0.5*lengthTaperedIC1_1,
164  0.0, 360.0*CLHEP::degree);
165  G4LogicalVolume *aVolIC1G_1 = new G4LogicalVolume(aVolIC1GCon_1, myAlumIC, aNStrTmp);
166  posTmp[2] = zZeroLocalCoord + lengthICCyl + 0.5*lengthTaperedIC1_1 + 0.002*CLHEP::mm;
167  const double zEndICTapered_1 = posTmp[2] + 0.5*lengthTaperedIC1_1 + 0.002*CLHEP::mm;
168  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC1G_1, aNStrTmp + std::string("_P"),
169  volMother, false, 1, true);
170  fZCoordCDRevisedHornA.push_back(posTmp[2] - 0.5*lengthTaperedIC1_1);
171  fRInCoordCDRevisedHornA.push_back(rTmps[0]);
172 
173  //adding second segment (1.75in long)
174  const double thickInnerIC1_2 = 0.354*in; // Cory's drawing
175  zTmps[0] = zZeroLocalCoord + lengthICCyl + 0.002*CLHEP::mm+lengthTaperedIC1_1;
176  rTmps[0] = rTmps[1];
177  //const double lengthTaperedIC1 = 992.3*CLHEP::mm; // Minor correction, August 12 2016.., from 56 to this
178  const double lengthTaperedIC1_2 = 1.75*in; //remove last part of the cone and make new volume for this
179  rTmps[1] = rTmps[0];
180  aNStrTmp = std::string("LBNFConceptHornAICTaper_2");
181  fHorn1IC.push_back(aNStrTmp);
182  G4Cons* aVolIC1GCon_2 =
183  new G4Cons(aNStrTmp, rTmps[0], rTmps[0]+thickInnerIC1,
184  rTmps[1], rTmps[1]+thickInnerIC1_2, 0.5*lengthTaperedIC1_2,
185  0.0, 360.0*CLHEP::degree);
186  G4LogicalVolume *aVolIC1G_2 = new G4LogicalVolume(aVolIC1GCon_2, myAlumIC, aNStrTmp);
187  posTmp[2] = zZeroLocalCoord + lengthICCyl + lengthTaperedIC1_1 + 0.5*lengthTaperedIC1_2 + 0.002*CLHEP::mm;
188  const double zEndICTapered_2 = posTmp[2] + 0.5*lengthTaperedIC1_2 + 0.002*CLHEP::mm;
189  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC1G_2, aNStrTmp + std::string("_P"),
190  volMother, false, 1, true);
191  fZCoordCDRevisedHornA.push_back(posTmp[2] - 0.5*lengthTaperedIC1_2);
192  fRInCoordCDRevisedHornA.push_back(rTmps[0]);
193 
194 //
195 // A holding ring, presumably for the spider support. Spider support itself not included
196 //
197  const double lengthRingSpiderSuppIC = 20.0*CLHEP::mm;
198  const double radRingSpiderSuppICInner = radInnerInnerCyl + thickInner + 0.010*CLHEP::mm;
199  const double radRingSpiderSuppICOuter = 52.5; // drawing/part 10068382
200  aNStrTmp = std::string("LBNFConceptHornARingSuppIC0");
201  fHorn1IC.push_back(aNStrTmp);
202  G4Tubs* aVolIC0SGT = new G4Tubs(aNStrTmp, radRingSpiderSuppICInner,radRingSpiderSuppICOuter,
203  0.5*lengthRingSpiderSuppIC, 0.0, 360.0*CLHEP::degree);
204  G4LogicalVolume *aVolIC0SG = new G4LogicalVolume(aVolIC0SGT, myAlumIC, aNStrTmp);
205  posTmp[2] = zZeroLocalCoord + (1170. - 85.5)*CLHEP::mm; // taken with the measurement tool
206  const double zSpiderSupport = posTmp[2];
207  const double zEndOfWaterLayer = posTmp[2] - lengthRingSpiderSuppIC/2.0 - 1.0*CLHEP::mm;
208  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC0SG, aNStrTmp + std::string("_P"),
209  volMother, false, 1, true);
210 //
211 // The weldings...
212 //
213  const double lengthWeldIC0toIC1 = 23.3*CLHEP::mm; // Took 2/3 of the smooth transition.
214  const double radRingWeldIC0toICInner = radInnerInnerCyl + thickInner + 0.010*CLHEP::mm;
215  const double radRingWeldIC0toICOuter = radRingWeldIC0toICInner + 1.25*CLHEP::mm; // Approximate guess.
216  // We place the weld on top of the water layer.. Unphysical, evidently, but not a big mistake..
217  aNStrTmp = std::string("LBNFConceptHornAWeldIC0toIC1");
218  fHorn1IC.push_back(aNStrTmp);
219  G4Tubs* aVolIC0WGT = new G4Tubs(aNStrTmp, radRingWeldIC0toICInner, radRingWeldIC0toICOuter,
220  0.5*lengthWeldIC0toIC1, 0.0, 360.0*CLHEP::degree);
221  G4LogicalVolume *aVolIC0WG = new G4LogicalVolume(aVolIC0WGT, myAlumIC, aNStrTmp);
222  posTmp[2] = zZeroLocalCoord + (1170. - 30)*CLHEP::mm ; // Measurement tool
223  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC0WG, aNStrTmp + std::string("_P"),
224  volMother, false, 1, true);
225 //
226 // The I/O transition, downstream. same method as for the upstream.
227 //
228 /*
229  const double radInnerDownstrtIO = 81*CLHEP::mm; // arc 3 od Sketch_000
230  const double phiStartInnerDownstrtIO = 0.001*M_PI/180.; // Deduced from parameter p261 of Sketch_000
231  const double yCenterInnerDownstrtIO = (35*CLHEP::mm +
232  radInnerDownstrtIO*std::cos(phiStartInnerDownstrtIO))*CLHEP::mm;
233  const double radOuterDownstrtIO = 86.2*CLHEP::mm; // arc 4 od Sketch_000. Check with Measurement tool .
234  const double yCenterOuterDownstrtIO = (35*CLHEP::mm +
235  radOuterDownstrtIO*std::cos(phiStartInnerDownstrtIO))*CLHEP::mm;
236  const double zCenterDownstrtIO = zEndICTapered + 0.025*CLHEP::mm;
237 */
238  //Using Cory's drawings (email to Zarko & Laura January 2019)
239  const double radInnerDownstrtIO = (3.401-0.354)*in;
240  const double phiStartInnerDownstrtIO = 0.001*M_PI/180.;
241  const double yCenterDownstrtIO = 4.7*in;
242  const double radOuterDownstrtIO = 3.401*in;
243  const double zCenterDownstrtIO = zEndICTapered_2 + 0.025*CLHEP::mm;
244 
245  const size_t nSegDownstrIO = 20.;
246 // const size_t nSegDownstrIO = 5.;
247  const double deltaPhiDownstrIO = (M_PI - phiStartInnerDownstrtIO)/nSegDownstrIO;
248  // This section is physically bigger, and is much more exposed to pion than the upstream one, make it more
249  for (size_t kPhi = 0; kPhi != nSegDownstrIO; kPhi++ ) {
250  std::ostringstream aNStrStr; aNStrStr << "LBNFConceptHornADownstrIOSect" << kPhi;
251  std::string aNStr(aNStrStr.str());
252  fHorn1IC.push_back(aNStr);
253  const double phi0 = phiStartInnerDownstrtIO + kPhi*deltaPhiDownstrIO + 1.0e-5;
254  const double phi1 = phi0 + deltaPhiDownstrIO - 2.0e-5;
255  zTmps[0] = zCenterDownstrtIO + radInnerDownstrtIO*std::sin(phi0);
256  zTmps[1] = zCenterDownstrtIO + radOuterDownstrtIO*std::sin(phi0);
257  zTmps[2] = zCenterDownstrtIO + radOuterDownstrtIO*std::sin(phi1);
258  zTmps[3] = zCenterDownstrtIO + radInnerDownstrtIO*std::sin(phi1);
259  rTmps[0] = yCenterDownstrtIO - radInnerDownstrtIO*std::cos(phi0);
260  rTmps[1] = yCenterDownstrtIO - radOuterDownstrtIO*std::cos(phi0);
261  rTmps[2] = yCenterDownstrtIO - radOuterDownstrtIO*std::cos(phi1);
262  rTmps[3] = yCenterDownstrtIO - radInnerDownstrtIO*std::cos(phi1);
263 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
264 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
265 // zTmps[kk] << " " << std::endl;
266  if (!installDownstreamIOTransition) continue;
267  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
268  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
269  std::cerr << " Volume for volume " << aNStr << " is " << aVolG->GetSolid()->GetCubicVolume()
270  << " at Y = " << 0.25*(rTmps[0] + rTmps[1] + rTmps[2] + rTmps[3]) << std::endl;
271  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
272  volMother, false, 1, true);
273  if (kPhi < nSegDownstrIO/2) {
274  fRInCoordCDRevisedHornA.push_back(rTmps[1]);
275  fZCoordCDRevisedHornA.push_back(zTmps[0]); // with respect to the beginning of the mother volume.
276  }
277  }
278 //
279 // The flanges only downstream, We also skip the Current Equalizer sections located upstream of the start
280 // of the target.
281 //
282  if (installCurrentEqualizer) {
283  std::cerr
284  << " Located upstream of the start of the target, the Current qualizer sections are irrelevant" << std::endl;
285  std::cerr << " So., not implemented yet.. " << std::endl;
286  }
287  // This is the connecting flange, OC to IOC, part of OC
288  const double radOuterFlangesDownstr = 274.5*CLHEP::mm; // 254 on the drawing. But,
289  // discussion on Oct 13 beam meeting, it was suggest to enlarge the end, such that we
290  // make a small "tub" to facilitate the water flow, and move the tub drain to larger
291  // radius. To be revisited when we have the final design. //
292  const double radInnerFlangesDownstrU = (220.52 + 0.25) *CLHEP::mm; // with 250 micron clearance.
293  const double thickFlangesDownstrU = 34.0*CLHEP::mm;
294  posTmp[2] = zCenterDownstrtIO -58.0*CLHEP::mm + 0.5*thickFlangesDownstrU - 0.02*CLHEP::mm;
295  std::cerr << " Z Position LBNFConceptHornAFlangeDownstrU " << posTmp[2]
296  << " Thickness " << thickFlangesDownstrU << std::endl;
297  const double zCoordEndOCFlangeU = posTmp[2] + 0.5*thickFlangesDownstrU + 0.025*CLHEP::mm;
298  aNStrTmp = std::string("LBNFConceptHornAFlangeDwnstrU");
299  if (installDownstreamIOTransition) {
300  G4Tubs *aVolGPFDU = new G4Tubs(aNStrTmp, radInnerFlangesDownstrU, radOuterFlangesDownstr,
301  0.5*thickFlangesDownstrU, 0.0, 360.0*CLHEP::degree);
302  G4LogicalVolume *aVolGFDU = new G4LogicalVolume(aVolGPFDU, myAlumIC, aNStrTmp);
303  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolGFDU, aNStrTmp + std::string("_P"),
304  volMother, false, 1, true);
305  }
306  //Using Cory's drawings (email to Zarko & Laura January 2019)
307  // const double radInnerFlangesDownstrD = 35*CLHEP::mm + 2.0*radInnerDownstrtIO;
308  const double radInnerFlangesDownstrD = 4.7*in+radInnerDownstrtIO;
309 
310  const double thickFlangesDownstrD = (58.4 - 34.0 - 2.50)*CLHEP::mm; // 2500 micron clearance. With measurement tool
311  posTmp[2] = zCoordEndOCFlangeU + 0.5*thickFlangesDownstrD - 0.025*CLHEP::mm;
312  aNStrTmp = std::string("LBNFConceptHornAFlangeDwnstrD");
313  if (installDownstreamIOTransition) {
314  G4Tubs *aVolGPFDD = new G4Tubs(aNStrTmp, radInnerFlangesDownstrD, radOuterFlangesDownstr,
315  0.5*thickFlangesDownstrD, 0.0, 360.0*CLHEP::degree);
316  G4LogicalVolume *aVolGFDD = new G4LogicalVolume(aVolGPFDD, myAlumIC, aNStrTmp);
317  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolGFDD, aNStrTmp + std::string("_P"),
318  volMother, false, 1, true);
319  }
320 //
321 // We now install the Outer conductor. Start with it's upstream flange.
322 // Which we skip.. We just start the outer conductor flush with the upstream IOC
323 //
324 //
325 // The main body of OC
326 //
327 //ZP: change lenthOC and posTmp[2] so it goes over the IO region (Cory's email Jan 2019)
328 //add/subtract 2*in (geometry actually had a block 50mm thick)
329  const double lengthOC = (2104. - 0.5)*CLHEP::mm+50*CLHEP::mm; // with the measurement tool..
330  // From the Z = start of the IC down to the start of LBNFConceptHornAFlangeDwnstrU
331  const double radOuterOC = (220.5 + 16)*CLHEP::mm;
332  const double radInnerOC = 220.5*CLHEP::mm;
333  posTmp[2] = zZeroLocalCoord + 0.5*lengthOC + 0.1*CLHEP::mm-50*CLHEP::mm;
334  aNStrTmp = std::string("LBNFConceptHornAOC");
335  if (installOuterConductor) {
336  G4Tubs* aVolOCG = new G4Tubs(aNStrTmp, radInnerOC, radOuterOC,
337  0.5*lengthOC, 0.0, 360.0*CLHEP::degree);
338  G4LogicalVolume *aVolOCGL = new G4LogicalVolume(aVolOCG, myAlumOC, aNStrTmp);
339  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolOCGL, aNStrTmp + std::string("_P"),
340  volMother, false, 1, true);
341  }
342 //
343 // The downstream Flange.Donw above !.
344 //
345 //
346 // The spider support. Borrowed code from NuMI/LBNE, written 3 years ago or so..
347 //
348 // The ring is already defined above.
349 //The connecting piece ring to the hangers.. There are three of them, at 120 degrees from each other.
350 //
351 // Optiminally, skip the spider support for study of the phi symmetry breaking terms in the magnetic field
352 // This speider support is intrinsically phy asymmetric, so, we skip it to study poins/neutrino distribution
353 // due to the presence of magnetic defect.
354 //
355 // P.L. June 19 2017.
356 //
357  bool installSpiderSupport = true;
358  if (installSpiderSupport) {
359 
360  const std::string nameStrH("LBNFConceptHornASpSupp");
361  G4String nameStr2(nameStrH); nameStr2 += G4String("Riser");
362  const double heightRiser = 0.333*in - 0.020*CLHEP::mm;
363  const double widthH = 1.5*in; // See drawing 8875.112-MD 363115
364  const double thickH = 0.184*2*in;
365  G4Box *aBoxRiser = new G4Box(nameStr2, widthH/2., heightRiser/2.0, thickH/2.0);
366  G4LogicalVolume *pCurrentRiser =
367  new G4LogicalVolume(aBoxRiser, myAlumOC, nameStr2);
368 
369  G4String nameStr3(nameStrH); nameStr3 += G4String("Hanger");
370  const double heightH = radInnerOC - radRingSpiderSuppICOuter - 1.0*CLHEP::mm - heightRiser;
371  const double widthH2 = 1.0*in; // 363115 Note: we collapsed both hanger along the horizontal, transverse
372  // direction.
373  const double thickH2 = 0.031*in;
374  G4Box *aBoxHanger = new G4Box(nameStr3, widthH2/2., heightH/2.0, thickH2/2.0);
375  G4LogicalVolume *pCurrentHanger =
376  new G4LogicalVolume(aBoxHanger, myAlumOC, nameStr3);
377 
378  posTmp[2] = zSpiderSupport;
379 
380  for (int iRot=0; iRot != 3; iRot++) {
381  std::ostringstream rnStrStr; rnStrStr << "_" << (iRot+1);
382  G4String rnStr(rnStrStr.str());
383  // Same Z position as above...
384  G4RotationMatrix * rMatPr = 0;
385  if (iRot == 1) {
386  rMatPr = new G4RotationMatrix;
387  rMatPr->rotateZ(2.0*M_PI/3.);
388  } else if (iRot == 2) {
389  rMatPr = new G4RotationMatrix;
390  rMatPr->rotateZ(-2.0*M_PI/3.);
391  }
392 
393  const double dHRiser = radRingSpiderSuppICOuter + 0.010*CLHEP::mm + heightRiser/2.;
394  posTmp[0] = 0.; posTmp[1] = dHRiser;
395  if (iRot != 0) {
396  posTmp[0] = dHRiser*rMatPr->xy();
397  posTmp[1] = dHRiser*rMatPr->yy();
398  }
399  if (iRot == 0) {
400  new G4PVPlacement(rMatPr, posTmp, pCurrentRiser, nameStr2 + std::string("_P") + rnStr,
401  volMother, false, iRot, fCheckVolumeOverLapWC);
402  } else {
403  new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentRiser, nameStr2 + std::string("_P") + rnStr,
404  volMother, false, iRot, true);
405  }
406 // Now the hanger it self
407 
408  const double dHHanger = radRingSpiderSuppICOuter + 0.010*CLHEP::mm + 0.5*CLHEP::mm + heightRiser + heightH/2.;
409  posTmp[0] = 0.; posTmp[1] = dHHanger;
410  if (iRot != 0) {
411  posTmp[0] = dHHanger*rMatPr->xy();
412  posTmp[1] = dHHanger*rMatPr->yy();
413  }
414  // Same Z position as above...
415  if (iRot == 0) {
416  new G4PVPlacement(rMatPr, posTmp, pCurrentHanger, nameStr3 + std::string("_P") + rnStr,
417  volMother, false, iRot, fCheckVolumeOverLapWC);
418  } else {
419  new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentHanger, nameStr3 + std::string("_P") + rnStr,
420  volMother, false, iRot, true);
421  }
422  } // on the 120 degree symmetry point.
423 //
424 }
425  //
426  // Finally, the water layer..
427  //
428  if (fWaterLayerThickInHorns > 1.0e-6) {
429 
430  //
431  // On the Inner cylindrical section around the target.
432  //
433  G4Material *myWater = G4Material::GetMaterial("Water");
434 
435  const double lengthICCylW = zEndOfWaterLayer - zZeroLocalCoord;
436  const double radWaterInnerCyl = radInnerInnerCyl + thickInner + 0.025*CLHEP::mm;
437  const double radWaterOuter = radWaterInnerCyl + fWaterLayerThickInHorns;
438  G4String aNStrTmpW0("LBNFConceptHornAICCylWater");
439  G4Tubs* aVolIC0GWT = new G4Tubs(aNStrTmpW0,
440  radWaterInnerCyl, radWaterOuter, 0.5*lengthICCylW, 0.0, 360.0*CLHEP::degree);
441  G4LogicalVolume *aVolIC0GW = new G4LogicalVolume(aVolIC0GWT, myWater, aNStrTmpW0);
442  G4ThreeVector posTmpW(0., 0., zZeroLocalCoord + 0.5*lengthICCylW);
443  new G4PVPlacement((G4RotationMatrix *) 0, posTmpW, aVolIC0GW, aNStrTmpW0 + std::string("_P"),
444  volMother, false, 1, true);
445  //
446  // We neglect the small segment between the end of the cylindrical section and
447  // the start of the tapered section.
448  //
449  G4VisAttributes* visAttributes = new G4VisAttributes(G4Colour(0.0,0.0,0.9));
450  visAttributes->SetVisibility(true);
451  std::string aNStrTmpIC1W = G4String("LBNFConceptHornAICDTaperCL1Water");
452  zTmps[0] = zZeroLocalCoord + lengthICCyl + 0.002*CLHEP::mm;
453  rTmps[0] = radInnerInnerCyl + thickInner + 0.025*CLHEP::mm;
454  rTmps[1] = 33*CLHEP::mm + thickInner + 0.025*CLHEP::mm;
455  aNStrTmp = std::string("LBNFConceptHornAICTaperWater_1");
456  G4Cons* aVolIC1GConW_1 =
457  new G4Cons(aNStrTmp, rTmps[0], rTmps[0]+fWaterLayerThickInHorns,
458  rTmps[1], rTmps[1]+fWaterLayerThickInHorns, 0.5*lengthTaperedIC1_1,
459  0.0, 360.0*CLHEP::degree);
460  G4LogicalVolume *aVolIC1GW_1 = new G4LogicalVolume(aVolIC1GConW_1, myWater, aNStrTmp);
461  aVolIC1GW_1->SetVisAttributes(visAttributes);
462  G4ThreeVector posTmpW2_1 (0., 0.,
463  zZeroLocalCoord + lengthICCyl + 0.5*lengthTaperedIC1_1 + 0.002*CLHEP::mm);
464  new G4PVPlacement((G4RotationMatrix *) 0, posTmpW2_1, aVolIC1GW_1, aNStrTmp + std::string("_P"),
465  volMother, false, 1, true);
466 
467  //adding second water segment since we added an additional tapered cone
468  //see Cory's drawing (email to Zarko and Laura on Jan 2019)
469  zTmps[0] = zZeroLocalCoord + lengthICCyl + 0.002*CLHEP::mm+lengthTaperedIC1_1;
470  rTmps[0] = rTmps[1];
471  rTmps[1] = 33*CLHEP::mm + thickInnerIC1_2 + 0.025*CLHEP::mm;
472  aNStrTmp = std::string("LBNFConceptHornAICTaperWater_2");
473  G4Cons* aVolIC1GConW_2 =
474  new G4Cons(aNStrTmp, rTmps[0], rTmps[0]+fWaterLayerThickInHorns,
475  rTmps[1], rTmps[1]+fWaterLayerThickInHorns, 0.5*lengthTaperedIC1_2,
476  0.0, 360.0*CLHEP::degree);
477  G4LogicalVolume *aVolIC1GW_2 = new G4LogicalVolume(aVolIC1GConW_2, myWater, aNStrTmp);
478  aVolIC1GW_2->SetVisAttributes(visAttributes);
479  G4ThreeVector posTmpW2_2 (0., 0.,
480  zZeroLocalCoord + lengthICCyl + lengthTaperedIC1_1 + 0.5*lengthTaperedIC1_2 + 0.002*CLHEP::mm);
481  new G4PVPlacement((G4RotationMatrix *) 0, posTmpW2_2, aVolIC1GW_2, aNStrTmp + std::string("_P"),
482  volMother, false, 1, true);
483  }
484  //
485  // Check the exact R/Z coordinates...
486  //
487  for (size_t k=0; k != fZCoordCDRevisedHornA.size(); k++) fZCoordCDRevisedHornA[k] -= zShiftMotherCoords;
488  std::cerr << " Dump of the R/Z map, accurate, for the magnetic field " << std::endl;
489  for (size_t k=0; k != fZCoordCDRevisedHornA.size(); k++) {
490  std::cerr << " " << k << " " << fRInCoordCDRevisedHornA[k] << " " << fZCoordCDRevisedHornA[k] << std::endl;
491  }
492  std::cerr << "... Should be good to go... " <<std::endl;
493  return;
494 }
496 
497  if (!fInstallDownstTargetSupport) return;
498  if (fUse1p2MWSmallTgt) return; // In case we want to go back the target with small cooling pipe.
499  std::cerr << " LBNEVolumePlacements::PlaceFinalLBNFConceptTgtSupport " <<std::endl;
500  const LBNEVolumePlacementData *plDatMother = this->Find(G4String("LBNFConceptTgtSupport"),
501  "TargetHallAndHorn1",
502  "LBNEVolumePlacements::PlaceFinalLBNFConceptTgtSupport");
503  G4LogicalVolume *volMother = plDatMother->fCurrent;
504 //
505 // For now, only the 4 Titanium tubes brining cooled Helium.
506 //
507  const double lengthTitCTube = 275.0*CLHEP::mm;
508  const double outerRadiusTitCTube = 5.0*CLHEP::mm;
509  const double innerRadiusTitCTube = outerRadiusTitCTube - 0.5*CLHEP::mm;
510  fRotTgtTitCTubeVert.rotateX(M_PI/2.);
511  fRotTgtTitCTubeHor.rotateY(M_PI/2.);
512  // to get the spring to touch the end of the old (not yet adapted to this conceptual design) NuMI target.
513 // G4Material *myAlum = G4Material::GetMaterial("Aluminum");
514  G4Material *myTitanium = G4Material::GetMaterial("Titanium");
515 
516  std::string aNStrExtTubeTmp = std::string("LBNFConceptHornATgtSupTitCTube");
517  G4Tubs* aVolTgtSup1 = new G4Tubs(aNStrExtTubeTmp, innerRadiusTitCTube, outerRadiusTitCTube,
518  0.5*lengthTitCTube, 0.0, 360.0*CLHEP::degree);
519  G4LogicalVolume *aVolTgtSup1L = new G4LogicalVolume(aVolTgtSup1, myTitanium, aNStrExtTubeTmp);
520 
521  const LBNEVolumePlacementData *plDatMotherHorn = this->Find(G4String("LBNFConceptHornATgtSupport"), "Horn1PolyM1",
522  "LBNEVolumePlacements::PlaceFinalLBNFConceptHornA");
523  const double lengthHornTotal = plDatMotherHorn->fParams[2];
524  const double zPosTitCTube = lengthHornTotal + 0.1*CLHEP::mm - 360.0*CLHEP::mm;
525  // to be adjusted...Done with Geantino,
526  const double radTitCTubeCenter = 50.0*CLHEP::mm + 0.5*lengthTitCTube+0.25*CLHEP::mm;
527 
528  G4ThreeVector posTitCTubeTop(0., radTitCTubeCenter , zPosTitCTube);
529  new G4PVPlacement(&fRotTgtTitCTubeVert, posTitCTubeTop, aVolTgtSup1L, aNStrExtTubeTmp + std::string("_PTop"),
530  volMother, false, 1, true);
531 
532  G4ThreeVector posTitCTubeBottom(0., -radTitCTubeCenter , zPosTitCTube);
533  new G4PVPlacement(&fRotTgtTitCTubeVert, posTitCTubeBottom, aVolTgtSup1L, aNStrExtTubeTmp + std::string("_PBot"),
534  volMother, false, 1, true);
535 
536  G4ThreeVector posTitCTubeLeft(-radTitCTubeCenter , 0., zPosTitCTube);
537  new G4PVPlacement(&fRotTgtTitCTubeHor, posTitCTubeLeft, aVolTgtSup1L, aNStrExtTubeTmp + std::string("_PLeft"),
538  volMother, false, 1, true);
539 
540  G4ThreeVector posTitCTubeRight(radTitCTubeCenter, 0. , zPosTitCTube);
541  new G4PVPlacement(&fRotTgtTitCTubeHor, posTitCTubeRight, aVolTgtSup1L, aNStrExtTubeTmp + std::string("_PRight"),
542  volMother, false, 1, true);
543 }
544 
546 
547  std::cerr
548  << " LBNEVolumePlacements::PlaceFinalLBNFConceptHornB..Rev 2 Drawing F10071359... Start with upstream IO/layer. "
549  << std::endl;
550  fZCoordCDRevisedHornB.clear();
551  fRInCoordCDRevisedHornB.clear();
552 
553  const double in = 25.4*CLHEP::mm;
554  const std::string header("LBNFConceptHornB");
555  const LBNEVolumePlacementData *plDatMother = this->Find(header, "LBNFSimpleHorn2Container",
556  "LBNEVolumePlacements::PlaceFinalLBNFConceptHornB");
557  G4LogicalVolume *volMother = plDatMother->fCurrent;
558  const double lengthMother=plDatMother->fParams[2];
559  const double zShiftMotherCoords = 0.005*CLHEP::mm; // We have little room in this case..
560  const size_t nSegUpstrIO = 20;
561  const double radInnerInner = 159.0*CLHEP::mm;
562  const double thickInner = 3.0*CLHEP::mm;
563  fThickICDRevisedHornB = thickInner; // for the magnetic field accurate definition of fiducials.
564  const double zStartUpstrIOC = -0.5*lengthMother + 0.025*CLHEP::mm; // small clearance,
565  const double deltaPhiUpstrIO = M_PI/nSegUpstrIO;
566  const double radOuterUpstIO = 0.5*(642. - radInnerInner) *CLHEP::mm; // Drawing F10071359.
567  const double radInnerUpstIO = 0.5*(2.0*radOuterUpstIO - 8.0*CLHEP::mm - thickInner); // Drawing F10060435
568  const double distUpstreamToBeginIC = radOuterUpstIO + 0.025 ; // 25 microns clearance..
569  const double zZeroLocalCoord = -0.5*lengthMother + distUpstreamToBeginIC;
570  const double radInnerOC = 634.0*CLHEP::mm;
571  std::cerr << " .....Mother Volume name " << volMother->GetName()
572  << " zShiftMother " << zShiftMotherCoords << " distUpstreamToBeginIC "
573  << distUpstreamToBeginIC << " zZeroLocalCoords " << zZeroLocalCoord << std::endl;
574 
575  std::vector<double> zTmps(20, 0.); std::vector<double> rTmps(20, 0.); // more room for later
576  G4ThreeVector zeroC(0., 0., 0.);
577  G4Material *myAlumina = G4Material::GetMaterial("Alumina");
578  G4Material *myAlumIC = G4Material::GetMaterial(fHorn2InnerCondMat.c_str());
579  G4Material *myAlumOC = G4Material::GetMaterial(fHorn2AllCondMat.c_str());
580  if (fHorn2AllCondMat.find("Alum") != std::string::npos)
581  myAlumina = G4Material::GetMaterial(fHorn2AllCondMat.c_str());
582  G4Material *myWater = 0;
583  if (fWaterLayerThickInHorns > 1.0e-6) myWater = G4Material::GetMaterial("Water");
584  size_t nSegUpstrIOBy2 = nSegUpstrIO/2;
585  fZCoordCDRevisedHornB.resize(nSegUpstrIOBy2);
586  fRInCoordCDRevisedHornB.resize(nSegUpstrIOBy2);
587 
588  for (size_t kPhi = 0; kPhi != nSegUpstrIO; kPhi++ ) {
589  std::ostringstream aNStrStr; aNStrStr << header << "UpstrIOSect" << kPhi;
590  std::string aNStr(aNStrStr.str());
591  fHorn2IC.push_back(aNStr);
592  const double phi0 = kPhi*deltaPhiUpstrIO + 1.0e-5;
593  const double phi1 = phi0 + deltaPhiUpstrIO - 2.0e-5;
594  zTmps[0] = zStartUpstrIOC + radOuterUpstIO - radOuterUpstIO*std::sin(phi1);
595  zTmps[1] = zStartUpstrIOC + radOuterUpstIO - radOuterUpstIO*std::sin(phi0);
596  zTmps[2] = zStartUpstrIOC + radOuterUpstIO - radInnerUpstIO*std::sin(phi0);
597  zTmps[3] = zStartUpstrIOC + radOuterUpstIO - radInnerUpstIO*std::sin(phi1);
598  rTmps[0] = radInnerInner + radOuterUpstIO - radOuterUpstIO*std::cos(phi1);
599  rTmps[1] = radInnerInner + radOuterUpstIO - radOuterUpstIO*std::cos(phi0);
600  rTmps[2] = radInnerInner + thickInner + radInnerUpstIO - radInnerUpstIO*std::cos(phi0);
601  rTmps[3] = radInnerInner + thickInner + radInnerUpstIO - radInnerUpstIO*std::cos(phi1);
602 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
603 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
604 // zTmps[kk] << " " << std::endl;
605  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
606  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
607  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
608  volMother, false, 1, true);
609 
610  if (kPhi < nSegUpstrIO/2) {
611  fRInCoordCDRevisedHornB[nSegUpstrIOBy2 - 1 - kPhi] = rTmps[1];
612  fZCoordCDRevisedHornB[nSegUpstrIOBy2 - 1 - kPhi] = zTmps[1] - zZeroLocalCoord; // with respect to zZero.
613  }
614  }
615  //
616  // The IC Upstream Out flange. We include a thin flange which is the transition between the
617  // IOC transition and the IC upstream outer flange.
618  //
619  {
620  const double thickUpstrICFlangeTr = 10.0;
621  const double radInnerICFl = 634.*CLHEP::mm;
622  const double radOuterICFlTr = radInnerICFl + 10.0*(1.0- M_PI/4.); // approximate. Exact shape is a cylinder - torus.
623  std::string aNStrTmp0(header); aNStrTmp0 += std::string("ICFlUtr");
624  fHorn1IC.push_back(aNStrTmp0);
625  G4Tubs* aVolICFlG0 = new G4Tubs(aNStrTmp0, radInnerICFl, radOuterICFlTr,
626  0.5*thickUpstrICFlangeTr, 0.0, 360.0*CLHEP::degree);
627  G4LogicalVolume *aVolICFlGL0 = new G4LogicalVolume(aVolICFlG0, myAlumIC, aNStrTmp0);
628 
629  G4ThreeVector posTmp0(0., 0.,
630  zZeroLocalCoord + 0.5*thickUpstrICFlangeTr + 0.05*CLHEP::mm);
631  new G4PVPlacement((G4RotationMatrix *) 0, posTmp0, aVolICFlGL0, aNStrTmp0 + std::string("_P"),
632  volMother, false, 1, true);
633 
634  const double thickUpstrICFlange = 29.8;
635  const double radOuterICFl = 691.5*CLHEP::mm;
636  std::string aNStrTmp(header); aNStrTmp += std::string("ICFlU");
637  G4Tubs* aVolICFlG = new G4Tubs(aNStrTmp, radInnerICFl, radOuterICFl,
638  0.5*thickUpstrICFlange, 0.0, 360.0*CLHEP::degree);
639  G4LogicalVolume *aVolICFlGL = new G4LogicalVolume(aVolICFlG, myAlumIC, aNStrTmp);
640 
641  G4ThreeVector posTmp(0., 0.,
642  zZeroLocalCoord + thickUpstrICFlangeTr + 0.5*thickUpstrICFlange + 0.1*CLHEP::mm);
643  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolICFlGL, aNStrTmp + std::string("_P"),
644  volMother, false, 1, true);
645  }
646  //
647  // A cylinder (G4tubs) for the first IC segment.
648  //
649  double zCoordLocalCurrent = zZeroLocalCoord;
650  fZCoordCDRevisedHornB.push_back(0.);
651  fRInCoordCDRevisedHornB.push_back(radInnerInner);
652  const double lengthFirstCylIC = 1089.*CLHEP::mm; // Downstream end, tight.
653  const double lengthFirstCylICWUp = lengthFirstCylIC - 126.*CLHEP::mm; // we subtract this to make room for the
654  // spider support. 2mm clearance...
655  const double lengthSpiderWebSupportOnIC = 27*CLHEP::mm;
656  std::vector<double> zPosSpiderWebSupportOnIC(3, 0.);
657  std::vector<double> radRingSpiderSuppICOuter(3, 0.);
658  {
659 
660  const double radInnerOuter = radInnerInner + thickInner;
661  std::string aNStrTmp(header); aNStrTmp += std::string("ICCyl0");
662  G4Tubs* aVolIC0GT = new G4Tubs(aNStrTmp,
663  radInnerInner, radInnerOuter, 0.5*lengthFirstCylIC, 0.0, 360.0*CLHEP::degree);
664  G4LogicalVolume *aVolIC0G = new G4LogicalVolume(aVolIC0GT, myAlumIC, aNStrTmp);
665  G4ThreeVector posTmp(0., 0., zZeroLocalCoord + 0.5*lengthFirstCylIC);
666  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC0G, aNStrTmp + std::string("_P"),
667  volMother, false, 1, true);
668  zCoordLocalCurrent += lengthFirstCylIC + 0.025*CLHEP::mm;
669  if (fWaterLayerThickInHorns > 1.0e-6) {
670  const double radInnerW = radInnerOuter + 0.010;
671  const double radOuterW = radInnerW + fWaterLayerThickInHorns;
672  std::string aNStrTmpWUp(aNStrTmp); aNStrTmpWUp += std::string("WaterUp");
673  G4Tubs* aVolIC0GTWUp = new G4Tubs(aNStrTmpWUp,
674  radInnerW, radOuterW, 0.5*lengthFirstCylICWUp, 0.0, 360.0*CLHEP::degree);
675  G4LogicalVolume *aVolIC0GWUp = new G4LogicalVolume(aVolIC0GTWUp, myWater, aNStrTmpWUp);
676  G4ThreeVector posTmpWUp(0., 0., zZeroLocalCoord + 0.5*lengthFirstCylICWUp);
677  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWUp, aVolIC0GWUp, aNStrTmpWUp + std::string("_P"),
678  volMother, false, 1, true);
679  //
680  // The downstream end, past the spider web support.
681  const double lengthFirstCylICWDw = 92. *CLHEP::mm; // with ~ one mm clearance.
682  std::string aNStrTmpWDw(aNStrTmp); aNStrTmpWDw += std::string("WaterDw");
683  G4Tubs* aVolIC0GTWDw = new G4Tubs(aNStrTmpWDw,
684  radInnerW, radOuterW, 0.5*lengthFirstCylICWDw, 0.0, 360.0*CLHEP::degree);
685  G4LogicalVolume *aVolIC0GWDw = new G4LogicalVolume(aVolIC0GTWDw, myWater, aNStrTmpWDw);
686  G4ThreeVector posTmpWDw(0., 0.,
687  zZeroLocalCoord + lengthFirstCylIC - 0.5*lengthFirstCylICWDw);
688  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWDw, aVolIC0GWDw, aNStrTmpWDw + std::string("_P"),
689  volMother, false, 1, true);
690 
691  }
692  //
693  // A weld.. At the downstream end..of this cylindre..
694  // Approximation: it is a smooth bulge, total length is 23 mm. We make it a bit shorter,
695  //
696  const double lengthFirstWeld = 16.0*CLHEP::mm; // we subtract 5 mm to make room for the weld.
697  double radInnerWeld = radInnerOuter + 0.010;
698  double radOuterWeld = radInnerWeld + 2.0; // top of the bulge at 165, 4.5 mm thick max.
699  // place this weld on top of the water layer.. for modeling simplicity.
700  if (fWaterLayerThickInHorns > 1.0e-6) {
701  radInnerWeld += 0.005*CLHEP::mm + fWaterLayerThickInHorns;
702  radOuterWeld += 0.005*CLHEP::mm + fWaterLayerThickInHorns;
703  }
704  std::string aNStrTmpWeld(aNStrTmp); aNStrTmpWeld += std::string("Weld");
705  G4Tubs* aVolIC0GTWe = new G4Tubs(aNStrTmpWeld,
706  radInnerWeld, radOuterWeld, 0.5*lengthFirstWeld, 0.0, 360.0*CLHEP::degree);
707  G4LogicalVolume *aVolIC0GWe = new G4LogicalVolume(aVolIC0GTWe, myAlumIC, aNStrTmpWeld);
708  G4ThreeVector posTmpWeld(0., 0., zZeroLocalCoord + lengthFirstCylIC - 36.); // approximate. Z location, few mm.
709  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWeld, aVolIC0GWe, aNStrTmpWeld + std::string("_P"),
710  volMother, false, 1, true);
711  // Lastly, the attachment ring for the spider web support. (first one.)
712  //
713  std::string aNStrTmpSpd(aNStrTmp); aNStrTmpSpd += std::string("SPWS");
714  G4Tubs* aVolIC0GTSpd = new G4Tubs(aNStrTmpSpd,
715  radInnerOuter+0.010*CLHEP::mm,
716  radInnerOuter+7.5*CLHEP::mm, 0.5*lengthSpiderWebSupportOnIC, 0.0, 360.0*CLHEP::degree);
717  G4LogicalVolume *aVolIC0GSpd = new G4LogicalVolume(aVolIC0GTSpd, myAlumIC, aNStrTmpSpd);
718  G4ThreeVector posTmpSpd(0., 0., zZeroLocalCoord + lengthFirstCylIC - 110.*CLHEP::mm);
719  // approximate. Z location, few mm.
720  zPosSpiderWebSupportOnIC[0] = posTmpSpd[2];
721  radRingSpiderSuppICOuter[0] = radInnerOuter+7.5*CLHEP::mm + 0.025*CLHEP::mm;
722  new G4PVPlacement((G4RotationMatrix *) 0, posTmpSpd, aVolIC0GSpd, aNStrTmpSpd + std::string("_P"),
723  volMother, false, 1, true);
724 
725  }
726  //
727  // The upstream conical section..Implemented as a G4GenericPolygon.
728  //
729  const double radInnerInnerNeck = 81.0*CLHEP::mm;
730  {
731  std::string aNStrTmp(header); aNStrTmp += std::string("UpstrCone");
732  const double lengthUpstrConeSec1 = 18.23*CLHEP::mm;
733  const double lengthUpstrConeSec2 = 851.46*CLHEP::mm;
734  const double lengthUpstrConeSec3 = 8.98*CLHEP::mm;
735  const double lengthUpstrCone = (lengthUpstrConeSec1 + lengthUpstrConeSec2 + lengthUpstrConeSec3);
736  // three steps.. probably futzing around too much..
737  std::cerr << " Before defining upstream conical section, zCoordLocalCurrent "
738  << zCoordLocalCurrent << std::endl;
739  zTmps[0] = zCoordLocalCurrent;
740  rTmps[0] = radInnerInner;
741  zTmps[1] = zCoordLocalCurrent + lengthUpstrConeSec1;
742  rTmps[1] = 158.2*CLHEP::mm;
743  zTmps[2] = zTmps[1] + lengthUpstrConeSec2;
744  rTmps[2] = 81.42*CLHEP::mm;
745  zTmps[3] = zTmps[2] + lengthUpstrConeSec3;
746  rTmps[3] = radInnerInnerNeck;
747  for (size_t kk=0; kk != 4; kk++) {
748  zTmps[4+kk] = zTmps[4 - kk - 1];
749  rTmps[4+kk] = rTmps[4 - kk - 1] + thickInner;
750  }
751  for(size_t kk=0; kk != 4; kk++) {
752  fZCoordCDRevisedHornB.push_back(zTmps[kk] - zZeroLocalCoord);
753  fRInCoordCDRevisedHornB.push_back(rTmps[kk]);
754  }
755  G4GenericPolycone *aVolGPCU =
756  new G4GenericPolycone(aNStrTmp, 0.0, 360.0*CLHEP::degree, 8, &rTmps[0], &zTmps[0]);
757  G4LogicalVolume *aVolGCU = new G4LogicalVolume(aVolGPCU, myAlumIC, aNStrTmp);
758  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolGCU, aNStrTmp + std::string("_P"),
759  volMother, false, 1, true);
760 
761  if (fWaterLayerThickInHorns > 1.0e-6) {
762  // We implement two polycone, as we have a spider web support on the way, and the distance
763  // between the downstream edge and the end of section is not negligible.
764  std::vector<double> zTmpsW(zTmps);
765  std::vector<double> rTmpsW(rTmps); // Oversized.
766  for (size_t kk=0; kk != 2; kk++) rTmpsW[kk] += thickInner + .025*CLHEP::mm;
767  zTmpsW[2] = zTmpsW[1] + 686.*CLHEP::mm;
768  rTmpsW[2] = (0.5+99.27)*CLHEP::mm; // lift up, because of the margin, longitudinally
769  for (size_t kk=0; kk != 3; kk++) {
770  zTmpsW[3+kk] = zTmpsW[3 - kk - 1];
771  rTmpsW[3+kk] = rTmpsW[3 - kk - 1] + fWaterLayerThickInHorns;
772  }
773  std::cerr << " Last Z coord for water layer, upstream cone, upstr section " << zTmpsW[2] << std::endl;
774 
775  std::string aNStrTmpWUp(aNStrTmp); aNStrTmpWUp += std::string("WaterUp");
776  G4GenericPolycone* aVolUCGTWUp =
777  new G4GenericPolycone(aNStrTmpWUp, 0.0, 360.0*CLHEP::degree, 6, &rTmpsW[0], &zTmpsW[0]);
778  G4LogicalVolume *aVolUCGWUp = new G4LogicalVolume(aVolUCGTWUp, myWater, aNStrTmpWUp);
779  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolUCGWUp, aNStrTmpWUp + std::string("_P"),
780  volMother, false, 1, true);
781  const double lengthUpstrUpstrConeW = lengthUpstrConeSec1 + 686.*CLHEP::mm;
782  zTmpsW[0] = zCoordLocalCurrent + lengthUpstrUpstrConeW + lengthSpiderWebSupportOnIC + 0.5*CLHEP::mm;
783  rTmpsW[0] = (96.650 + 0.3)*CLHEP::mm;
784  zTmpsW[1] = zTmpsW[0] + 143.*CLHEP::mm; // approximate, few mm.
785  rTmpsW[1] = (radInnerInnerNeck + thickInner + 0.6)*CLHEP::mm; // lift up again, clash with IC
786  zTmpsW[2] = zTmpsW[1];
787  rTmpsW[2] = rTmpsW[1] + fWaterLayerThickInHorns;
788  zTmpsW[3] = zTmpsW[0];
789  rTmpsW[3] = rTmpsW[0] + fWaterLayerThickInHorns;
790  std::cerr << " Last zCoord for LBNFConceptHornBUpstrConeWaterDw "
791  << zTmpsW[1] << " lengthUpstrUpstrConeW " <<lengthUpstrUpstrConeW
792  << " zCoordLocalCurrent " << zCoordLocalCurrent << std::endl;
793  std::string aNStrTmpWDw(aNStrTmp); aNStrTmpWDw += std::string("WaterDw");
794  G4GenericPolycone* aVolUCGTWDw =
795  new G4GenericPolycone(aNStrTmpWDw, 0.0, 360.0*CLHEP::degree, 4, &rTmpsW[0], &zTmpsW[0]);
796  G4LogicalVolume *aVolUCGWDw = new G4LogicalVolume(aVolUCGTWDw, myWater, aNStrTmpWDw);
797  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolUCGWDw, aNStrTmpWDw + std::string("_P"),
798  volMother, false, 1, true);
799 
800  }
801  //
802  // Lastly, we place a Spider web support attachment ring
803  //
804  std::string aNStrTmpSpd(aNStrTmp); aNStrTmpSpd += std::string("SPWS");
805  G4Tubs* aVolICodGTSpd = new G4Tubs(aNStrTmpSpd,
806  99.20+0.030*CLHEP::mm,
807  99.23+7.5*CLHEP::mm, 0.5*lengthSpiderWebSupportOnIC, 0.0, 360.0*CLHEP::degree);
808  G4LogicalVolume *aVolICodGSpd = new G4LogicalVolume(aVolICodGTSpd, myAlumIC, aNStrTmpSpd);
809  G4ThreeVector posTmpSpd(0., 0.,
810  zCoordLocalCurrent + lengthUpstrCone - 173.2*CLHEP::mm + 0.5*lengthSpiderWebSupportOnIC ); // approximate. Z location, few mm.
811  zPosSpiderWebSupportOnIC[1] = posTmpSpd[2];
812  radRingSpiderSuppICOuter[1] = 99.23 + 7.5*CLHEP::mm + 0.025*CLHEP::mm;
813  new G4PVPlacement((G4RotationMatrix *) 0, posTmpSpd, aVolICodGSpd, aNStrTmpSpd + std::string("_P"),
814  volMother, false, 1, true);
815 
816  zCoordLocalCurrent += lengthUpstrCone + 0.025;
817  std::cerr << " Last Z coord for upstr. cone " << zCoordLocalCurrent << std::endl;
818  }
819  const double thickNeck = 3.0*CLHEP::mm;
820 
821  // The neck..
822  {
823 
824  const double lengthNeck = 62.4; // exact. ;
825  const double radInnerOuterNeck = radInnerInnerNeck + thickNeck;
826  std::string aNStrTmp(header); aNStrTmp += std::string("Neck");
827  G4Tubs* aVolNeckGT = new G4Tubs(aNStrTmp,
828  radInnerInnerNeck, radInnerOuterNeck, 0.5*lengthNeck, 0.0, 360.0*CLHEP::degree);
829  G4LogicalVolume *aVolNeckG = new G4LogicalVolume(aVolNeckGT, myAlumIC, aNStrTmp);
830  G4ThreeVector posTmp(0., 0., zCoordLocalCurrent + 0.5*lengthNeck);
831  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolNeckG, aNStrTmp + std::string("_P"),
832  volMother, false, 1, true);
833  if (fWaterLayerThickInHorns > 1.0e-6) {
834  const double lengthNeckW = lengthNeck - 0.010*CLHEP::mm; //Clearance, religious...
835  const double radInnerNeckW = radInnerOuterNeck + 0.010;
836  const double radOuterNeckW = radInnerNeckW + fWaterLayerThickInHorns;
837  std::string aNStrTmpW(aNStrTmp); aNStrTmpW += std::string("Water");
838  G4Tubs* aVolNeckGTW = new G4Tubs(aNStrTmpW,
839  radInnerNeckW, radOuterNeckW, 0.5*lengthNeckW, 0.0, 360.0*CLHEP::degree);
840  G4LogicalVolume *aVolNeckGW = new G4LogicalVolume(aVolNeckGTW, myWater, aNStrTmpW);
841  G4ThreeVector posTmpW(posTmp); posTmpW[2] -= 0.050*CLHEP::mm;
842  new G4PVPlacement((G4RotationMatrix *) 0, posTmpW, aVolNeckGW, aNStrTmpW + std::string("_P"),
843  volMother, false, 1, true);
844 
845  }
846  zCoordLocalCurrent += lengthNeck + 0.025*CLHEP::mm;
847  fZCoordCDRevisedHornB.push_back(zCoordLocalCurrent - zZeroLocalCoord);
848  fRInCoordCDRevisedHornB.push_back(radInnerInnerNeck);
849  std::cerr << " Last Z coord for upstr. cone and neck " << zCoordLocalCurrent << std::endl;
850  }
851  //
852  // The downstream cone.
853  //
854  {
855  std::string aNStrTmp(header); aNStrTmp += std::string("DwnstrCone");
856  zTmps[0] = zCoordLocalCurrent;
857  rTmps[0] = radInnerInnerNeck;
858  const double zDwnstCL1 = 22.3*CLHEP::mm;
859  zTmps[1] = zTmps[0] + zDwnstCL1;
860  rTmps[1] = 83.6*CLHEP::mm;
861  const double zDwnstCL2 = 595.75*CLHEP::mm;
862  zTmps[2] = zTmps[1] + zDwnstCL2;
863  rTmps[2] = 219.9*CLHEP::mm;
864  const double zDwnstCL3 = 44.63*CLHEP::mm;
865  zTmps[3] = zTmps[2] + zDwnstCL3;
866  rTmps[3] = 225.0*CLHEP::mm;
867  for (size_t kk=0; kk != 4; kk++) {
868  zTmps[4+kk] = zTmps[4 - kk - 1];
869  rTmps[4+kk] = rTmps[4 - kk - 1] + thickInner;
870  }
871 
872  G4GenericPolycone *aVolGPCD =
873  new G4GenericPolycone(aNStrTmp, 0.0, 360.0*CLHEP::degree, 8, &rTmps[0], &zTmps[0]);
874  G4LogicalVolume *aVolGCD = new G4LogicalVolume(aVolGPCD, myAlumIC, aNStrTmp);
875  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolGCD, aNStrTmp + std::string("_P"),
876  volMother, false, 1, true);
877  for(size_t kk=0; kk != 4; kk++) {
878  fZCoordCDRevisedHornB.push_back(zTmps[kk] - zZeroLocalCoord);
879  fRInCoordCDRevisedHornB.push_back(rTmps[kk]);
880  }
881  if (fWaterLayerThickInHorns > 1.0e-6) {
882  // No futz around.. No welds now spider support.
883  std::vector<double> rTmpsW(rTmps);
884  for (size_t kk=0; kk != 4; kk++) rTmps[kk] = rTmps[4+kk] + 0.025*CLHEP::mm;
885  for (size_t kk=0; kk != 4; kk++) rTmps[kk+4] = rTmps[4] + fWaterLayerThickInHorns;
886  std::vector<double> zTmpsW(zTmps);
887  std::string aNStrTmpW(aNStrTmp); aNStrTmpW += std::string("Water");
888  G4GenericPolycone* aVolDCGTW =
889  new G4GenericPolycone(aNStrTmpW, 0.0, 360.0*CLHEP::degree, 8, &rTmpsW[0], &zTmpsW[0]);
890  G4LogicalVolume *aVolDCGW = new G4LogicalVolume(aVolDCGTW, myWater, aNStrTmpW);
891  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolDCGW, aNStrTmpW + std::string("_P"),
892  volMother, false, 1, true);
893 
894  }
895  zCoordLocalCurrent += zDwnstCL1 + zDwnstCL2 + zDwnstCL3 + 0.025*CLHEP::mm;
896  std::cerr << " zCoordLocalCurrent, just before defining downstream cylinder " << zCoordLocalCurrent << std::endl;
897 
898  }
899  //
900  // The downstream cylinder.
901  //
902  const double lengthICDwnstrCyl = (1042.82 - 0.1)*CLHEP::mm; // as we have adding a bit of length each time,
903  // substract some..
904  const double radInnerInnerDw = 225.0*CLHEP::mm;
905  {
906 
907  const double radInnerOuterDw = radInnerInnerDw + thickInner;
908  std::string aNStrTmp(header); aNStrTmp += std::string("ICCyl1");
909  G4Tubs* aVolIC0GT = new G4Tubs(aNStrTmp,
910  radInnerInnerDw, radInnerOuterDw, 0.5*lengthICDwnstrCyl, 0.0, 360.0*CLHEP::degree);
911  G4LogicalVolume *aVolIC0G = new G4LogicalVolume(aVolIC0GT, myAlumIC, aNStrTmp);
912  G4ThreeVector posTmp(0., 0., zCoordLocalCurrent + 0.5*lengthICDwnstrCyl);
913  std::cerr << " Long. Position of downstream cylinder " << posTmp[2] << " length " << lengthICDwnstrCyl<< std::endl;
914  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolIC0G, aNStrTmp + std::string("_P"),
915  volMother, false, 1, true);
916  if (fWaterLayerThickInHorns > 1.0e-6) {
917  double lengthICDwnCylICWUp = 101.5*CLHEP::mm - 1.0*CLHEP::mm;
918  // First short section, upstream of the spider support. Includes the weld.
919  const double radInnerW = radInnerOuterDw + 0.010;
920  const double radOuterW = radInnerW + fWaterLayerThickInHorns;
921  std::string aNStrTmpWUp(aNStrTmp); aNStrTmpWUp += std::string("WaterUp");
922  G4Tubs* aVolIC0GTWUp = new G4Tubs(aNStrTmpWUp,
923  radInnerW, radOuterW, 0.5*lengthICDwnCylICWUp, 0.0, 360.0*CLHEP::degree);
924  G4LogicalVolume *aVolIC0GWUp = new G4LogicalVolume(aVolIC0GTWUp, myWater, aNStrTmpWUp);
925  G4ThreeVector posTmpWUp(0., 0., zCoordLocalCurrent + 0.5*lengthICDwnCylICWUp + 0.5*CLHEP::mm);
926 
927  std::cerr << " Long. Position of downstream cylinder water layer, upstream "
928  << posTmpWUp[2] << " Length " << lengthICDwnCylICWUp << std::endl;
929  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWUp, aVolIC0GWUp, aNStrTmpWUp + std::string("_P"),
930  volMother, false, 1, true);
931  //
932  // The downstream end, past the spider web support.
933  const double lengthICDwnCylICWDw = lengthICDwnstrCyl -
934  lengthICDwnCylICWUp - lengthSpiderWebSupportOnIC - 1.0*CLHEP::mm; // with ~ one mm clearance.
935  std::string aNStrTmpWDw(aNStrTmp); aNStrTmpWDw += std::string("WaterDw");
936  G4Tubs* aVolIC0GTWDw = new G4Tubs(aNStrTmpWDw,
937  radInnerW, radOuterW, 0.5*lengthICDwnCylICWDw, 0.0, 360.0*CLHEP::degree);
938  G4LogicalVolume *aVolIC0GWDw = new G4LogicalVolume(aVolIC0GTWDw, myWater, aNStrTmpWDw);
939  G4ThreeVector posTmpWDw(0., 0.,
940  zCoordLocalCurrent + lengthICDwnCylICWUp +
941  lengthSpiderWebSupportOnIC + 0.5*lengthICDwnCylICWDw + 1.0*CLHEP::mm);
942  std::cerr << " Long. Position of downstream cylinder water layer, downsstream "
943  << posTmpWDw[2] << " Length " << lengthICDwnCylICWDw << std::endl;
944  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWDw, aVolIC0GWDw, aNStrTmpWDw + std::string("_P"),
945  volMother, false, 1, true);
946 
947  }
948  //
949  // We place a weld on top of the water layer, if there.
950  //
951 
952  const double length2ndWeld = 16.0*CLHEP::mm; // we subtract 5 mm to make room for the weld.
953  double radInnerWeld = radInnerOuterDw + 0.010;
954  double radOuterWeld = radInnerWeld + 2.0; // top of the bulge at 165, 4.5 mm thick max.
955  // place this weld on top of the water layer.. for modeling simplicity.
956  if (fWaterLayerThickInHorns > 1.0e-6) {
957  radInnerWeld += 0.005*CLHEP::mm + fWaterLayerThickInHorns;
958  radOuterWeld += 0.005*CLHEP::mm + fWaterLayerThickInHorns;
959  }
960  std::string aNStrTmpWeld(aNStrTmp); aNStrTmpWeld += std::string("Weld");
961  G4Tubs* aVolIC0GTWe = new G4Tubs(aNStrTmpWeld,
962  radInnerWeld, radOuterWeld, 0.5*length2ndWeld, 0.0, 360.0*CLHEP::degree);
963  G4LogicalVolume *aVolIC0GWe = new G4LogicalVolume(aVolIC0GTWe, myAlumIC, aNStrTmpWeld);
964  G4ThreeVector posTmpWeld(0., 0., zCoordLocalCurrent + 48.5*CLHEP::mm + 0.5*length2ndWeld); // approximate. Z location, few mm.
965  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWeld, aVolIC0GWe, aNStrTmpWeld + std::string("_P"),
966  volMother, false, 1, true);
967  //
968  // Lastly, we place a Spider web support attachment ring
969  //
970  std::string aNStrTmpSpd(aNStrTmp); aNStrTmpSpd += std::string("SPWS");
971  G4Tubs* aVolIC1GTSpd = new G4Tubs(aNStrTmpSpd,
972  radInnerOuterDw+0.010*CLHEP::mm,
973  radInnerOuterDw+7.5*CLHEP::mm, 0.5*lengthSpiderWebSupportOnIC, 0.0, 360.0*CLHEP::degree);
974  G4LogicalVolume *aVolIC1GSpd = new G4LogicalVolume(aVolIC1GTSpd, myAlumIC, aNStrTmpSpd);
975  G4ThreeVector posTmpSpd(0., 0.,
976  zCoordLocalCurrent + 101.5*CLHEP::mm + 0.5*lengthSpiderWebSupportOnIC ); // approximate. Z location, few mm.
977  zPosSpiderWebSupportOnIC[2] = posTmpSpd[2];
978  radRingSpiderSuppICOuter[2] = radInnerOuterDw + 7.5*CLHEP::mm + 0.025*CLHEP::mm;
979  std::cerr << " Long. Position of last spider web support ring "
980  << posTmpSpd[2] << " Length " << lengthSpiderWebSupportOnIC << std::endl;
981  new G4PVPlacement((G4RotationMatrix *) 0, posTmpSpd, aVolIC1GSpd, aNStrTmpSpd + std::string("_P"),
982  volMother, false, 1, true);
983 
984  zCoordLocalCurrent += lengthICDwnstrCyl + 0.025*CLHEP::mm;
985  fZCoordCDRevisedHornB.push_back(zCoordLocalCurrent - zZeroLocalCoord);
986  fRInCoordCDRevisedHornB.push_back(radInnerInnerDw);
987 
988  std::cerr << " Distance between the downstream end of IC and zZeroLocal Coord "
989  << zCoordLocalCurrent - zZeroLocalCoord << std::endl;
990 
991  } // Downstream IC cylinder.
992  //
993  // The spider web support themselves.
994  //
995  for (size_t iCs=0; iCs != 3; iCs++) {
996 
997  const double zSpiderSupport = zPosSpiderWebSupportOnIC[iCs];
998  //
999 // The spider support. almost same code as for HornA.
1000 // The connecting piece ring to the hangers.. There are three of them, at 120 degrees from each other.
1001 //
1002  std::string nameStrH(header); nameStrH+= std::string("Spider_");
1003  std::ostringstream osstrTmp; osstrTmp << iCs;
1004  nameStrH += osstrTmp.str() + std::string("_support");
1005  G4String nameStr2(nameStrH); nameStr2 += G4String("_Riser");
1006  const double heightRiser = 0.333*in - 0.020*CLHEP::mm;
1007  const double widthH = 1.5*in; // See drawing 8875.112-MD 363115
1008  const double thickH = 0.184*2*in;
1009  G4Box *aBoxRiser = new G4Box(nameStr2, widthH/2., heightRiser/2.0, thickH/2.0);
1010  G4LogicalVolume *pCurrentRiser =
1011  new G4LogicalVolume(aBoxRiser, myAlumIC, nameStr2);
1012 
1013  G4String nameStr3(nameStrH); nameStr3 += G4String("Hanger");
1014  const double heightH = radInnerOC - radRingSpiderSuppICOuter[iCs] - 1.0*CLHEP::mm - heightRiser;
1015  const double widthH2 = 1.0*in; // 363115 Note: we collapsed both hanger along the horizontal, transverse
1016  // direction.
1017  const double thickH2 = 0.031*in;
1018  G4Box *aBoxHanger = new G4Box(nameStr3, widthH2/2., heightH/2.0, thickH2/2.0);
1019  G4LogicalVolume *pCurrentHanger =
1020  new G4LogicalVolume(aBoxHanger, myAlumIC, nameStr3);
1021 
1022  G4ThreeVector posTmp(0., 0., zSpiderSupport);
1023 
1024  for (int iRot=0; iRot != 3; iRot++) {
1025  std::ostringstream rnStrStr; rnStrStr << "_" << (iRot+1);
1026  G4String rnStr(rnStrStr.str());
1027  // Same Z position as above...
1028  G4RotationMatrix * rMatPr = 0;
1029  if (iRot == 1) {
1030  rMatPr = new G4RotationMatrix;
1031  rMatPr->rotateZ(2.0*M_PI/3.);
1032  } else if (iRot == 2) {
1033  rMatPr = new G4RotationMatrix;
1034  rMatPr->rotateZ(-2.0*M_PI/3.);
1035  }
1036 
1037  const double dHRiser = radRingSpiderSuppICOuter[iCs] + 0.010*CLHEP::mm + heightRiser/2.;
1038  posTmp[0] = 0.; posTmp[1] = dHRiser;
1039  if (iRot != 0) {
1040  posTmp[0] = dHRiser*rMatPr->xy();
1041  posTmp[1] = dHRiser*rMatPr->yy();
1042  }
1043  if (iRot == 0) {
1044  new G4PVPlacement(rMatPr, posTmp, pCurrentRiser, nameStr2 + std::string("_P") + rnStr,
1045  volMother, false, iRot, fCheckVolumeOverLapWC);
1046  } else {
1047  new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentRiser, nameStr2 + std::string("_P") + rnStr,
1048  volMother, false, iRot, true);
1049  }
1050 // Now the hanger it self
1051 
1052  const double dHHanger = radRingSpiderSuppICOuter[iCs] + 0.010*CLHEP::mm + 0.5*CLHEP::mm + heightRiser + heightH/2.;
1053  posTmp[0] = 0.; posTmp[1] = dHHanger;
1054  if (iRot != 0) {
1055  posTmp[0] = dHHanger*rMatPr->xy();
1056  posTmp[1] = dHHanger*rMatPr->yy();
1057  }
1058  // Same Z position as above...
1059  if (iRot == 0) {
1060  new G4PVPlacement(rMatPr, posTmp, pCurrentHanger, nameStr3 + std::string("_P") + rnStr,
1061  volMother, false, iRot, fCheckVolumeOverLapWC);
1062  } else {
1063  new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentHanger, nameStr3 + std::string("_P") + rnStr,
1064  volMother, false, iRot, true);
1065  }
1066  } // on the 120 degree symmetry point.
1067  } // Spider support number.
1068  //
1069  // The downstream I/O section. Again, adapted from HornA.
1070  //
1071  double zEndICIOFl = 0.;
1072  {
1073  const double radOuterDownstrtIO = 0.5*(525. - radInnerInnerDw)*CLHEP::mm; // Drawing F10071312.
1074  const double radInnerDownstrtIO = 0.5*(2.0*radOuterDownstrtIO - 8.0*CLHEP::mm - thickInner); //
1075  const double phiStartInnerDownstrtIO = 0.;
1076  const double yCenterInnerDownstrtIO = radInnerInnerDw + thickInner + radInnerDownstrtIO;
1077  const double yCenterOuterDownstrtIO = radInnerInnerDw + radOuterDownstrtIO;
1078  const double zCenterDownstrtIO = zCoordLocalCurrent;
1079  std::cerr << " Check distance between start of the downstream IO section to zZeroLocalCoord "
1080  << zCenterDownstrtIO - zZeroLocalCoord << std::endl;
1081  const size_t nSegDownstrIO = 20.;
1082 // const size_t nSegDownstrIO = 5.;
1083  const double deltaPhiDownstrIO = (M_PI - phiStartInnerDownstrtIO)/nSegDownstrIO;
1084  // This section is physically bigger, and is much more exposed to pion than the upstream one, make it more
1085  for (size_t kPhi = 0; kPhi != nSegDownstrIO; kPhi++ ) {
1086  std::ostringstream aNStrStr; aNStrStr << header << "DownstrIOSect" << kPhi;
1087  std::string aNStr(aNStrStr.str());
1088  fHorn2IC.push_back(aNStr);
1089  const double phi0 = phiStartInnerDownstrtIO + kPhi*deltaPhiDownstrIO + 1.0e-5;
1090  const double phi1 = phi0 + deltaPhiDownstrIO - 2.0e-5;
1091  zTmps[0] = zCenterDownstrtIO + radInnerDownstrtIO*std::sin(phi0);
1092  zTmps[1] = zCenterDownstrtIO + radOuterDownstrtIO*std::sin(phi0);
1093  zTmps[2] = zCenterDownstrtIO + radOuterDownstrtIO*std::sin(phi1);
1094  zTmps[3] = zCenterDownstrtIO + radInnerDownstrtIO*std::sin(phi1);
1095  rTmps[0] = yCenterInnerDownstrtIO - radInnerDownstrtIO*std::cos(phi0);
1096  rTmps[1] = yCenterOuterDownstrtIO - radOuterDownstrtIO*std::cos(phi0);
1097  rTmps[2] = yCenterOuterDownstrtIO - radOuterDownstrtIO*std::cos(phi1);
1098  rTmps[3] = yCenterInnerDownstrtIO - radInnerDownstrtIO*std::cos(phi1);
1099 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
1100 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
1101 // zTmps[kk] << " " << std::endl;
1102  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
1103  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
1104  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
1105  volMother, false, 1, true);
1106  if (kPhi < nSegDownstrIO/2) {
1107  fRInCoordCDRevisedHornB.push_back(rTmps[1]);
1108  fZCoordCDRevisedHornB.push_back(zTmps[0] - zZeroLocalCoord); // with respect to zZero.
1109  }
1110  }
1111  } // Downstream IO section.
1112  //
1113  // The IC Downstream flange.
1114  //
1115  double zLocalDwnstrICFlange = 0.;
1116  {
1117  // First, the curved par of the IOC, leading to the flange. Make it a set of 4 pts polycone.
1118  // same algorithm as above, over 90 instead of 180 degree.
1119  const double radInnerFlDownstrtIO = 50.*CLHEP::mm; // Drawing F10071312.
1120  const double radOuterFlDownstrtIO = 24.5*CLHEP::mm; //
1121  const double phiStartInnerFlDownstrtIO = 0.083333; // eye-balled!!!
1122  const double phiStartOuterFlDownstrtIO = 0.0;
1123  const double yCenterOuterFlDownstrtIO = radOuterFlDownstrtIO + 525.0*CLHEP::mm;
1124  const double yCenterInnerFlDownstrtIO = radInnerFlDownstrtIO + 517.0*CLHEP::mm;
1125  const double zCenterFlDownstrtIO = zCoordLocalCurrent - 0.050*CLHEP::mm;
1126  const size_t nSegFlDownstrIO = 10;
1127  const double deltaPhiFlDownstrIOInner = (M_PI/2.0 - phiStartInnerFlDownstrtIO)/nSegFlDownstrIO;
1128  const double deltaPhiFlDownstrIOOuter = (M_PI/2.0 - phiStartOuterFlDownstrtIO)/nSegFlDownstrIO;
1129 // std::cerr << " Installing curved ICtoInsulator, set of polygons, zCenterFlDownstrtIO "
1130 // << zCenterFlDownstrtIO << " YcOuter " << yCenterOuterFlDownstrtIO
1131 // << " YcInner " << yCenterInnerFlDownstrtIO << std::endl;
1132  for (size_t kPhi = 0; kPhi != nSegFlDownstrIO; kPhi++ ) {
1133  std::ostringstream aNStrStr; aNStrStr << header << "DwnstrFlIOSect" << kPhi;
1134  std::string aNStr(aNStrStr.str());
1135  const double phi0Inner = phiStartInnerFlDownstrtIO + kPhi*deltaPhiFlDownstrIOInner + 1.0e-2;
1136  const double phi1Inner = phi0Inner + deltaPhiFlDownstrIOInner - 2.0e-2;
1137  const double phi0Outer = phiStartOuterFlDownstrtIO + kPhi*deltaPhiFlDownstrIOOuter + 1.0e-2;
1138  const double phi1Outer = phi0Outer + deltaPhiFlDownstrIOOuter - 2.0e-2;
1139  zTmps[0] = zCenterFlDownstrtIO - radOuterFlDownstrtIO*std::cos(phi0Outer);
1140  zTmps[1] = zCenterFlDownstrtIO - radOuterFlDownstrtIO*std::cos(phi1Outer);
1141  zTmps[2] = zCenterFlDownstrtIO - radInnerFlDownstrtIO*std::cos(phi1Inner);
1142  zTmps[3] = zCenterFlDownstrtIO - radInnerFlDownstrtIO*std::cos(phi0Inner);
1143  rTmps[0] = yCenterOuterFlDownstrtIO - radOuterFlDownstrtIO*std::sin(phi0Outer);
1144  rTmps[1] = yCenterOuterFlDownstrtIO - radOuterFlDownstrtIO*std::sin(phi1Outer);
1145  rTmps[2] = yCenterInnerFlDownstrtIO - radInnerFlDownstrtIO*std::sin(phi1Inner);
1146  rTmps[3] = yCenterInnerFlDownstrtIO - radInnerFlDownstrtIO*std::sin(phi0Inner);
1147 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
1148 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
1149 // zTmps[kk] << " " << std::endl;
1150  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
1151  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
1152  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
1153  volMother, false, 1, true);
1154  }
1155  // we now put the outer part of the flange, 25 mm thick
1156 
1157  zTmps[0] = zCenterFlDownstrtIO - radOuterFlDownstrtIO;
1158  rTmps[0] = 629.5*CLHEP::mm;
1159  zTmps[1] = zTmps[0];
1160  rTmps[1] = yCenterOuterFlDownstrtIO + 0.010*CLHEP::mm;
1161  zTmps[2] = zCenterFlDownstrtIO - radInnerFlDownstrtIO;;
1162  rTmps[2] = yCenterInnerFlDownstrtIO + 0.010*CLHEP::mm;;
1163  zTmps[3] = zTmps[2];
1164  rTmps[3] = rTmps[0];
1165  std::string aNStrTmpO(header); aNStrTmpO += std::string("ICDwnstrFlA");
1166  fHorn2IC.push_back(aNStrTmpO);
1167  G4GenericPolycone* aVolDwnstrFlA =
1168  new G4GenericPolycone(aNStrTmpO, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
1169  G4LogicalVolume *aVolDwnstrFlAG = new G4LogicalVolume(aVolDwnstrFlA, myAlumOC, aNStrTmpO);
1170  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolDwnstrFlAG, aNStrTmpO + std::string("_P"),
1171  volMother, false, 1, true);
1172  zEndICIOFl = zTmps[0];
1173 
1174  } // End of IC downstream flange
1175  //
1176  // the Outer conductor.
1177  //
1178  double zLocalDwnstrOCFlange = 0.; // to connect to the outer current equalizer section.
1179  double zLocalStartICEQ = 0.;
1180  double zLocalStartOCEQ = 0.;
1181  {
1182  const double thickUpstrFlange = (28.0 -1.5)*CLHEP::mm;
1183  const double spacerUstrFlange = 67.0*CLHEP::mm; // distance between the beginning of IC and the flange.
1184  const double lengthOC = (3149.2 - 0.05)*CLHEP::mm; //including the flanges. with 50 microns clearance
1185  const double radOuterOC = 650.*CLHEP::mm;
1186  std::string aNStrTmp(header); aNStrTmp += std::string("OC");
1187  G4Tubs* aVolOCG = new G4Tubs(aNStrTmp, radInnerOC, radOuterOC,
1188  0.5*lengthOC, 0.0, 360.0*CLHEP::degree);
1189  G4LogicalVolume *aVolOCGL = new G4LogicalVolume(aVolOCG, myAlumOC, aNStrTmp);
1190  G4ThreeVector posTmp(0., 0., zZeroLocalCoord + spacerUstrFlange + 0.5*lengthOC + 0.010*CLHEP::mm);
1191  std::cerr << " Position of Outer Conductor main cylinder " << posTmp[2] << " length "
1192  << lengthOC << std::endl;
1193  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolOCGL, aNStrTmp + std::string("_P"),
1194  volMother, false, 1, true);
1195 
1196  zLocalDwnstrOCFlange += posTmp[2] + 0.5*lengthOC + 0.010*CLHEP::mm;
1197  std::cerr << " Z position of the start of the OC " << posTmp[2] - 0.5*lengthOC << std::endl;
1198  std::cerr << " Z position of the start of the OC downstream flange and drain connect " <<
1199  zLocalDwnstrOCFlange << std::endl;
1200  //
1201  // The OC upstream flange
1202  //
1203  const double radInnerOCFl = 634*CLHEP::mm;
1204  const double radOuterOCFl = 688.*CLHEP::mm;
1205  std::string aNStrTmp2(header); aNStrTmp2 += std::string("OCFlU1");
1206  G4Tubs* aVolOCFlG = new G4Tubs(aNStrTmp2, radInnerOCFl, radOuterOCFl,
1207  0.5*thickUpstrFlange, 0.0, 360.0*CLHEP::degree);
1208  G4LogicalVolume *aVolOCFlGL = new G4LogicalVolume(aVolOCFlG, myAlumOC, aNStrTmp);
1209 
1210  G4ThreeVector posTmp2(0., 0., zZeroLocalCoord + 39.5*CLHEP::mm + 0.5*thickUpstrFlange + 0.5*CLHEP::mm);
1211  new G4PVPlacement((G4RotationMatrix *) 0, posTmp2, aVolOCFlGL, aNStrTmp2 + std::string("_P"),
1212  volMother, false, 1, true);
1213  } // End of Outer Conductor
1214  //
1215  // The OC Downstream flanges. They are now more complicated, as they include the outer belt in which the
1216  // holes for the water drain are cut. We do not implement these cut volumes, outside the beam aperture of the beam.
1217  //
1218  {
1219  // Again, a polycone.
1220  const double thickOC = 16.0*CLHEP::mm;
1221  zTmps[0] = zLocalDwnstrOCFlange;
1222  rTmps[0] = 634.0*CLHEP::mm;
1223  zTmps[1] = zTmps[0] + 108.76*CLHEP::mm;
1224  rTmps[1] = 702.2*CLHEP::mm;
1225  zTmps[2] = zTmps[0] + 138.2*CLHEP::mm;
1226  rTmps[2] = 707.5*CLHEP::mm;
1227  zTmps[3] = zTmps[0] + 297.4*CLHEP::mm;
1228  rTmps[3] = 691.*CLHEP::mm;
1229  zTmps[4] = zTmps[0] + 359.1*CLHEP::mm;
1230  rTmps[4] = 651.*CLHEP::mm;
1231  zTmps[5] = zTmps[0] + 376.*CLHEP::mm;
1232  rTmps[5] = 651.*CLHEP::mm;
1233  zTmps[6] = zTmps[0] + 404.*CLHEP::mm;
1234  rTmps[6] = 634.*CLHEP::mm;
1235  zTmps[7] = zTmps[0] + 404.*CLHEP::mm;
1236  rTmps[7] = 634.*CLHEP::mm;
1237  for (size_t kk=0; kk != 8; kk++) {
1238  zTmps[kk+8] = zTmps[7 - kk];
1239  rTmps[kk+8] = rTmps[7 - kk] + thickOC;
1240  }
1241  rTmps[8] = 697.*CLHEP::mm;
1242  rTmps[9] = 766.5*CLHEP::mm;
1243  rTmps[10] = 766.5*CLHEP::mm;
1244  std::string aNStrTmpO(header); aNStrTmpO += std::string("OCDwnstrFl");
1245  G4GenericPolycone* aVolDwnstrFlA =
1246  new G4GenericPolycone(aNStrTmpO, 0.0, 360.0*CLHEP::degree, 16, &rTmps[0], &zTmps[0]);
1247  G4LogicalVolume *aVolDwnstrFlAG = new G4LogicalVolume(aVolDwnstrFlA, myAlumOC, aNStrTmpO);
1248  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolDwnstrFlAG, aNStrTmpO + std::string("_P"),
1249  volMother, false, 1, true);
1250  zLocalStartOCEQ = zTmps[7];
1251  }
1252  //
1253  // The insulator ring Drawing/part F10060437
1254  //
1255  {
1256  const double thickInsulator = (70.0 - 0.050)*CLHEP::mm; // 50 microns clearance. Position of OC not that accurate.
1257  const double radInnerInsul = 634.0*CLHEP::mm;
1258  const double radOuterInsul = 694.0*CLHEP::mm;
1259  std::string aNStrTmp(header); aNStrTmp += std::string("Insul");
1260  G4Tubs* aVolOCInsulG = new G4Tubs(aNStrTmp, radInnerInsul, radOuterInsul,
1261  0.5*thickInsulator, 0.0, 360.0*CLHEP::degree);
1262  G4LogicalVolume *aVolOCInsulGL = new G4LogicalVolume(aVolOCInsulG, myAlumina, aNStrTmp);
1263  std::cerr << " Placing insulator ring, from zLocalStartICEQ " << zLocalStartICEQ << std::endl;
1264  //
1265  G4ThreeVector posTmp(0., 0., zLocalStartOCEQ + 0.5*thickInsulator + 0.025*CLHEP::mm);
1266  std::cerr << " .... zLocalStartICEQ after installation of the insulator ring .. " << zLocalStartICEQ << std::endl;
1267  // 0.025 mm is apprixomate..
1268  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolOCInsulGL, aNStrTmp + std::string("_P"),
1269  volMother, false, 1, true);
1270 
1271  zLocalStartICEQ = posTmp[2] + 0.5*thickInsulator + 0.050*CLHEP::mm; // for the insulator ring.
1272  }
1273  //
1274  // The IC EQ Connecting flanges. Two of them, although they are only one piece in drawing F10071385
1275  // This piece is holding together the Inner conductor to it's inner current equalizer section
1276  //
1277  {
1278  const double thickCon1 = 23.*CLHEP::mm;
1279  const double thickCon2 = (45. - thickCon1 - 0.050)*CLHEP::mm;
1280  const double radInnerCon1 = 630.1*CLHEP::mm;
1281  const double radOuterCon1 = 697.0*CLHEP::mm;
1282  const double radInnerCon2 = 570.0*CLHEP::mm;
1283  const double radOuterCon2 = radOuterCon1;
1284  std::string aNStrTmp1(header); aNStrTmp1 += std::string("Con1ICICEQ");
1285  G4Tubs* aVolOC1G = new G4Tubs(aNStrTmp1, radInnerCon1, radOuterCon1,
1286  0.5*thickCon1, 0.0, 360.0*CLHEP::degree);
1287  std::string aNStrTmp2(header); aNStrTmp2 += std::string("Con2ICICEQ");
1288  G4Tubs* aVolOC2G = new G4Tubs(aNStrTmp2, radInnerCon2, radOuterCon2,
1289  0.5*thickCon2, 0.0, 360.0*CLHEP::degree);
1290  G4LogicalVolume *aVolOC1GL = new G4LogicalVolume(aVolOC1G, myAlumOC, aNStrTmp1);
1291  G4LogicalVolume *aVolOC2GL = new G4LogicalVolume(aVolOC2G, myAlumOC, aNStrTmp2);
1292  //
1293  // We push this flange and IC EQ by 1.2 mm downstream, accumulated error of IC lengths..
1294  //
1295 // zLocalStartICEQ += 1.2*CLHEP::mm; not needed!.
1296 
1297  G4ThreeVector posTmp1(0., 0., zLocalStartICEQ + 0.5*thickCon1 + 0.05*CLHEP::mm);
1298  std::cerr << " Zstart of Inner IC connect Flange to EQ IC1 " << posTmp1[2] - 0.5*thickCon1
1299  << " Zend of of the downstream IC flange " << zEndICIOFl << std::endl;
1300  std::cerr << " Dist Zstart of Inner IC connect Flange to EQ IC1 " << posTmp1[2] - 0.5*thickCon1 - zZeroLocalCoord
1301  << " and dist Zend of of the downstream IC flange " << zEndICIOFl - zZeroLocalCoord << std::endl;
1302  //
1303  new G4PVPlacement((G4RotationMatrix *) 0, posTmp1, aVolOC1GL, aNStrTmp1 + std::string("_P"),
1304  volMother, false, 1, true);
1305  std::cerr << " Z position of the connecting flange, inner " << posTmp1[2] << std::endl;
1306  G4ThreeVector posTmp2(0., 0., posTmp1[2] + 0.5*thickCon1 + 0.5*thickCon2 + 0.015*CLHEP::mm);
1307  new G4PVPlacement((G4RotationMatrix *) 0, posTmp2, aVolOC2GL, aNStrTmp2 + std::string("_P"),
1308  volMother, false, 1, true);
1309  std::cerr << " Z position of the connecting flange, outer " << posTmp2[2] << std::endl;
1310  zLocalDwnstrICFlange = posTmp2[2] + 0.5*thickCon2 + 0.025*CLHEP::mm;
1311  // Add one more, esthetically pleasing..
1312  const double radInnerCon3 = radOuterCon1 + 0.015*CLHEP::mm;
1313  const double radOuterCon3 = 715.*CLHEP::mm;
1314  const double thickCon3 = 12.9*CLHEP::mm;
1315  std::string aNStrTmp3(header); aNStrTmp3 += std::string("Con3ICICEQ");
1316  G4Tubs* aVolOC3G = new G4Tubs(aNStrTmp3, radInnerCon3, radOuterCon3,
1317  0.5*thickCon3, 0.0, 360.0*CLHEP::degree);
1318  G4LogicalVolume *aVolOC3GL = new G4LogicalVolume(aVolOC3G, myAlumOC, aNStrTmp3);
1319  G4ThreeVector posTmp3(0., 0., zLocalDwnstrICFlange - 0.5*thickCon3 + 0.0125*CLHEP::mm); // not a typo in sign
1320  new G4PVPlacement((G4RotationMatrix *) 0, posTmp3, aVolOC3GL, aNStrTmp3 + std::string("_P"),
1321  volMother, false, 1, true);
1322 
1323  }
1324  //
1325  // The current equalizer sections, subsection that are include in the mother volume.
1326  // Start with the IC one.
1327 
1328  fLengthCurrEqICInMotherHorn2 = (922.5 - 0.050)*CLHEP::mm; //This does not include the connecting flange.
1329  // Could be used to compute correction to the magnetic field.
1330  std::cerr << " ... Installing the current equalizer section for IC , Starting at Z " <<
1331  zLocalDwnstrICFlange << " (In Horn2 coord sys.), " << std::endl
1332  << " ..... length of mother " << lengthMother <<
1333  " fLengthCurrEqICInMotherHorn2 = " << fLengthCurrEqICInMotherHorn2 << std::endl;
1334 
1335  {
1336  const double thickFlDWICICEQ = 27.31*CLHEP::mm;
1337  const double radInnerICICEQ = 707.*CLHEP::mm;
1338  const double radOuterICICEQ = 715.*CLHEP::mm;
1339  const double radInnerFlDWICICEQ = 707.0*CLHEP::mm;
1340  const double radOuterFlDWICICEQ = 730.0*CLHEP::mm;
1341  fRadInnerICCurrEqHorn2 = radInnerICICEQ;
1342  fRadOuterICCurrEqHorn2 = radOuterICICEQ;
1343  std::string aNStrTmp1(header); aNStrTmp1 += std::string("ICCurrEq");
1344  G4Tubs* aVolOC1G = new G4Tubs(aNStrTmp1, radInnerICICEQ, radOuterICICEQ,
1345  0.5*fLengthCurrEqICInMotherHorn2, 0.0, 360.0*CLHEP::degree);
1346  G4LogicalVolume *aVolOC1GL = new G4LogicalVolume(aVolOC1G, myAlumOC, aNStrTmp1);
1347 
1348  G4ThreeVector posTmp(0., 0., zLocalDwnstrICFlange + 0.5*fLengthCurrEqICInMotherHorn2 + 0.0125*CLHEP::mm); // ..
1349  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolOC1GL, aNStrTmp1 + std::string("_P"),
1350  volMother, false, 1, true);
1351  std::string aNStrTmp2(header); aNStrTmp2 += std::string("ICCurrEqFlo");
1352  G4Tubs* aVolOC2G = new G4Tubs(aNStrTmp2, radInnerFlDWICICEQ, radOuterFlDWICICEQ,
1353  0.5*thickFlDWICICEQ, 0.0, 360.0*CLHEP::degree);
1354  G4ThreeVector posTmp2(0., 0., posTmp[2] + 0.5*fLengthCurrEqICInMotherHorn2 +
1355  0.0125*CLHEP::mm + 0.5*thickFlDWICICEQ);
1356  G4LogicalVolume *aVolOC2GL = new G4LogicalVolume(aVolOC2G, myAlumOC, aNStrTmp2);
1357  new G4PVPlacement((G4RotationMatrix *) 0, posTmp2, aVolOC2GL, aNStrTmp2 + std::string("_P"),
1358  volMother, false, 1, true);
1359  fLengthCurrEqICInMotherHorn2 += thickFlDWICICEQ + 28.*CLHEP::mm; //
1360  //
1361  // for sake of completion, the 4 Strip-line connecting pads.
1362  //
1363  const double angleHalfWPad = 0.131; // in radians
1364  const double radOuterPaDWICICEQ = 760.0*CLHEP::mm;
1365  const double radInnerPaDWICICEQ = (730.0+0.015)*CLHEP::mm;
1366  const double thickPaDWICICEQ = thickFlDWICICEQ;
1367  std::string aNStrTmp3(header); aNStrTmp3 += std::string("ICCurrEqFlo");
1368  double angleHalfPad = M_PI/4.;
1369  for (size_t kk=0; kk !=4; kk++) {
1370  std::ostringstream aStrStrTmpK3; aStrStrTmpK3 << "_" << kk;
1371  std::string aNStrTmpK3(aNStrTmp3); aNStrTmpK3 += aStrStrTmpK3.str();
1372  G4Tubs* aVolOC3G = new G4Tubs(aNStrTmpK3, radInnerPaDWICICEQ, radOuterPaDWICICEQ,
1373  0.5*thickPaDWICICEQ, angleHalfPad-angleHalfWPad, 2.0*angleHalfWPad);
1374  G4LogicalVolume *aVolOC3GL = new G4LogicalVolume(aVolOC3G, myAlumOC, aNStrTmpK3);
1375 
1376  new G4PVPlacement((G4RotationMatrix *) 0, posTmp2, aVolOC3GL, aNStrTmpK3 + std::string("_P"),
1377  volMother, false, 1, true);
1378  angleHalfPad += M_PI/2.;
1379  }
1380  } // End of IC Current equalizer section.
1381  //
1382  // The outer current equalizer sections, subsection that are include in the mother volume.
1383  // Drawing F10071400.
1384  //
1385  fLengthCurrEqOCInMotherHorn2 = (973.2 - 32.5 - 0.050)*CLHEP::mm;
1386  std::cerr << " ... Installing the current equalizer section for oC , Starting at Z " <<
1387  zLocalStartOCEQ << " (In Horn2 coord sys.), " << std::endl
1388  << " ..... length of mother " << lengthMother <<
1389  " fLengthCurrEqOCInMotherHorn2 = " << fLengthCurrEqOCInMotherHorn2 << std::endl;
1390 
1391  {
1392  const double thickFl1 = 32.5*CLHEP::mm;
1393  const double lengthTube = fLengthCurrEqOCInMotherHorn2;
1394  const double radInnerFl1 = 714.*CLHEP::mm;
1395  const double radOuterFl1 = 766.5*CLHEP::mm;
1396  const double radInnerTube = 758.5*CLHEP::mm;
1397  const double radOuterTube = radOuterFl1;
1398  fRadInnerOCCurrEqHorn2 = radInnerTube;
1399  fRadOuterOCCurrEqHorn2 = radOuterTube; // Could be used for magnetic field correction.
1400  std::string aNStrTmp1(header); aNStrTmp1 += std::string("OCCurrEqFl");
1401  G4Tubs* aVolOC1G = new G4Tubs(aNStrTmp1, radInnerFl1, radOuterFl1,
1402  0.5*thickFl1, 0.0, 360.0*CLHEP::degree);
1403  G4LogicalVolume *aVolOC1GL = new G4LogicalVolume(aVolOC1G, myAlumOC, aNStrTmp1);
1404 
1405  G4ThreeVector posTmp(0., 0., zLocalStartOCEQ + 0.5*thickFl1 + 0.025*CLHEP::mm); // ..
1406  std::cerr << " ZStart of EQOC upstrs flange " << posTmp[2] - 0.5*thickFl1 << " length " << thickFl1 << std::endl;
1407  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolOC1GL, aNStrTmp1 + std::string("_P"),
1408  volMother, false, 1, true);
1409  std::string aNStrTmp2(header); aNStrTmp2 += std::string("OCCurrEq");
1410  G4Tubs* aVolOC2G = new G4Tubs(aNStrTmp2, radInnerTube, radOuterTube,
1411  0.5*lengthTube, 0.0, 360.0*CLHEP::degree);
1412  G4LogicalVolume *aVolOC2GL = new G4LogicalVolume(aVolOC2G, myAlumOC, aNStrTmp2);
1413  G4ThreeVector posTmp2(0., 0., posTmp[2] + 0.5*thickFl1 + 0.5*lengthTube + 0.0125*CLHEP::mm); // ..
1414  std::cerr << " ZStart of EQOC upstrs body " << posTmp2[2] - 0.5*lengthTube << " length " << lengthTube << std::endl;
1415  new G4PVPlacement((G4RotationMatrix *) 0, posTmp2, aVolOC2GL, aNStrTmp2 + std::string("_P"),
1416  volMother, false, 1, true);
1417 
1418  const double thickFl2 = 27.5*CLHEP::mm; // Why different from above ??
1419  const double radInnerFl2 = 766.5*CLHEP::mm;
1420  const double radOuterFl2 = 773.5*CLHEP::mm;
1421  std::string aNStrTmp3(header); aNStrTmp3 += std::string("OCCurrEqFld");
1422  G4Tubs* aVolOC3G = new G4Tubs(aNStrTmp3, radInnerFl2, radOuterFl2,
1423  0.5*thickFl2, 0.0, 360.0*CLHEP::degree);
1424  G4LogicalVolume *aVolOC3GL = new G4LogicalVolume(aVolOC3G, myAlumOC, aNStrTmp3);
1425  G4ThreeVector posTmp3(posTmp2);
1426  posTmp3[2] += 0.5*lengthTube + 0.5*thickFl2 + 0.050*CLHEP::mm;
1427  new G4PVPlacement((G4RotationMatrix *) 0, posTmp3, aVolOC3GL, aNStrTmp3 + std::string("_P"),
1428  volMother, false, 1, true);
1429  //
1430  // again, the downstream flange to connect the striplines, and the pad.
1431  //
1432  const double radOuterPaDWOCOCEQ = 811.5*CLHEP::mm;
1433  const double angleHalfWPad = (210.*CLHEP::mm)/radOuterPaDWOCOCEQ; // in radians
1434  const double radInnerPaDWOCOCEQ = (773.5+0.015)*CLHEP::mm;
1435  const double thickPaDWOCOCEQ = thickFl2;
1436  std::string aNStrTmp4(header); aNStrTmp4 += std::string("ICCurrEqFlo");
1437  double angleHalfPad = M_PI/4.;
1438  for (size_t kk=0; kk !=4; kk++) {
1439  std::ostringstream aStrStrTmpK4; aStrStrTmpK4 << "_" << kk;
1440  std::string aNStrTmpK4(aNStrTmp4); aNStrTmpK4 += aStrStrTmpK4.str();
1441  G4Tubs* aVolOC4G = new G4Tubs(aNStrTmpK4, radInnerPaDWOCOCEQ, radOuterPaDWOCOCEQ,
1442  0.5*thickPaDWOCOCEQ, angleHalfPad-angleHalfWPad, 2.0*angleHalfWPad);
1443  G4LogicalVolume *aVolOC4GL = new G4LogicalVolume(aVolOC4G, myAlumOC, aNStrTmpK4);
1444 
1445  new G4PVPlacement((G4RotationMatrix *) 0, posTmp3, aVolOC4GL, aNStrTmpK4 + std::string("_P"),
1446  volMother, false, 1, true);
1447  angleHalfPad += M_PI/2.;
1448  }
1449  fLengthCurrEqOCInMotherHorn2 += thickFl1 + thickFl2;
1450  }
1451  for (size_t k=0; k != fZCoordCDRevisedHornB.size(); k++) fZCoordCDRevisedHornB[k] += distUpstreamToBeginIC + 0.050*CLHEP::mm;
1452 
1453  //
1454  // Check the exact R/Z coordinates...
1455  //
1456  std::cerr << " Dump of the R/Z map, accurate, for the magnetic field " << std::endl;
1457  for (size_t k=0; k != fZCoordCDRevisedHornB.size(); k++) {
1458  std::cerr << " " << k << " " << fRInCoordCDRevisedHornB[k] << " " << fZCoordCDRevisedHornB[k] << std::endl;
1459  }
1460  return;
1461 }
1463 
1464  if (fRadInnerICCurrEqHorn2 > 500.) {
1465 
1466  std::cerr << " Conceptual desing, October/November 2016, Skipping the installation of the strip lines, " <<
1467  " as they are no longer in the beam aperture. " << std::endl
1468  << " .... Also, we do not have the updated drawings yet. " << std::endl;
1469  return;
1470  }
1471 
1472  std::string header("LBNFConceptHornBStrpL");
1473  const LBNEVolumePlacementData *plDatMotherTunnel = this->Find(header, "Tunnel",
1474  "LBNEVolumePlacements::PlaceFinalLBNFConceptStripLinesConnectHornB");
1475  const LBNEVolumePlacementData *plDatMotherHorn2 = this->Find(header, "LBNFSimpleHorn2Container",
1476  "LBNEVolumePlacements::PlaceFinalLBNFConceptHornB");
1477 
1478  const double lengthHornB = plDatMotherHorn2->fParams[2];
1479  const double lengthStripZone = 870.25; // Drawing F10060435
1480  const double lengthStripZoneEff = lengthStripZone - fLengthCurrEqOCInMotherHorn2; // Already placed, see above.
1481  const double zPosStripZone = plDatMotherHorn2->fPosition[2] + 0.5*lengthHornB
1482  + 0.5*lengthStripZoneEff + 0.1*CLHEP::mm;
1483  G4Material *myAlum = G4Material::GetMaterial("Aluminum");
1484  G4Material *myAir = G4Material::GetMaterial("Air");
1485  // A mother volume for convenience of top/down declaration of the geometry.
1486  const double halfWidthZone = 561. + 47.5*CLHEP::mm; // Clearance of 45 + 2.5 mm , for the container box of rotate olumes
1487  const double halfHeightZone = 0.5*(1560. + 0.5*CLHEP::mm); // set by thetotal height of the strip line system.
1488  std::string aNStrTmp1(header); aNStrTmp1 += std::string("Mother");
1489  G4Box* aVolM = new G4Box(aNStrTmp1, halfWidthZone, halfHeightZone, 0.5*lengthStripZoneEff);
1490  G4LogicalVolume *volMotherLoc = new G4LogicalVolume(aVolM, myAir, aNStrTmp1);
1491  G4ThreeVector posTmpM(0., 0., zPosStripZone); // ..
1492  G4LogicalVolume *volMother = plDatMotherTunnel->fCurrent;
1493  new G4PVPlacement((G4RotationMatrix *) 0, posTmpM, volMotherLoc, aNStrTmp1 + std::string("_P"),
1494  volMother, false, 1, true);
1495  bool doInstallCurrEq = true;
1496  bool doInstallStrplConn = true;
1497  bool doInstallStrpl = true;
1498  //
1499  // The remaining of the current equalizer sections.
1500  //
1501  const double lengthCurrEqOC = 501.0*mm;
1502  const double lengthCurrEqOCHere = lengthCurrEqOC - fLengthCurrEqOCInMotherHorn2 - 0.050*CLHEP::mm;
1503  double zLocalCurrent = -0.5*lengthStripZoneEff + 0.025*CLHEP::mm;
1504  std::cerr << " .... zLocalCurrent Before placing Current eq "
1505  << zLocalCurrent << " lengthCurrEqOCHere " << lengthCurrEqOCHere << std::endl;
1506  if (doInstallCurrEq) {
1507  std::string aNStr1(header); aNStr1 += std::string("OCCurrEq");
1508  G4Tubs* aVolOC1G = new G4Tubs(aNStr1, fRadInnerOCCurrEqHorn2, fRadOuterOCCurrEqHorn2,
1509  0.5*lengthCurrEqOCHere, 0.0, 360.0*CLHEP::degree);
1510  G4LogicalVolume *aVolOC1GL = new G4LogicalVolume(aVolOC1G, myAlum, aNStr1);
1511  G4ThreeVector posTmp1(0., 0., zLocalCurrent+ 0.5*lengthCurrEqOCHere);
1512  new G4PVPlacement((G4RotationMatrix *) 0, posTmp1, aVolOC1GL, aNStr1 + std::string("_P"),
1513  volMotherLoc , false, 1, true);
1514 
1515  std::string aNStr2(header); aNStr2 += std::string("ICCurrEq");
1516  G4Tubs* aVolIC2G = new G4Tubs(aNStr2, fRadInnerICCurrEqHorn2, fRadOuterICCurrEqHorn2,
1517  0.5*lengthCurrEqOCHere, 0.0, 360.0*CLHEP::degree); // No typo, length are now the same
1518  G4LogicalVolume *aVolIC2GL = new G4LogicalVolume(aVolIC2G, myAlum, aNStr2);
1519  new G4PVPlacement((G4RotationMatrix *) 0, posTmp1, aVolIC2GL, aNStr2 + std::string("_P"),
1520  volMotherLoc , false, 1, true);
1521  zLocalCurrent = posTmp1[2] + 0.5*lengthCurrEqOCHere + 0.025*CLHEP::mm;
1522  std::cerr << " .... zLocalCurrent after placing Current eq " << zLocalCurrent << std::endl;
1523  //
1524  // Two flanges.
1525  //
1526  const double thickFlg = 25.0*CLHEP::mm;
1527  zLocalCurrent -= 0.5*thickFlg;
1528  std::string aNStr3(header); aNStr3 += std::string("OCCurrEqFl");
1529  G4Tubs* aVolOC3G = new G4Tubs(aNStr3, fRadOuterOCCurrEqHorn2+0.025*CLHEP::mm, 561.*CLHEP::mm,
1530  0.5*thickFlg, 0.0, 360.0*CLHEP::degree);
1531  G4LogicalVolume *aVolOC3GL = new G4LogicalVolume(aVolOC3G, myAlum, aNStr3);
1532  G4ThreeVector posTmp3(0., 0., zLocalCurrent);
1533  new G4PVPlacement((G4RotationMatrix *) 0, posTmp3, aVolOC3GL, aNStr3 + std::string("_P"),
1534  volMotherLoc , false, 1, true);
1535 
1536  std::string aNStr4(header); aNStr4 += std::string("ICCurrEqFl");
1537  G4Tubs* aVolIC4G = new G4Tubs(aNStr4, fRadOuterICCurrEqHorn2+0.025*CLHEP::mm, 388.*CLHEP::mm,
1538  0.5*thickFlg, 0.0, 360.0*CLHEP::degree); // No typo, length are now the same
1539  G4LogicalVolume *aVolIC4GL = new G4LogicalVolume(aVolIC4G, myAlum, aNStr4);
1540  new G4PVPlacement((G4RotationMatrix *) 0, posTmp3, aVolIC4GL, aNStr4 + std::string("_P"),
1541  volMotherLoc , false, 1, true);
1542  zLocalCurrent += 0.5*thickFlg + 0.025*CLHEP::mm;
1543  std::cerr << " After installing current equal downstream flanges , zLocalCurrent "
1544  << zLocalCurrent << std::endl;
1545  }
1546  //
1547  // The connection stripline to flange of current equalizer. Drawing F10061024
1548  //
1549  const double thickConnPlate = 9.52*CLHEP::mm;
1550  if (doInstallStrplConn) {
1551  //
1552  // We two kinds : the flat plate that terminate the sripline, flushed with the dowstream face
1553  // of the OC/IC flange, and, a 90 section of tube, curved section
1554  //
1555  // First, these flat plates. They have cut corners, which we neglect, however, the total volume is correct
1556  //
1557  const double widthConnPlate = 200.0*CLHEP::mm;
1558  const double heightConnPlateO = 56.875*CLHEP::mm; // the flull value is 58, but the surface
1559  const double heightConnPlateI = 48.75*CLHEP::mm; // the flull value is 50, but the surface
1560  // taken by the cut corner is 15 x 15 mm sq.
1561  std::string aNStr1OO(header); aNStr1OO += std::string("ConnFlatO");
1562  G4Box* aVol1OOG = new G4Box(aNStr1OO, 0.5*widthConnPlate, 0.5*heightConnPlateO, 0.5*thickConnPlate);
1563  G4LogicalVolume *aVol1OOGL = new G4LogicalVolume(aVol1OOG, myAlum, aNStr1OO);
1564  std::string aNStr1II(header); aNStr1II += std::string("ConnFlatI");
1565  G4Box* aVol1IIG = new G4Box(aNStr1II, 0.5*widthConnPlate, 0.5*heightConnPlateI, 0.5*thickConnPlate);
1566  G4LogicalVolume *aVol1IIGL = new G4LogicalVolume(aVol1IIG, myAlum, aNStr1II);
1567  const double radInnerCurveConnPlate = 45.0*CLHEP::mm;
1568  const double radOuterCurveConnPlate = radInnerCurveConnPlate + thickConnPlate + 0.025*CLHEP::mm;
1569 
1570  const double radLocConnPlateOC = 0.5*(1122. - heightConnPlateO)*CLHEP::mm;
1571  const double radLocConnPlateIC = 0.5*(662.3 + heightConnPlateI - 1.5)*CLHEP::mm; // a bit more room for the curved section
1572  // Trick to get the right dimensions..
1573  const double radLocConnCurvedOC = 0.5*(1005. - 0.050)*CLHEP::mm - 0.5*radOuterCurveConnPlate;
1574  const double radLocConnCurvedIC = 0.5*(871.42 - radOuterCurveConnPlate + 1.5)*CLHEP::mm; // tight fit, to be adjusted..
1575  zLocalCurrent += 0.5*thickConnPlate + 0.025*CLHEP::mm;
1576  std::cerr << " Before installing ConnFlat, zLocalCurrent " << zLocalCurrent << std::endl;
1577  for (int kPhi=0; kPhi != 4; kPhi++) {
1578  std::ostringstream phiOCStrStr; phiOCStrStr << (kPhi+1);
1579  std::ostringstream phiICStrStr; phiICStrStr << (kPhi+5);
1580  fRotHornBStrpLineConnFlatB[kPhi] = new G4RotationMatrix;
1581  const double anglePhiPlate = (kPhi+1)*M_PI/2. - M_PI/4.;
1582  fRotHornBStrpLineConnFlatB[kPhi]->rotateZ(anglePhiPlate);
1583  double xLocalPlateOC = radLocConnPlateOC*std::cos(anglePhiPlate);
1584  double yLocalPlateOC = radLocConnPlateOC*std::sin(anglePhiPlate);
1585  G4ThreeVector posTmp1OC(xLocalPlateOC, yLocalPlateOC, zLocalCurrent);
1586  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1OC,
1587  aVol1OOGL, aNStr1OO + phiOCStrStr.str() + std::string("_P"),
1588  volMotherLoc , false, kPhi+1, true);
1589  double xLocalPlateIC = radLocConnPlateIC*std::cos(anglePhiPlate);
1590  double yLocalPlateIC = radLocConnPlateIC*std::sin(anglePhiPlate);
1591  G4ThreeVector posTmp1IC(xLocalPlateIC, yLocalPlateIC, zLocalCurrent);
1592  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1IC,
1593  aVol1IIGL, aNStr1II + phiICStrStr.str() + std::string("_P"),
1594  volMotherLoc , false, kPhi+1, true);
1595  }
1596  //
1597  // Now the curved one. We install first a 1/4 (phi) tube section in a box, the tube is rotated in the box,
1598  // and then we place the box 2x2 times around. The rotations can not be combined, since the origin of
1599  // axis of rotation are spatially disctinct. We need to define the 1/4 tube in two distinct quadrant..
1600  //
1601 
1602  std::string aNStr2Q1(header); aNStr2Q1 += std::string("ConnCurvQ1");
1603  G4Tubs* aVolTQ1G = new G4Tubs(aNStr2Q1, radInnerCurveConnPlate,
1604  radInnerCurveConnPlate + thickConnPlate, 0.5*widthConnPlate, 180.*CLHEP::degree, 90.0*CLHEP::degree);
1605  G4LogicalVolume *aVolTQ1GL = new G4LogicalVolume(aVolTQ1G, myAlum, aNStr2Q1);
1606  std::string aNStr2Q1M(aNStr2Q1); aNStr2Q1M += std::string("M");
1607  G4Box* aVolTQ1MG = new G4Box(aNStr2Q1M,
1608  0.5*(widthConnPlate + 0.025*CLHEP::mm),
1609  0.5*(radOuterCurveConnPlate + 0.025*CLHEP::mm),
1610  0.5*(radOuterCurveConnPlate + 0.025*CLHEP::mm));
1611  G4LogicalVolume *aVolTQ1MGL = new G4LogicalVolume(aVolTQ1MG, myAir, aNStr2Q1M);
1612  G4ThreeVector posTmpQ1MOC(0., 0.5*(radOuterCurveConnPlate-0.0125*CLHEP::mm),
1613  0.5*(radOuterCurveConnPlate-0.0125*CLHEP::mm));
1614  fRotHornBStrpLineRotY = new G4RotationMatrix();
1615  fRotHornBStrpLineRotY->rotateY(M_PI/2.);
1616  new G4PVPlacement(fRotHornBStrpLineRotY, posTmpQ1MOC,
1617  aVolTQ1GL, aNStr2Q1 + std::string("_P"),
1618  aVolTQ1MGL , false, 1, true);
1619 //
1620 // 2nd quadrant.
1621 //
1622  std::string aNStr2Q2(header); aNStr2Q2 += std::string("ConnCurvQ2");
1623  G4Tubs* aVolTQ2G = new G4Tubs(aNStr2Q2, radInnerCurveConnPlate,
1624  radInnerCurveConnPlate + thickConnPlate, 0.5*widthConnPlate, 90.*CLHEP::degree, 90.0*CLHEP::degree);
1625  G4LogicalVolume *aVolTQ2GL = new G4LogicalVolume(aVolTQ2G, myAlum, aNStr2Q2);
1626  std::string aNStr2Q2M(aNStr2Q2); aNStr2Q2M += std::string("M");
1627  G4Box* aVolTQ2MG = new G4Box(aNStr2Q2M,
1628  0.5*(widthConnPlate + 0.025*CLHEP::mm),
1629  0.5*(radOuterCurveConnPlate + 0.025*CLHEP::mm),
1630  0.5*(radOuterCurveConnPlate + 0.025*CLHEP::mm));
1631  G4LogicalVolume *aVolTQ2MGL = new G4LogicalVolume(aVolTQ2MG, myAir, aNStr2Q2M);
1632  G4ThreeVector posTmpQ2MOC(0., -0.5*(radOuterCurveConnPlate-0.0125*CLHEP::mm),
1633  0.5*(radOuterCurveConnPlate-0.0125*CLHEP::mm));
1634  new G4PVPlacement(fRotHornBStrpLineRotY, posTmpQ2MOC,
1635  aVolTQ2GL, aNStr2Q1 + std::string("_P"),
1636  aVolTQ2MGL , false, 1, true);
1637 
1638 // zLocalCurrent += radInnerCurveConnPlate - thickConnPlate + 0.025*CLHEP::mm;
1639  zLocalCurrent += -0.5*thickConnPlate + 0.5*radOuterCurveConnPlate + 0.025*CLHEP::mm;
1640  std::cerr << " After installing ConnFlat, zLocalCurrent " << zLocalCurrent << std::endl;
1641  for (int kPhi=0; kPhi != 4; kPhi++) {
1642 
1643  std::ostringstream phiOCStrStr; phiOCStrStr << (kPhi+1);
1644  const double anglePhiCurve = (kPhi + 1)*M_PI/2. - M_PI/4.; // Oriented right (hopefully)
1645  double xLocalCurvedOC = radLocConnCurvedOC*std::cos(anglePhiCurve);
1646  double yLocalCurvedOC = radLocConnCurvedOC*std::sin(anglePhiCurve);
1647  G4ThreeVector posTmp1OC(xLocalCurvedOC, yLocalCurvedOC, zLocalCurrent);
1648  if ((kPhi == 0) || (kPhi ==2)) {
1649  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1OC,
1650  aVolTQ1MGL, aNStr2Q1M + phiOCStrStr.str() + std::string("_P"),
1651  volMotherLoc , false, kPhi + 1, true);
1652  } else {
1653 
1654  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1OC,
1655  aVolTQ2MGL, aNStr2Q2M + phiOCStrStr.str() + std::string("_P"),
1656  volMotherLoc , false, kPhi + 1, true);
1657 
1658  }
1659 
1660  }
1661 
1662  for (int kPhi=0; kPhi != 4; kPhi++) {
1663 
1664  std::ostringstream phiICStrStr; phiICStrStr << (kPhi+5);
1665  const double anglePhiCurve = (kPhi + 1)*M_PI/2. - M_PI/4.; // Oriented right (hopefully)
1666  double xLocalCurvedIC = radLocConnCurvedIC*std::cos(anglePhiCurve);
1667  double yLocalCurvedIC = radLocConnCurvedIC*std::sin(anglePhiCurve);
1668  G4ThreeVector posTmp1IC(xLocalCurvedIC, yLocalCurvedIC, zLocalCurrent);
1669  if ((kPhi == 0) || (kPhi ==2)) {
1670  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1IC,
1671  aVolTQ2MGL, aNStr2Q2M + phiICStrStr.str() + std::string("_P"),
1672  volMotherLoc , false, kPhi + 1, true);
1673  } else {
1674  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1IC,
1675  aVolTQ1MGL, aNStr2Q1M + phiICStrStr.str() + std::string("_P"),
1676  volMotherLoc , false, kPhi + 1, true);
1677  }
1678  }
1679  zLocalCurrent += 0.5*radOuterCurveConnPlate + 0.025*CLHEP::mm;
1680  }
1681 
1682  std::cerr << " Before installing 45 degree stripline plates, zLocalCurrent " << zLocalCurrent << std::endl;
1683  if (doInstallStrpl) {
1684  //
1685  // We start with the 45 (+- 90, +180) degree plate that are oriented along the beam direction.
1686  // Same roration matrices as the connector plates.
1687  //
1688  const double length45Deg = 275.0*CLHEP::mm;
1689  const double width45Deg = 200*CLHEP::mm;
1690  std::string aNStr45D(header); aNStr45D += std::string("45D");
1691  G4Box* aVol45DG = new G4Box(aNStr45D, 0.5*width45Deg, 0.5*thickConnPlate, 0.5*length45Deg);
1692  G4LogicalVolume *aVol45DGL = new G4LogicalVolume(aVol45DG, myAlum, aNStr45D);
1693  const double radLoc45DegOC = 0.5*896.82*CLHEP::mm + 0.5*thickConnPlate;
1694  const double radLoc45DegIC = 0.5*871.45*CLHEP::mm - 0.5*thickConnPlate;
1695  zLocalCurrent += 0.5*length45Deg + 0.025*CLHEP::mm;
1696  std::cerr << " Before installing 45 degree stripline section, 2nd check, zLocalCurrent " << zLocalCurrent << std::endl;
1697  for (int kPhi=0; kPhi != 4; kPhi++) {
1698  std::ostringstream phiOCStrStr; phiOCStrStr << (kPhi+1);
1699  std::ostringstream phiICStrStr; phiICStrStr << (kPhi+5);
1700  const double anglePhiPlate = (kPhi+1)*M_PI/2. - M_PI/4.;
1701  double xLocalPlateOC = radLoc45DegOC*std::cos(anglePhiPlate);
1702  double yLocalPlateOC = radLoc45DegOC*std::sin(anglePhiPlate);
1703  G4ThreeVector posTmp1OC(xLocalPlateOC, yLocalPlateOC, zLocalCurrent);
1704  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1OC,
1705  aVol45DGL, aNStr45D + phiOCStrStr.str() + std::string("_P"),
1706  volMotherLoc , false, 1, true);
1707  double xLocalPlateIC = radLoc45DegIC*std::cos(anglePhiPlate);
1708  double yLocalPlateIC = radLoc45DegIC*std::sin(anglePhiPlate);
1709  G4ThreeVector posTmp1IC(xLocalPlateIC, yLocalPlateIC, zLocalCurrent);
1710  new G4PVPlacement(fRotHornBStrpLineConnFlatB[kPhi], posTmp1IC,
1711  aVol45DGL, aNStr45D + phiICStrStr.str() + std::string("_P"),
1712  volMotherLoc , false, 1, true);
1713  }
1714  //
1715  // We move further downstream. This time, we simplify quite a bit. The 45/2 bends that are up down
1716  // neglected, instead, we just extend the flat part of the strip at bit longer, such that the mount of material
1717  // is almost conserved. No rotation.. Note: we are moving further radially...
1718  //
1719  const double lengthLateral = 200.0*CLHEP::mm;
1720  const double widthLateral = 195*CLHEP::mm; //Approximate... Total length including arcs is ~242,
1721  // but some of it will go to the vertical
1722  const double widthTopConn = 98.43*CLHEP::mm;
1723  std::string aNStrLat(header); aNStrLat += std::string("Lat");
1724  G4Box* aVolLatG = new G4Box(aNStrLat, 0.5*widthLateral, 0.5*thickConnPlate, 0.5*lengthLateral);
1725  G4LogicalVolume *aVolLatGL = new G4LogicalVolume(aVolLatG, myAlum, aNStrLat);
1726  const double xLocalLatOC = 0.5*widthTopConn + 0.5*widthLateral;
1727  const double yLocalLatOC = 0.5*814. + 0.5*thickConnPlate;
1728  G4ThreeVector posLatOC(xLocalLatOC, yLocalLatOC, zLocalCurrent);
1729  new G4PVPlacement((G4RotationMatrix*) 0, posLatOC,
1730  aVolLatGL, aNStrLat + std::string("OCTopR_P"),
1731  volMotherLoc , false, 1, true);
1732  posLatOC[0] *= -1.;
1733  new G4PVPlacement((G4RotationMatrix*) 0, posLatOC,
1734  aVolLatGL, aNStrLat + std::string("OCTopL_P"),
1735  volMotherLoc , false, 2, true);
1736  posLatOC[1] *= -1.;
1737  posLatOC[0] *= -1.;
1738  new G4PVPlacement((G4RotationMatrix*) 0, posLatOC,
1739  aVolLatGL, aNStrLat + std::string("OCBotL_P"),
1740  volMotherLoc , false, 3, true);
1741  posLatOC[0] *= -1.;
1742  new G4PVPlacement((G4RotationMatrix*) 0, posLatOC,
1743  aVolLatGL, aNStrLat + std::string("OCBotR_P"),
1744  volMotherLoc , false, 4, true);
1745 
1746  const double xLocalLatIC = 22.2*CLHEP::mm + 0.5*widthLateral;
1747  const double yLocalLatIC = 0.5*770.5 + 0.5*thickConnPlate;
1748  G4ThreeVector posLatIC(xLocalLatIC, yLocalLatIC, zLocalCurrent);
1749  new G4PVPlacement((G4RotationMatrix*) 0, posLatIC,
1750  aVolLatGL, aNStrLat + std::string("ICTopR_P"),
1751  volMotherLoc , false, 5, true);
1752  posLatIC[0] *= -1.;
1753  new G4PVPlacement((G4RotationMatrix*) 0, posLatIC,
1754  aVolLatGL, aNStrLat + std::string("ICTopL_P"),
1755  volMotherLoc , false, 6, true);
1756 
1757  posLatIC[0] *= -1.;
1758  posLatIC[1] *= -1.;
1759  new G4PVPlacement((G4RotationMatrix*) 0, posLatIC,
1760  aVolLatGL, aNStrLat + std::string("ICBotR_P"),
1761  volMotherLoc , false, 7, true);
1762  posLatIC[0] *= -1.;
1763  new G4PVPlacement((G4RotationMatrix*) 0, posLatIC,
1764  aVolLatGL, aNStrLat + std::string("ICBotL_P"),
1765  volMotherLoc , false, 8, true);
1766  //
1767  // 8 vertical slabs. All same height.
1768  //
1769  const double heightLateral = 230.*CLHEP::mm; //Approximate... Include some of the length above and
1770  // and below the top/bottom connector plates.
1771  std::string aNStrVert(header); aNStrVert += std::string("Vert");
1772  G4Box* aVolVertG = new G4Box(aNStrVert, 0.5*thickConnPlate, 0.5*heightLateral, 0.5*lengthLateral);
1773  G4LogicalVolume *aVolVertGL = new G4LogicalVolume(aVolVertG, myAlum, aNStrVert);
1774  const double xLocalVertOC = 0.5*98.425*CLHEP::mm - 0.5*thickConnPlate;
1775  const double xLocalVertIC = 0.5*54.*CLHEP::mm - 0.5*thickConnPlate;
1776  const double yLocalVertAll = 0.5*1282 - 0.5*heightLateral + 10.0*CLHEP::mm; //literally cutting corners a bit.
1777  G4ThreeVector posVertOC(xLocalVertOC, yLocalVertAll, zLocalCurrent);
1778  new G4PVPlacement((G4RotationMatrix*) 0, posVertOC,
1779  aVolVertGL, aNStrVert + std::string("OCTopR_P"),
1780  volMotherLoc , false, 1, true);
1781  posVertOC[0] *= -1.0;
1782  new G4PVPlacement((G4RotationMatrix*) 0, posVertOC,
1783  aVolVertGL, aNStrVert + std::string("OCTopL_P"),
1784  volMotherLoc , false, 2, true);
1785  posVertOC[1] *= -1.0;
1786  posVertOC[0] *= -1.0;
1787  new G4PVPlacement((G4RotationMatrix*) 0, posVertOC,
1788  aVolVertGL, aNStrVert + std::string("OCBotR_P"),
1789  volMotherLoc , false, 3, true);
1790  posVertOC[0] *= -1.0;
1791  new G4PVPlacement((G4RotationMatrix*) 0, posVertOC,
1792  aVolVertGL, aNStrVert + std::string("OCBotL_P"),
1793  volMotherLoc , false, 4, true);
1794 
1795  G4ThreeVector posVertIC(xLocalVertIC, yLocalVertAll, zLocalCurrent);
1796  new G4PVPlacement((G4RotationMatrix*) 0, posVertIC,
1797  aVolVertGL, aNStrVert + std::string("ICTopR_P"),
1798  volMotherLoc , false, 5, true);
1799  posVertIC[0] *= -1.0;
1800  new G4PVPlacement((G4RotationMatrix*) 0, posVertIC,
1801  aVolVertGL, aNStrVert + std::string("ICTopL_P"),
1802  volMotherLoc , false, 6, true);
1803  posVertIC[1] *= -1.0;
1804  posVertIC[0] *= -1.0;
1805  new G4PVPlacement((G4RotationMatrix*) 0, posVertIC,
1806  aVolVertGL, aNStrVert + std::string("ICBotR_P"),
1807  volMotherLoc , false, 7, true);
1808  posVertIC[0] *= -1.0;
1809  new G4PVPlacement((G4RotationMatrix*) 0, posVertIC,
1810  aVolVertGL, aNStrVert + std::string("ICBotL_P"),
1811  volMotherLoc , false, 8, true);
1812  //
1813  // The jumper block
1814  //
1815  const double widthJumpBlck = 98.5*CLHEP::mm;
1816  const double heightJumpBlck = 145.0*CLHEP::mm;
1817  const double lengthJumpBlck = 20.0*CLHEP::mm;
1818  const double yLocJumpBlck = 0.5*1215.0 - 0.5*heightJumpBlck;
1819  std::string aNStrJmp(header); aNStrJmp += std::string("JmpB");
1820  G4Box* aVolJmpG = new G4Box(aNStrJmp, 0.5*widthJumpBlck, 0.5*heightJumpBlck, 0.5*lengthJumpBlck);
1821  G4LogicalVolume *aVolJmpGL = new G4LogicalVolume(aVolJmpG, myAlum, aNStrJmp);
1822  const double offZJmp = 0.5*lengthLateral + 0.5*lengthJumpBlck + 5.0*CLHEP::mm;
1823  G4ThreeVector posJmpTopFr(0., yLocJumpBlck, zLocalCurrent - offZJmp);
1824  new G4PVPlacement((G4RotationMatrix*) 0, posJmpTopFr,
1825  aVolJmpGL, aNStrJmp + std::string("TopFr"),
1826  volMotherLoc , false, 1, true);
1827  G4ThreeVector posJmpTopBck(0., yLocJumpBlck, zLocalCurrent + offZJmp);
1828  new G4PVPlacement((G4RotationMatrix*) 0, posJmpTopBck,
1829  aVolJmpGL, aNStrJmp + std::string("TopBck"),
1830  volMotherLoc , false, 1, true);
1831  G4ThreeVector posJmpBotFr(0., -1.0*yLocJumpBlck, zLocalCurrent - offZJmp);
1832  new G4PVPlacement((G4RotationMatrix*) 0, posJmpBotFr,
1833  aVolJmpGL, aNStrJmp + std::string("BotFr"),
1834  volMotherLoc , false, 1, true);
1835  G4ThreeVector posJmpBotBck(0., -1.0*yLocJumpBlck, zLocalCurrent + offZJmp);
1836  new G4PVPlacement((G4RotationMatrix*) 0, posJmpBotBck,
1837  aVolJmpGL, aNStrJmp + std::string("BotBck"),
1838  volMotherLoc , false, 1, true);
1839  //
1840  // good enough for now..
1841  //
1842 
1843  }
1844 }
1846 
1847  std::cerr << " LBNEVolumePlacements::PlaceFinalLBNFConceptHornC In progress...Drawing F10071767 " <<std::endl;
1848  fZCoordCDRevisedHornC.clear();
1849  fRInCoordCDRevisedHornC.clear();
1850  const double in = 25.4*CLHEP::mm;
1851  const std::string header("LBNFConceptHornC");
1852  const LBNEVolumePlacementData *plDatMother = this->Find(header, "LBNFSimpleHorn3Container",
1853  "LBNEVolumePlacements::PlaceFinalLBNFConceptHornC");
1854  G4LogicalVolume *volMother = plDatMother->fCurrent;
1855  const double lengthMother=plDatMother->fParams[2];
1856  const double zShiftMotherCoords = 0.005*CLHEP::mm; // We have little room in this case..
1857  const size_t nSegUpstrIO = 20;
1858  const double distUpstreamToBeginIC = (237.451 - 106.0479 + 0.025)*CLHEP::mm; // clone from the polygon used to defined
1859  const double distUpstrCurrEQToBeginIC = (926. + 0.025)*CLHEP::mm;
1860  // the mother volume.
1861  const double deltaPhiUpstrIO = M_PI/nSegUpstrIO;
1862  const double radOuterUpstIO = 131.254*CLHEP::mm; // Drawing F10071765 accurate to ~100 microns
1863  const double radInnerUpstIO = 125.25*CLHEP::mm; //
1864  const double radInnerInner = 284.0*CLHEP::mm;
1865  const double thickInner = 4.0*CLHEP::mm;
1866  fThickICDRevisedHornC = thickInner; // for the magnetic field accurate definition of fiducials.
1867  const double zZeroLocalCoord = -0.5*lengthMother + distUpstrCurrEQToBeginIC + 0.010*CLHEP::mm;
1868  const double zStartUpstrIOC = zZeroLocalCoord - radOuterUpstIO - 1.050*CLHEP::mm; // 1 mm from the clearance def. in mother volume
1869  const double radInnerOC = 634.0*CLHEP::mm;
1870  std::cerr << " .....Mother Volume name " << volMother->GetName()
1871  << " zShiftMother " << zShiftMotherCoords << " distUpstreamToBeginIC "
1872  << distUpstreamToBeginIC << " zZeroLocalCoords " << zZeroLocalCoord << std::endl;
1873 
1874  std::vector<double> zTmps(10, 0.); std::vector<double> rTmps(10, 0.); // more room for later
1875  G4ThreeVector zeroC(0., 0., 0.);
1876  G4Material *myAlumina = G4Material::GetMaterial("Alumina");
1877  G4Material *myAlumIC = G4Material::GetMaterial(fHorn3InnerCondMat.c_str());
1878  G4Material *myAlumOC = G4Material::GetMaterial(fHorn3AllCondMat.c_str());
1879  if (fHorn3AllCondMat.find("Alum") != std::string::npos)
1880  myAlumina = G4Material::GetMaterial(fHorn3AllCondMat.c_str());
1881  G4Material *myWater = 0;
1882  if (fWaterLayerThickInHorns > 1.0e-6) myWater = G4Material::GetMaterial("Water");
1883 
1884  size_t nSegUpstrIOBy2 = nSegUpstrIO/2;
1885  fZCoordCDRevisedHornC.resize(nSegUpstrIOBy2);
1886  fRInCoordCDRevisedHornC.resize(nSegUpstrIOBy2);
1887  for (size_t kPhi = 0; kPhi != nSegUpstrIO; kPhi++ ) {
1888  std::ostringstream aNStrStr; aNStrStr << header << "UpstrIOSect" << kPhi;
1889  std::string aNStr(aNStrStr.str());
1890  fHorn2IC.push_back(aNStr);
1891  const double phi0 = kPhi*deltaPhiUpstrIO + 1.0e-5;
1892  const double phi1 = phi0 + deltaPhiUpstrIO - 2.0e-5;
1893  zTmps[0] = zStartUpstrIOC + radOuterUpstIO - radOuterUpstIO*std::sin(phi1);
1894  zTmps[1] = zStartUpstrIOC + radOuterUpstIO - radOuterUpstIO*std::sin(phi0);
1895  zTmps[2] = zStartUpstrIOC + radOuterUpstIO - radInnerUpstIO*std::sin(phi0);
1896  zTmps[3] = zStartUpstrIOC + radOuterUpstIO - radInnerUpstIO*std::sin(phi1);
1897  rTmps[0] = radInnerInner + radOuterUpstIO - radOuterUpstIO*std::cos(phi1);
1898  rTmps[1] = radInnerInner + radOuterUpstIO - radOuterUpstIO*std::cos(phi0);
1899  rTmps[2] = radInnerInner + thickInner + radInnerUpstIO - radInnerUpstIO*std::cos(phi0);
1900  rTmps[3] = radInnerInner + thickInner + radInnerUpstIO - radInnerUpstIO*std::cos(phi1);
1901 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
1902 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
1903 // zTmps[kk] << " " << std::endl;
1904  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree, 4, &rTmps[0], &zTmps[0]);
1905  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
1906  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
1907  volMother, false, 1, true);
1908  if (kPhi < nSegUpstrIO/2) {
1909  fRInCoordCDRevisedHornC[nSegUpstrIOBy2 - 1 - kPhi] = rTmps[1];
1910  fZCoordCDRevisedHornC[nSegUpstrIOBy2 - 1 - kPhi] = zTmps[1] - zZeroLocalCoord; // with respect to zZero.
1911  // In local coordinate of the mother volume.
1912  }
1913  }
1914  //
1915  // The IC Upstream Out transition flange, nicely curved in the real model... We approximate
1916  // by a polycone.
1917  //
1918  const double radOuterICFlTr = 628.*CLHEP::mm;
1919  const double radInnerICFlTr = 538.5*CLHEP::mm;;
1920  {
1921  zTmps.resize(20); rTmps.resize(20);
1922  const double radInnerBig = 40.0*CLHEP::mm;
1923  const double radOuterSmall = 15.0 *CLHEP::mm;
1924  const size_t numPtsBig = 8;
1925  const size_t numPtsSmall = 4;
1926  const double phiStepBig = (M_PI/2)/numPtsBig;
1927  const double phiStepSmall = (M_PI/2)/numPtsSmall;
1928  for (size_t i=0; i!= numPtsBig+1; i++) {
1929  const double phiC = i*phiStepBig;
1930  zTmps[i] = radInnerBig*std::sin(phiC);
1931  rTmps[i] = radInnerICFlTr + radInnerBig - radInnerBig*std::cos(phiC);
1932  }
1933  zTmps[numPtsBig+1] = zTmps[numPtsBig];
1934  rTmps[numPtsBig+1] = radOuterICFlTr;
1935  zTmps[numPtsBig+2] = 15.0*CLHEP::mm;
1936  rTmps[numPtsBig+2] = radOuterICFlTr;
1937  for (size_t i=0; i != (numPtsSmall+1); i++) {
1938  const double phiC = i*phiStepSmall;
1939  zTmps[numPtsBig+3+i] = radOuterSmall*std::cos(phiC);
1940  rTmps[numPtsBig+3+i] = radInnerICFlTr + thickInner + radOuterSmall*(1.0 - std::sin(phiC));
1941  }
1942  for (size_t i=0; i != zTmps.size(); i++) zTmps[i] += zZeroLocalCoord + 0.050*CLHEP::mm; // possible collision with I/O section
1943  const size_t numPtsFinal = numPtsBig + 3 + numPtsSmall + 1;
1944  /*
1945  std::ofstream fOutTmp("./RZICUpstrFl.txt");
1946  std::cerr << " Dump of Polycon for IC Upstream Flange " << std::endl;
1947  fOutTmp << " i Z R " << std::endl;
1948  for(size_t i=0; i != numPtsFinal; i++) {
1949  fOutTmp << " " << i << " " << zTmps[i] << " " << rTmps[i] << std::endl;
1950  }
1951  std::cerr << " And Quit ... " << std::endl; exit(2);
1952  fOutTmp.close();
1953  */
1954  std::string aNStrTmp(header); aNStrTmp += std::string("ICFlUTr");
1955  G4GenericPolycone *aVolICFlG = new G4GenericPolycone(aNStrTmp, 0.0, 360.0*CLHEP::degree,
1956  numPtsFinal, &rTmps[0], &zTmps[0]);
1957  G4LogicalVolume *aVolICFlGL = new G4LogicalVolume(aVolICFlG, myAlumIC, aNStrTmp);
1958 
1959  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolICFlGL, aNStrTmp + std::string("_P"),
1960  volMother, false, 1, true);
1961  }
1962  //
1963  // The inner conductor per-se.
1964  // We differ from hornB here, implement the whole thing as a Polycone.
1965  //
1966  double zEndOfIC = 0.;
1967  {
1968  size_t numPtsRinThickZ = fHornsPolyListRinThickZVects[2].size();
1969  size_t numPtsIC = 2*(numPtsRinThickZ-5);
1970  // First point skipped, last 2 points are for the IOC transition, downstream.
1971  std::vector<double> zc(numPtsIC);
1972  std::vector<double> rc(numPtsIC);
1974  iRZPtr++; iRZPtr++; iRZPtr++;// Skip the first three.
1975  for (size_t iPt = 0; iPt != numPtsIC; iPt++) {
1976  if (iPt < numPtsIC/2) {
1977  zc[iPt] = -0.5*lengthMother + iRZPtr->z() + 0.025*CLHEP::mm; // small offset tune to avoid small overlap
1978  rc[iPt] = iRZPtr->x();
1979  fZCoordCDRevisedHornC.push_back(zc[iPt] - zZeroLocalCoord);
1980  fRInCoordCDRevisedHornC.push_back(rc[iPt]);
1981  } else {
1982  size_t iPtBack = numPtsIC - iPt -1;
1983  zc[iPt] = zc[iPtBack];
1984  rc[iPt] = rc[iPtBack] + thickInner;
1985  }
1986  iRZPtr++;
1987  }
1988  zEndOfIC = zc[numPtsIC/2 - 1];
1989  std::cerr << " Dump of the IC Polygon .... zEndOfIC " << zEndOfIC << " From start of IC " <<
1990  zEndOfIC - zZeroLocalCoord << std::endl;
1991  for (size_t k=0; k != rc.size(); k++) {
1992  std::cerr << " " << k << " " << zc[k] << " " << zc[k] - zZeroLocalCoord << " " << rc[k] << std::endl;
1993  }
1994  std::string aNStrTmp(header); aNStrTmp += std::string("ICPoly");
1995  G4GenericPolycone *aVolGP =
1996  new G4GenericPolycone(aNStrTmp, 0.0, 360.0*CLHEP::degree, numPtsIC, &rc[0], &zc[0]);
1997  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStrTmp);
1998  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStrTmp + std::string("_P"),
1999  volMother, false, 1, true);
2000 
2001  }
2002  //
2003  // The water layers
2004  //
2005  if (fWaterLayerThickInHorns > 1.0e-6*CLHEP::mm) {
2006  const double radInnerUW1 = radInnerInner + thickInner + 0.025*CLHEP::mm;
2007  const double radOuterUW1 = radInnerUW1 + fWaterLayerThickInHorns;
2008  const double lengthUW1 = (286. - 0.100)*CLHEP::mm;
2009  std::string aNStrUW1(header); aNStrUW1 += std::string("ICU1Water");
2010  G4Tubs* aVolUW1 = new G4Tubs(aNStrUW1, radInnerUW1, radOuterUW1, 0.5*lengthUW1, 0., 360.0*CLHEP::degree);
2011  G4LogicalVolume *aVolUW1L = new G4LogicalVolume(aVolUW1, myWater, aNStrUW1);
2012  G4ThreeVector posUW1(0., 0., zZeroLocalCoord + 0.5*lengthUW1 + 0.025);
2013  new G4PVPlacement((G4RotationMatrix *) 0, posUW1, aVolUW1L, aNStrUW1 + std::string("_P"),
2014  volMother, false, 1, true);
2015  //
2016  // we skip over the first weld. Put a polycone over a section of IC polycone.
2017  // This goes up to the spider support.
2018  //
2019  size_t numPtsUW2SumTmp = 0;
2020  for (size_t kkk=1; kkk != 6; kkk++) numPtsUW2SumTmp += fLBNFOptimConceptDesignHornCNumStepIC[kkk];
2021  size_t numPtsUW2 = 2*(2+ numPtsUW2SumTmp +1 );
2022  // a bit dangerous, I am relying on the geometry coded up in
2023  // PreparePolyconForConceptHornC
2024  std::vector<double> zc(numPtsUW2);
2025  std::vector<double> rc(numPtsUW2);
2027  for (int i=0; i != 4; i++) iRZPtr++; // From the geometry of the IC... We skip one more, as we already have one layer.
2028  zc[0] = zZeroLocalCoord + (310. + 3.0)*CLHEP::mm;
2029  rc[0] = iRZPtr->x() + thickInner + 0.025*CLHEP::mm;
2030  for (size_t iPtUW2 = 1; iPtUW2 != numPtsUW2/2-1; iPtUW2++) {
2031  zc[iPtUW2] = -0.5*lengthMother + iRZPtr->z() + 0.025*CLHEP::mm;
2032  rc[iPtUW2] = iRZPtr->x() + thickInner + 0.025*CLHEP::mm;
2033  iRZPtr++;
2034  }
2035  std::vector<G4ThreeVector>::const_iterator iRZPtrBefDwnstrCone = iRZPtr;
2036  iRZPtrBefDwnstrCone--;
2037  std::cerr << " Last iRZ point, beginning of downnstream cone, Z " << iRZPtr->z()
2038  << " R " << iRZPtr->x() << std::endl;
2039  zc[numPtsUW2/2-1] = zZeroLocalCoord + (866. - 0.6)*CLHEP::mm; // up to spider support.
2040  rc[numPtsUW2/2-1] = (179.2558 + 0.1)*CLHEP::mm;
2041  for (size_t iPtUW2 = numPtsUW2/2; iPtUW2 != numPtsUW2; iPtUW2++) {
2042  size_t iPtUW2R = numPtsUW2 - iPtUW2 -1;
2043  zc[iPtUW2] = zc[iPtUW2R];
2044  rc[iPtUW2] = rc[iPtUW2R] + fWaterLayerThickInHorns ;
2045  }
2046  std::string aNStrUW2(header); aNStrUW2 += std::string("ICU2Water");
2047  std::cerr << " Dump of the upstream Water Polygon ICU2Water " << std::endl;
2048  for (size_t k=0; k != rc.size(); k++) {
2049  std::cerr << " " << k << " " << zc[k] << " " << zc[k] - zZeroLocalCoord << " " << rc[k] << std::endl;
2050  }
2051  G4GenericPolycone *aVolGPUW2 =
2052  new G4GenericPolycone(aNStrUW2, 0.0, 360.0*CLHEP::degree, numPtsUW2, &rc[0], &zc[0]);
2053  G4LogicalVolume *aVolGUW2L = new G4LogicalVolume(aVolGPUW2, myAlumIC, aNStrUW2);
2054  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolGUW2L , aNStrUW2 + std::string("_P"),
2055  volMother, false, 1, true);
2056  //
2057  // We skip the spider support, Put a ploycone over a section of IC polycone. Up to the downstream weld
2058  //
2059  size_t numPtsCW0 = 2*(1 + fLBNFOptimConceptDesignHornCNumStepIC[7] + 1);
2060  std::cerr << " Number of pst water layer, numPtsCW0 " << numPtsCW0 << std::endl;
2061  zc.resize(numPtsCW0);
2062  rc.resize(numPtsCW0);
2063  iRZPtr = iRZPtrBefDwnstrCone;
2064  iRZPtr++;// This should be the beginning of the last curve.
2065  // Again, if the IC description changes, this be must re-adjusted. (the 3 in the line above).
2066  zc[0] = zZeroLocalCoord + (893.8916 + 0.1)*CLHEP::mm;
2067  rc[0] = (187.9 + thickInner + 0.025)*CLHEP::mm;
2068  for (size_t iPtCW0 = 1; iPtCW0 != numPtsCW0/2-1; iPtCW0++) {
2069  zc[iPtCW0] = -0.5*lengthMother + iRZPtr->z() + 0.025*CLHEP::mm;
2070  rc[iPtCW0] = iRZPtr->x() + thickInner + 0.025*CLHEP::mm;
2071  iRZPtr++;
2072  }
2073  zc[numPtsCW0/2-1] = zZeroLocalCoord + (1525.9205 - 0.1)*CLHEP::mm;
2074  rc[numPtsCW0/2-1] = 366.0*CLHEP::mm + thickInner + 0.025*CLHEP::mm; // return back loop
2075  for (size_t iPtCW0 = numPtsCW0/2; iPtCW0 != numPtsCW0; iPtCW0++) {
2076  size_t iPtCW0R = numPtsCW0 - iPtCW0 -1;
2077  zc[iPtCW0] = zc[iPtCW0R];
2078  rc[iPtCW0] = rc[iPtCW0R] + fWaterLayerThickInHorns ;
2079  }
2080  std::cerr << " Dump of the upstream Water Polygon ICDw0Water " << std::endl;
2081  for (size_t k=0; k != rc.size(); k++) {
2082  std::cerr << " " << k << " " << zc[k] << " " << zc[k] - zZeroLocalCoord << " " << rc[k] << std::endl;
2083  }
2084  std::string aNStrCW0(header); aNStrCW0 += std::string("ICDw0Water");
2085  G4GenericPolycone *aVolGPCW0 =
2086  new G4GenericPolycone(aNStrCW0, 0.0, 360.0*CLHEP::degree, numPtsCW0, &rc[0], &zc[0]);
2087  G4LogicalVolume *aVolGCW0L = new G4LogicalVolume(aVolGPCW0, myAlumIC, aNStrCW0);
2088  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolGCW0L, aNStrCW0 + std::string("_P"),
2089  volMother, false, 1, true);
2090  //
2091  // Skip the weld again..
2092  //
2093  const double radInnerDW2 = 366.0*CLHEP::mm + 0.025*CLHEP::mm;
2094  const double radOuterDW2 = radInnerDW2 + fWaterLayerThickInHorns;
2095  const double lengthDW2 = (504.50 - 0.2)*CLHEP::mm;
2096  std::string aNStrDW2(header); aNStrDW2 += std::string("ICD1Water");
2097  G4Tubs* aVolDW2 = new G4Tubs(aNStrDW2, radInnerDW2, radOuterDW2, 0.5*lengthDW2, 0.0, 360.0*CLHEP::degree);
2098  G4LogicalVolume *aVolDW2L = new G4LogicalVolume(aVolDW2, myWater, aNStrDW2);
2099  G4ThreeVector posDW2(0., 0., zZeroLocalCoord + 1549.7 +
2100  0.5*lengthDW2 - 0.025*CLHEP::mm);
2101  new G4PVPlacement((G4RotationMatrix *) 0, posDW2, aVolDW2L, aNStrDW2 + std::string("_P"),
2102  volMother, false, 1, true);
2103  } // End of water layer.
2104  //
2105  // The welds, aluminum.
2106  //
2107  {
2108  const double lengthFirstWeld = 8.0*CLHEP::mm; // we subtract ~5 mm on both sides..
2109  const double radInnerWeld = radInnerInner + thickInner + 0.010;
2110  const double radOuterWeld = radInnerWeld + 4.0; // top of the bulge at 198.5, 4.5 mm thick max.
2111  // Approximate..
2112  std::string aNStrTmpWeld(header); aNStrTmpWeld += std::string("WeldUp");
2113  G4Tubs* aVolIC0GTWe = new G4Tubs(aNStrTmpWeld,
2114  radInnerWeld, radOuterWeld, 0.5*lengthFirstWeld, 0.0, 360.0*CLHEP::degree);
2115  G4LogicalVolume *aVolIC0GWe = new G4LogicalVolume(aVolIC0GTWe, myAlumIC, aNStrTmpWeld);
2116  G4ThreeVector posTmpWeld(0., 0., zZeroLocalCoord + 0.5*lengthFirstWeld + 288.5*CLHEP::mm); // added 1.5 mm from beginning..
2117  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWeld, aVolIC0GWe, aNStrTmpWeld + std::string("_P"),
2118  volMother, false, 1, true);
2119  }
2120  {
2121  const double length2ndWeld = 8.0*CLHEP::mm; // we subtract 5 mm to make room for the weld.
2122  const double radInnerWeld = 366.0*CLHEP::mm + 0.010*CLHEP::mm;
2123  const double radOuterWeld = radInnerWeld + 4.0; // top of the bulge at 198.5, 4.5 mm thick max.
2124  std::string aNStrTmpWeld(header); aNStrTmpWeld += std::string("WeldDw");
2125  G4Tubs* aVolIC0GTWe = new G4Tubs(aNStrTmpWeld,
2126  radInnerWeld, radOuterWeld, 0.5*length2ndWeld, 0.0, 360.0*CLHEP::degree);
2127  G4LogicalVolume *aVolIC0GWe = new G4LogicalVolume(aVolIC0GTWe, myAlumIC, aNStrTmpWeld);
2128  G4ThreeVector posTmpWeld(0., 0., zZeroLocalCoord + 0.5*length2ndWeld + 1527.5*CLHEP::mm);
2129  // added 1.5 mm from beginning..
2130  new G4PVPlacement((G4RotationMatrix *) 0, posTmpWeld, aVolIC0GWe, aNStrTmpWeld + std::string("_P"),
2131  volMother, false, 1, true);
2132  }
2133  //
2134  // The spider support.. Again, this is HornC Mostly cloned from HornB, with
2135  // geometrical data updated. Fist a polygon
2136  //
2137  // double zCoordLocalCurrent = zZeroLocalCoord + (0.05 + 866.4702)*CLHEP::mm; // minor push of 0.05 ?
2138  double zCoordLocalCurrent = zZeroLocalCoord + (866.4702 - 1.0)*CLHEP::mm; // minor push of 0.05 ?
2139  {
2140  std::string aNStrTmpSp(header); aNStrTmpSp += std::string("SuppRing");
2141  std::vector<double> rTmpsSR(5, 0.);
2142  std::vector<double> zTmpsSR(5, zCoordLocalCurrent);
2143  rTmpsSR[0] = (179.35 + 0.050 )*CLHEP::mm;
2144  rTmpsSR[1] = (191.32 + 0.050)*CLHEP::mm;
2145  zTmpsSR[1] += 3.55*CLHEP::mm;
2146  rTmpsSR[2] = (191.32 + 0.050)*CLHEP::mm;
2147  zTmpsSR[2] += 20.*CLHEP::mm;
2148  rTmpsSR[3] = (186.0 + 0.050)*CLHEP::mm;
2149  zTmpsSR[3] += 22.*CLHEP::mm;
2150  rTmpsSR[4] = (rTmpsSR[0] - 0.0125)*CLHEP::mm;
2151  G4GenericPolycone *aVolGPCDSp =
2152  new G4GenericPolycone(aNStrTmpSp, 0.0, 360.0*CLHEP::degree, 5, &rTmpsSR[0], &zTmpsSR[0]);
2153  G4LogicalVolume *aVolGCDSp = new G4LogicalVolume(aVolGPCDSp, myAlumIC, aNStrTmpSp);
2154  G4ThreeVector posTmpCDZero(0., 0., 0.);
2155  new G4PVPlacement((G4RotationMatrix *) 0, posTmpCDZero, aVolGCDSp, aNStrTmpSp + std::string("_P"),
2156  volMother, false, 1, true);
2157  const double radRingSpiderSuppICOuter = rTmpsSR[2] + 0.025*CLHEP::mm;
2158  const double zSpiderSupport = 0.5*(zTmpsSR[1] + zTmpsSR[2]);
2159  //
2160 // The spider support. almost same code as for HornA & HornB
2161 // The connecting piece ring to the hangers.. There are three of them, at 120 degrees from each other.
2162 //
2163  std::string nameStrH(header); nameStrH+= std::string("Spider1Supp");
2164  G4String nameStr2(nameStrH); nameStr2 += G4String("Riser");
2165  const double heightRiser = 0.333*in - 0.020*CLHEP::mm;
2166  const double widthH = 1.5*in; // See drawing 8875.112-MD 363115
2167  const double thickH = 0.184*2*in;
2168  G4Box *aBoxRiser = new G4Box(nameStr2, widthH/2., heightRiser/2.0, thickH/2.0);
2169  G4LogicalVolume *pCurrentRiser =
2170  new G4LogicalVolume(aBoxRiser, myAlumIC, nameStr2);
2171 
2172  G4String nameStr3(nameStrH); nameStr3 += G4String("Hanger");
2173  const double heightH = radInnerOC - radRingSpiderSuppICOuter - 1.0*CLHEP::mm - heightRiser;
2174  const double widthH2 = 1.0*in; // 363115 Note: we collapsed both hanger along the horizontal, transverse
2175  // direction.
2176  const double thickH2 = 0.031*in;
2177  G4Box *aBoxHanger = new G4Box(nameStr3, widthH2/2., heightH/2.0, thickH2/2.0);
2178  G4LogicalVolume *pCurrentHanger =
2179  new G4LogicalVolume(aBoxHanger, myAlumIC, nameStr3);
2180 
2181  std::cerr << " ..... zSpiderSupport " << zSpiderSupport << std::endl;
2182  G4ThreeVector posTmp(0., 0., zSpiderSupport);
2183 
2184  for (int iRot=0; iRot != 3; iRot++) {
2185  std::ostringstream rnStrStr; rnStrStr << "_" << (iRot+1);
2186  G4String rnStr(rnStrStr.str());
2187  // Same Z position as above...
2188  G4RotationMatrix * rMatPr = 0;
2189  if (iRot == 1) {
2190  rMatPr = new G4RotationMatrix;
2191  rMatPr->rotateZ(2.0*M_PI/3.);
2192  } else if (iRot == 2) {
2193  rMatPr = new G4RotationMatrix;
2194  rMatPr->rotateZ(-2.0*M_PI/3.);
2195  }
2196 
2197  const double dHRiser = radRingSpiderSuppICOuter + 0.010*CLHEP::mm + heightRiser/2.;
2198  posTmp[0] = 0.; posTmp[1] = dHRiser;
2199  if (iRot != 0) {
2200  posTmp[0] = dHRiser*rMatPr->xy();
2201  posTmp[1] = dHRiser*rMatPr->yy();
2202  }
2203  if (iRot == 0) {
2204  new G4PVPlacement(rMatPr, posTmp, pCurrentRiser, nameStr2 + std::string("_P") + rnStr,
2205  volMother, false, iRot, fCheckVolumeOverLapWC);
2206  } else {
2207  new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentRiser, nameStr2 + std::string("_P") + rnStr,
2208  volMother, false, iRot, true);
2209  }
2210 // Now the hanger it self
2211 
2212  const double dHHanger = radRingSpiderSuppICOuter + 0.010*CLHEP::mm
2213  + 0.5*CLHEP::mm + heightRiser + heightH/2.;
2214  posTmp[0] = 0.; posTmp[1] = dHHanger;
2215  if (iRot != 0) {
2216  posTmp[0] = dHHanger*rMatPr->xy();
2217  posTmp[1] = dHHanger*rMatPr->yy();
2218  }
2219  // Same Z position as above...
2220  if (iRot == 0) {
2221  new G4PVPlacement(rMatPr, posTmp, pCurrentHanger, nameStr3 + std::string("_P") + rnStr,
2222  volMother, false, iRot, fCheckVolumeOverLapWC);
2223  } else {
2224  new G4PVPlacement(G4Transform3D(*rMatPr, posTmp), pCurrentHanger, nameStr3 + std::string("_P") + rnStr,
2225  volMother, false, iRot, true);
2226  }
2227  } // on the 120 degree symmetry point.
2228 
2229  } // End of spider support
2230  //
2231  // The Inner Outer transition region, downstream..
2232  //
2233  {
2234  const double radInnerDownstrtIO = 122.1*CLHEP::mm; //Direct measurement on Drawing of IC, F10061161
2235  const double radOuterDownstrtIO = 128.1*CLHEP::mm;
2236  const double phiStartInnerDownstrtIO = 0.;
2237  const double yCenterInnerDownstrtIO = 362.0*CLHEP::mm + thickInner + radInnerDownstrtIO;
2238  const double yCenterOuterDownstrtIO = 362.0*CLHEP::mm + radOuterDownstrtIO;
2239  const double zCenterDownstrtIO = zEndOfIC + 0.5*CLHEP::mm; // a bit of clearance needed..
2240  const size_t nSegDownstrIO = 30.;
2241  const double deltaPhiDownstrIO = (M_PI - phiStartInnerDownstrtIO)/nSegDownstrIO;
2242  // This section is physically bigger, and is much more exposed to pion than the upstream one,
2243  // make it more accurate..
2244  for (size_t kPhi = 0; kPhi != nSegDownstrIO; kPhi++ ) {
2245  std::ostringstream aNStrStr; aNStrStr << header << "DownstrIOSect" << kPhi;
2246  std::string aNStr(aNStrStr.str());
2247  fHorn2IC.push_back(aNStr);
2248  const double phi0 = phiStartInnerDownstrtIO + kPhi*deltaPhiDownstrIO + 1.0e-5;
2249  const double phi1 = phi0 + deltaPhiDownstrIO - 2.0e-5;
2250  zTmps[0] = zCenterDownstrtIO + radInnerDownstrtIO*std::sin(phi0);
2251  zTmps[1] = zCenterDownstrtIO + radOuterDownstrtIO*std::sin(phi0);
2252  zTmps[2] = zCenterDownstrtIO + radOuterDownstrtIO*std::sin(phi1);
2253  zTmps[3] = zCenterDownstrtIO + radInnerDownstrtIO*std::sin(phi1);
2254  rTmps[0] = yCenterInnerDownstrtIO - radInnerDownstrtIO*std::cos(phi0);
2255  rTmps[1] = yCenterOuterDownstrtIO - radOuterDownstrtIO*std::cos(phi0);
2256  rTmps[2] = yCenterOuterDownstrtIO - radOuterDownstrtIO*std::cos(phi1);
2257  rTmps[3] = yCenterInnerDownstrtIO - radInnerDownstrtIO*std::cos(phi1);
2258 // std::cerr << " At kPhi " << kPhi << " Phi0 " << phi0 << " Phi1 " << phi1 << " rZVector " << std::endl;
2259 // for (size_t kk=0; kk != 4; kk++) std::cerr << " " << rTmps[kk] << " " <<
2260 // zTmps[kk] << " " << std::endl;
2261  G4GenericPolycone *aVolGP = new G4GenericPolycone(aNStr, 0.0, 360.0*CLHEP::degree,
2262  4, &rTmps[0], &zTmps[0]);
2263  G4LogicalVolume *aVolG = new G4LogicalVolume(aVolGP, myAlumIC, aNStr);
2264  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolG, aNStr + std::string("_P"),
2265  volMother, false, 1, true);
2266  if (kPhi < nSegDownstrIO/2.) {
2267  fZCoordCDRevisedHornC.push_back(zTmps[1] - zZeroLocalCoord);
2268  fRInCoordCDRevisedHornC.push_back(rTmps[1]);
2269  }
2270  }
2271  }
2272  //
2273  // IC IO Flange, downstream..
2274  //
2275  {
2276  const double radOuterICFlDwnTr = (671.1)*CLHEP::mm;
2277  const double radInnerICFlDwnTr = 614*CLHEP::mm; // Approximate. It is a bit polygonal.
2278  const double thickDwnICFlangeTr = 25.2*CLHEP::mm;
2279 
2280  std::string aNStrTmp(header); aNStrTmp += std::string("ICFlDTr");
2281  G4Tubs* aVolICFlTrG = new G4Tubs(aNStrTmp, radInnerICFlDwnTr, radOuterICFlDwnTr,
2282  0.5*thickDwnICFlangeTr, 0.0, 360.0*CLHEP::degree);
2283  G4LogicalVolume *aVolICFlTrGL = new G4LogicalVolume(aVolICFlTrG, myAlumIC, aNStrTmp);
2284 
2285  G4ThreeVector posTmp(0., 0., zEndOfIC - 0.5*thickDwnICFlangeTr - 0.050*CLHEP::mm);
2286  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolICFlTrGL, aNStrTmp + std::string("_P"),
2287  volMother, false, 1, true);
2288  }
2289  //
2290  // ------------ O.K., the IC and its content, and IO transitions are complete.
2291  // Moving to the Outer Conductor, 3 tubes. (body + two flanges)
2292  // + downstream polygonal, for dranage bulge + flange.
2293  //
2294  {
2295  const double radOuterOC = 650.*CLHEP::mm;
2296  const double lengthOCBody = 1682.606 - 0.250*CLHEP::mm; //Too much clearance ??
2297  // Exclude the downstream polygonal section for the water drainage.
2298  std::string aNStrTmpB(header); aNStrTmpB += std::string("OC");
2299  G4Tubs* aVolOCbG = new G4Tubs(aNStrTmpB, radInnerOC, radOuterOC,
2300  0.5*lengthOCBody, 0.0, 360.0*CLHEP::degree);
2301  G4LogicalVolume *aVolOCbGL = new G4LogicalVolume(aVolOCbG, myAlumOC, aNStrTmpB);
2302 
2303  G4ThreeVector posTmp(0., 0., zZeroLocalCoord + 0.5*lengthOCBody + 151*CLHEP::mm);
2304  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolOCbGL, aNStrTmpB + std::string("_P"),
2305  volMother, false, 1, true);
2306 
2307  const double radOuterOCFlU2 = 766.5*CLHEP::mm;
2308  const double radICOCFlU2 = radInnerOC; // Approximate. There is curvature.
2309  const double lengthOCFlU2 = (30.0 - 0.025)*CLHEP::mm; // needs clearance..
2310 
2311  std::string aNStrTmpFlU2(header); aNStrTmpFlU2 += std::string("OCFlU2");
2312  G4Tubs* aVolOCU2G = new G4Tubs(aNStrTmpFlU2, radICOCFlU2, radOuterOCFlU2,
2313  0.5*lengthOCFlU2, 0.0, 360.0*CLHEP::degree);
2314  G4LogicalVolume *aVolOCU2GL = new G4LogicalVolume(aVolOCU2G, myAlumOC, aNStrTmpFlU2);
2315 
2316  G4ThreeVector posTmpU2(0., 0., zZeroLocalCoord + 0.5*lengthOCFlU2 + (120.5 - 0.0125)*CLHEP::mm);
2317  new G4PVPlacement((G4RotationMatrix *) 0, posTmpU2, aVolOCU2GL, aNStrTmpFlU2 + std::string("_P"),
2318  volMother, false, 1, true);
2319 
2320  const double radOuterOCFlU1 = 697.*CLHEP::mm;
2321  const double radICOCFlU1 = radInnerOC;
2322  const double lengthOCFlU1 = (15.0 - 0.025)*CLHEP::mm; // needs clearance..
2323 
2324  std::string aNStrTmpFlU1(header); aNStrTmpFlU1 += std::string("OCFlU1");
2325  G4Tubs* aVolOCU1G = new G4Tubs(aNStrTmpFlU1, radICOCFlU1, radOuterOCFlU1,
2326  0.5*lengthOCFlU1, 0.0, 360.0*CLHEP::degree);
2327  G4LogicalVolume *aVolOCU1GL = new G4LogicalVolume(aVolOCU1G, myAlumOC, aNStrTmpFlU1);
2328 
2329  G4ThreeVector posTmpU1(0., 0., zZeroLocalCoord
2330  + 0.5*lengthOCFlU1 + (105.0 - 0.030)*CLHEP::mm);
2331  new G4PVPlacement((G4RotationMatrix *) 0, posTmpU1, aVolOCU1GL, aNStrTmpFlU1 + std::string("_P"),
2332  volMother, false, 1, true);
2333 
2334  // The downstream section, conical + flange, make it a polygon.
2335 
2336  std::vector<double> rOCTmps(13, -1.);
2337  std::vector<double> zOCTmps(13, zZeroLocalCoord + lengthOCBody + 151*CLHEP::mm + 0.050*CLHEP::mm);
2338  const double zOrigDwOCFl = 1727.34; // Absolute coord. in F10071767., start of this polygon.
2339  zOCTmps[1] += 1750.19*CLHEP::mm - zOrigDwOCFl;
2340  zOCTmps[2] += 1849.84*CLHEP::mm - zOrigDwOCFl;
2341  zOCTmps[3] += 1876.74*CLHEP::mm - zOrigDwOCFl;
2342  zOCTmps[4] += 1893.24*CLHEP::mm - zOrigDwOCFl;
2343  zOCTmps[5] += 1922.308*CLHEP::mm - zOrigDwOCFl - 0.6*CLHEP::mm; // subtract 700 microns,
2344  // clash with IC ..To be confirmed..if need be..
2345  zOCTmps[6] = zOCTmps[5]; zOCTmps[7] = zOCTmps[4] + 1.0*CLHEP::mm; zOCTmps[8] = zOCTmps[4];
2346  zOCTmps[9] = zOCTmps[3]; zOCTmps[10] = zOCTmps[2]; zOCTmps[11] = zOCTmps[1];
2347  zOCTmps[12] = zOCTmps[0];
2348  const double thickOCNom = radOuterOC - radInnerOC;
2349  rOCTmps[0] = radInnerOC; rOCTmps[1] = 632.02; rOCTmps[2] = 621.52;
2350  rOCTmps[3] = 634.9*CLHEP::mm - thickOCNom; rOCTmps[4] = rOCTmps[3] -2.0*CLHEP::mm;
2351  rOCTmps[5] = rOCTmps[4] -4.0*CLHEP::mm; rOCTmps[6] = 668.1*CLHEP::mm;
2352  rOCTmps[7] = rOCTmps[6];
2353  rOCTmps[8] = 0.5*(rOCTmps[7] + rOCTmps[4]); rOCTmps[9] = rOCTmps[3] + thickOCNom;
2354  rOCTmps[10] = rOCTmps[2] + thickOCNom; rOCTmps[11] = rOCTmps[1] + thickOCNom;
2355  rOCTmps[12] = rOCTmps[0] + thickOCNom;
2356  std::string aNStrOCDwnEndFl(header); aNStrOCDwnEndFl += std::string("OCDwnEndFl");
2357  /*
2358  std::ofstream fOutTmp("./RZOCDwnFl.txt");
2359  std::cerr << " Dump of Polycon for OC Flange " << std::endl;
2360  fOutTmp << " i Z R " << std::endl;
2361  for(size_t i=0; i != 13; i++) {
2362  fOutTmp << " " << i << " " << zOCTmps[i] << " " << rOCTmps[i] << std::endl;
2363  }
2364  std::cerr << " And Quit ... " << std::endl; exit(2);
2365  fOutTmp.close();
2366  */
2367  G4GenericPolycone *aVolGPDwnOCEnd = new G4GenericPolycone(aNStrOCDwnEndFl, 0.0, 360.0*CLHEP::degree,
2368  13, &rOCTmps[0], &zOCTmps[0]);
2369  G4LogicalVolume *aVolGDwnOCEnd = new G4LogicalVolume(aVolGPDwnOCEnd, myAlumIC, aNStrOCDwnEndFl);
2370  new G4PVPlacement((G4RotationMatrix *) 0, zeroC, aVolGDwnOCEnd, aNStrOCDwnEndFl + std::string("_P"),
2371  volMother, false, 1, true);
2372 
2373  }
2374  //
2375  // The Insulator ring (part F10071768 )
2376  //
2377  {
2378  const double radOuterIns = 694.*CLHEP::mm;
2379  const double radInnerIns = radInnerOC;
2380  const double thickIns = 67.0 - 0.060*CLHEP::mm; // cheat a tiny bit.. clearance.
2381 
2382  std::string aNStrTmp(header); aNStrTmp += std::string("InsulR");
2383  G4Tubs* aVolInsG = new G4Tubs(aNStrTmp,radInnerIns , radOuterIns,
2384  0.5*thickIns, 0.0, 360.0*CLHEP::degree);
2385  G4LogicalVolume *aVolInsGL = new G4LogicalVolume(aVolInsG, myAlumina, aNStrTmp);
2386 
2387  G4ThreeVector posTmp(0., 0., zZeroLocalCoord + 0.5*thickIns + (36. + 0.025)*CLHEP::mm);
2388  new G4PVPlacement((G4RotationMatrix *) 0, posTmp, aVolInsGL, aNStrTmp + std::string("_P"),
2389  volMother, false, 1, true);
2390 
2391  }
2392  //
2393  // Connecting IC to OC flange... Included in the aVolGPDwnOCEnd polygon..
2394  //
2395  // The Current Equalizer sections. At least, the downstream section that fits into
2396  // the mother volume contain all of the above (in this method)
2397  // Implemented as 4 tubes. Starting from the most upstream, going downstream
2398  //
2399  {
2400  const double radOuterICEQ1 = 760.0*CLHEP::mm;
2401  const double radInnerICEQ1 = 715.025*CLHEP::mm;
2402  const double thickICEQ1 = (25.- 0.0125)*CLHEP::mm; // cheat a tiny bit.. clearance.
2403  // up to the upstream face of the HornC mother volume.
2404  std::string aNStrTmp1(header); aNStrTmp1 += std::string("ICEQFl1");
2405  G4Tubs* aVol1G = new G4Tubs(aNStrTmp1,radInnerICEQ1, radOuterICEQ1,
2406  0.5*thickICEQ1, 0.0, 360.0*CLHEP::degree);
2407  G4LogicalVolume *aVol1GL = new G4LogicalVolume(aVol1G, myAlumIC, aNStrTmp1);
2408 
2409  const double zZeroLocalICEQ = -0.5*lengthMother + 0.010*CLHEP::mm; // to be adjusted...
2410 // std::cerr << " Inner Conduct. Current Equal. Section, zZeroLocalICEQ " << zZeroLocalICEQ << std::endl;
2411  G4ThreeVector posTmp1(0., 0., zZeroLocalICEQ + 0.5*thickICEQ1 + 0.025*CLHEP::mm);
2412  new G4PVPlacement((G4RotationMatrix *) 0, posTmp1, aVol1GL, aNStrTmp1 + std::string("_P"),
2413  volMother, false, 1, true);
2414 
2415  const double radOuterICEQ2 = 715.;
2416  const double radInnerICEQ2 = 707.*CLHEP::mm;
2417  fRadOuterICCurrEqHornC = radOuterICEQ2;
2418  fRadInnerICCurrEqHornC = radInnerICEQ2;
2419  std::string aNStrTmp2(header); aNStrTmp2 += std::string("ICEQbodyUp");
2420  const double lengthICEQ2 = (907. - 0.050)*CLHEP::mm;
2421  G4Tubs* aVol2G = new G4Tubs(aNStrTmp2,radInnerICEQ2, radOuterICEQ2,
2422  0.5*lengthICEQ2, 0.0, 360.0*CLHEP::degree);
2423  G4LogicalVolume *aVol2GL = new G4LogicalVolume(aVol2G, myAlumIC, aNStrTmp2);
2424 
2425  G4ThreeVector posTmp2(0., 0., zZeroLocalICEQ + 0.5*lengthICEQ2 + 0.0125);
2426  new G4PVPlacement((G4RotationMatrix *) 0, posTmp2, aVol2GL, aNStrTmp2 + std::string("_P"),
2427  volMother, false, 1, true);
2428  fHorn3ICQLengthIntoHornMother = lengthICEQ2;
2429  //
2430  // The connecting flange. Install as three tubes.
2431  //
2432  const double radOuterICEQ3 = 715.*CLHEP::mm;
2433  const double radInnerICEQ3 = (570. - 0.10)*CLHEP::mm;
2434  const double thickICEQ3 = (13.- 0.0125)*CLHEP::mm; // cheat a tiny bit.. clearance.
2435  std::string aNStrTmp3(header); aNStrTmp3 += std::string("ICEQFl3");
2436  G4Tubs* aVol3G = new G4Tubs(aNStrTmp3,radInnerICEQ3, radOuterICEQ3,
2437  0.5*thickICEQ3, 0.0, 360.0*CLHEP::degree);
2438  G4LogicalVolume *aVol3GL = new G4LogicalVolume(aVol3G, myAlumIC, aNStrTmp3);
2439 
2440  G4ThreeVector posTmp3(0., 0., zZeroLocalICEQ + lengthICEQ2 + 0.5*thickICEQ3 + 0.0125*CLHEP::mm);
2441 // std::cerr << " Current Equl, vol " << aNStrTmp3 << " At Z = " << posTmp3[2] << std::endl;
2442  new G4PVPlacement((G4RotationMatrix *) 0, posTmp3, aVol3GL, aNStrTmp3 + std::string("_P"),
2443  volMother, false, 1, true);
2444 
2445  const double radOuterICEQ4 = 697.*CLHEP::mm;
2446  const double radInnerICEQ4 = (570. - 0.10)*CLHEP::mm;
2447  const double thickICEQ4 = (30. - 13. - 0.025)*CLHEP::mm;
2448  std::string aNStrTmp4(header); aNStrTmp4 += std::string("ICEQFl4");
2449  G4Tubs* aVol4G = new G4Tubs(aNStrTmp4,radInnerICEQ4, radOuterICEQ4,
2450  0.5*thickICEQ4, 0.0, 360.0*CLHEP::degree);
2451  G4LogicalVolume *aVol4GL = new G4LogicalVolume(aVol4G, myAlumIC, aNStrTmp4);
2452 
2453  G4ThreeVector posTmp4(0., 0., zZeroLocalICEQ + lengthICEQ2 + thickICEQ3 + 0.5*thickICEQ4 + 0.0125*CLHEP::mm);
2454 // std::cerr << " Current Equl, vol " << aNStrTmp4 << " At Z = " << posTmp4[2] << std::endl;
2455  new G4PVPlacement((G4RotationMatrix *) 0, posTmp4, aVol4GL, aNStrTmp4 + std::string("_P"),
2456  volMother, false, 1, true);
2457  const double radOuterICEQ5 = 697.*CLHEP::mm;
2458  const double radInnerICEQ5 = (628.5 - 0.250)*CLHEP::mm;
2459  const double thickICEQ5 = (55.0 - (thickICEQ4 + thickICEQ3) - 0.050 )*CLHEP::mm;
2460  std::string aNStrTmp5(header); aNStrTmp5 += std::string("ICEQFl5");
2461  G4Tubs* aVol5G = new G4Tubs(aNStrTmp5,radInnerICEQ5, radOuterICEQ5,
2462  0.5*thickICEQ5, 0.0, 360.0*CLHEP::degree);
2463  G4LogicalVolume *aVol5GL = new G4LogicalVolume(aVol5G, myAlumIC, aNStrTmp5);
2464 
2465  G4ThreeVector posTmp5(0., 0.,
2466  zZeroLocalICEQ + lengthICEQ2 + thickICEQ3 + thickICEQ4 + 0.5*thickICEQ5 + 0.075*CLHEP::mm);
2467  new G4PVPlacement((G4RotationMatrix *) 0, posTmp5, aVol5GL, aNStrTmp5 + std::string("_P"),
2468  volMother, false, 1, true);
2469  //
2470  // Same for the Outer Current Equalizer section. Part F10071771
2471  //
2472  const double radOuterOCEQ1 = 811.5*CLHEP::mm;
2473  const double radInnerOCEQ1 = (766.5 + 0.025)*CLHEP::mm;
2474  const double thickOCEQ1 = (25.- 0.0125)*CLHEP::mm; // cheat a tiny bit.. clearance.
2475  // up to the upstream face of the HornC mother volume.
2476  std::string aNStrTmp6(header); aNStrTmp6 += std::string("OCEQFlUp");
2477  G4Tubs* aVol6G = new G4Tubs(aNStrTmp6,radInnerOCEQ1, radOuterOCEQ1,
2478  0.5*thickOCEQ1, 0.0, 360.0*CLHEP::degree);
2479  G4LogicalVolume *aVol6GL = new G4LogicalVolume(aVol6G, myAlumOC, aNStrTmp6);
2480 
2481  const double zZeroLocalOCEQ = -0.5*lengthMother + (45.0 - 0.10)*CLHEP::mm; // to be adjusted...
2482  G4ThreeVector posTmp6(0., 0., zZeroLocalOCEQ + 0.5*thickOCEQ1);
2483  new G4PVPlacement((G4RotationMatrix *) 0, posTmp6, aVol6GL, aNStrTmp6 + std::string("_P"),
2484  volMother, false, 1, true);
2485 
2486  const double radInnerOCEQ2 = 758.5*CLHEP::mm;
2487  const double radOuterOCEQ2 = radInnerOCEQ1 - 0.050*CLHEP::mm;
2488  const double lengthOCEQ2 = (998.0 - 0.050)*CLHEP::mm;
2489  fRadInnerOCCurrEqHornC = radInnerOCEQ2;
2490  std::string aNStrTmp7(header); aNStrTmp7 += std::string("OCEQbody");
2491  G4Tubs* aVol7G = new G4Tubs(aNStrTmp7,radInnerOCEQ2, radOuterOCEQ2,
2492  0.5*lengthOCEQ2, 0.0, 360.0*CLHEP::degree);
2493  G4LogicalVolume *aVol7GL = new G4LogicalVolume(aVol7G, myAlumOC, aNStrTmp7);
2494 
2495  G4ThreeVector posTmp7(0., 0., zZeroLocalOCEQ + 0.5*lengthOCEQ2 + 0.020*CLHEP::mm);
2496  new G4PVPlacement((G4RotationMatrix *) 0, posTmp7, aVol7GL, aNStrTmp7 + std::string("_P"),
2497  volMother, false, 1, true);
2498  fHorn3OCQLengthIntoHornMother = lengthOCEQ2;
2499  //
2500  // One more ...
2501  //
2502  const double radOuterOCEQ3 = radInnerOCEQ2 - 0.050*CLHEP::mm;
2503  const double radInnerOCEQ3 = 714.0*CLHEP::mm;
2504  const double thickOCEQ3 = (25.- 0.0125)*CLHEP::mm; // cheat a tiny bit.. clearance.
2505  // up to the upstream face of the HornC mother volume.
2506  std::string aNStrTmp8(header); aNStrTmp8 += std::string("OCEQF3Dw");
2507  G4Tubs* aVol8G = new G4Tubs(aNStrTmp8,radInnerOCEQ3, radOuterOCEQ3,
2508  0.5*thickOCEQ3, 0.0, 360.0*CLHEP::degree);
2509  G4LogicalVolume *aVol8GL = new G4LogicalVolume(aVol8G, myAlumOC, aNStrTmp8);
2510 
2511  G4ThreeVector posTmp8(0., 0., zZeroLocalOCEQ + 973.0*CLHEP::mm + 0.5*thickOCEQ3);
2512  new G4PVPlacement((G4RotationMatrix *) 0, posTmp8, aVol8GL, aNStrTmp8 + std::string("_P"),
2513  volMother, false, 1, true);
2514 
2515  // Alumina insulators. skip for now.. They are at a radius of ~ 850 mm,
2516  // Not that much materials .
2517  //
2518 
2519  }
2520  for (size_t k=0; k != fZCoordCDRevisedHornC.size(); k++)
2521  fZCoordCDRevisedHornC[k] += distUpstrCurrEQToBeginIC+ 0.050*CLHEP::mm; // From the beginning of the mother volume.
2522  //
2523  // Check the exact R/Z coordinates...
2524  //
2525  std::cerr << " Dump of the R/Z map, accurate, for the magnetic field " << std::endl;
2526  for (size_t k=0; k != fZCoordCDRevisedHornC.size(); k++) {
2527  std::cerr << " " << k << " " << fRInCoordCDRevisedHornC[k] << " " << fZCoordCDRevisedHornC[k] << std::endl;
2528  }
2529  return;
2530 }
2532 
2533  // So we simplify. We remove the bulge at the downstream end.
2534 //
2537  // Dimension are based on the NX tool .
2538  const double outRadMax = 220.52; // Drawing F10068454. The inner radius of the OC, some 47 mm from the start of the target.
2539  // The upstream out flange has an outer radius of 665. mm , 1 mm clearance
2540  const double outLengthMax = 2277. + 25.; // Drawing 10068454. Includes the Upstr and downstream Inner to Outer radius.
2541  // Nore we will have to shift the mother volume by ~50.00 mm, the distance between the most upstream point
2542  // of the I/O piece of the upstream I/O transition and the start of the inner conductor.
2543  // Also add ~2 mm for the Outer I/O transition. Approximate
2544  // for the geometry with the bulge for downstream I/O section.
2545  // Oct 13 2016
2546 
2547  G4ThreeVector v1(outRadMax, 1.2500, 0.00);
2549  SetHornsPolyInnerThreeVect(1, 0, v1);
2550  const double inRadMinCyl = 43.0; // Inner Inner radius. for the cylindrical pieces
2551  // Exact, Clearance of 150 microns or so in Horn1PolyM1
2552  // declaration... See Drawing F10068382
2553  //
2554  // Tracking difficulty, the HornPolyM1 volume is too close to the IC. we try to put more than 100 microns..
2555  // rare bug geomNav0003 problem.
2556  G4ThreeVector v2(inRadMinCyl -3.0, 2.000, 1.00);
2558  SetHornsPolyInnerThreeVect(1, 1, v2);
2559  const double endOfCylIC = 1170.5 + 25. + 25.; // include the thick piece of Al at a radius of 43 + 2 + 25.
2560 
2561  G4ThreeVector v3(inRadMinCyl - 3.0, 2.000, endOfCylIC ); // Inner Rad starts decreasing . 100 microns
2562  // This is the tapered version.
2564  SetHornsPolyInnerThreeVect(1, 2, v3);
2565  // Now the conical section.
2566  const double endOfIC = 2188. + 25.0 + 1.; // 25. to include the thickness of
2567  // the bulk cylinder upstr of IC, from R 43+50 to R ~220
2568  const double inRadMin = 33.0;
2569  G4ThreeVector v4(inRadMin - 3.0, 2.000, endOfIC); //
2571  SetHornsPolyInnerThreeVect(1, 3, v4);
2572  const double radOutIOC = 86.2;
2573  for (int kTheta = 1; kTheta != 6; kTheta++) {
2574  const double thetaIOC = kTheta*M_PI/10.;
2575 
2576  G4ThreeVector vkTH(inRadMin - 0.1 + radOutIOC*(1.0-std::cos(thetaIOC)),
2577  2. + 5.*std::sin(thetaIOC),
2578  endOfIC + radOutIOC*std::sin(thetaIOC) + 2.0*CLHEP::mm);
2579  // It has curvature... 2 mm clearance... Maintainance headache,
2580  // duplicate constants wit those in PlaceFinalLBNFConceptHornA
2581  SetHorn1PolyInnerThreeVect(3+kTheta, vkTH);
2582  SetHornsPolyInnerThreeVect(1, 3+kTheta, vkTH);
2583  }
2584  //
2585  G4ThreeVector v10(outRadMax, 0.020, outLengthMax+0.001 + 3.0*CLHEP::mm); // Thickness is virtual
2587  SetHornsPolyInnerThreeVect(1, 9, v10);
2588 
2589  //fix mag field
2590  SetHorn1PolyOuterRadius(outRadMax);
2591  SetHornsPolyOuterRadius(1, outRadMax);
2592 
2593 
2594 }
2596 
2598  const double outRadMax = (811.5 + 2.0); // set by the Downstream OC current equalizer section connection pads
2599  // Includes the upstream and downstream Inner to Outer transition.
2600  // Also (the ~ 2 cm ) the thickness of the downstream flange, and the upstream few cm length of the
2601  // current transition sections. does not includes the downstream section of these.
2602  const double distUpstreamToBeginIC = 242.25;
2603  G4ThreeVector v1(outRadMax, 0.05, 0.00);
2604  SetHornsPolyInnerThreeVect(2, 0, v1);
2605  const double inRadMin = 159.0; // Inner Inner radius. Exact, Clearance of 150 microns or so in Horn1PolyM1
2606  // declaration... See Drawing F10071359
2607  G4ThreeVector v2(inRadMin, 3.000, 1.00);
2608  SetHornsPolyInnerThreeVect(2, 1, v2);
2609  double zzTmp = 1090. + distUpstreamToBeginIC; // We take the downstream edge.
2610  G4ThreeVector v3(inRadMin, 3.0, zzTmp); // Inner Rad starts increasing.
2611  SetHornsPolyInnerThreeVect(2, 2, v3);
2612  zzTmp += 878.67;
2613  G4ThreeVector v4(81.0, 2.000, zzTmp);
2614  SetHornsPolyInnerThreeVect(2, 3, v4);
2615  zzTmp += 62.368;
2616  G4ThreeVector v5(81.0, 3.0, zzTmp); //
2617  SetHornsPolyInnerThreeVect(2, 4, v5);
2618  zzTmp += 22.31;
2619  G4ThreeVector v6(83.6, 3.0, zzTmp); // This in reality a curve transition, but will be approximate as a straight cone.
2620  SetHornsPolyInnerThreeVect(2, 5, v6);
2621  zzTmp += 640.38 ;
2622  G4ThreeVector v7(223., 3.0, zzTmp); // Took the middle of a 2nd curve transtition, to the downstream cylindrical
2623  SetHornsPolyInnerThreeVect(2, 6, v7);
2624  zzTmp += 1042.8 + 0.5; // the end of the last IC cylindrical section. 500 microns added.
2625  G4ThreeVector v8(225., 3.0, zzTmp); // Also approximate. Not essential
2626  SetHornsPolyInnerThreeVect(2, 7, v8);
2627  // We add now the downstream Inner to Outer transition section,
2628  zzTmp += 150. + 1.0; // the end of the last of this transition
2629  G4ThreeVector v9(225., 3.0, zzTmp); // Also approximate. Not essential
2630  SetHornsPolyInnerThreeVect(2, 8, v9);
2631  zzTmp += 975. - 151.; // the end current equlizer section.
2632  G4ThreeVector v10(630., 3.0, zzTmp); // Also approximate. Not essential
2633  SetHornsPolyInnerThreeVect(2, 9, v10);
2634  zzTmp += 0.5; // clearance.. near the end.
2635  G4ThreeVector v11(outRadMax, 0.05, zzTmp);
2636  SetHornsPolyInnerThreeVect(2, 10, v11);
2637 
2638  SetHornsPolyOuterRadius(2, outRadMax);
2639  const double zStartHorn2Set = GetHornsPolyZStartPos(2);
2640  SetHornsPolyZStartPos(2, (zStartHorn2Set - 0.5*distUpstreamToBeginIC));
2641  //Place it such that the start of the effective field region is 1/2 way between the start of
2642  // of the upstream IO trnasition, and the beginning of the IC at the same location as
2643  std::cerr << " Shifting start of Horn2 magnetic field region from " << zStartHorn2Set
2644  << " by " << -1.*distUpstreamToBeginIC << " to take into account I/O transition. " << std::endl;
2645  // for simplified (idealistic) horn) . Accurate to a ~ cm
2646 
2647 
2648 }
2649 //
2650 
2652 //
2653 // The current magnetic field map used the optimized, simple, polycone representation of the
2654 // inner conductor. We might as well doing it a bit more precisely than for Horn B, since the curved
2655 // section are a bit longer. If successul, we'll got back to HornB, at a later stage
2656 //
2657 // December 20-23: Revision 2, from drawing Nx9, F10071767, and related.
2658 //
2659  SetUseHornsPolyNumInnerPts(3, 33); /// Obtained by counting the number of instance of
2660  // SetUseHornsPolyNumInnerPts. A rather moronic way..
2661  const double outRadMax = (811.5 + 2.0); // Drawing F10071771. with 2 mm clearance
2662  // Driven by the upstream Current Equalizer section outer, upstream flange.
2663  // Includes the upstream and downstream Inner to Outer transition.
2664  // Also (the ~ 2 cm ) the thickness of the downstream flange, and the upstream few cm length of the
2665  // current transition sections. does not includes the downstream section of these.
2666  const double distUpstreamIOToBeginIC = (237.451 - 106.0479 + 0.025)*CLHEP::mm;
2667  const double distUpstrCurrEQToBeginIC = (926. + 0.025)*CLHEP::mm;
2668  G4ThreeVector v1(outRadMax, 0.05, 0.00);
2669  SetHornsPolyInnerThreeVect(3, 0, v1);
2670  const double inRadMinCurrEq = (707. -1.0)*CLHEP::mm;
2671  G4ThreeVector v2(inRadMinCurrEq, 4.000, 1.00);
2672  SetHornsPolyInnerThreeVect(3, 1, v2);
2673  const double inRadMin = 284.0; // Inner Inner radius. Exact, Clearance of 150 microns or so in Horn1PolyM1
2674  // declaration... See Drawing F10071765
2675  G4ThreeVector v2a(inRadMinCurrEq, 4.000, distUpstrCurrEQToBeginIC - 1.0*CLHEP::mm - distUpstreamIOToBeginIC );
2676  SetHornsPolyInnerThreeVect(3, 2, v2a);
2677 
2678  G4ThreeVector v2b(inRadMin, 4.000, distUpstrCurrEQToBeginIC - 1.0*CLHEP::mm );
2679  SetHornsPolyInnerThreeVect(3, 3, v2b);
2680 
2681  double zzTmp = 336.8430 + distUpstrCurrEQToBeginIC;
2682  G4ThreeVector v3(inRadMin, 4.0, zzTmp); // Inner Rad starts increasing.
2683  int iNumPt = 4;
2684  SetHornsPolyInnerThreeVect(3, iNumPt, v3);
2686  //
2687  // A radial curve., up to a distance off
2688  const double distZPtU1 = (398.2670 - 336.8430)*CLHEP::mm;
2689  const double deltaRU1 = inRadMin - 262.9119*CLHEP::mm;
2690  const double thetaArcU1 = std::atan(deltaRU1/(0.5*distZPtU1));
2691  const double outRadU1 = distZPtU1/std::sin(thetaArcU1);
2692  const int numStepU1 = 8; // should be fine enough
2693  const double thetaStepU1 = thetaArcU1/numStepU1;
2694  for (int iStepU1 = 0.; iStepU1 != numStepU1; iStepU1++) {
2695  const double thU1 = thetaStepU1*(iStepU1+1);
2696  const double rrU1 = inRadMin - outRadU1 * (1.0 - std::cos(thU1));
2697  const double dzU1 = outRadU1*std::sin(thU1);
2698  G4ThreeVector vTmpU1(rrU1, 4.0, zzTmp + dzU1);
2699  iNumPt++;
2700  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpU1);
2701  }
2703 
2704  zzTmp = 553.1053 + distUpstrCurrEQToBeginIC; ; //Now we go straight to the next intersection.
2705  const double distZPtU2 = (586.2743 - 553.1053)*CLHEP::mm;
2706  const double inRadMinU2 = 142.3876;
2707  G4ThreeVector vU1ToU2(inRadMinU2, 4.000, zzTmp); iNumPt++;
2708  SetHornsPolyInnerThreeVect(3, iNumPt, vU1ToU2);
2710  const double innerRadNeck = 131.0*CLHEP::mm;
2711  const double deltaRadMinU32 = inRadMinU2 - innerRadNeck;
2712  const double distZPtU2byHalf = 0.5*distZPtU2;
2713  const double thetaArcU2 = std::atan(deltaRadMinU32/(distZPtU2byHalf));
2714  const int numStepU2 = 6; // should be fine enough
2715  const double thetaStepU2 = thetaArcU2/numStepU2;
2716  const double outRad2 = distZPtU2/std::sin(thetaArcU2);
2717  double thetaCurrU2 = thetaArcU2;
2718  for (int iStepU2 = 0.; iStepU2 != numStepU2; iStepU2++) {
2719  thetaCurrU2 -= thetaStepU2;
2720  const double drrU2 = outRad2*(1.0-std::cos(thetaCurrU2));
2721  const double dzU2 = outRad2*std::sin(thetaCurrU2);
2722  G4ThreeVector vTmpU2(innerRadNeck + drrU2, 4.0, zzTmp + distZPtU2 - dzU2);
2723  iNumPt++;
2724  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpU2);
2725  }
2726  zzTmp += distZPtU2;
2728  //
2729  // Next we have the Neck.
2730  //
2731  zzTmp += 118.9697*CLHEP::mm;
2732  G4ThreeVector vNeckD(innerRadNeck, 4.000, zzTmp); iNumPt++;
2733  SetHornsPolyInnerThreeVect(3, iNumPt, vNeckD);
2735  //
2736  // Neck to downstream cone transition.
2737  const double distZPtD1 = (147.8974 - 118.9697)*CLHEP::mm;
2738  const double innerRadD1 = 135.4465*CLHEP::mm;
2739  const double deltaInnerRadD1 = innerRadD1 - innerRadNeck;
2740 // const double thetaArcD1 = std::atan(deltaInnerRadD1/distZPtD1byHalf);
2741  // theta is a bit bigger than the other case... refine
2742  const double outRad3 = (distZPtD1*distZPtD1 + deltaInnerRadD1*deltaInnerRadD1)/(2.0*deltaInnerRadD1);
2743  const double thetaArcD1 = std::asin(distZPtD1/outRad3);
2744  const int numStepD1 = 4;
2745  const double thetaStepD1 = thetaArcD1/numStepD1;
2746  double thetaCurrD1 = 0.;
2747  for (int iStepD1 = 0.; iStepD1 != numStepD1; iStepD1++) {
2748  thetaCurrD1 += thetaStepD1;
2749  const double drrD1 = outRad3*(1.0-std::cos(thetaCurrD1));
2750  const double dzD1 = outRad3*std::sin(thetaCurrD1);
2751  G4ThreeVector vTmpD1(innerRadNeck + drrD1, 4.0, zzTmp + dzD1);
2752  iNumPt++;
2753  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpD1);
2754  }
2755  zzTmp += distZPtD1;
2757  //
2758  // The downstream cone.
2759  //
2760  const double innerRadD2 = 357.7245*CLHEP::mm;
2761  const double distZPtD2 = 735.5382*CLHEP::mm;
2762  zzTmp += distZPtD2;
2763  G4ThreeVector vTmpD2(innerRadD2, 4.0, zzTmp);
2764  iNumPt++;
2765  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpD2);
2767  //
2768  // The last curve section.
2769  //
2770  const double distZPtD3 = 28.9277*CLHEP::mm;
2771  const double distZPtD3byHalf = 0.5*distZPtD3;
2772  const double innerRadD3 = 362*CLHEP::mm;
2773  const double deltaInnerRadD3 = innerRadD3 - innerRadD2;
2774  const double thetaArcD3 = std::atan(deltaInnerRadD3/distZPtD3byHalf);
2775  const int numStepD3 = 4;
2776  const double thetaStepD3 = thetaArcD3/numStepD3;
2777  const double outRad5 = distZPtD3/std::sin(thetaArcD3);
2778  double thetaCurrD3 = thetaArcD3;
2779  for (int iStepD3 = 0.; iStepD3 != numStepD3; iStepD3++) {
2780  thetaCurrD3 -= thetaStepD3;
2781  const double drrD3 = outRad5*(1.0-std::cos(thetaCurrD3));
2782  const double dzD3 = outRad5*std::sin(thetaCurrD3);
2783  G4ThreeVector vTmpD3(innerRadD3 - drrD3, 4.0, zzTmp + distZPtD3 - dzD3);
2784  iNumPt++;
2785  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpD3);
2786  }
2787  zzTmp += distZPtD3;
2789  // The downstream tube..
2790  zzTmp += 554.3802*CLHEP::mm;
2791  G4ThreeVector vTmpD5(innerRadD3, 4.0, zzTmp);
2792  iNumPt++;
2793  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpD5);
2794  // We add a 45 degree section for to the downstream torus
2795 
2796  zzTmp += 138.0*CLHEP::mm; // with 10 mm clearance...
2797  // The downstream tube..
2798  G4ThreeVector vTmpD6(innerRadD3, 4.0, zzTmp);
2799  iNumPt++;
2800  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpD6);
2801  // Going up to the inner radius of the outer conductor
2802  zzTmp += 0.5*CLHEP::mm;
2803  G4ThreeVector vTmpD7(701.0*CLHEP::mm, 4.0, zzTmp);
2804  iNumPt++;
2805  SetHornsPolyInnerThreeVect(3, iNumPt, vTmpD7);
2807 
2808  SetHornsPolyOuterRadius(3, outRadMax);
2809  const double zStartHorn3SetUser = this->GetHornsPolyZStartPos(3);
2810  const double zStartHorn3Set = this->GetHornsPolyZStartPos(3) - distUpstrCurrEQToBeginIC + 0.5*131.254*CLHEP::mm;
2811  // last number is the radius of the upstream I/O transition.
2812  this->SetHornsPolyZStartPos(3, zStartHorn3Set);
2813  //Place it such that the start of the effective field region is 1/2 way between the start of
2814  // of the upstream IO trnasition, and the beginning of the IC at the same location as
2815  std::cerr << " Shifting start of Horn3 magnetic field region from " << zStartHorn3SetUser
2816  << " to " << zStartHorn3Set << " to take into account current Eq and I/O transition. " << std::endl;
2817  //
2818  // Now we print the result...
2819  //
2820 // std::ofstream fOut("./HornCRZ.txt");
2821 // fOut << " Z ZfIC R " << std::endl;
2822 // for(std::vector<G4ThreeVector>::const_iterator itD = fHornsPolyListRinThickZVects[2].begin();
2823 // itD != fHornsPolyListRinThickZVects[2].end(); itD++) {
2824 // fOut << " " << itD->z() << " " << itD->z() - distUpstrCurrEQToBeginIC << " " << itD->x() << std::endl;
2825 // }
2826 // fOut.close();
2827 // std::cerr << " And quit for now.... " << std::endl; exit(2);
2828 }
2830 
2831 
2832  std::string header("LBNFConceptHornCStrpL");
2833  const LBNEVolumePlacementData *plDatMotherTunnel = this->Find(header, "Tunnel",
2834  "LBNEVolumePlacements::PlaceFinalLBNFConceptStripLinesConnectHornC");
2835  const LBNEVolumePlacementData *plDatMotherHorn3 = this->Find(header, "LBNFSimpleHorn3Container",
2836  "LBNEVolumePlacements::PlaceFinalLBNFConceptHornB");
2837 
2838  const double lengthHornC = plDatMotherHorn3->fParams[2];
2839  const double lengthStripZoneEff = 376.75*CLHEP::mm ; // part F10071884
2840  const double zPosStripZone = plDatMotherHorn3->fPosition[2] - 0.5*lengthHornC
2841  - 0.5*lengthStripZoneEff - 5.0*CLHEP::mm; // Such that we can study
2842  // misalignments.
2843  const double halfWidthZone = 820.0; // 5 cm clearance.
2844  G4Material *myAlum = G4Material::GetMaterial("Aluminum");
2845  G4Material *myAir = G4Material::GetMaterial("Air");
2846  // A mother volume for convenience of top/down declaration of the geometry.
2847  // model dependent..
2848  std::string aNStrTmp1(header); aNStrTmp1 += std::string("Mother");
2849  G4Box* aVolM = new G4Box(aNStrTmp1, halfWidthZone, halfWidthZone, 0.5*lengthStripZoneEff);
2850  G4LogicalVolume *volMotherLoc = new G4LogicalVolume(aVolM, myAir, aNStrTmp1);
2851  G4ThreeVector posTmpM(0., 0., zPosStripZone); // ..
2852  G4LogicalVolume *volMother = plDatMotherTunnel->fCurrent;
2853  new G4PVPlacement((G4RotationMatrix *) 0, posTmpM, volMotherLoc, aNStrTmp1 + std::string("_P"),
2854  volMother, false, 1, true);
2855  //
2856  // Crude installation, 4 x 3 volumes in all.
2857  //
2858  const double stripThick = 9.5250*CLHEP::mm;
2859  const double stripWidth = 200.0*CLHEP::mm;
2860  const double stripConnBlock = 100.0*CLHEP::mm;
2861  const double radLoc45DegIOC = 800.50*CLHEP::mm; // Correct to a few mm.
2862 
2863  //
2864  // The connection block, approximated as just one thick piece of Al.
2865  // Assume the longitudinal gap between the strip line is zero.
2866  //
2867  std::string aNStr45D(header); aNStr45D += std::string("Conn45D");
2868  G4Box* aVol45DG = new G4Box(aNStr45D, 0.5*stripWidth, 0.5*stripConnBlock, 2.0*0.5*stripThick); // 2 of them
2869  G4LogicalVolume *aVol45DGL = new G4LogicalVolume(aVol45DG, myAlum, aNStr45D);
2870  const double zLocalCurrent = 0.5*lengthStripZoneEff - stripThick - 0.010*CLHEP::mm;
2871  //
2872  // The sections that are parallel to the Z axis., rotated by 45 degrees.
2873  //
2874  const double lengthLong45D = (345.0 - 0.5)*CLHEP::mm;
2875  std::string aNStrLongD(header); aNStrLongD += std::string("Long45D");
2876  G4Box* aVol45LG = new G4Box(aNStrLongD, 0.5*stripWidth, 2.0*0.5*stripThick*1.10, 0.5*lengthLong45D );
2877  // The exta 1.05 is to take into account the curve. Good to ~ 5 to 10 % in material budget.
2878  G4LogicalVolume *aVol45LGL = new G4LogicalVolume(aVol45LG, myAlum, aNStrLongD);
2879 
2880  const double radLoc45LongIOC = (811.50 - 170.)*CLHEP::mm; // Correct to a few cm.
2881  for (int kPhi=0; kPhi != 4; kPhi++) {
2882  std::ostringstream phiIOCStrStr; phiIOCStrStr << "phi" << kPhi;
2883  const double anglePhiPlate = (kPhi+1)*M_PI/2. - M_PI/4.;
2884  fRotHornBStrpLineConnFlatC[kPhi] = new G4RotationMatrix;
2885  fRotHornBStrpLineConnFlatC[kPhi]->rotateZ(anglePhiPlate);
2886  double xLocalPlateIOC = radLoc45DegIOC*std::cos(anglePhiPlate);
2887  double yLocalPlateIOC = radLoc45DegIOC*std::sin(anglePhiPlate);
2888  G4ThreeVector posTmp1IOC(xLocalPlateIOC, yLocalPlateIOC, zLocalCurrent);
2889  new G4PVPlacement(fRotHornBStrpLineConnFlatC[kPhi], posTmp1IOC,
2890  aVol45DGL, aNStr45D + phiIOCStrStr.str() + std::string("_P"),
2891  volMotherLoc , false, 1, true);
2892  double xLocalPlateIOL = radLoc45LongIOC*std::cos(anglePhiPlate);
2893  double yLocalPlateIOL = radLoc45LongIOC*std::sin(anglePhiPlate);
2894  G4ThreeVector posTmp1IOL(xLocalPlateIOL, yLocalPlateIOL, -0.5*lengthStripZoneEff + 0.5*lengthLong45D + 0.01*CLHEP::mm);
2895 // std::cerr << " Position of long plate " << posTmp1IOL << std::endl;
2896  new G4PVPlacement(fRotHornBStrpLineConnFlatC[kPhi], posTmp1IOL,
2897  aVol45LGL, aNStrLongD + phiIOCStrStr.str() + std::string("_P"),
2898  volMotherLoc , false, 1, true);
2899  }
2900  //
2901  // The 4 vertical segments, slight covering the Outer-Inner conductor region.
2902  // So we put it in.
2903  //
2904  const double heightVertStrip = 329.0*CLHEP::mm; // Good to 5 cm. Ugly Nx9 measurement.
2905  const double widthVertStrip = 2.0*stripThick;
2906  const double depthVertStrip = stripWidth;
2907  const double xLocVertStrip = 537.0*CLHEP::mm;
2908  const double yLocVertStrip = 0.5*heightVertStrip + 5.0*CLHEP::mm;
2909  std::string aNStrVert(header); aNStrVert += std::string("Vert");
2910  G4Box* aVolVertLG = new G4Box(aNStrVert, 0.5*widthVertStrip, 0.5*heightVertStrip, 0.5*depthVertStrip);
2911  // The exta 1.05 is to take into account the curve. Good to ~ 5 to 10 % in material budget.
2912  G4LogicalVolume *aVolVertLGL = new G4LogicalVolume(aVolVertLG, myAlum, aNStrVert);
2913  G4ThreeVector posTmpIOV(0., 0., -0.5*lengthStripZoneEff + 0.5*depthVertStrip + 0.1*CLHEP::mm);
2914  std::string posXYStr;
2915  for (int kS=0; kS != 4; kS++) {
2916  switch (kS) {
2917  case 0:
2918  posTmpIOV[0] = xLocVertStrip; posTmpIOV[1] = yLocVertStrip;
2919  posXYStr = std::string("UpLeft");
2920  break;
2921  case 1:
2922  posTmpIOV[0] = xLocVertStrip; posTmpIOV[1] = -1.*yLocVertStrip;
2923  posXYStr = std::string("DwnLeft");
2924  break;
2925  case 2:
2926  posTmpIOV[0] = -1.0*xLocVertStrip; posTmpIOV[1] = yLocVertStrip;
2927  posXYStr = std::string("UpRight");
2928  break;
2929  case 3:
2930  posTmpIOV[0] = -1.0*xLocVertStrip; posTmpIOV[1] = -1.*yLocVertStrip;
2931  posXYStr = std::string("DwnRight");
2932  break;
2933  }
2934  new G4PVPlacement((G4RotationMatrix *) 0, posTmpIOV, aVolVertLGL,
2935  aNStrVert + posXYStr + std::string("_P"),
2936  volMotherLoc, false, 1, true);
2937  }
2938  //
2939  // Lastly, the horizontal segment and their support. Rough guess!.
2940  // Note that this volume will be located at radius greater than the outer Inner conductor region, mostly.
2941  // Very crude dimension. Could be reviewed at a later stage.
2942  //
2943  const double heightHorzStrip = 1.05*(5.0*stripThick); // 5% more the connector plates.
2944  // in front.
2945  const double widthHorzStrip = 162.0;
2946  const double depthHorzStrip = stripWidth*CLHEP::mm;
2947  const double xLocHorzStrip = 678.*CLHEP::mm; // also aproximate.
2948  std::string aNStrHorz(header); aNStrHorz += std::string("Horz");
2949  G4Box* aVolHorzLG = new G4Box(aNStrHorz, 0.5*widthHorzStrip, 0.5*heightHorzStrip, 0.5*depthHorzStrip);
2950  // The exta 1.05 is to take into account the curve. Good to ~ 5 to 10 % in material budget.
2951  G4LogicalVolume *aVolHorzLGL = new G4LogicalVolume(aVolHorzLG, myAlum, aNStrHorz);
2952  G4ThreeVector posTmpIOH(0., 0., -0.5*lengthStripZoneEff + 0.5*depthHorzStrip + 0.1*CLHEP::mm);
2953  for (int kS=0; kS != 2; kS++) {
2954  switch (kS) {
2955  case 0:
2956  posTmpIOH[0] = xLocHorzStrip;
2957  posXYStr = std::string("Left");
2958  break;
2959  case 1:
2960  posTmpIOH[0] = -1.0*xLocHorzStrip;
2961  posXYStr = std::string("Right");
2962  break;
2963  }
2964  new G4PVPlacement((G4RotationMatrix *) 0, posTmpIOH, aVolHorzLGL,
2965  aNStrHorz + posXYStr + std::string("_P"),
2966  volMotherLoc, false, 1, true);
2967  }
2968 }
std::vector< std::vector< G4ThreeVector > > fHornsPolyListRinThickZVects
std::vector< double > fZCoordCDRevisedHornC
const LBNEVolumePlacementData * Find(const G4String &name, const char *motherName, const char *method) const
std::string string
Definition: nybbler.cc:12
std::vector< double > fRInCoordCDRevisedHornA
intermediate_table::const_iterator const_iterator
std::vector< double > fRInCoordCDRevisedHornC
void SetHornsPolyZStartPos(size_t hornNumber, double z)
std::vector< G4String > fHorn2IC
std::vector< double > fParams
double GetHornsPolyZStartPos(size_t iH) const
G4RotationMatrix * fRotHornBStrpLineRotY
std::vector< double > fRInCoordCDRevisedHornB
void SetHorn1PolyOuterRadius(double r)
size_t fLBNFOptimConceptDesignHornCNumStepIC[10]
void SetUseHorn1PolyNumInnerPts(int n)
std::vector< double > fZCoordCDRevisedHornA
G4RotationMatrix fRotTgtTitCTubeHor
G4RotationMatrix fRotTgtTitCTubeVert
void SetHornsPolyOuterRadius(size_t hornNumber, double r)
std::vector< double > fZCoordCDRevisedHornB
void SetUseHornsPolyNumInnerPts(size_t hornNumber, size_t nElem)
void SetHornsPolyInnerThreeVect(size_t hornNumber, size_t iP, G4ThreeVector vVal)
void SetHorn1PolyInnerThreeVect(size_t iP, G4ThreeVector vVal)
QTextStream & endl(QTextStream &s)
G4RotationMatrix * fRotHornBStrpLineConnFlatB[4]
std::vector< G4String > fHorn1IC
G4RotationMatrix * fRotHornBStrpLineConnFlatC[4]