Commit de286d34 authored by Sarka Todorova's avatar Sarka Todorova Committed by Graeme Stewart
Browse files

cleanup of memory leaks (LArTrackingGeometry-01-00-13)

parent 97665a51
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// LArVolumeBuilder.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef LARTRACKINGGEOMETRY_LARVOLUMEBUILDER_H
#define LARTRACKINGGEOMETRY_LARVOLUMEBUILDER_H
// Gaudi
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
// Trk
#include "TrkDetDescrInterfaces/ITrackingVolumeBuilder.h"
#include "CaloTrackingGeometry/ICaloSurfaceBuilder.h"
// STL
#include <vector>
class LArDetectorManager;
class CaloDepthTool;
class GeoPVConstLink;
namespace Trk {
class ILayerArrayCreator;
class ITrackingVolumeHelper;
class ITrackingVolumeCreator;
class TrackingVolume;
class Material;
class Volume;
class Layer;
}
namespace LAr {
/** @class LArVolumeBuilder
The LArVolumeBuilder builds the TrackingVolumes for
- LAr Barrel
- LAr Inner Endcap
- LAr Outer Endcap
The HEC and Forward Calorimeter have to be added later when knowing the dimensions
of the Tile Calorimter.
@author Andreas.Salzburger@cern.ch
*/
class LArVolumeBuilder : public AthAlgTool,
virtual public Trk::ITrackingVolumeBuilder {
public:
/** AlgTool style constructor */
LArVolumeBuilder(const std::string&,const std::string&,const IInterface*);
/** Destructor */
virtual ~LArVolumeBuilder();
/** AlgTool initialize method */
StatusCode initialize();
/** AlgTool finalize method */
StatusCode finalize();
/** TrackingVolumeBuilder interface method - returns vector of Volumes */
const std::vector<const Trk::TrackingVolume*>* trackingVolumes() const;
private:
// ------------- private methods -----------------------------------------
void printCheckResult(MsgStream& log, const Trk::TrackingVolume* vol) const;
void printInfo(GeoPVConstLink pv, int gen=-1) const;
void printChildren(GeoPVConstLink pv, int gen, int igen, Amg::Transform3D tr) const;
void throwIntoGarbage(const Trk::Material* mat) const;
/** create the sensitive volumes to associate to the layers **/
Trk::Volume* cylAssociatedVolume(const CaloCell_ID::CaloSample sample,
const double hlenz,
double& radius) const;
Trk::Volume* discAssociatedVolume(const CaloCell_ID::CaloSample sample,
const int side,
const double radmin,
const double radmax,
double& z,
double& depth) const;
/** associates volumes to layers,
defines a sensitive volume around a layer **/
void associateVolumeToPositiveLayer(const std::vector<const Trk::Layer*>,
const std::vector<const Trk::Volume*>) const;
/** associates volumes to layers,
defines a sensitive volume around a layer **/
void associateVolumeToNegativeLayer(const std::vector<const Trk::Layer*>,
const std::vector<const Trk::Volume*>) const;
/** associates cylindrical volumes to layers
defines a sensitive volume around a layer **/
void associateCylVolumeToLayer(const std::vector<const Trk::Layer*> matLayers,
const std::vector<const Trk::Volume*> sensitiveVolumes) const;
// ------------- private members -----------------------------------------
const LArDetectorManager* m_lArMgr; //!< Calo DetDescrMgr
std::string m_lArMgrLocation; //!< Location of the CaloDetDescrMgr
ToolHandle<Trk::ITrackingVolumeHelper> m_lArTrackingVolumeHelper; //!< Helper Tool to create TrackingVolumes
ToolHandle<Trk::ITrackingVolumeCreator> m_trackingVolumeCreator; //!< helper for volume creation
unsigned int m_lArBarrelMaterialBinsRz; //!< the material bins in Rz, barrel
unsigned int m_lArBarrelMaterialBinsPhi; //!< the material bins in Rz, barrel
unsigned int m_lArEndcapMaterialBinsRz; //!< the material bins in Rz, endcap
unsigned int m_lArEndcapMaterialBinsPhi; //!< the material bins in Rz, endcap
unsigned int m_lArEndcapHecMaterialBinsRz; //!< the material bins in Rz, endcap Hec
unsigned int m_lArEndcapHecMaterialBinsPhi; //!< the material bins in Rz, endcap
unsigned int m_lArEndcapFcalMaterialBinsRz; //!< the material bins in Rz, endcap Fcal
unsigned int m_lArEndcapFcalMaterialBinsPhi;//!< the material bins in Rz, endcap
unsigned int m_lArEndcapGapMaterialBinsRz; //!< the material bins in Rz, endcap Gap
unsigned int m_lArEndcapGapMaterialBinsPhi; //!< the material bins in Rz, endcap
bool m_useMeotProvider; //!< steer the meot provider
//std::vector<Trk::IMaterialEffectsOnTrackProvider*> m_meotProviders; //!< drawback of ToolHandle
//ToolHandleArray<Trk::IMaterialEffectsOnTrackProvider> m_materialEffectsOnTrackProviders; //!< MaterialEffectsOnTrackProvider for TrackingVolumes
double m_lArBarrelEnvelope; //!< envelope Cover of the Barrel
double m_lArEndcapEnvelope; //!< envelope Cover of the Endcap
unsigned int m_lArBarrelModelLayers; //!< number of model layers for LAr Barrel
unsigned int m_lArEndcapModelLayers; //!< number of model layers for LAr Endcap
unsigned int m_lArEndcapInnerGapModelLayers; //!< number of model layers for LAr Endcap
unsigned int m_lArFcalModelLayers; //!< number of model layers for the Fcal
unsigned int m_lArHecFcalCoverModelLayers; //!< number of model layers for the Hec (part that covers Fcal)
unsigned int m_lArHecModelLayers; //!< number of model layers for the Hec (part that attaches to LAr EC)
bool m_useCaloSurfBuilder; //!< if true use DetDescr based layering, if false use biequidistant layering
unsigned int m_lArLayersPerRegion; //!< if m_useCaloSurfBuilder == true, number of layers per dead material region or sampling
bool m_useCaloTrackingGeometryBounds;//!< if true use DetDescr based layering, if false use biequidistant layering
ToolHandle<ICaloSurfaceBuilder> m_calosurf; //!< tool required for DetDescr-based layering
mutable std::map<const Trk::Material*, bool> m_materialGarbage;
};
} // end of namespace
inline void LAr::LArVolumeBuilder::throwIntoGarbage(const Trk::Material* mat) const
{ if (mat) m_materialGarbage[mat] = true; }
#endif // CALOTRACKINGGEOMETRY_LARVOLUMEBUILDER_H
package LArTrackingGeometry
author Andreas Salzburger <Andreas.Salzburger@cern.ch>
# public dependencies
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use AthenaBaseComps AthenaBaseComps-* Control
use TrkDetDescrInterfaces TrkDetDescrInterfaces-* Tracking/TrkDetDescr
use CaloTrackingGeometry CaloTrackingGeometry-* Calorimeter
# private dependencies
private
use StoreGate StoreGate-* Control
use GeoPrimitives GeoPrimitives-* DetectorDescription
# the Tracking dependencies :
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use TrkVolumes TrkVolumes-* Tracking/TrkDetDescr
use TrkGeometry TrkGeometry-* Tracking/TrkDetDescr
use TrkDetDescrUtils TrkDetDescrUtils-* Tracking/TrkDetDescr
use TrkDetDescrGeoModelCnv TrkDetDescrGeoModelCnv-* Tracking/TrkDetDescr
use TrkGeometrySurfaces TrkGeometrySurfaces-* Tracking/TrkDetDescr
# the LAr and GeoModel dependencies
use GeoModelKernel GeoModelKernel-* DetectorDescription/GeoModel
use GeoModelUtilities GeoModelUtilities-* DetectorDescription/GeoModel
use LArReadoutGeometry LArReadoutGeometry-* LArCalorimeter/LArGeoModel
#Calo dependencies
use CaloDetDescr CaloDetDescr-* Calorimeter
public
# other dependencies :
library LArTrackingGeometry *.cxx components/*.cxx
apply_pattern component_library
apply_pattern declare_python_modules files="*.py"
private
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage LArTrackingGeometry package
@author Andreas.Salzburger@cern.ch
@section LArTrackingGeometryIntro Introduction
This packge contains a single AthAlgTool, the LArVolumeBuilder that
translates the LArGeometry description into Trk::TrackingVolume objects.
The layer position & dimensions are gathered directly through the GeoModel
description or through the CaloSurfaceProvider that is part of the
CaloTrackingGeometry package.
The material maps are loaded through conditions data service in the
TrackingGeometry building process, steered via a geometry callback.
*/
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
######################################################
# ConfiguredLArVolumeBuilder module
#
# it inherits from LArVolumeBuilder and performs
# standard configuration
#
######################################################
# import the Extrapolator configurable
from LArTrackingGeometry.LArTrackingGeometryConf import LAr__LArVolumeBuilder
# define the class
class ConfiguredLArVolumeBuilder( LAr__LArVolumeBuilder ):
# constructor
def __init__(self,name = 'LArVolumeBuilder'):
#from CaloMaterialEffectsOnTrackProvider.ConfCaloMaterialEffectsOnTrackProvider import ConfCaloMaterialEffectsOnTrackProvider as ConfMEOTP
from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
# import the ToolSvc if necessary
from AthenaCommon.AppMgr import ToolSvc
if 'ToolSvc' not in dir():
ToolSvc = ToolSvc()
meotps = []
#if TrkDetFlags.LArUseMaterialEffectsOnTrackProvider() :
#from CaloMaterialEffectsOnTrackProvider.ConfCaloMaterialEffectsOnTrackProvider import ConfCaloMaterialEffectsOnTrackProvider as ConfMEOTP
#MEOTP = ConfMEOTP('CaloMaterialEffectsOnTrackProvider')
#ToolSvc += MEOTP
#meotps += [ MEOTP ]
# The volume helper
from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__TrackingVolumeHelper
LArTrackingVolumeHelper = Trk__TrackingVolumeHelper(name='TrackingVolumeHelper')
ToolSvc += LArTrackingVolumeHelper
LAr__LArVolumeBuilder.__init__(self,
name,
MaterialEffectsOnTrackProviders = meotps,
UseCaloSurfBuilder = TrkDetFlags.LArUseCaloSurfBuilder(),
TrackingVolumeHelper = LArTrackingVolumeHelper,
BarrelEnvelopeCover = TrkDetFlags.LArBarrelEnvelopeCover(),
EndcapEnvelopeCover = TrkDetFlags.LArEndcapEnvelopeCover(),
BarrelMaterialBinsRz = TrkDetFlags.LArBarrelLayerMaterialBinsRz(),
BarrelMaterialBinsPhi = TrkDetFlags.LArBarrelLayerMaterialBinsPhi(),
EndcapMaterialBinsRz = TrkDetFlags.LArEndcapLayerMaterialBinsRz(),
EndcapMaterialBinsPhi = TrkDetFlags.LArEndcapLayerMaterialBinsPhi(),
EndcapHecMaterialBinsRz = TrkDetFlags.LArEndcapHecLayerMaterialBinsRz(),
EndcapHecMaterialBinsPhi = TrkDetFlags.LArEndcapHecLayerMaterialBinsPhi(),
EndcapFcalMaterialBinsRz = TrkDetFlags.LArEndcapFcalLayerMaterialBinsRz(),
EndcapFcalMaterialBinsPhi = TrkDetFlags.LArEndcapFcalLayerMaterialBinsPhi(),
EndcapGapMaterialBinsRz = TrkDetFlags.LArEndcapGapLayerMaterialBinsRz(),
EndcapGapMaterialBinsPhi = TrkDetFlags.LArEndcapGapLayerMaterialBinsPhi(),
OutputLevel = TrkDetFlags.LArBuildingOutputLevel(),
MagneticFieldMode = TrkDetFlags.MagneticFieldMode())
This diff is collapsed.
#include "GaudiKernel/DeclareFactoryEntries.h"
#include "LArTrackingGeometry/LArVolumeBuilder.h"
using namespace LAr;
DECLARE_TOOL_FACTORY( LArVolumeBuilder )
DECLARE_FACTORY_ENTRIES( LArTrackingGeometry )
{
DECLARE_TOOL( LArVolumeBuilder );
}
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES( LArTrackingGeometry )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment