Commit 77ea4892 authored by Deion Elgin Fellers's avatar Deion Elgin Fellers Committed by Walter Lampl
Browse files

Pixel Luminosity Rings hits collection

parent bc58cb9b
......@@ -37,7 +37,7 @@ from AthenaConfiguration.AutoConfigFlags import getDefaultDetectors
allDetectors = [
'Bpipe', 'Cavern',
'BCM', 'DBM', 'Pixel', 'SCT', 'TRT',
'BCMPrime', 'ITkPixel', 'ITkStrip', 'HGTD',
'BCMPrime', 'PLR', 'ITkPixel', 'ITkStrip', 'HGTD',
'LAr', 'Tile', 'MBTS',
'CSC', 'MDT', 'RPC', 'TGC', 'sTGC', 'MM',
'Lucid', 'ZDC', 'ALFA', 'AFP', 'FwdRegion',
......@@ -45,7 +45,7 @@ allDetectors = [
# all detector groups - used in helper functions
allGroups = {
'ID': ['BCM', 'DBM', 'Pixel', 'SCT', 'TRT'],
'ITk': ['BCMPrime', 'ITkPixel', 'ITkStrip'],
'ITk': ['BCMPrime', 'ITkPixel', 'ITkStrip', 'PLR'],
'Calo': ['LAr', 'Tile', 'MBTS'],
'Muon': ['CSC', 'MDT', 'RPC', 'TGC', 'sTGC', 'MM'],
'Forward': ['Lucid', 'ZDC', 'ALFA', 'AFP', 'FwdRegion'],
......@@ -70,12 +70,14 @@ def createDetectorConfigFlags():
or prevFlags.Detector.GeometryTRT))
# Upgrade ITk Inner Tracker is a separate and parallel detector
dcf.addFlag('Detector.GeometryPLR', lambda prevFlags : 'PLR' in getDefaultDetectors(prevFlags.GeoModel.AtlasVersion))
dcf.addFlag('Detector.GeometryBCMPrime', lambda prevFlags : 'BCMPrime' in getDefaultDetectors(prevFlags.GeoModel.AtlasVersion))
dcf.addFlag('Detector.GeometryITkPixel', lambda prevFlags : 'ITkPixel' in getDefaultDetectors(prevFlags.GeoModel.AtlasVersion))
dcf.addFlag('Detector.GeometryITkStrip', lambda prevFlags : 'ITkStrip' in getDefaultDetectors(prevFlags.GeoModel.AtlasVersion))
dcf.addFlag('Detector.GeometryITk', lambda prevFlags : (prevFlags.Detector.GeometryBCMPrime
or prevFlags.Detector.GeometryITkPixel
or prevFlags.Detector.GeometryITkStrip))
or prevFlags.Detector.GeometryITkStrip
or prevFlags.Detector.GeometryPLR))
# HGTD
dcf.addFlag('Detector.GeometryHGTD', lambda prevFlags : 'HGTD' in getDefaultDetectors(prevFlags.GeoModel.AtlasVersion))
......@@ -123,12 +125,14 @@ def createDetectorConfigFlags():
or prevFlags.Detector.EnableTRT))
# Upgrade ITk Inner Tracker is a separate and parallel detector
dcf.addFlag('Detector.EnablePLR', lambda prevFlags : prevFlags.Detector.GeometryPLR)
dcf.addFlag('Detector.EnableBCMPrime', lambda prevFlags : prevFlags.Detector.GeometryBCMPrime)
dcf.addFlag('Detector.EnableITkPixel', lambda prevFlags : prevFlags.Detector.GeometryITkPixel)
dcf.addFlag('Detector.EnableITkStrip', lambda prevFlags : prevFlags.Detector.GeometryITkStrip)
dcf.addFlag('Detector.EnableITk', lambda prevFlags : (prevFlags.Detector.EnableBCMPrime
or prevFlags.Detector.EnableITkPixel
or prevFlags.Detector.EnableITkStrip))
or prevFlags.Detector.EnableITkStrip
or prevFlags.Detector.EnablePLR))
# HGTD
dcf.addFlag('Detector.EnableHGTD', lambda prevFlags : prevFlags.Detector.GeometryHGTD)
......
......@@ -37,7 +37,9 @@ AtlasDetectorIDHelper::initialize_from_dictionary(const IdDictMgr& dict_mgr,
}
else {
// Check if this is High Luminosity LHC layout
m_isHighLuminosityLHC = (dict->m_version=="ITkHGTD");
if (dict->m_version=="ITkHGTD" || dict->m_version=="ITkHGTDPLR") {
m_isHighLuminosityLHC = true;
}
// Save index to a PIXEL region for unpacking
id = atlas_id.pixel_exp();
......
......@@ -43,11 +43,13 @@ class GeoSiHit {
private:
static const InDetDD::PixelDetectorManager* initPixMgr();
static const InDetDD::PixelDetectorManager* initPlrMgr();
static const InDetDD::SCT_DetectorManager* initSctMgr();
static const PixelID* initPixID();
static const SCT_ID* initSctID();
const InDetDD::PixelDetectorManager* pixMgr() const;
const InDetDD::PixelDetectorManager* plrMgr() const;
const InDetDD::SCT_DetectorManager* sctMgr() const;
const PixelID* pixID() const;
const SCT_ID* sctID() const;
......
......@@ -27,7 +27,12 @@ inline HepGeom::Point3D<double> GeoSiHit::getGlobalPosition() const {
m_hit->getLayerDisk(),
m_hit->getPhiModule(),
m_hit->getEtaModule());
geoelement = pixMgr()->getDetectorElement(id);
if (m_hit->isPLR()) {
geoelement = plrMgr()->getDetectorElement(id);
} else {
geoelement = pixMgr()->getDetectorElement(id);
}
}
else {
id = sctID()->wafer_id(Barrel,
......
......@@ -40,6 +40,15 @@ const InDetDD::SCT_DetectorManager* GeoSiHit::initSctMgr()
}
const InDetDD::PixelDetectorManager* GeoSiHit::initPlrMgr()
{
ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "GeoSiHit");
const InDetDD::PixelDetectorManager* plr = nullptr;
detStore->retrieve(plr,"PLR").isFailure();
return plr;
}
const PixelID* GeoSiHit::initPixID()
{
ServiceHandle<StoreGateSvc> detStore ("DetectorStore", "GeoSiHit");
......@@ -76,6 +85,13 @@ const InDetDD::SCT_DetectorManager* GeoSiHit::sctMgr() const
}
const InDetDD::PixelDetectorManager* GeoSiHit::plrMgr() const
{
const InDetDD::PixelDetectorManager* const mgr = initPlrMgr();
return mgr;
}
const PixelID* GeoSiHit::pixID() const
{
const PixelID* const id = initPixID();
......
......@@ -418,9 +418,9 @@ using Trk::distDepth;
ATH_MSG_DEBUG( "Unable to swap local depth axis.");
}
}
if (std::abs(dir.m_depthAngle) < 0.5) { // Check that it is in roughly the right direction.
ATH_MSG_ERROR( "Orientation of local depth axis does not follow correct convention.");
dir.m_depthDirection = true; // Don't swap.
if (std::abs(dir.m_depthAngle) < 0.5 && (m_design->type())!=InDetDD::PLR) { // Check that it is in roughly the right direction. Ignore this for the PLR as it gives values as low as 0.489)
ATH_MSG_ERROR( "Orientation of local depth axis does not follow correct convention.");
dir.m_depthDirection = true; // Don't swap.
}
//
......
......@@ -10,6 +10,7 @@ def createITkConfigFlags():
itkcf.addFlag("ITk.pixelGeometryFilename", "ITKLayouts/Pixel/ITkPixel.gmx")
itkcf.addFlag("ITk.stripGeometryFilename", "ITKLayouts/Strip/ITkStrip.gmx")
itkcf.addFlag("ITk.bcmPrimeGeometryFilename", "ITKLayouts/Pixel/BCMPrime.gmx")
itkcf.addFlag("ITk.plrGeometryFilename", "ITKLayouts/PLR/PLR.gmx")
itkcf.addFlag("ITk.doPrintConfigurables",False) # if this is on all the print(ITkXYZ) lines are activated
itkcf.addFlag("ITk.doSplitReco", False ) # Turn running of the truth seeded pseudo tracking only for pileup on and off. Only makes sense to run on RDO file where SplitDigi was used!
......
......@@ -32,6 +32,10 @@ def InDetGeometryCfg (flags):
from StripGeoModelXml.ITkStripGeoModelConfig import ITkStripGeometryCfg
acc.merge(ITkStripGeometryCfg( flags ))
if flags.Detector.GeometryPLR:
from PLRGeoModelXml.PLRGeoModelConfig import PLRGeometryCfg
acc.merge(PLRGeometryCfg( flags ))
return acc
......
......@@ -420,7 +420,7 @@ namespace InDetDD {
//Similar to 21.9, but ... Do we actually need this? If not, we could just rely on the base-class implementation?
if (isBarrel() && !m_axisDir.ptr()->m_barrelLike) {
ATH_MSG_WARNING("Element has endcap like orientation with barrel identifier.");
} else if (!isBarrel() && m_axisDir.ptr()->m_barrelLike && (m_design->type())!=InDetDD::PixelInclined) {
} else if (!isBarrel() && m_axisDir.ptr()->m_barrelLike && (m_design->type())!=InDetDD::PixelInclined && (m_design->type())!=InDetDD::PLR) {
ATH_MSG_WARNING("Element has barrel like orientation with endcap identifier.");
}
}
......
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( PLRGeoModelXml )
# External dependencies:
find_package( GeoModel COMPONENTS GeoModelKernel )
# Component(s) in the package:
atlas_add_library( PLRGeoModelXmlLib
src/*.cxx
PUBLIC_HEADERS PLRGeoModelXml
PRIVATE_INCLUDE_DIRS ${GEOMODEL_INCLUDE_DIRS}
LINK_LIBRARIES GaudiKernel GeoModelUtilities GeoModelXml InDetGeoModelUtils PixelReadoutGeometryLib PixelGeoModelXmlLib
PRIVATE_LINK_LIBRARIES ${GEOMODEL_LIBRARIES} AthenaBaseComps AthenaPoolUtilities DetDescrConditions GeoModelInterfaces ReadoutGeometryBase InDetReadoutGeometry InDetSimEvent PathResolver RDBAccessSvcLib SGTools StoreGateLib )
atlas_add_component( PLRGeoModelXml
src/components/*.cxx
LINK_LIBRARIES PLRGeoModelXmlLib )
# Install files from the package:
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PLRGeoModelXml_PLRDETECTORFACTORY_H
#define PLRGeoModelXml_PLRDETECTORFACTORY_H
//
// Main routine to build the GeoModel geometry, and handle the GeometryManager and
// DetectorManager.
//
#include "InDetGeoModelUtils/InDetDetectorFactoryBase.h"
#include "PixelReadoutGeometry/PixelDetectorManager.h"
#include "InDetGeoModelUtils/WaferTree.h"
namespace InDetDD {class AthenaComps; class SiCommonItems;}
class GeoPhysVol;
namespace InDetDDSLHC {
class PLROptions;
class PLRDetectorFactory : public InDetDD::DetectorFactoryBase {
public:
PLRDetectorFactory(InDetDD::AthenaComps *athenaComps,
InDetDD::SiCommonItems *commonItems,
PLROptions &options);
virtual ~PLRDetectorFactory();
// Creation of geometry:
virtual void create(GeoPhysVol *world);
// Access to the results:
virtual InDetDD::PixelDetectorManager * getDetectorManager() const;
// Print out how many of each layer/eta/phi etc. have been set up.
void doNumerology();
private:
// Copy and assignments operations illegal and so are made private
PLRDetectorFactory(PLRDetectorFactory &right);
PLRDetectorFactory & operator=(PLRDetectorFactory &right);
InDetDD::PixelDetectorManager *m_detectorManager;
InDetDD::AthenaComps *m_athenaComps;
InDetDD::SiCommonItems *m_commonItems;
PLROptions *m_options;
WaferTree m_moduleTree;
};
}
#endif
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PLRGeoModelXml_PLRDETECTORTOOL_H
#define PLRGeoModelXml_PLRDETECTORTOOL_H
//
// Create an Athena Tool; handle Athena services and Tools needed for
// building the Pixel geometry. Then create the geometry using the PixelDetectorFactory.
// This is the entry to the PixelGeoModelXml package.
//
#include "GeoModelUtilities/GeoModelTool.h"
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include <string>
class IGeoModelSvc;
class IRDBAccessSvc;
class IGeoDbTagSvc;
namespace InDetDD {
class PixelDetectorManager;
class AthenaComps;
class SiCommonItems;
}
class PLRDetectorTool : public GeoModelTool {
public:
PLRDetectorTool(const std::string &type, const std::string &name, const IInterface *parent);
virtual ~PLRDetectorTool();
StatusCode create() override final;
StatusCode clear() override final;
StatusCode registerCallback() override final;
virtual StatusCode align(IOVSVC_CALLBACK_ARGS_P(I,keys)) override;
private:
std::string m_detectorName;
bool m_alignable;
std::string m_gmxFilename;
const InDetDD::PixelDetectorManager *m_manager;
InDetDD::AthenaComps *m_athenaComps;
InDetDD::SiCommonItems *m_commonItems;
ServiceHandle<IGeoModelSvc> m_geoModelSvc;
ServiceHandle<IRDBAccessSvc> m_rdbAccessSvc;
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc;
};
#endif // PLRGEOMODELXML_PLRDETECTORTOOL_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PLRGEOMODELXML_PLRGMXINTERFACE_H
#define PLRGEOMODELXML_PLRGMXINTERFACE_H
#include <PixelGeoModelXml/PixelGmxInterface.h>
#include <map>
#include <memory>
#include <sstream>
#include <string>
// Most functions for this interface are derived from PixelGeoModelXml/PixelGmxInterface.h
// The functions here are similar functions to that of Pixel, but have a few PLR specific differences
// such as only loading the correct PLR sensor type and identifying the modules as InDetDD::PLR
namespace InDetDD {class PixelDetectorManager; class SiCommonItems;}
namespace ITk
{
class PLRGmxInterface : public PixelGmxInterface
{
public:
PLRGmxInterface(InDetDD::PixelDetectorManager *detectorManager,
InDetDD::SiCommonItems *commonItems,
WaferTree *moduleTree);
virtual void addSensorType(std::string clas,
std::string typeName,
std::map<std::string, std::string> parameters) override final;
private:
void makePLRModule(const std::string& typeName,
const std::map<std::string, std::string> &parameters);
InDetDD::PixelDetectorManager *m_detectorManager{};
};
} // namespace ITk
#endif // PLRGEOMODELXML_PLRGMXINTERFACE_H
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PLRGeoModelXml_PLROptions_H
#define PLRGeoModelXml_PLROptions_H
#include <string>
namespace InDetDDSLHC {
//
// Class to store run time options.
//
class PLROptions {
public:
PLROptions();
bool alignable() const;
bool alignAtModuleLevel() const;
std::string gmxFilename() const;
std::string detectorName() const;
void setAlignable(bool flag = true);
void setAlignAtModuleLevel(bool flag = true);
void setGmxFilename(std::string filename);
void setDetectorName(std::string detectorname);
private:
bool m_alignable;
bool m_alignModule;
std::string m_gmxFilename;
std::string m_detectorName;
};
// Inlined methods
inline PLROptions::PLROptions() :
m_alignable(true),
m_alignModule(true),
m_gmxFilename(""),
m_detectorName("PLR")
{}
inline bool PLROptions::alignable() const {
return m_alignable;
}
inline bool PLROptions::alignAtModuleLevel() const {
return m_alignModule;
}
inline std::string PLROptions::gmxFilename() const {
return m_gmxFilename;
}
inline std::string PLROptions::detectorName() const {
return m_detectorName;
}
inline void PLROptions::setAlignable(bool flag) {
m_alignable = flag;
}
inline void PLROptions::setAlignAtModuleLevel(bool flag) {
m_alignModule = flag;
}
inline void PLROptions::setGmxFilename(std::string filename) {
m_gmxFilename = filename;
}
inline void PLROptions::setDetectorName(std::string detectorname) {
m_detectorName = detectorname;
}
}
#endif // PLRGeoModelXml_PLROptions_H
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
from AthenaConfiguration.ComponentFactory import CompFactory
# needed for alignment (copied from ITkPixel):
#from AthenaConfiguration.Enums import ProductionStep
#from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline
def PLRGeometryCfg(flags):
from AtlasGeoModel.GeoModelConfig import GeoModelCfg
acc = GeoModelCfg(flags)
geoModelSvc = acc.getPrimary()
PLRDetectorTool = CompFactory.PLRDetectorTool
plrDetectorTool = PLRDetectorTool()
# ITkPixelDetectorTool.useDynamicAlignFolders = flags.GeoModel.Align.Dynamic
plrDetectorTool.Alignable = False # make this a flag? Set true as soon as decided on folder structure
plrDetectorTool.DetectorName = "PLR"
if flags.GeoModel.useLocalGeometry:
# Setting this filename triggers reading from local file rather than DB
plrDetectorTool.GmxFilename = flags.ITk.plrGeometryFilename
geoModelSvc.DetectorTools += [ plrDetectorTool ]
# Alignment corrections and DetElements to conditions (copied from ITkPixel):
#if flags.Common.Project != "AthSimulation" and (flags.Common.ProductionStep != ProductionStep.Simulation or flags.Overlay.DataOverlay):
# from PixelConditionsAlgorithms.ITkPixelConditionsConfig import ITkPixelDetectorElementCondAlgCfg
# acc.merge(ITkPixelDetectorElementCondAlgCfg(flags))
#else:
# acc.merge(addFoldersSplitOnline(flags, "INDET", "/Indet/Onl/Align", "/Indet/Align"))
return acc
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "PLRGeoModelXml/PLRDetectorFactory.h"
#include <string>
#include <sstream>
#include "StoreGate/StoreGateSvc.h" // For alignment getAlignableFolderType()
#include "AthenaPoolUtilities/CondAttrListCollection.h"
#include "DetDescrConditions/AlignableTransformContainer.h"
#include "InDetGeoModelUtils/InDetDDAthenaComps.h"
#include "GeoModelKernel/GeoPhysVol.h"
#include "GeoModelInterfaces/IGeoModelSvc.h"
#include "GeoModelUtilities/DecodeVersionKey.h"
#include "ReadoutGeometryBase/SiCommonItems.h"
#include "PixelReadoutGeometry/PixelDetectorManager.h"
#include "InDetReadoutGeometry/Version.h"
#include "PixelReadoutGeometry/PixelModuleDesign.h"
#include "RDBAccessSvc/IRDBAccessSvc.h"
#include "RDBAccessSvc/IRDBRecordset.h"
#include "RDBAccessSvc/IRDBRecord.h"
#include "PLRGeoModelXml/PLROptions.h"
#include "GeoModelXml/Gmx2Geo.h"
#include "PLRGeoModelXml/PLRGmxInterface.h"
#include "GeoModelXml/GmxInterface.h"
#include "PathResolver/PathResolver.h"
using namespace std;
namespace InDetDDSLHC {
PLRDetectorFactory::PLRDetectorFactory(InDetDD::AthenaComps *athenaComps,
InDetDD::SiCommonItems *commonItems,
PLROptions &options) :
InDetDD::DetectorFactoryBase(athenaComps),
m_athenaComps(athenaComps),
m_commonItems(commonItems),
m_options(&options) {
//
// Create the detector manager... should allow the name to be set
//
m_detectorManager = new InDetDD::PixelDetectorManager(detStore(),m_options->detectorName());
}
PLRDetectorFactory::~PLRDetectorFactory() {
// NB the detector manager (m_detectorManager) is stored in the detector store by the Tool and so we don't delete it.
}
void PLRDetectorFactory::create(GeoPhysVol *world) {
ATH_MSG_INFO( "C R E A T E W O R L D" );
ITk::PLRGmxInterface gmxInterface(m_detectorManager, m_commonItems, &m_moduleTree);
// To set up solid geometry only, without having to worry about sensitive detectors etc., and get loads of debug output,
// comment out above line and uncomment the following line; also, switch header files above.
// GmxInterface gmxInterface;
int flags(0);
string gmxInput;
if (m_options->gmxFilename().empty()) {
ATH_MSG_INFO( "gmxFilename not set; getting .gmx from Geometry database Blob not supported"
);
}
else {
flags = 0;
gmxInput = PathResolver::find_file(m_options->gmxFilename(), "DATAPATH");
if (gmxInput.empty()) { // File not found
string errMessage("PLRDetectorFactory::create: Unable to find file " + m_options->gmxFilename() +
" with PathResolver; check filename and DATAPATH environment variable");
throw runtime_error(errMessage);
}
}
Gmx2Geo gmx2Geo(gmxInput, world, gmxInterface, flags);
//
// Add the tree-top to the detector manager.
//
unsigned int nChildren = world->getNChildVols();
bool foundVolume = false;
for (int iChild = nChildren - 1; iChild>=0; --iChild) {
if( world->getNameOfChildVol(iChild) == "PLR") {
// The * converts from a ConstPVLink to a reference to a GeoVPhysVol;
// the & takes its address.
foundVolume = true;
m_detectorManager->addTreeTop(&*world->getChildVol(iChild));
break;
}
}
if(!foundVolume) ATH_MSG_ERROR("Could not find a logicalVolume named \"PLR\"- this is required to provide the Envelope!");
doNumerology();
m_detectorManager->initNeighbours();
}
InDetDD::PixelDetectorManager * PLRDetectorFactory::getDetectorManager() const {
return m_detectorManager;
}
void PLRDetectorFactory::doNumerology() {
InDetDD::SiNumerology n;
ATH_MSG_INFO( "\n\nPLR Numerology:\n===============\n\nNumber of parts is " << m_moduleTree.nParts() );
}
}
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "PLRGeoModelXml/PLRDetectorTool.h"
#include "PLRGeoModelXml/PLRDetectorFactory.h"
#include "PLRGeoModelXml/PLROptions.h"
#include "PixelReadoutGeometry/PixelDetectorManager.h"
#include "InDetGeoModelUtils/InDetDDAthenaComps.h"
#include "ReadoutGeometryBase/SiCommonItems.h"
#include "GeoModelUtilities/GeoModelExperiment.h"
#include "GeoModelInterfaces/IGeoModelSvc.h"
#include "GeoModelUtilities/DecodeVersionKey.h"
#include "StoreGate/StoreGateSvc.h"
#include "RDBAccessSvc/IRDBAccessSvc.h"