Skip to content
Snippets Groups Projects
Commit fd3192cb authored by Yee Chinn Yap's avatar Yee Chinn Yap Committed by Adam Edward Barton
Browse files

Beampipe optimisation

parent ea1587df
No related branches found
No related tags found
No related merge requests found
...@@ -66,6 +66,11 @@ void BeamPipeDetectorFactory::create(GeoPhysVol *world) ...@@ -66,6 +66,11 @@ void BeamPipeDetectorFactory::create(GeoPhysVol *world)
m_centralRegionZMax = 1500 * Gaudi::Units::mm; // For backward compatibility in DB. m_centralRegionZMax = 1500 * Gaudi::Units::mm; // For backward compatibility in DB.
if (bpipeGeneral->size() != 0) m_centralRegionZMax = (*bpipeGeneral)[0]->getDouble("CENTRALZMAX") * Gaudi::Units::mm; if (bpipeGeneral->size() != 0) m_centralRegionZMax = (*bpipeGeneral)[0]->getDouble("CENTRALZMAX") * Gaudi::Units::mm;
const GeoMaterial* ether = m_materialManager->getMaterial("special::Ether");
GeoTube* dummytube= new GeoTube(0., 4711., 4711.);
GeoLogVol* dummyBeamPipe = new GeoLogVol("BeamPipe",dummytube,ether);
GeoPhysVol* theBeamPipe = new GeoPhysVol(dummyBeamPipe);
EnvelopeShapes envelopes; EnvelopeShapes envelopes;
if (bpipeEnvelope->size() != 0) { if (bpipeEnvelope->size() != 0) {
...@@ -103,26 +108,48 @@ void BeamPipeDetectorFactory::create(GeoPhysVol *world) ...@@ -103,26 +108,48 @@ void BeamPipeDetectorFactory::create(GeoPhysVol *world)
beamz = (*bpipePosition)[0]->getDouble("POSZ") * Gaudi::Units::mm; beamz = (*bpipePosition)[0]->getDouble("POSZ") * Gaudi::Units::mm;
} }
// Only shift the central section if (m_mode=="AssemblyBeamPipe"){
// Only shift the central section
// Central // Central
world->add(tag); theBeamPipe->add(tag);
world->add(new GeoTransform(GeoTrf::Translate3D(beamx,beamy,beamz))); theBeamPipe->add(new GeoTransform(GeoTrf::Translate3D(beamx,beamy,beamz)));
world->add(pvMotherCentral); theBeamPipe->add(pvMotherCentral);
m_detectorManager->addTreeTop(pvMotherCentral); //
// FwdPlus
// FwdPlus theBeamPipe->add(tag);
world->add(tag); theBeamPipe->add(pvMotherFwdPlus);
world->add(pvMotherFwdPlus);
m_detectorManager->addTreeTop(pvMotherFwdPlus); // FwdMinus
theBeamPipe->add(tag);
// FwdMinus theBeamPipe->add(new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::degree)));
world->add(tag); theBeamPipe->add(pvMotherFwdMinus);
world->add(new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::degree)));
world->add(pvMotherFwdMinus); const GeoShape *shape = envelopes.bpShape;
m_detectorManager->addTreeTop(pvMotherFwdMinus); GeoLogVol* lvMother = new GeoLogVol("BeamPipe",shape,air);
GeoPhysVol* pvMother = new GeoPhysVol(lvMother);
pvMother->add(tag);
pvMother->add(theBeamPipe);
world->add(tag);
world->add(pvMother);
m_detectorManager->addTreeTop(pvMother);
}
else{
// Default beam pipe, union of central and forward beampipes rather than assembly volume
// Central
world->add(tag);
world->add(new GeoTransform(GeoTrf::Translate3D(beamx,beamy,beamz)));
world->add(pvMotherCentral);
m_detectorManager->addTreeTop(pvMotherCentral); //
// FwdPlus
world->add(tag);
world->add(pvMotherFwdPlus);
m_detectorManager->addTreeTop(pvMotherFwdPlus);
// FwdMinus
world->add(new GeoTransform(GeoTrf::RotateY3D(180*Gaudi::Units::degree)));
world->add(pvMotherFwdMinus);
m_detectorManager->addTreeTop(pvMotherFwdMinus);
}
} }
void BeamPipeDetectorFactory::addSections(GeoPhysVol* parent, int region) void BeamPipeDetectorFactory::addSections(GeoPhysVol* parent, int region)
...@@ -283,10 +310,11 @@ const BeamPipeDetectorManager * BeamPipeDetectorFactory::getDetectorManager() co ...@@ -283,10 +310,11 @@ const BeamPipeDetectorManager * BeamPipeDetectorFactory::getDetectorManager() co
return m_detectorManager; return m_detectorManager;
} }
void BeamPipeDetectorFactory::setTagNode(std::string tag, std::string node) void BeamPipeDetectorFactory::setTagNode(std::string tag, std::string node, std::string mode)
{ {
m_versionTag = tag; m_versionTag = tag;
m_versionNode = node; m_versionNode = node;
m_mode = mode;
} }
...@@ -358,6 +386,24 @@ BeamPipeDetectorFactory::makeEnvelope(IRDBRecordset_ptr bpipeEnvelope) ...@@ -358,6 +386,24 @@ BeamPipeDetectorFactory::makeEnvelope(IRDBRecordset_ptr bpipeEnvelope)
envelopes.fwdShape = pcone; envelopes.fwdShape = pcone;
} }
//central+fwd
{
GeoPcon* Pcone = new GeoPcon(0, 360*Gaudi::Units::deg);
for (int i=fwdEntry.size()-1; i>=0; i--) {
double z = fwdEntry[i].z();
double r = fwdEntry[i].r();
Pcone->addPlane(-z,0,r);
}
Pcone->addPlane(-m_centralRegionZMax,0,rFwd);
Pcone->addPlane(m_centralRegionZMax,0,rFwd);
for (unsigned int i=0; i<fwdEntry.size(); i++) {
double z = fwdEntry[i].z();
double r = fwdEntry[i].r();
Pcone->addPlane(z,0,r);
}
envelopes.bpShape = Pcone;
}
return envelopes; return envelopes;
} }
......
...@@ -32,7 +32,7 @@ class BeamPipeDetectorFactory final : public GeoVDetectorFactory ...@@ -32,7 +32,7 @@ class BeamPipeDetectorFactory final : public GeoVDetectorFactory
virtual const BeamPipeDetectorManager * getDetectorManager() const override; virtual const BeamPipeDetectorManager * getDetectorManager() const override;
// Set version Tag and Node // Set version Tag and Node
void setTagNode(std::string tag, std::string node); void setTagNode(std::string tag, std::string node, std::string mode);
void addSections(GeoPhysVol* parent, int region); void addSections(GeoPhysVol* parent, int region);
...@@ -52,9 +52,10 @@ class BeamPipeDetectorFactory final : public GeoVDetectorFactory ...@@ -52,9 +52,10 @@ class BeamPipeDetectorFactory final : public GeoVDetectorFactory
class EnvelopeShapes { class EnvelopeShapes {
public: public:
EnvelopeShapes() : centralShape(0), fwdShape(0) {} EnvelopeShapes() : centralShape(0), fwdShape(0), bpShape(0) {}
GeoShape * centralShape; GeoShape * centralShape;
GeoShape * fwdShape; GeoShape * fwdShape;
GeoShape * bpShape;
}; };
...@@ -75,6 +76,7 @@ class BeamPipeDetectorFactory final : public GeoVDetectorFactory ...@@ -75,6 +76,7 @@ class BeamPipeDetectorFactory final : public GeoVDetectorFactory
IRDBAccessSvc * m_access; IRDBAccessSvc * m_access;
std::string m_versionTag; std::string m_versionTag;
std::string m_versionNode; std::string m_versionNode;
std::string m_mode;
double m_centralRegionZMax; double m_centralRegionZMax;
}; };
......
...@@ -22,8 +22,10 @@ BeamPipeDetectorTool::BeamPipeDetectorTool( const std::string& type, ...@@ -22,8 +22,10 @@ BeamPipeDetectorTool::BeamPipeDetectorTool( const std::string& type,
const std::string& name, const std::string& name,
const IInterface* parent ): const IInterface* parent ):
GeoModelTool(type,name,parent), GeoModelTool(type,name,parent),
m_manager(0) m_manager(0),
m_mode("BeamPipe")
{ {
declareProperty("BeamPipeMode", m_mode); //m_mode="BeamPipe" by default, setting m_mode="AssemblyBeamPipe" will trigger optimised implementation using assembly volume
} }
BeamPipeDetectorTool::~BeamPipeDetectorTool() BeamPipeDetectorTool::~BeamPipeDetectorTool()
...@@ -75,14 +77,13 @@ StatusCode BeamPipeDetectorTool::create() ...@@ -75,14 +77,13 @@ StatusCode BeamPipeDetectorTool::create()
beampipeVersionTag = raccess->getChildTag("BeamPipe", atlasVersion,versionNode); beampipeVersionTag = raccess->getChildTag("BeamPipe", atlasVersion,versionNode);
log << MSG::DEBUG << "Beampipe Version: " << beampipeVersionTag << endmsg; log << MSG::DEBUG << "Beampipe Version: " << beampipeVersionTag << endmsg;
if (beampipeVersionTag.empty()) { if (beampipeVersionTag.empty()) {
log << MSG::INFO << "No BeamPipe Version. Beam pipe will not be built." << endmsg; log << MSG::INFO << "No BeamPipe Version. Beam pipe will not be built." << endmsg;
} else { } else {
BeamPipeDetectorFactory theBeamPipeFactory(detStore().operator->(),raccess); BeamPipeDetectorFactory theBeamPipeFactory(detStore().operator->(),raccess);
theBeamPipeFactory.setTagNode(atlasVersion,versionNode); theBeamPipeFactory.setTagNode(atlasVersion,versionNode,m_mode);
theBeamPipeFactory.create(world); theBeamPipeFactory.create(world);
m_manager = theBeamPipeFactory.getDetectorManager(); m_manager = theBeamPipeFactory.getDetectorManager();
......
...@@ -22,6 +22,7 @@ class BeamPipeDetectorTool final : public GeoModelTool ...@@ -22,6 +22,7 @@ class BeamPipeDetectorTool final : public GeoModelTool
virtual StatusCode clear() override final; virtual StatusCode clear() override final;
private: private:
const BeamPipeDetectorManager* m_manager; const BeamPipeDetectorManager* m_manager;
std::string m_mode;
}; };
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment