Commit 988692cf authored by Nicholas Styles's avatar Nicholas Styles Committed by Graeme Stewart
Browse files

fix for TRT PRD flag (InDetRecExample-02-04-23)

parent 8e132484
For details on how to use this package, please look at
- doc/mainpage.h,
- or the autogenerated doxygen documentation
(http://atlas.web.cern.ch/Atlas/GROUPS/SOFTWARE/OO/dist/latest/InstallArea/doc/InDetRecExample/html/ )
package InDetRecExample
private
use AtlasPolicy AtlasPolicy-*
use TestPolicy TestPolicy-*
use AthenaCommon AthenaCommon-* Control
#use AthenaServices AthenaServices-* Control
use AtlasReconstructionRunTime AtlasReconstructionRunTime-*
# --- needed for LCG relational database stuff
use RDBAccessSvc RDBAccessSvc-* Database/AthenaPOOL
# ---
branches run share
apply_pattern declare_joboptions files="*.py"
apply_pattern declare_python_modules files="*.py"
# --- Install run-time files
apply_pattern declare_runtime files="jobOptions.py"
apply_pattern install_xmls
apply_pattern validate_xml
# --- automatic testing upon gmake check
apply_pattern athenarun_test name="InDetRecExampleTesting" pre_script="../test/script_pre_check.sh" options="../share/jobOptions.py" post_script="../test/script_post_check.sh"
#macro InDetRecExample_libraries "libeformat"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage InDetRecExample Package
@author Edward.Moyse@cern.ch, Markus.Elsing@cern.ch
@section InDetRecExampleIntro Introduction
InDetRecExample is the runtime package for running Inner Detector reconstruction and also contains the InnerDetector jobOption fragments that are included in the overall RecExample package. Running the InDetRecExample will only use Inner Detector software and hence is better suited for development of tracking code (being faster and using less memory).
@section InDetRecExampleSetup Setup
To set it please do :
- cd cmt
- make
- cd ../run
@section InDetRecExampleRunning Running
And then to run the Example:
- cd ../run
- athena ../share/jobOptions.py
@section InDetRecExamplejo JobOptions
The main jobOption files are:
- jobOptions.py ... run ID reconstruction from clusterization to particle creation and produce ESD and AOD
- ReadInDet_jobOptions.py ... read the produced ESD or AOD with various possibilities i.e. redo the primary vertex finding. Can also read
bytestrem
- WriteInDetBS_jobOptions.py ... can be used to create ID bytestream filel from RDO
In addition there are some jobOptions Fragments (kept in share/). You should not need to modify these files, but for completeness they are:
- InDetRec_all.py - configures the ID reco to run, included from jobOptions.py.
- InDetRec_jobOptions.py - the main InDetRec fragment. This sets up the various algorithms used in ID reconstruction. This is the
joboptions which is used by RecExCommon
- ConfiguredInDetFlags.py - contains the flags needed to use InDet. Include this file in any top-level jobOptions which use ID. Details of the flags are in the section "InDetFlags"
- ConfiguredInDetCutvalues.py - contains the cut values for the ID pattern (only the main ones)
- ConfiguredInDetKeys.py - contains the StoreGate Keys for ID containers that might be written to ESD/AOD
The setup of the reconstruction itself is split into several InDetRec*.py files.
@section InDetRecExampleJobProperties
Since release 14 InDetRecExample has entirely migrated to JobProperties (ConfiguredInDetCutValues.py is a small exception where it is questionable if
it should be jobproperties). There two kind of jobproperties, both are in the python subdirectory:
- InDetJobProperties.py ... holds the steering flags for ID reconstruction
- InDetKeys.py ... holds storegate keys for our containers
In addition - for convenience - there are still some pure python flags in the top level job options of the package. Notice that these should only be
used to e.g. ease the steering in the top level job options and to setup up some jobproperty stuff. They should never appear in joboptions below the
top level runtime scripts.
Some flags are:
- doTruth : controls whether the various truth algorithms are run (default is TRUE)
- doJiveXML : if true, produce an atlantis data file for each of the events (default is FALSE)
- doVP1: run the 3D event visualization
The following control what is written out. ESD includes AOD, so it's normally enough
- doWriteESD (default is TRUE)
- doWriteAOD (default is TRUE)
@section Event Data Model Monitor
In debug the EventDataModelMonitor will run and do instance counting of EDM objects to help flagging memory leaks.
@section InDetRecExampleReq Requirements file
@include requirements
*/
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
class InDetSGDeletionAlg:
def __init__(self, container = "TrackCollection#", key = None):
#
# --- Delete the storegate container of the given type and key
# N.B. Don't delete anything that makes the ESD/AOD
#
if not container.endswith('#'): container += '#'
# --- Do nothing if deletion not configured
from InDetRecExample.InDetJobProperties import InDetFlags
if not InDetFlags.doSGDeletion(): return
if isinstance(key, list):
# Delete all containers in list
for k in key: self.deletionAlg(container, k)
else:
# Delete single container
self.deletionAlg(container, key)
def deletionAlg(self, container, key):
if not isinstance(key, str):
print "InDetSGDeletionAlg: WARNING Key is not a string, ignoring!"
return
from InDetRecExample.InDetJobProperties import InDetFlags
from AthenaCommon import CfgMgr
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
# Call SGDeleteAlg
InDetDelAlg = CfgMgr.SGDeleteAlg(name = "InDetSGDel_" + key)
InDetDelAlg.ToDelete.ItemList = [container + key]
topSequence += InDetDelAlg
if InDetFlags.doPrintConfigurables():
print InDetDelAlg
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# ------------------------------------------------------------------------------------
#
# ----------- Configures secondary vertex finding for V0 or conversions
#
# ------------------------------------------------------------------------------------
class ConfiguredSecVertexFinding:
def __init__(self,
prefix = "",
VertexCuts = None,
TrackParticles = None,
SecVertices = None,
Extrapolator = None,
TrackSummaryTool = None,
MagFieldSvc = None,
printConfig = False):
# get ToolSvc and topSequence
from AthenaCommon.AppMgr import ToolSvc
from AthenaCommon.AlgSequence import AlgSequence
topSequence = AlgSequence()
# get InDetFlags
from InDetRecExample.InDetJobProperties import InDetFlags
#
# --- load vertex fitter
#
from TrkVKalVrtFitter.TrkVKalVrtFitterConf import Trk__TrkVKalVrtFitter
InDetSecVxFitterTool = Trk__TrkVKalVrtFitter(name = prefix+"Fitter",
Extrapolator = Extrapolator,
IterationNumber = VertexCuts.Fitter_IterationNumber(),
MakeExtendedVertex = VertexCuts.Fitter_MakeExtendedVertex(),
FirstMeasuredPoint = VertexCuts.Fitter_FirstMeasuredPoint(),
Robustness = VertexCuts.Fitter_Robustness(),
InputParticleMasses = VertexCuts.Fitter_InputParticleMasses(),
VertexForConstraint = VertexCuts.Fitter_VertexForConstraint(),
CovVrtForConstraint = VertexCuts.Fitter_CovVrtForConstraint(),
FirstMeasuredPointLimit = VertexCuts.FirstMeasuredPointLimit(),
usePhiCnst = VertexCuts.usePhiCnst(),
useThetaCnst = VertexCuts.useThetaCnst())
ToolSvc += InDetSecVxFitterTool
if (printConfig):
print InDetSecVxFitterTool
#
# --- Distance of minimum approach utility
#
from TrkVertexSeedFinderUtils.TrkVertexSeedFinderUtilsConf import Trk__SeedNewtonTrkDistanceFinder
InDetSecVxTrkDistanceFinder = Trk__SeedNewtonTrkDistanceFinder(name = prefix+'TrkDistanceFinder')
ToolSvc += InDetSecVxTrkDistanceFinder
if (printConfig):
print InDetSecVxTrkDistanceFinder
#
# --- Helper Tool
#
from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__ConversionFinderUtils
InDetSecVxHelper = InDet__ConversionFinderUtils(name = prefix+"FinderUtils")
ToolSvc += InDetSecVxHelper
if (printConfig):
print InDetSecVxHelper
#
# --- Track selector tool
#
from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetConversionTrackSelectorTool
InDetSecVxTrackSelector = InDet__InDetConversionTrackSelectorTool(name = prefix+"TrackSelector",
TrackSummaryTool = TrackSummaryTool,
Extrapolator = Extrapolator,
maxSiD0 = VertexCuts.TrkSel_maxSiD0(),
maxTrtD0 = VertexCuts.TrkSel_maxTrtD0(),
maxSiZ0 = VertexCuts.TrkSel_maxSiZ0(),
maxTrtZ0 = VertexCuts.TrkSel_maxTrtZ0(),
minPt = VertexCuts.TrkSel_minPt(),
RatioCut1 = VertexCuts.TrkSel_RatioCut1(),
RatioCut2 = VertexCuts.TrkSel_RatioCut2(),
RatioCut3 = VertexCuts.TrkSel_RatioCut3(),
RatioTRT = VertexCuts.TrkSel_RatioTRT(),
IsConversion = VertexCuts.TrkSel_IsConversion(),
significanceD0_Si= VertexCuts.TrkSel_significanceD0_Si(),
RatioV0 = VertexCuts.TrkSel_RatioV0())
ToolSvc += InDetSecVxTrackSelector
if (printConfig):
print InDetSecVxTrackSelector
#
# Track pairs selector
#
from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__TrackPairsSelector
InDetSecVxTrackPairsSelector = InDet__TrackPairsSelector(name = prefix+"TrackPairsSelector",
ConversionFinderHelperTool = InDetSecVxHelper,
DistanceTool = InDetSecVxTrkDistanceFinder,
MaxFirstHitRadius = VertexCuts.TrkPairSel_MaxFirstHitRadius(),
MaxDistBetweenTracks = VertexCuts.TrkPairSel_MaxDistBetweenTracks(),
MaxEta = VertexCuts.TrkPairSel_MaxEta(),
MaxInitDistance = VertexCuts.TrkPairSel_MaxInitDistance(),
MinTrackAngle = VertexCuts.TrkPairSel_MinTrackAngle())
ToolSvc += InDetSecVxTrackPairsSelector
if (printConfig):
print InDetSecVxTrackPairsSelector
#
# Vertex point estimator
#
from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__VertexPointEstimator
InDetSecVtxPointEstimator = InDet__VertexPointEstimator(name = prefix+"PointEstimator",
MinDeltaR = VertexCuts.VtxPt_MinDeltaR(),
MaxDeltaR = VertexCuts.VtxPt_MaxDeltaR(),
MaxPhi = VertexCuts.VtxPt_MaxPhi())
ToolSvc += InDetSecVtxPointEstimator
if (printConfig):
print InDetSecVtxPointEstimator
#
# Secondary Vertex post selector
#
from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__ConversionPostSelector
InDetSecVtxPostSelector = InDet__ConversionPostSelector(name = prefix+"PostSelector",
MaxChi2Vtx = VertexCuts.SecVtxPost_MaxChi2Vtx(),
MaxInvariantMass = VertexCuts.SecVtxPost_MaxInvariantMass(),
MinFitMomentum = VertexCuts.SecVtxPost_MinFitMomentum(),
MinRadius = VertexCuts.SecVtxPost_MinRadius(),
MinPt = VertexCuts.SecVtxPost_MinPt(),
MaxdR = VertexCuts.SecVtxPost_MaxdR(),
MaxPhiVtxTrk = VertexCuts.SecVtxPost_MaxPhiVtxTrk())
ToolSvc += InDetSecVtxPostSelector
if (printConfig):
print InDetSecVtxPostSelector
#
# Single track secondary vertex tool
#
from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__SingleTrackConversionTool
InDetSingleTrackSecVtx = InDet__SingleTrackConversionTool(name = prefix+"SingleTrackTool",
ConversionFinderHelperTool = InDetSecVxHelper,
TrackSummaryTool = TrackSummaryTool,
Extrapolator = Extrapolator,
MaxBLayerHits = VertexCuts.SingleTrk_MaxBLayerHits(),
MinInitialHitRadius = VertexCuts.SingleTrk_MinInitialHitRadius(),
MinInitialHitRadius_noBlay = VertexCuts.SingleTrk_MinInitialHitRadius_noBlay(),
MinRatioOfHLhits = VertexCuts.SingleTrk_MinRatioOfHLhits())
ToolSvc += InDetSingleTrackSecVtx
if (printConfig):
print InDetSingleTrackSecVtx
#
# conversion finder tool
#
from InDetConversionFinderTools.InDetConversionFinderToolsConf import InDet__InDetConversionFinderTools
InDetSecVtxFinderTool = InDet__InDetConversionFinderTools(name = prefix+"FinderTool",
VertexFitterTool = InDetSecVxFitterTool,
TrackSelectorTool = InDetSecVxTrackSelector,
TrackPairsSelector = InDetSecVxTrackPairsSelector,
ConversionFinderHelperTool = InDetSecVxHelper,
VertexPointEstimator = InDetSecVtxPointEstimator,
PostSelector = InDetSecVtxPostSelector,
SingleTrackConversionTool = InDetSingleTrackSecVtx,
Extrapolator = Extrapolator,
TrackParticleCollection = TrackParticles,
RemoveTrtTracks = VertexCuts.Finder_RemoveTrtTracks(),
IsConversion = VertexCuts.Finder_IsConversion(),
MinDistVtxHit = VertexCuts.Finder_MinDistVtxHit(),
MaxDistVtxHit = VertexCuts.Finder_MaxDistVtxHit(),
MinFlightAngle = VertexCuts.Finder_MinFlightAngle(),
MinInitVtxR = VertexCuts.Finder_MinInitVtxR())
ToolSvc += InDetSecVtxFinderTool
if (printConfig):
print InDetSecVtxFinderTool
# --- remember instances
self.__prefix = prefix
self.__InDetSecVtxFinderTool = InDetSecVtxFinderTool
self.__TrackParticles = TrackParticles
self.__SecVertices = SecVertices
self.__printConfig = printConfig
self.__topSequence = topSequence
def toolInstance(self):
#
# --- return tool for usage in egamma
#
return self.__InDetSecVtxFinderTool
def addAlgorithm(self):
#
# --- add driving algorithm of usage in InDet
#
from InDetConversionFinder.InDetConversionFinderConf import InDet__ConversionFinder
InDetSecVtxFinder = InDet__ConversionFinder(name = self.__prefix+"Finder",
VertexFinderTool = self.__InDetSecVtxFinderTool,
TracksName = self.__TrackParticles,
InDetConversionOutputName = self.__SecVertices)
self.__topSequence += InDetSecVtxFinder
if (self.__printConfig):
print InDetSecVtxFinder
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
##############################################################################
# ConfiguredVertexingCuts class
#
# Python Setup Class for primary vertex reconstruction
#
# Author: Kirill Prokofiev
#
#
# 18-5-2010 Removing the Single collision flag and moving it to InDetFlags
# The single/multiple collision mode is now independent on the general
# numberOfCollisions flag. Update to the head version is made
#
#
# 7-9-2010 General clean up of the configurable file
#
#
import AthenaCommon.SystemOfUnits as Units
class ConfiguredVertexingCuts :
def __init__ (self, mode = "offline"):
self.__mode = mode
self.__extension = ""
#pointer to InDetFlags, don't use them directly
#to allow sharing this code with the trigger
self.__set_indetflags()
from AthenaCommon.GlobalFlags import globalflags
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.BeamFlags import jobproperties
from RecExConfig.RecFlags import rec
#-----------------------------------------------------------------------
#General default cuts, which are modified according to the mode of
# operation selected. These cuts are used ONLY for the pre-selection
# of tracks for the vertex reconstruction.
#
# this is cutLevel = 1
self.__minPT = 400. * Units.MeV
self.__IPd0Max = 10.
self.__IPz0Max = 1000.
self.__z0Max = 1000.
self.__sigIPd0Max = 5.
self.__sigIPz0Max = 10.
self.__d0significanceMax = -1.
self.__z0significanceMax = -1.
self.__etaMax = 9999.
#cluster and track quality cuts
self.__useTrackSummaryInfo = True
self.__nHitBLayer = 0
self.__nHitPix = 1
self.__nHolesPix = 1
self.__nHitBLayerPlusPix = 0
self.__nHitSct = 4
self.__nHitSi = 6
self.__nHitTrt = 0
self.__nHitTrtHighEFractionMax = 1
self.__nHitTrtHighEFractionWithOutliersMax = 1
self.__useSharedHitInfo = False
self.__useTrackQualityInfo = False
self.__fitChi2OnNdfMax = 3.5
self.__TrtMaxEtaAcceptance = 1.9
#cuts ONLY relevant to InDetPriVxFinder + Full or Fast or similar
self.__chi2CutMethod = 2
self.__enableMultipleVertices = True
#-----------------------------------------------------------------------
#End of the default track pre-selection block
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Maximal chi2 per track value to be accepted in the vertex mixture.
# ATTENTION: this cut is ONLY used in InDetPriVxFinder; it has no
# meaning for the other finders and used mostly during the commisionning
# stage
if rec.Commissioning():
self.__maxChi2PerTrack = 15.
else:
self.__maxChi2PerTrack = 5.
#-----------------------------------------------------------------------
#End of the InDetPriVxFinder tuning block
#-----------------------------------------------------------------------
#-----------------------------------------------------------------------
# Fine tuning of the opration mode depending on the machine conditions
# degree of understanding of detector performance.
#
# "Start Up" - to be operated in the beginning of the LHC run when the
# parameters of the beam and detector performance are largely unknown,
# energy and event mutiplicity are bot small.
# Features the use of very low pT and relaxed requirements on the
# impact parameters of the used tracks. The IP cuts are tighten
# if the beam spot information is available.
#
# "No Lumi" Intended for the stable running in the single vertex mode
# using the beam constraint. Features tighter cuts on the impact parameters
# during the pre-selection of tracks. At present time is probably obsolete.
#
# "Pile Up" Intended for the stable running in the pile up conditions
# using the beam constraint. High track multiplicities are supposed.
# Thus the impact parameter cuts are tightened and the pT threschold
# is significantly raised.
if (self.__indetflags.useBeamConstraint()):
self.__IPd0Max = 4.
if (self.__indetflags.doRobustReco()):
self.__nHitPix = 0
if (self.__indetflags.doMinBias()):
self.__minPT = 100. * Units.MeV
#--------------"Hight PileUp mode, setup for 2012 ?"---------------------
# Same Pt cut of 400, higher requirements for the track quality
#
if self.__indetflags.priVtxCutLevel() == 2 :
self.__nHitSi = 9
self.__nHolesPix = 0
#-------------"MinBias running mode"-----------------------------------
# Looser pT cut on input tracks; tighter cut on sigma IP d0
if mode == "LowPt":
self.__minPT = 100. * Units.MeV
self.__sigIPd0Max = 0.9
#-------------"IBL running mode"-----------------------------------
# For the moment, same as above, but just explicitely request the special
# mode for the Fast(or Full)VertexFinder, since it is in the single vertex
# mode anyways
if mode == "IBL":
self.__minPT = 500. * Units.MeV
self.__IPd0Max = 1.
self.__sigIPd0Max = 0.35
self.__sigIPz0Max = 2.5
self.__d0significanceMax = 4.
#cluster and track quality cuts
self.__nHitSct = 5
self.__nHitSi = 7
self.__useTrackQualityInfo = True
#-------------"Heavy Ion running mode"-----------------------------------
# For the moment, same as above, but just explicitely request the special
# mode for the Fast(or Full)VertexFinder, since it is in the single vertex
# mode anyways
if mode == "SLHC":
self.__minPT = 500. * Units.MeV
self.__IPd0Max = 1.
self.__sigIPd0Max = 0.35
self.__sigIPz0Max = 2.5
self.__d0significanceMax = 4.
#cluster and track quality cuts
self.__nHitSct = 5
self.__nHitSi = 7
self.__useTrackQualityInfo = True
#-------------"Heavy Ion running mode"-----------------------------------
# For the moment, same as above, but just explicitely request the special
# mode for the Fast(or Full)VertexFinder, since it is in the single vertex
# mode anyways
if mode == "HeavyIon":
self.__chi2CutMethod = 1
self.__enableMultipleVertices = False
#-------------------------------------------------------------------------
# Return methods for the cut values - the main purpose of this class
#
def mode( self ) :
return self.__mode
def extension( self ) :
return self.__extension
def minPT( self ) :
return self.__minPT
def IPd0Max( self ) :
return self.__IPd0Max
def IPz0Max( self ) :
return self.__IPz0Max
def z0Max( self ) :
return self.__z0Max
def sigIPd0Max( self ) :
return self.__sigIPd0Max
def sigIPz0Max( self ) :
return self.__sigIPz0Max
def d0significanceMax( self ) :
return self.__d0significanceMax
def z0significanceMax( self ) :
return self.__z0significanceMax
def etaMax( self ) :
return self.__etaMax
def useTrackSummaryInfo( self ) :
return self.__useTrackSummaryInfo
def nHitBLayer( self ) :
return self.__nHitBLayer
def nHitPix( self ):
return self.__nHitPix