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

merge with -00-01-32-branch (ISF_FatrasServices-00-02-03)

parent 57398937
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// FatrasSimSvc.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef ISF_FATRASSIMSVC_H
#define ISF_FATRASSIMSVC_H 1
// STL includes
#include <string>
// FrameWork includes
#include "GaudiKernel/ServiceHandle.h"
#include "GaudiKernel/ToolHandle.h"
#include "AthenaBaseComps/AthService.h"
// ISF includes
#include "ISF_Interfaces/BaseSimulationSvc.h"
// DetectorDescription
#include "AtlasDetDescr/AtlasRegion.h"
// Tracking includes
#include "TrkTrack/TrackCollection.h"
namespace ISF {
class IParticleFilter;
class ISFParticle;
class ITruthSvc;
}
namespace iFatras {
class ITransportTool;
/** @class FatrasSimSvc
@author Andreas.Salzburger -at- cern.ch
*/
class FatrasSimSvc : public ISF::BaseSimulationSvc {
public:
//** Constructor with parameters */
FatrasSimSvc( const std::string& name, ISvcLocator* pSvcLocator );
/** Destructor */
virtual ~FatrasSimSvc();
/** Athena algorithm's interface methods */
StatusCode initialize();
StatusCode finalize();
/** Simulation Call */
StatusCode simulate(const ISF::ISFParticle& isp);
/** Setup Event chain - in case of a begin-of event action is needed */
StatusCode setupEvent();
/** Release Event chain - in case of an end-of event action is needed */
StatusCode releaseEvent();
private:
/** Default constructor */
FatrasSimSvc();
/** Track Creation & transport */
ToolHandle<iFatras::ITransportTool> m_simulationTool; //!< Pointer to the transport AlgTool
ToolHandle<ISF::IParticleFilter> m_particleFilter; //!< the particle filter concerning kinematic cuts, etc.
};
}
#endif //> !ISF_FatrasSimSvc_H
package ISF_FatrasServices
manager Andreas Salzburger <Andreas.Salzburger@cern.ch>
manager Elmar Ritsch <Elmar.Ritsch@cern.ch>
manager Wolfgang Lukas <Wolfgang.Lukas@cern.ch>
#################################################################
# public use statements
use AtlasPolicy AtlasPolicy-*
use GaudiInterface GaudiInterface-* External
use AthenaBaseComps AthenaBaseComps-* Control
use ISF_Interfaces ISF_Interfaces-* Simulation/ISF/ISF_Core
use TrkTrack TrkTrack-* Tracking/TrkEvent
use AtlasDetDescr AtlasDetDescr-* DetectorDescription
#################################################################
# private use statements
private
use StoreGate StoreGate-* Control
use ISF_FatrasInterfaces ISF_FatrasInterfaces-* Simulation/ISF/ISF_Fatras
use ISF_Event ISF_Event-* Simulation/ISF/ISF_Core
public
library ISF_FatrasServices *.cxx components/*.cxx
apply_pattern component_library
apply_pattern declare_python_modules files="*.py"
# use the following to compile with debug information
#private
#macro cppdebugflags '$(cppdebugflags_s)'
#macro_remove componentshr_linkopts "-Wl,-s"
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#
## @file FatrasExample/python/FatrasPhysicsList.py
## @purpose Python module to hold common flags to configure JobOptions
##
""" FatrasPhysicsList
Python module to hold storegate keys of InDet objects.
"""
__author__ = "A. Salzburger"
__version__= "$Revision: 476468 $"
__doc__ = "FatrasPhysicsList"
__all__ = [ "FatrasPhysicsList" ]
# kindly stolen from AthenaCommonFlags from S. Binet and M. Gallas
##-----------------------------------------------------------------------------
## Import
from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
from AthenaCommon.JobProperties import jobproperties
##-----------------------------------------------------------------------------
## 1st step: define JobProperty classes
class MultipleScattering(JobProperty):
"""Steering of multiple scattering in simulation/reconstruction"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
class EnergyLoss(JobProperty):
"""Steering of energy loss (ionisation) in simulation/reconstruction"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
class Bremsstrahlung(JobProperty):
"""Steering of energy loss (radiative) in simulation"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
class PairProduction(JobProperty):
"""Steering of pair production in simulation"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
class HadronicInteraction(JobProperty):
"""Steering of nuclear (hadronic) interactions in simulation"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
class ParticleDecay(JobProperty):
"""Steering of particle decay in simulation"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
##-----------------------------------------------------------------------------
## 2nd step
## Definition of the InDet flag container
class FatrasPhysicsList(JobPropertyContainer):
"""Container for the Fatras physics list flags
"""
pass
##-----------------------------------------------------------------------------
## 3rd step
## adding the container to the general top-level container
jobproperties.add_Container(FatrasPhysicsList)
##-----------------------------------------------------------------------------
## 4th step
## adding ID flags to the InDetKeys container
jobproperties.FatrasPhysicsList.add_JobProperty(MultipleScattering)
jobproperties.FatrasPhysicsList.add_JobProperty(EnergyLoss)
jobproperties.FatrasPhysicsList.add_JobProperty(Bremsstrahlung)
jobproperties.FatrasPhysicsList.add_JobProperty(PairProduction)
jobproperties.FatrasPhysicsList.add_JobProperty(HadronicInteraction)
jobproperties.FatrasPhysicsList.add_JobProperty(ParticleDecay)
##-----------------------------------------------------------------------------
## 5th step
## short-cut for lazy people
## carefull: do not select FatrasPhysicsList as a short name as well.
## otherwise problems with pickle
## Note: you still have to import it:
## >>> from FatrasExample.FatrasPhysicsList import FatrasPhysicsListFlags
FatrasPhysicsListFlags = jobproperties.FatrasPhysicsList
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
class FatrasTrackingGeometrySvc:
def __init__(self):
from AthenaCommon.Include import include
from AthenaCommon.AppMgr import ToolSvc
##################################################################################
# The FatrasTrackingGeometry Svc fragment
#
# usage:
# include('TrkDetDescrSvc/FatrasTrackingGeometrySvc.py')
#
# + for the navigator, set the TrackingGeometryName to:
# FatrasTrackingGeometrySvc.trackingGeometryName()
#
##################################################################################
# import the DetFlags for the setting
from AthenaCommon.DetFlags import DetFlags
#################################################################################
# Material for the Geometry
#
# if only ID is switched on different COOLDB Folders
# and different Tag is used
#
#################################################################################
from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
if TrkDetFlags.ConfigurationOutputLevel() < 3 :
print '[ Configuration : start ] *** FatrasTrackingGeometry ********************************'
print '[ TrackingGeometrySvc ]'
# check whether the material retrieval is ment to be from COOL
if TrkDetFlags.MaterialFromCool() :
# the tag names
CoolDataBaseFolder = TrkDetFlags.MaterialStoreGateKey()
AtlasMaterialTag = TrkDetFlags.MaterialTagBase()+str(TrkDetFlags.MaterialVersion())+'_'
if TrkDetFlags.ConfigurationOutputLevel() < 3 :
print '[ TrackingGeometrySvc ] Associating DB folder : ',CoolDataBaseFolder
print '[ TrackingGeometrySvc ] base material tag : ',AtlasMaterialTag
# we need the conditions interface
from IOVDbSvc.CondDB import conddb
# use a local database
if TrkDetFlags.MaterialDatabaseLocal():
# specify the local database
DataBasePath = TrkDetFlags.MaterialDatabaseLocalPath()
DataBaseName = TrkDetFlags.MaterialDatabaseLocalName()
MagicTag = TrkDetFlags.MaterialMagicTag()
DataBaseConnection = '<dbConnection>sqlite://X;schema='+DataBasePath+DataBaseName+';dbname=OFLP200</dbConnection>'
conddb.blockFolder('/GLOBAL/TrackingGeo/LayerMaterial')
conddb.addFolderWithTag('',DataBaseConnection+CoolDataBaseFolder,AtlasMaterialTag+MagicTag,force=True)
if TrkDetFlags.ConfigurationOutputLevel() < 3 :
print '[ TrackingGeometrySvc ] Using Local Database: '+DataBaseConnection
# make sure that the pool files are in the catalog
#from PoolSvc.PoolSvcConf import PoolSvc
#PoolSvc.ReadCatalog += [ DataBasePath+'PoolFileCatalog.xml' ]
elif TrkDetFlags.SLHC_Geometry() :
# set the folder to the SLHC location
CoolDataBaseFolder = '/GLOBAL/TrackingGeo/SLHC_LayerMaterial'
ctag = AtlasMaterialTag+TrkDetFlags.MaterialMagicTag()
cfoldertag = CoolDataBaseFolder+' <tag>'+ctag+'</tag>'
conddb.addFolderSplitMC('GLOBAL',cfoldertag,cfoldertag)
else :
# load the right folders (preparation for calo inclusion)
cfolder = CoolDataBaseFolder +'<tag>TagInfoMajor/'+AtlasMaterialTag+'/GeoAtlas</tag>'
conddb.addFolderSplitMC('GLOBAL',cfolder,cfolder)
#################################################################################
# The Geometry Builder
#################################################################################
# the name to register the Geometry
FatrasTrackingGeometryName = 'FatrasTrackingGeometry'
# the geometry builder alg tool
from TrkDetDescrTools.TrkDetDescrToolsConf import Trk__GeometryBuilder
FatrasGeometryBuilder = Trk__GeometryBuilder(name = 'FatrasGeometryBuilder')
# switch on the Detectors
FatrasGeometryBuilder.InDetTrackingGeometry = DetFlags.ID_on()
FatrasGeometryBuilder.CaloTrackingGeometry = DetFlags.Calo_on()
FatrasGeometryBuilder.MuonTrackingGeometry = DetFlags.Muon_on() # avoid double building of MTG
# register it to tool svc
ToolSvc += FatrasGeometryBuilder
# (ID)
if DetFlags.ID_on() :
# get hand on the ID Tracking Geometry Builder
if not TrkDetFlags.SLHC_Geometry() :
from InDetTrackingGeometry.ConfiguredInDetTrackingGeometryBuilder import ConfiguredInDetTrackingGeometryBuilder as IDGeometryBuilder
else :
from InDetTrackingGeometry.ConfiguredSLHC_InDetTrackingGeometryBuilder import ConfiguredSLHC_InDetTrackingGeometryBuilder as IDGeometryBuilder
if not TrkDetFlags.SLHC_Geometry() :
self.__InDetTrackingGeometryBuilder__ = IDGeometryBuilder(name ='InDetTrackingGeometryBuilder',
namePrefix = 'Fatras',
setLayerAssociation = False,
buildTrtStrawLayers = True)
self.__InDetTrackingGeometryBuilder__.VolumeEnclosureOuterR = 1148.
else :
self.__InDetTrackingGeometryBuilder__ = IDGeometryBuilder(name ='InDetTrackingGeometryBuilder',
namePrefix = 'Fatras',
setLayerAssociation = False)
self.__InDetTrackingGeometryBuilder__.VolumeEnclosureOuterR = 1148.
# make a public tool out of it
ToolSvc += self.__InDetTrackingGeometryBuilder__
# and give it to the Geometry Builder
FatrasGeometryBuilder.InDetTrackingGeometryBuilder = self.__InDetTrackingGeometryBuilder__
#
# (Calo)
if DetFlags.Calo_on():
from CaloTrackingGeometry.ConfiguredCaloTrackingGeometryBuilder import ConfiguredCaloTrackingGeometryBuilder as ConfiguredCaloGeo
CaloTrackingGeometryBuilder = ConfiguredCaloGeo(name = 'FatrasCaloTrackingGeometryBuilder')
CaloTrackingGeometryBuilder.RecordLayerIndexCaloSampleMap = True
# make a publid tool
ToolSvc += CaloTrackingGeometryBuilder
# and give it to the Geometry Builder
FatrasGeometryBuilder.CaloTrackingGeometryBuilder = CaloTrackingGeometryBuilder
# (Muon)
if DetFlags.Muon_on():
from MuonTrackingGeometry.ConfiguredMuonTrackingGeometry import MuonTrackingGeometryBuilder
FatrasMuonTrackingGeometryBuilder = MuonTrackingGeometryBuilder(name = 'FatrasMuonTrackingGeometryBuilder')
FatrasMuonTrackingGeometryBuilder.BarrelZ = 6783.
FatrasMuonTrackingGeometryBuilder.InnerBarrelRadius = 4255.
ToolSvc += FatrasMuonTrackingGeometryBuilder
# and give it to the Geometry Builder
FatrasGeometryBuilder.MuonTrackingGeometryBuilder = FatrasMuonTrackingGeometryBuilder
# then get the tuning parameters
from FatrasExample.FatrasTuning import FatrasTuningFlags
if FatrasTuningFlags.MaterialDistortionsX0.statusOn and \
FatrasTuningFlags.MaterialDistortionsRho.statusOn :
from TrkDetDescrSvc.TrkDetDescrSvcConf import CalibrationTrackingGeometrySvc as GeometrySvc
else :
from TrkDetDescrSvc.TrkDetDescrSvcConf import TrackingGeometrySvc as GeometrySvc
FatrasTrackingGeometrySvc = GeometrySvc(name = 'FatrasTrackingGeometrySvc')
# register the Builder
FatrasTrackingGeometrySvc.GeometryBuilder = FatrasGeometryBuilder
# and register the name under which the geometry is registered
FatrasTrackingGeometrySvc.TrackingGeometryName = FatrasTrackingGeometryName
# global scaling of the material if necessary
FatrasTrackingGeometrySvc.GlobalScaleFactor = FatrasTuningFlags.MaterialScalor()
# some flags - only works when ID is on
FatrasTrackingGeometrySvc.AssignMaterialFromCOOL = True
FatrasTrackingGeometrySvc.BuildGeometryFromTagInfo = True
# Material scaling & distortion
if FatrasTuningFlags.MaterialDistortionsX0.statusOn and \
FatrasTuningFlags.MaterialDistortionsRho.statusOn :
FatrasTrackingGeometrySvc.RandomDistortions = True
FatrasTrackingGeometrySvc.DistortionsRadiationLength = FatrasTuningFlags.MaterialDistortionsX0()
FatrasTrackingGeometrySvc.DistortionsDensity = FatrasTuningFlags.MaterialDistortionsRho()
from FatrasExample.FatrasValidation import FatrasValidationFlags
FatrasTrackingGeometrySvc.RecordDistortions = FatrasValidationFlags.MaterialDistortions()
FatrasTrackingGeometrySvc.DistortionOutputFolder = '/'+FatrasValidationFlags.ValidationStream()+'/MaterialDistortions'
# switch to the rigth CoolDB folder
FatrasTrackingGeometrySvc.InputLayerMaterialSetName = CoolDataBaseFolder
from AthenaCommon.AppMgr import ServiceMgr as svcMgr
svcMgr += FatrasTrackingGeometrySvc
print '* [ Configuration : start ] *** FatrasTrackingGeometry ********************************'
print '* [ FatrasTrackingGeometrySvc ]'
print FatrasTrackingGeometrySvc
print '* [ GeometryBuilder ]'
print FatrasGeometryBuilder
print '* [ Configuration : end ] *** FatrasTrackingGeometry ********************************'
##################################################################################
self.__geoSvc__ = FatrasTrackingGeometrySvc
def getGeoSvc(self):
return self.__geoSvc__
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#
## @file FatrasExample/python/FatrasTuning.py
## @purpose Python module to hold common flags to configure JobOptions
##
""" FatrasKeys
Python module to hold storegate keys of InDet objects.
"""
__author__ = "A. Salzburger"
__version__= "$Revision: 578960 $"
__doc__ = "FatrasTuning"
__all__ = [ "FatrasTuning" ]
# kindly stolen from AthenaCommonFlags from S. Binet and M. Gallas
##-----------------------------------------------------------------------------
## Import
from AthenaCommon.JobProperties import JobProperty, JobPropertyContainer
from AthenaCommon.JobProperties import jobproperties
##-----------------------------------------------------------------------------
## 1st step: define JobProperty classes
class MinimumParticlePtPrimaryTrackCreation(JobProperty):
"""do not simulate primary tracks below this momentum"""
statusOn = True
allowedTypes = ['float']
StoredValue = 250.
class MinimumMuonPtTrackCreation(JobProperty):
"""Kill the particle when it falls underneath this threshold"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1000.
class MinimumParticleMomentum(JobProperty):
"""Kill the particle when it falls underneath this threshold"""
statusOn = True
allowedTypes = ['float']
StoredValue = 50.
class MinimumBremPhotonMomentum(JobProperty):
"""Follow the photon if it is over threshold"""
statusOn = True
allowedTypes = ['float']
StoredValue = 150.
# Conversion Creation:
class InteractionVolumeRadius(JobProperty):
"""Volume (r) in which brem photons / had int are processed"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1200.
class InteractionVolumeHalfZ(JobProperty):
"""Volume (z) in which brem photons / had int are processed"""
statusOn = True
allowedTypes = ['float']
StoredValue = 4000.
## ============================================================================
## Energy Loss through: Bethe-Heitler distribution
class BetheHeitlerScalor(JobProperty):
"""Scalor to adapt Bethe-Heitler contribution"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1.
## ============================================================================
## Multiple Scattering: Gaussian mixture model
class GaussianMixtureModel(JobProperty):
"""Gaussian mixture model on/off for Multiple Scattering"""
statusOn = True
allowedTypes = ['bool']
StoredValue = True
## ============================================================================
## Conversion Creation:
class ParticleDecayMinChildEnergy(JobProperty):
"""minimum child energy from a conversion"""
statusOn = True
allowedTypes = ['float']
StoredValue = 250.
## ============================================================================
## Conversion Creation:
class ConversionMinChildEnergy(JobProperty):
"""minimum child energy from a conversion"""
statusOn = True
allowedTypes = ['float']
StoredValue = 100.
class ConversionChildEnergyScalor(JobProperty):
"""minimum child energy from a conversion"""
statusOn = True
allowedTypes = ['float']
StoredValue = 2.
# Conversion Creation:
class ConversionProbabilityScalor(JobProperty):
"""Scalor to adapt the conversion probability"""
statusOn = True
allowedTypes = ['float']
StoredValue = 0.98
# Conversion Creation:
class ConversionVolumeRadius(JobProperty):
"""Volume (r) in which conversions are created"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1200.
class ConversionVolumeHalfZ(JobProperty):
"""Volume (z) in which conversions are created"""
statusOn = True
allowedTypes = ['float']
StoredValue = 4000.
## ============================================================================
## Hadronic interactions:
class HadronicInteractionProbabilityScalor(JobProperty):
""" """
statusOn = True
allowedTypes = ['float']
StoredValue = 1.
## Hadronic interactions:
class HadronicInteractionMinMomentumIn(JobProperty):
""" """
statusOn = True
allowedTypes = ['float']
StoredValue = 1000.
## Hadronic interactions:
class HadronicInteractionMinMomentumOut(JobProperty):
"""Volume (z) in which conversions are created"""
statusOn = True
allowedTypes = ['float']
StoredValue = 200.
## ============================================================================
## Noise Levels
class PixNoiseLevel(JobProperty):
"""Pixel overall noise level (fraction of noisy pixels)"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1e-5
class SctNoiseLevel(JobProperty):
"""SCT overall noise level (fraction of noisy strips)"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1e-5
class TrtNoiseLevel(JobProperty):
"""TRT overall noise level (fraction of noisy straws)"""
statusOn = True
allowedTypes = ['float']
StoredValue = 0.02
class TrtMultiHitFlag(JobProperty):
"""Flag how to deal with TRT multiple hits on straw"""
statusOn = True
allowedTypes = ['int']
StoredValue = 1
# Material distortions
class MaterialScalor(JobProperty):
"""efficiencies (vs. eta) for the TRT"""
statusOn = True
allowedTypes = ['float']
StoredValue = 1.00
class MaterialDistortionsX0(JobProperty):
"""efficiencies (vs. eta) for the TRT"""
statusOn = True
allowedTypes = ['float']
StoredValue = 0.02
# Material distortions
class MaterialDistortionsRho(JobProperty):
"""efficiencies (vs. eta) for the TRT"""
statusOn = True
allowedTypes = ['float']
StoredValue = 0.02
class MomCutOffSec(JobProperty):
"""Steering of ISF: common momentum cut-off for secondaries"""
statusOn = True