Commit 7a886177 authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge remote-tracking branch 'upstream/master' into fromRobert

parents e42fe7df b8776ee0
#
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
#
from AthenaConfiguration.ComponentFactory import CompFactory
def CavernGeometryCfg( flags ):
from AtlasGeoModel.GeoModelConfig import GeoModelCfg
acc = GeoModelCfg( flags )
geoModelSvc=acc.getPrimary()
from AthenaConfiguration.Enums import ProductionStep
if (flags.Common.ProductionStep == ProductionStep.Simulation and flags.Beam.Type == "cosmics") or flags.Detector.GeometryCavern:
from CavernInfraGeoModel.CavernInfraGeoModelConf import CavernInfraDetectorTool
geoModelSvc.DetectorTools += [ CavernInfraDetectorTool() ]
CavernInfraDetectorTool=CompFactory.CavernInfraDetectorTool
acc.getPrimary().DetectorTools += [ CavernInfraDetectorTool() ]
return acc
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
############## Input: Reading Particles from TrackRecord Input File ###############
def Input_TrackRecordGeneratorCfg(ConfigFlags,name="TrackRecordGenerator", **kwargs):
"""Configuring the Athena application for a 'track record' job"""
from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
acc = ComponentAccumulator()
# import G4AtlasApps.AtlasCosmicTrackRecordJob #todo make this new style
from AthenaConfiguration.ComponentFactory import CompFactory
TrackRecordGenerator=CompFactory.TrackRecordGenerator
kwargs = {}
kwargs.setdefault('TRCollection','CosmicRecord') # Collection name
kwargs.setdefault("TRSmearing", -1 ) #in millimeters, e.g. 10
kwargs.setdefault("TRPSmearing", -1 ) #in radians, e.g. 0.01
kwargs.setdefault('StopParticles', False) # Stop the particles or not
kwargs.setdefault('stopped_tminus', -25.) # in ns, lower bound
kwargs.setdefault('stopped_tplus', 25.) # in ns, upper bound
#kwargs.setdefault('OutputLevel', DEBUG) # for turning up output during testing
seed = 'FatrasRnd OFFSET 123 81234740 23474923'
from RngComps.RandomServices import dSFMT
acc.merge(dSFMT(seed))
acc.addEventAlgo(TrackRecordGenerator(name,**kwargs))
return acc
# def getTrackRecordCosmicGenerator(name="TrackRecordCosmicGenerator", **kwargs):
# return getInput_TrackRecordGenerator(name, **kwargs)
......@@ -62,10 +62,11 @@ namespace InDet {
*/
class RobustTrackingGeometryBuilder : public AthAlgTool,
public Trk::TrackingVolumeManipulator,
virtual public Trk::IGeometryBuilder {
class RobustTrackingGeometryBuilder
: public AthAlgTool
, public Trk::TrackingVolumeManipulator
, virtual public Trk::IGeometryBuilder
{
public:
/** Constructor */
......@@ -85,23 +86,27 @@ namespace InDet {
Trk::GeometrySignature geometrySignature() const { return Trk::ID; }
private:
/** Private method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap layers */
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE
(const std::vector<const Trk::Layer*>& negLayers,
const std::vector<const Trk::Layer*>& centralLayers,
const std::vector<const Trk::Layer*>& posLayers,
double rMin, double rMax,
double zMin, double zPosCentral,
const std::string& baseName="UndefinedVolume",
int colorCode = 21,
Trk::BinningType bintype=Trk::arbitrary) const;
/** Private method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap volumes */
const Trk::TrackingVolume* packVolumeTriple(const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName="UndefinedVolume") const;
/** Private method, creates and packs a triple containing of
* NegEndcap-Barrel-PosEndcap layers */
const Trk::TrackingVolume* packVolumeTriple
ATLAS_NOT_THREAD_SAFE(const std::vector<const Trk::Layer*>& negLayers,
const std::vector<const Trk::Layer*>& centralLayers,
const std::vector<const Trk::Layer*>& posLayers,
double rMin,
double rMax,
double zMin,
double zPosCentral,
const std::string& baseName = "UndefinedVolume",
int colorCode = 21,
Trk::BinningType bintype = Trk::arbitrary) const;
/** Private method, creates and packs a triple containing of
* NegEndcap-Barrel-PosEndcap volumes */
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE(
const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName = "UndefinedVolume") const;
// helper tools for the geometry building
ToolHandle<Trk::ILayerBuilder> m_beamPipeBuilder; //!< BeamPipe builder (is different from layers)
......
......@@ -24,6 +24,8 @@
#include <vector>
#include <string>
#include "CxxUtils/checker_macros.h"
#ifndef TRKDETDESCR_TAKESMALLERBIGGER
#define TRKDETDESCR_TAKESMALLERBIGGER
#define takeSmaller(current,test) current = current < test ? current : test
......@@ -59,12 +61,12 @@ namespace InDet {
@author Andreas.Salzburger@cern.ch
*/
class RobustTrackingGeometryBuilderCond : public AthAlgTool,
public Trk::TrackingVolumeManipulator,
virtual public Trk::IGeometryBuilderCond {
class RobustTrackingGeometryBuilderCond
: public AthAlgTool
, public Trk::TrackingVolumeManipulator
, virtual public Trk::IGeometryBuilderCond
{
public:
/** Constructor */
RobustTrackingGeometryBuilderCond(const std::string&,const std::string&,const IInterface*);
......@@ -77,29 +79,36 @@ namespace InDet {
/** AlgTool finalize method */
StatusCode finalize();
/** TrackingGeometry Interface methode */
std::pair<EventIDRange, const Trk::TrackingGeometry*> trackingGeometry ATLAS_NOT_THREAD_SAFE (const EventContext& ctx, std::pair<EventIDRange, const Trk::TrackingVolume*> tVolPair) const;
std::pair<EventIDRange, const Trk::TrackingGeometry*> trackingGeometry
ATLAS_NOT_THREAD_SAFE(
const EventContext& ctx,
std::pair<EventIDRange, const Trk::TrackingVolume*> tVolPair) const;
/** The unique signature */
Trk::GeometrySignature geometrySignature() const { return Trk::ID; }
private:
/** Private method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap layers */
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE
(const std::vector<const Trk::Layer*>& negLayers,
const std::vector<const Trk::Layer*>& centralLayers,
const std::vector<const Trk::Layer*>& posLayers,
double rMin, double rMax,
double zMin, double zPosCentral,
const std::string& baseName="UndefinedVolume",
int colorCode = 21,
Trk::BinningType bintype=Trk::arbitrary) const;
/** Private method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap volumes */
const Trk::TrackingVolume* packVolumeTriple(const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName="UndefinedVolume") const;
/** Private method, creates and packs a triple containing of
* NegEndcap-Barrel-PosEndcap layers */
const Trk::TrackingVolume* packVolumeTriple
ATLAS_NOT_THREAD_SAFE(const std::vector<const Trk::Layer*>& negLayers,
const std::vector<const Trk::Layer*>& centralLayers,
const std::vector<const Trk::Layer*>& posLayers,
double rMin,
double rMax,
double zMin,
double zPosCentral,
const std::string& baseName = "UndefinedVolume",
int colorCode = 21,
Trk::BinningType bintype = Trk::arbitrary) const;
/** Private method, creates and packs a triple containing of
* NegEndcap-Barrel-PosEndcap volumes */
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE(
const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName = "UndefinedVolume") const;
// helper tools for the geometry building
ToolHandle<Trk::ILayerBuilderCond> m_beamPipeBuilder; //!< BeamPipe builder (is different from layers)
......
......@@ -162,37 +162,49 @@ namespace InDet {
/** Private helper method to check if a sector is compatible with the cache */
bool setupFitsCache(LayerSetup& layerSetup, std::vector<InDet::LayerSetup>& layerSetupCache) const;
/** Private helper method to flush the cache into the id volumes - return volume is the one to be provided */
const Trk::TrackingVolume* createFlushVolume ATLAS_NOT_THREAD_SAFE
(std::vector<InDet::LayerSetup>& layerSetupCache,
double innerRadius, double& outerRadius, double extendZ) const;
/** Private helper method, creates a TrackingVolume - and checks if configured - for Ring Layout
- in case a ring layout is given, it creates the corresponding sub-volumes and updates the radius
/** Private helper method to flush the cache into the id volumes - return
* volume is the one to be provided */
const Trk::TrackingVolume* createFlushVolume
ATLAS_NOT_THREAD_SAFE(std::vector<InDet::LayerSetup>& layerSetupCache,
double innerRadius,
double& outerRadius,
double extendZ) const;
/** Private helper method, creates a TrackingVolume - and checks if
configured - for Ring Layout
- in case a ring layout is given, it creates the corresponding
sub-volumes and updates the radius
*/
const Trk::TrackingVolume* createTrackingVolume(const std::vector<const Trk::Layer*>& layers,
double innerRadius, double& outerRadius,
double zMin, double zMax,
const std::string& volumeName,
Trk::BinningType btype,
bool doAdjustOuterRadius = true) const;
/** Private helper method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap layers
- in case of a ring layout the subvolumes are created and the rMax is adapted
const Trk::TrackingVolume* createTrackingVolume
ATLAS_NOT_THREAD_SAFE(const std::vector<const Trk::Layer*>& layers,
double innerRadius,
double& outerRadius,
double zMin,
double zMax,
const std::string& volumeName,
Trk::BinningType btype,
bool doAdjustOuterRadius = true) const;
/** Private helper method, creates and packs a triple containing of
NegEndcap-Barrel-PosEndcap layers
- in case of a ring layout the subvolumes are created and the rMax is
adapted
*/
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE
(const LayerSetup& layerSetup,
double rMin, double& rMax,
double zMin, double zPosCentral) const;
const Trk::TrackingVolume* packVolumeTriple
ATLAS_NOT_THREAD_SAFE(const LayerSetup& layerSetup,
double rMin,
double& rMax,
double zMin,
double zPosCentral) const;
/** Private helper method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap volumes */
const Trk::TrackingVolume* packVolumeTriple(const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName="UndefinedVolume") const;
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE(
const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName = "UndefinedVolume") const;
/** Private helper method for detection of Ring layout */
bool ringLayout(const std::vector<const Trk::Layer*>& layers, std::vector<double>& rmins, std::vector<double>& rmaxs) const;
......
......@@ -26,6 +26,8 @@
#include <vector>
#include <string>
#include "CxxUtils/checker_macros.h"
#ifndef TRKDETDESCR_TAKESMALLERBIGGER
#define TRKDETDESCR_TAKESMALLERBIGGER
#define takeSmaller(current,test) current = current < test ? current : test
......@@ -145,7 +147,10 @@ namespace InDet {
/** AlgTool finalize method */
StatusCode finalize();
/** TrackingGeometry Interface methode */
std::pair<EventIDRange, const Trk::TrackingGeometry*> trackingGeometry ATLAS_NOT_THREAD_SAFE (const EventContext& ctx, std::pair<EventIDRange, const Trk::TrackingVolume*> tVolPair) const;
std::pair<EventIDRange, const Trk::TrackingGeometry*> trackingGeometry
ATLAS_NOT_THREAD_SAFE(
const EventContext& ctx,
std::pair<EventIDRange, const Trk::TrackingVolume*> tVolPair) const;
/** The unique signature */
Trk::GeometrySignature geometrySignature() const { return Trk::ID; }
......@@ -164,23 +169,30 @@ namespace InDet {
/** Private helper method to check if a sector is compatible with the cache */
bool setupFitsCache(LayerSetup& layerSetup, std::vector<InDet::LayerSetup>& layerSetupCache) const;
/** Private helper method to flush the cache into the id volumes - return volume is the one to be provided */
const Trk::TrackingVolume* createFlushVolume ATLAS_NOT_THREAD_SAFE
(std::vector<InDet::LayerSetup>& layerSetupCache,
double innerRadius, double& outerRadius, double extendZ) const;
/** Private helper method, creates a TrackingVolume - and checks if configured - for Ring Layout
- in case a ring layout is given, it creates the corresponding sub-volumes and updates the radius
/** Private helper method to flush the cache into the id volumes - return
* volume is the one to be provided */
const Trk::TrackingVolume* createFlushVolume
ATLAS_NOT_THREAD_SAFE(std::vector<InDet::LayerSetup>& layerSetupCache,
double innerRadius,
double& outerRadius,
double extendZ) const;
/** Private helper method, creates a TrackingVolume - and checks if
configured - for Ring Layout
- in case a ring layout is given, it creates the corresponding
sub-volumes and updates the radius
*/
const Trk::TrackingVolume* createTrackingVolume(const std::vector<const Trk::Layer*>& layers,
double innerRadius, double& outerRadius,
double zMin, double zMax,
const std::string& volumeName,
Trk::BinningType btype,
bool doAdjustOuterRadius = true) const;
const Trk::TrackingVolume* createTrackingVolume
ATLAS_NOT_THREAD_SAFE(const std::vector<const Trk::Layer*>& layers,
double innerRadius,
double& outerRadius,
double zMin,
double zMax,
const std::string& volumeName,
Trk::BinningType btype,
bool doAdjustOuterRadius = true) const;
/** Private helper method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap layers
- in case of a ring layout the subvolumes are created and the rMax is adapted
*/
......@@ -190,11 +202,12 @@ namespace InDet {
double zMin, double zPosCentral) const;
/** Private helper method, creates and packs a triple containing of NegEndcap-Barrel-PosEndcap volumes */
const Trk::TrackingVolume* packVolumeTriple(const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName="UndefinedVolume") const;
const Trk::TrackingVolume* packVolumeTriple ATLAS_NOT_THREAD_SAFE(
const std::vector<const Trk::TrackingVolume*>& negVolumes,
const std::vector<const Trk::TrackingVolume*>& centralVolumes,
const std::vector<const Trk::TrackingVolume*>& posVolumes,
const std::string& baseName = "UndefinedVolume") const;
/** Private helper method for detection of Ring layout */
bool ringLayout(const std::vector<const Trk::Layer*>& layers, std::vector<double>& rmins, std::vector<double>& rmaxs) const;
......
......@@ -5,70 +5,24 @@
#ifndef MUONCABLINGTOOLS_LVL1OBJECT_H
#define MUONCABLINGTOOLS_LVL1OBJECT_H
#define DISP \
{ \
__osstream display; \
display
#define DISP_DEBUG \
display_debug(display); \
}
#define DISP_VERBOSE \
display_verbose(display); \
}
#define DISP_ERROR \
display_error(display); \
}
#define DISP_WARNING \
display_warning(display); \
}
#define DISP_INFO \
display_info(display); \
}
#include <functional>
#include <iostream>
#include <string>
#include "MuonCablingTools/OutputDef.h"
#include "GaudiKernel/Bootstrap.h"
#include "GaudiKernel/IMessageSvc.h"
#include "GaudiKernel/ISvcLocator.h"
#include "GaudiKernel/MsgStream.h"
enum ObjectType { Logic, Data, Hardware, Monitoring };
class BaseObject {
private:
ObjectType m_tag;
std::string m_name{};
IMessageSvc* m_msgSvc{nullptr};
std::unique_ptr<MsgStream> m_message{};
void dump_message(__osstream& sstr, MSG::Level) const;
std::string m_name;
public:
BaseObject(ObjectType, const std::string&, IMessageSvc* msgSvc = nullptr);
BaseObject& operator=(const BaseObject&);
BaseObject(const BaseObject&);
BaseObject(ObjectType, const std::string&);
virtual ~BaseObject() = default;
ObjectType tag() const;
std::string name() const;
bool msgLevel(MSG::Level lvl) const;
ObjectType tag() const { return m_tag; }
std::string name() const { return m_name; }
virtual void Print(std::ostream&, bool) const {}
void display_warning(__osstream&) const;
void display_info(__osstream&) const;
void display_error(__osstream&) const;
void display_debug(__osstream&) const;
void display_verbose(__osstream&) const;
};
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MUONCABLINGTOOLS_OUTPUTDEF_H
#define MUONCABLINGTOOLS_OUTPUTDEF_H
#include <sstream>
typedef std::ostringstream __osstream;
#define COUNT str().size()
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
// INTRODUCTION
......@@ -264,8 +264,6 @@
#include <sstream>
#include <string>
#include <typeinfo>
typedef std::ostringstream __osstream;
typedef std::istringstream __isstream;
typedef enum result_extraction { not_extracted, extracted } DBstatus;
......
......@@ -4,66 +4,7 @@
#include "MuonCablingTools/BaseObject.h"
namespace {
std::string to_string(MSG::Level lvl) {
if (lvl == MSG::VERBOSE) return "VEBOSE";
if (lvl == MSG::DEBUG) return "DEBUG";
if (lvl == MSG::INFO) return "INFO";
if (lvl == MSG::WARNING) return "WARNING";
if (lvl == MSG::ERROR) return "ERROR";
if (lvl == MSG::FATAL) return "FATAL";
return "UNKNOWN";
}
} // namespace
ObjectType BaseObject::tag() const { return m_tag; }
std::string BaseObject::name() const { return m_name; }
void BaseObject::dump_message(__osstream& display, MSG::Level lvl) const {
if (m_message) {
(*m_message) << lvl << display.str() << endmsg;
} else {
std::cout << to_string(lvl) << display.str() << std::endl;
}
}
bool BaseObject::msgLevel(MSG::Level lvl) const {
if (m_message) return m_message->level() >= lvl;
return false;
BaseObject::BaseObject(ObjectType tag, const std::string& obj_name) :
m_tag{tag},
m_name{obj_name} {
}
BaseObject::BaseObject(ObjectType tag, const std::string& obj_name, IMessageSvc* msgSvc) : m_tag{tag}, m_name{obj_name}, m_msgSvc{msgSvc} {
/// To be fixed in a follow up MR
if (false && !msgSvc) {
ISvcLocator* svcLocator = Gaudi::svcLocator();
StatusCode sc = svcLocator->service("MessageSvc", msgSvc);
if (sc.isFailure()) { std::cout << "Can't locate the MessageSvc" << std::endl; }
}
m_message = std::make_unique<MsgStream>(msgSvc, obj_name);
}
BaseObject::BaseObject(const BaseObject& obj) {
m_tag = obj.tag();
m_name = obj.name();
m_msgSvc = obj.m_msgSvc;
if (m_msgSvc) { m_message = std::make_unique<MsgStream>(m_msgSvc, m_name); }
}
BaseObject& BaseObject::operator=(const BaseObject& obj) {
if (this != &obj) {
m_tag = obj.m_tag;
m_name = obj.m_name;
m_msgSvc = obj.m_msgSvc;
if (m_msgSvc)
m_message = std::make_unique<MsgStream>(m_msgSvc, m_name);
else
m_message.reset();
}
return *this;
}
void BaseObject::display_error(__osstream& display) const { dump_message(display, MSG::ERROR); }
void BaseObject::display_debug(__osstream& display) const { dump_message(display, MSG::DEBUG); }
void BaseObject::display_warning(__osstream& display) const { dump_message(display, MSG::WARNING); }
void BaseObject::display_info(__osstream& display) const { dump_message(display, MSG::INFO); }
void BaseObject::display_verbose(__osstream& display) const { dump_message(display, MSG::VERBOSE); }
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "MuonCablingTools/dbline.h"
......@@ -212,7 +212,7 @@ template <class type> DBline& DBline::token(const std::string& str, type t) {
std::string new_token = str;
unsigned long int pos = new_token.find('#');
if (pos != std::string::npos) {
__osstream tmp;
std::ostringstream tmp;
tmp << t;
std::string rep = tmp.str();
......@@ -228,7 +228,7 @@ template <class type> DBline& DBline::token(const std::string& str, type t, int
std::string new_token = str;
unsigned long int pos = new_token.find('#');
if (pos != std::string::npos) {