67 if (bpipeGeneral->
size() != 0)
m_centralRegionZMax = (*bpipeGeneral)[0]->getDouble(
"CENTRALZMAX") * Gaudi::Units::mm;
70 GeoTube* dummytube=
new GeoTube(0., 4711., 4711.);
71 GeoLogVol* dummyBeamPipe =
new GeoLogVol(
"BeamPipe",dummytube,ether);
76 if (bpipeEnvelope->
size() != 0) {
82 GeoLogVol* lvMotherCentral =
new GeoLogVol(
"BeamPipeCentral",envelopes.
centralShape,air);
83 GeoPhysVol* pvMotherCentral =
new GeoPhysVol(lvMotherCentral);
88 GeoLogVol* lvMotherFwd =
new GeoLogVol(
"BeamPipeFwd",envelopes.
fwdShape,air);
89 GeoPhysVol* pvMotherFwdPlus =
new GeoPhysVol(lvMotherFwd);
90 GeoPhysVol* pvMotherFwdMinus =
new GeoPhysVol(lvMotherFwd);
100 GeoNameTag *tag =
new GeoNameTag(
"BeamPipe");
105 if (bpipePosition->
size() != 0) {
106 beamx = (*bpipePosition)[0]->getDouble(
"POSX") * Gaudi::Units::mm;
107 beamy = (*bpipePosition)[0]->getDouble(
"POSY") * Gaudi::Units::mm;
108 beamz = (*bpipePosition)[0]->getDouble(
"POSZ") * Gaudi::Units::mm;
111 if (
m_mode==
"AssemblyBeamPipe"){
114 theBeamPipe->add(tag);
115 theBeamPipe->add(
new GeoTransform(GeoTrf::Translate3D(beamx,beamy,beamz)));
116 theBeamPipe->add(pvMotherCentral);
119 theBeamPipe->add(tag);
120 theBeamPipe->add(pvMotherFwdPlus);
123 theBeamPipe->add(tag);
124 theBeamPipe->add(
new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::degree)));
125 theBeamPipe->add(pvMotherFwdMinus);
127 const GeoShape *shape = envelopes.
bpShape;
128 GeoLogVol* lvMother =
new GeoLogVol(
"BeamPipe",shape,air);
129 GeoPhysVol* pvMother =
new GeoPhysVol(lvMother);
131 pvMother->add(theBeamPipe);
134 world->add(pvMother);
141 world->add(
new GeoTransform(GeoTrf::Translate3D(beamx,beamy,beamz)));
142 world->add(pvMotherCentral);
146 world->add(pvMotherFwdPlus);
150 world->add(
new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::degree)));
151 world->add(pvMotherFwdMinus);
161 bool central = (region == 0);
165 GeoPhysVol* pvMotherSection =
nullptr;
166 bool addToFirstSection =
true;
172 for (
unsigned int itemp=0; itemp<bpipeSections->
size(); itemp++)
174 std::string material = (*bpipeSections)[itemp]->getString(
"MATERIAL");
175 double rMin1 = (*bpipeSections)[itemp]->getDouble(
"RMIN1") * Gaudi::Units::mm;
176 double rMax1 = (*bpipeSections)[itemp]->getDouble(
"RMAX1") * Gaudi::Units::mm;
177 double rMin2 = (*bpipeSections)[itemp]->getDouble(
"RMIN2") * Gaudi::Units::mm;
178 double rMax2 = (*bpipeSections)[itemp]->getDouble(
"RMAX2") * Gaudi::Units::mm;
179 double z = (*bpipeSections)[itemp]->getDouble(
"Z") * Gaudi::Units::mm;
180 double dZ = (*bpipeSections)[itemp]->getDouble(
"DZ") * Gaudi::Units::mm;
181 int secNum = (*bpipeSections)[itemp]->getInt(
"SECNUM");
183 double zmin =
z - dZ;
184 double zmax =
z + dZ;
200 double znew = 0.5 * (zmin + zmax);
201 double dZnew = 0.5 * (zmax - zmin);
203 std::ostringstream os;
209 os << std::setw(2) << std::setfill(
'0') << secNum;
210 std::string name = os.str();
224 if((rMin1==rMin2)&&(rMax1==rMax2)) {
225 shape =
new GeoTube(rMin1,rMax1,dZnew);
228 shape =
new GeoCons(rMin1,rMin2,
231 0*Gaudi::Units::deg,360*Gaudi::Units::deg);
236 if (mat ==
nullptr) {
243 GeoLogVol* lvSection =
new GeoLogVol(name,shape,mat);
244 GeoIntrusivePtr<GeoPhysVol> pvSection{
new GeoPhysVol(lvSection)};
251 pvMotherSection = pvSection;
258 if (addToFirstSection && secNum != 1) {
259 double rAve = 0.5*(rMin1+rMax1);
260 addToFirstSection = (znew > zminSec1 && znew < zmaxSec1 &&
261 rAve > rminSec1 && rAve < rmaxSec1);
265 GeoTransform* tfSection =
nullptr;
266 if (znew != 0 && (secNum==1 || !addToFirstSection)) tfSection =
new GeoTransform(GeoTrf::TranslateZ3D(znew));
267 GeoIntrusivePtr<GeoNameTag> ntSection{
new GeoNameTag(name)};
269 if (addToFirstSection && secNum!=1) {
270 if (!pvMotherSection) {
272 gLog << MSG::ERROR <<
"Logic error building beam pipe." <<
endmsg;
276 pvMotherSection->add(ntSection);
277 pvMotherSection->add(pvSection);
281 parent->add(ntSection);
282 if (tfSection) parent->add(tfSection);
283 parent->add(pvSection);
287 if(central &&
z!=0.) {
289 GeoTransform* tfSectionRot =
nullptr;
292 tfSectionRot =
new GeoTransform(GeoTrf::TranslateZ3D(-znew));
295 tfSectionRot =
new GeoTransform(GeoTrf::TranslateZ3D(-znew)*GeoTrf::RotateY3D(180*Gaudi::Units::deg));
297 parent->add(ntSection);
298 parent->add(tfSectionRot);
299 parent->add(pvSection);
323 std::vector<EnvelopeEntry> centralEntry;
324 std::vector<EnvelopeEntry> fwdEntry;
326 for (
unsigned int i=0; i<bpipeEnvelope->
size(); i++) {
327 double z = (*bpipeEnvelope)[i]->getDouble(
"Z") * Gaudi::Units::mm;
328 double r = (*bpipeEnvelope)[i]->getDouble(
"R") * Gaudi::Units::mm;
331 centralEntry.push_back(entry);
333 fwdEntry.push_back(entry);
338 if (!fwdEntry.empty()) {
339 rFwd = fwdEntry[0].r();
340 }
else if (!centralEntry.empty()) {
341 rFwd = centralEntry[0].r();
343 std::cout <<
"Unexpected condition when building beam pipe." << std::endl;
347 if (centralEntry.empty()) {
354 for (
int i=centralEntry.size()-1; i>=0; i--) {
355 double z = centralEntry[i].z();
356 double r = centralEntry[i].r();
357 pcone->addPlane(-
z,0,
r);
359 for (
unsigned int i=0; i<centralEntry.size(); i++) {
360 double z = centralEntry[i].z();
361 double r = centralEntry[i].r();
362 pcone->addPlane(
z,0,
r);
373 if (fwdEntry.empty()) {
378 for (
unsigned int i=0; i<fwdEntry.size(); i++) {
379 double z = fwdEntry[i].z();
380 double r = fwdEntry[i].r();
381 pcone->addPlane(
z,0,
r);
389 for (
int i=fwdEntry.size()-1; i>=0; i--) {
390 double z = fwdEntry[i].z();
391 double r = fwdEntry[i].r();
392 Pcone->addPlane(-
z,0,
r);
396 for (
unsigned int i=0; i<fwdEntry.size(); i++) {
397 double z = fwdEntry[i].z();
398 double r = fwdEntry[i].r();
399 Pcone->addPlane(
z,0,
r);
413 double iir = (*atlasMother)[0]->getDouble(
"IDETIR")*Gaudi::Units::cm;
414 double cir = (*atlasMother)[0]->getDouble(
"CALOIR")*Gaudi::Units::cm;
415 double mir = (*atlasMother)[0]->getDouble(
"MUONIR")*Gaudi::Units::cm;
416 double totlen = (*atlasMother)[0]->getDouble(
"ZMAX")*Gaudi::Units::cm;
417 double ilen = (*atlasMother)[0]->getDouble(
"IDETZMX")*Gaudi::Units::cm;
418 double clen = (*atlasMother)[0]->getDouble(
"CALOZMX")*Gaudi::Units::cm;
430 bpipeEnvPcone->addPlane(ilen,0,iir);
431 bpipeEnvPcone->addPlane(ilen,0,cir);
432 bpipeEnvPcone->addPlane(clen,0,cir);
433 bpipeEnvPcone->addPlane(clen,0,mir);
434 bpipeEnvPcone->addPlane(totlen,0,mir);