Skip to content
Snippets Groups Projects
Commit 0150ba91 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (InDetGeoModelUtils-00-06-14)

	* Add shifted IBL code - cache
	* Tag as InDetGeoModelUtils-00-06-14

2015-02-13 Sabine Elles
	* Add shifted IBL code
	* Tag as InDetGeoModelUtils-00-06-13

2014-09-23 Sabine elles <sabine.elles@cern.ch>
	* Fix special::ether material scaling error
	* Tag as InDetGeoModelUtils-00-06-12
parent f753e97f
No related branches found
No related tags found
No related merge requests found
################################################################################
# Package: InDetGeoModelUtils
################################################################################
# Declare the package name:
atlas_subdir( InDetGeoModelUtils )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaKernel
Database/AthenaPOOL/RDBAccessSvc
DetectorDescription/GeoModel/GeoModelKernel
GaudiKernel
PRIVATE
Control/StoreGate
DetectorDescription/GeoModel/GeoModelInterfaces
DetectorDescription/GeoModel/GeoModelUtilities
DetectorDescription/GeometryDBSvc )
# External dependencies:
find_package( Boost COMPONENTS filesystem thread system )
find_package( CLHEP )
find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess )
# Component(s) in the package:
atlas_add_library( InDetGeoModelUtils
src/*.cxx
PUBLIC_HEADERS InDetGeoModelUtils
INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
DEFINITIONS ${CLHEP_DEFINITIONS}
LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaKernel GeoModelKernel GaudiKernel StoreGateLib SGtests
PRIVATE_LINK_LIBRARIES GeoModelUtilities )
...@@ -64,6 +64,7 @@ namespace InDetDD { ...@@ -64,6 +64,7 @@ namespace InDetDD {
void setGeoShape(const GeoShape * geoShape, double volume=0); void setGeoShape(const GeoShape * geoShape, double volume=0);
void setEnvelopeNum(int num) { m_envNum=num; } void setEnvelopeNum(int num) { m_envNum=num; }
void setParentEnvelope(int num) { m_envParentNum=num; } void setParentEnvelope(int num) { m_envParentNum=num; }
void setZShift(double shift) { m_zShift=shift; }
double rmin() const {return m_rmin;} double rmin() const {return m_rmin;}
double rmax() const {return m_rmax;} double rmax() const {return m_rmax;}
...@@ -96,7 +97,8 @@ namespace InDetDD { ...@@ -96,7 +97,8 @@ namespace InDetDD {
bool splittableInZ() const {return m_splittableZ;} bool splittableInZ() const {return m_splittableZ;}
int envelopeNum() const {return m_envNum; } int envelopeNum() const {return m_envNum; }
int envelopeParent() const {return m_envParentNum; } int envelopeParent() const {return m_envParentNum; }
double zShift() const {return m_zShift; }
// For debugging // For debugging
void print() const; void print() const;
...@@ -133,6 +135,7 @@ namespace InDetDD { ...@@ -133,6 +135,7 @@ namespace InDetDD {
int m_envNum; int m_envNum;
int m_envParentNum; int m_envParentNum;
double m_zShift;
}; };
} // End namespace } // End namespace
......
...@@ -42,6 +42,7 @@ namespace InDetDD { ...@@ -42,6 +42,7 @@ namespace InDetDD {
std::string phiStep() const {return m_phiStep;} std::string phiStep() const {return m_phiStep;}
std::string radialDiv() const {return m_radialDiv;} std::string radialDiv() const {return m_radialDiv;}
std::string volId() const {return m_volId;} std::string volId() const {return m_volId;}
std::string shiftFlag() const {return m_shiftFlag;}
void set_rmin (const std::string & s) {m_rmin = s;} void set_rmin (const std::string & s) {m_rmin = s;}
void set_rmax (const std::string & s) {m_rmax = s;} void set_rmax (const std::string & s) {m_rmax = s;}
...@@ -61,9 +62,11 @@ namespace InDetDD { ...@@ -61,9 +62,11 @@ namespace InDetDD {
void set_phiStep (const std::string & s) {m_phiStep = s;} void set_phiStep (const std::string & s) {m_phiStep = s;}
void set_radialDiv (const std::string & s) {m_radialDiv = s;} void set_radialDiv (const std::string & s) {m_radialDiv = s;}
void set_volId (const std::string & s) {m_volId = s;} void set_volId (const std::string & s) {m_volId = s;}
void set_shiftFlag (const std::string & s) {m_shiftFlag = s;}
bool simple() const {return m_rmin2.empty();} bool simple() const {return m_rmin2.empty();}
bool has_volId() const {return !m_volId.empty();} bool has_volId() const {return !m_volId.empty();}
bool has_shiftFlag() const {return !m_shiftFlag.empty();}
bool has_shapeType() const {return !m_shapeType.empty();} bool has_shapeType() const {return !m_shapeType.empty();}
bool has_width() const {return !m_width.empty();} bool has_width() const {return !m_width.empty();}
bool has_radial() const {return !m_radialDiv.empty();} bool has_radial() const {return !m_radialDiv.empty();}
...@@ -88,6 +91,8 @@ namespace InDetDD { ...@@ -88,6 +91,8 @@ namespace InDetDD {
std::string m_phiStep; std::string m_phiStep;
std::string m_radialDiv; std::string m_radialDiv;
std::string m_volId; std::string m_volId;
std::string m_shiftFlag;
}; };
class ServiceVolumeMakerMgr { class ServiceVolumeMakerMgr {
...@@ -109,9 +114,11 @@ namespace InDetDD { ...@@ -109,9 +114,11 @@ namespace InDetDD {
int repeat(int index) const; int repeat(int index) const;
int radialDiv(int index) const; int radialDiv(int index) const;
int volId(int index) const; int volId(int index) const;
int shiftFlag(int index) const;
std::string shapeType(int index) const; std::string shapeType(int index) const;
std::string volName(int index) const; std::string volName(int index) const;
std::string materialName(int index) const; std::string materialName(int index) const;
std::vector<double> readLayerShift() const;
unsigned int numElements() const; unsigned int numElements() const;
...@@ -120,6 +127,7 @@ namespace InDetDD { ...@@ -120,6 +127,7 @@ namespace InDetDD {
private: private:
IRDBRecordset_ptr m_table; IRDBRecordset_ptr m_table;
IRDBRecordset_ptr m_layer;
ServiceVolumeSchema m_schema; ServiceVolumeSchema m_schema;
const InDetDD::AthenaComps * m_athenaComps; const InDetDD::AthenaComps * m_athenaComps;
}; };
...@@ -139,6 +147,7 @@ namespace InDetDD { ...@@ -139,6 +147,7 @@ namespace InDetDD {
std::string m_label; std::string m_label;
ServiceVolumeMakerMgr * m_mgr; ServiceVolumeMakerMgr * m_mgr;
std::vector<const ServiceVolume *> m_services; std::vector<const ServiceVolume *> m_services;
std::vector<double> m_layerShift;
}; };
} // end namespace } // end namespace
......
...@@ -998,7 +998,7 @@ InDetMaterialManager::extraScaledMaterial(const std::string & materialName, cons ...@@ -998,7 +998,7 @@ InDetMaterialManager::extraScaledMaterial(const std::string & materialName, cons
double scaleFactor = getExtraScaleFactor(materialName); double scaleFactor = getExtraScaleFactor(materialName);
// -1 (or any -ve number) indicates material is not scaled. And if the scale factor // -1 (or any -ve number) indicates material is not scaled. And if the scale factor
// is 1 then there is no need to create a new material. // is 1 then there is no need to create a new material.
if (scaleFactor < 0 || scaleFactor == 1) return origMaterial; if (scaleFactor < 0 || scaleFactor == 1 || materialName.find("Ether")!=std::string::npos) return origMaterial;
if (scaleFactor == 0) return getMaterialInternal("std::Vacuum"); if (scaleFactor == 0) return getMaterialInternal("std::Vacuum");
std::string newName = materialName+"_ExtraScaling"; std::string newName = materialName+"_ExtraScaling";
......
...@@ -118,7 +118,8 @@ ServiceVolume::ServiceVolume() ...@@ -118,7 +118,8 @@ ServiceVolume::ServiceVolume()
m_splittableR(true), m_splittableR(true),
m_splittableZ(true), m_splittableZ(true),
m_envNum(0), m_envNum(0),
m_envParentNum(0) m_envParentNum(0),
m_zShift(0.)
{} {}
...@@ -190,6 +191,10 @@ ServiceVolume::getShape() const { ...@@ -190,6 +191,10 @@ ServiceVolume::getShape() const {
const GeoShape * serviceShape = 0; const GeoShape * serviceShape = 0;
double volume = 0; double volume = 0;
// Check if service needs to be shifted
// if(fabs(m_zShift)>0.001)
// std::cout<<"SHIFTED SERVICE : "<<m_volName<<" "<<m_shapeType<<std::endl;
if (m_shapeType.empty() || m_shapeType == "TUBE") { if (m_shapeType.empty() || m_shapeType == "TUBE") {
serviceShape = new GeoTube(m_rmin,m_rmax,halflength); serviceShape = new GeoTube(m_rmin,m_rmax,halflength);
} else if (m_shapeType == "TUBS") { } else if (m_shapeType == "TUBS") {
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#include "InDetGeoModelUtils/ServiceVolumeMaker.h" #include "InDetGeoModelUtils/ServiceVolumeMaker.h"
#include "InDetGeoModelUtils/ServiceVolume.h" #include "InDetGeoModelUtils/ServiceVolume.h"
#include "InDetGeoModelUtils/InDetDDAthenaComps.h" #include "InDetGeoModelUtils/InDetDDAthenaComps.h"
#include "GeoModelUtilities/DecodeVersionKey.h"
#include "RDBAccessSvc/IRDBRecordset.h" #include "RDBAccessSvc/IRDBRecordset.h"
#include "GeometryDBSvc/IGeometryDBSvc.h" #include "GeometryDBSvc/IGeometryDBSvc.h"
#include "CLHEP/Units/SystemOfUnits.h" #include "CLHEP/Units/SystemOfUnits.h"
...@@ -35,6 +38,7 @@ void ServiceVolumeSchema::setPixelSchema() ...@@ -35,6 +38,7 @@ void ServiceVolumeSchema::setPixelSchema()
m_radialDiv = ""; m_radialDiv = "";
m_phiStep = ""; m_phiStep = "";
m_volId = "FRAMENUM"; m_volId = "FRAMENUM";
m_shiftFlag="SHIFT";
} }
void ServiceVolumeSchema::setDefaultSchema() void ServiceVolumeSchema::setDefaultSchema()
...@@ -56,6 +60,7 @@ void ServiceVolumeSchema::setDefaultSchema() ...@@ -56,6 +60,7 @@ void ServiceVolumeSchema::setDefaultSchema()
m_radialDiv = "RADIAL"; m_radialDiv = "RADIAL";
m_phiStep = "PHISTEP"; m_phiStep = "PHISTEP";
m_volId = ""; m_volId = "";
m_shiftFlag="SHIFT";
} }
void ServiceVolumeSchema::setSimpleSchema() void ServiceVolumeSchema::setSimpleSchema()
...@@ -77,6 +82,8 @@ void ServiceVolumeSchema::setSimpleSchema() ...@@ -77,6 +82,8 @@ void ServiceVolumeSchema::setSimpleSchema()
m_radialDiv = ""; m_radialDiv = "";
m_phiStep = ""; m_phiStep = "";
m_volId = ""; m_volId = "";
m_shiftFlag="SHIFT";
} }
ServiceVolumeMakerMgr::ServiceVolumeMakerMgr(IRDBRecordset_ptr table, const ServiceVolumeSchema & schema, ServiceVolumeMakerMgr::ServiceVolumeMakerMgr(IRDBRecordset_ptr table, const ServiceVolumeSchema & schema,
...@@ -207,12 +214,48 @@ int ServiceVolumeMakerMgr::volId(int index) const ...@@ -207,12 +214,48 @@ int ServiceVolumeMakerMgr::volId(int index) const
return 0; return 0;
} }
int ServiceVolumeMakerMgr::shiftFlag(int index) const
{
if (m_schema.has_shiftFlag()) {
if (db()->testField(m_table, m_schema.shiftFlag(), index))
return db()->getInt(m_table, m_schema.shiftFlag(), index);
}
return 0;
}
std::vector<double> ServiceVolumeMakerMgr::readLayerShift() const
{
std::vector<double> layerShift;
IRDBAccessSvc *rdbSvc = m_athenaComps->rdbAccessSvc();
IGeoModelSvc *geoModel = m_athenaComps->geoModelSvc();
DecodeVersionKey versionKey(geoModel, "Pixel");
std::string detectorKey = versionKey.tag();
std::string detectorNode = versionKey.node();
IRDBRecordset_ptr PixelBarrelGeneral= rdbSvc->getRecordsetPtr("PixelBarrelGeneral",detectorKey, detectorNode);
IRDBRecordset_ptr PixelLayer= rdbSvc->getRecordsetPtr("PixelLayer",detectorKey, detectorNode);
int numLayers = db()->getInt(PixelBarrelGeneral,"NLAYER");
for(int iLayer=0; iLayer<numLayers; iLayer++)
{
double shift = 0;
if (db()->testField(PixelLayer,"GBLSHIFT",iLayer)) shift = db()->getDouble(PixelLayer,"GBLSHIFT",iLayer);
layerShift.push_back(shift);
}
return layerShift;
}
ServiceVolumeMaker::ServiceVolumeMaker(const std::string & label, ServiceVolumeMaker::ServiceVolumeMaker(const std::string & label,
IRDBRecordset_ptr table, const ServiceVolumeSchema & schema, IRDBRecordset_ptr table, const ServiceVolumeSchema & schema,
const InDetDD::AthenaComps * athenaComps) const InDetDD::AthenaComps * athenaComps)
: m_label(label) : m_label(label)
{ {
m_mgr = new ServiceVolumeMakerMgr(table, schema, athenaComps); m_mgr = new ServiceVolumeMakerMgr(table, schema, athenaComps);
m_layerShift = m_mgr->readLayerShift();
// std::cout<<"LAYER SHIFT "<<m_layerShift[0]<<" "<<m_layerShift[1]<<" "<<m_layerShift[2]<<" "<<m_layerShift[3]<<std::endl;
} }
ServiceVolumeMaker::~ServiceVolumeMaker() ServiceVolumeMaker::~ServiceVolumeMaker()
...@@ -252,6 +295,10 @@ ServiceVolumeMaker::make(int ii) ...@@ -252,6 +295,10 @@ ServiceVolumeMaker::make(int ii)
param->setZsymm(m_mgr->zsymm(ii)); param->setZsymm(m_mgr->zsymm(ii));
param->setVolName(m_mgr->volName(ii)); param->setVolName(m_mgr->volName(ii));
double zShift=0.; // the famous IBL Z shift
if(m_mgr->shiftFlag(ii)>0) zShift=m_layerShift[m_mgr->shiftFlag(ii)-100];
param->setZShift(zShift);
int volId = m_mgr->volId(ii); int volId = m_mgr->volId(ii);
if (volId == 0) volId = ii+1; if (volId == 0) volId = ii+1;
......
...@@ -29,7 +29,19 @@ TubeVolData::maxRadius() const ...@@ -29,7 +29,19 @@ TubeVolData::maxRadius() const
TubeVolData::TubeVolData(const IRDBRecord * record) TubeVolData::TubeVolData(const IRDBRecord * record)
: m_record(record) : m_record(record),
m_bothZ(false),
m_nRepeat(0),
m_radialDiv(0),
m_phiStart(0.),
m_phiDelta(0.),
m_phiStep(0.),
m_rmin1(0.),
m_rmin2(0.),
m_rmax1(0.),
m_rmax2(0.),
m_length(0.),
m_zMid(0.)
{ {
// add an 2*epsilon gap between phi sectors. // add an 2*epsilon gap between phi sectors.
const double phiepsilon = 0.001*CLHEP::degree; const double phiepsilon = 0.001*CLHEP::degree;
......
...@@ -343,6 +343,10 @@ GeoTransform * VolumeBuilder::getPlacement(int iElement, int iCopy) ...@@ -343,6 +343,10 @@ GeoTransform * VolumeBuilder::getPlacement(int iElement, int iCopy)
// NB. Corrected for placement in endcaps // NB. Corrected for placement in endcaps
double zpos = param.zposition() - m_zcenter; double zpos = param.zposition() - m_zcenter;
// Shift along Z axis ( IBL shift )
double zshift = param.zShift();
zpos += zshift;
// Check if we need to rotate around Y axis. // Check if we need to rotate around Y axis.
bool rotateAroundY = false; bool rotateAroundY = false;
if (param.needsRotation()) { // zpos will always be negative in this case if (param.needsRotation()) { // zpos will always be negative in this case
......
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