Exemple #1
0
def getRecTrackParticleNameIfInFile(coll_name):
    return getCollectionNameIfInFile('Rec::TrackParticle', coll_name)


def getRecVertexNameIfInFile(coll_name):
    return getCollectionNameIfInFile('Rec::Vertex', coll_name)


from AthenaCommon.GlobalFlags import globalflags
is_mc = (globalflags.DataSource == 'geant4')

doCreation = ( InDetFlags.doNewTracking() or InDetFlags.doPseudoTracking() or InDetFlags.doLargeD0() or InDetFlags.doR3LargeD0() \
                   or InDetFlags.doLowPtLargeD0() )  and InDetFlags.doParticleCreation()
doConversion = not InDetFlags.doNewTracking()  and not InDetFlags.doPseudoTracking() and not InDetFlags.doLargeD0() and not InDetFlags.doR3LargeD0()\
                    and not InDetFlags.doLowPtLargeD0() and InDetFlags.doParticleConversion()

if doCreation:
    printfunc("Creating xAOD::TrackParticles from Trk::Tracks")
if doConversion:
    printfunc("Converting Rec::TrackParticles to xAOD::TrackParticles")

# Run the xAOD truth builder for PU if needed
if InDetFlags.doSplitReco() and is_mc:
    from xAODTruthCnv.xAODTruthCnvConf import xAODMaker__xAODTruthCnvAlg
    xAODTruthCnvPU = xAODMaker__xAODTruthCnvAlg("xAODTruthCnvPU")
    xAODTruthCnvPU.WriteInTimePileUpTruth = False
    xAODTruthCnvPU.WriteAllPileUpTruth = True
    xAODTruthCnvPU.AODContainerName = "GEN_EVENT_PU"
    xAODTruthCnvPU.xAODTruthEventContainerName = "TruthEvents_PU"  #output
    xAODTruthCnvPU.xAODTruthPileupEventContainerName = "TruthPileupEvents_PU"  #output
from InDetRecExample.InDetJobProperties import InDetFlags
from InDetRecExample.InDetKeys import InDetKeys

doCreation = ( InDetFlags.doNewTracking() or InDetFlags.doPseudoTracking() or InDetFlags.doLargeD0) \
                    and InDetFlags.doParticleCreation()
doConversion = not InDetFlags.doNewTracking()  and not InDetFlags.doPseudoTracking() and not InDetFlags.doLargeD0() \
                    and InDetFlags.doParticleConversion()

if doCreation:
    print "Creating xAOD::TrackParticles from Trk::Tracks"
if doConversion:
    print "Converting Rec::TrackParticles to xAOD::TrackParticles"

_perigee_expression=InDetFlags.perigeeExpression()
# need to tread Vertex specifically because at the time of
# the track particle creation the primary vertex does not yet exist.
# The problem is solved by first creating track particles wrt. the beam line
# and correcting the parameters after the vertex finding.
if _perigee_expression == 'Vertex' :
    _perigee_expression = 'BeamLine'
    

from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool
InDetxAODParticleCreatorTool = Trk__TrackParticleCreatorTool(name = "InDetxAODParticleCreatorTool", 
                                                             Extrapolator            = InDetExtrapolator,
                                                             TrackSummaryTool        = InDetTrackSummaryToolSharedHits,
                                                             BadClusterID            = InDetFlags.pixelClusterBadClusterID(),
                                                             ForceTrackSummaryUpdate = False,
                                                             KeepParameters          = True,
                                                             PerigeeExpression       = _perigee_expression)
from InDetRecExample.InDetJobProperties import InDetFlags
from InDetRecExample.InDetKeys import InDetKeys

doCreation = ( InDetFlags.doNewTracking() or InDetFlags.doPseudoTracking() or InDetFlags.doLargeD0() or InDetFlags.doLowPtLargeD0() or InDetFlags.doDisplacedSoftPion() ) \
                    and InDetFlags.doParticleCreation()
doConversion = not InDetFlags.doNewTracking()  and not InDetFlags.doPseudoTracking() and not InDetFlags.doLargeD0() \
                    and not InDetFlags.doLowPtLargeD0() and not InDetFlags.doDisplacedSoftPion() and InDetFlags.doParticleConversion()

if doCreation:
    print "Creating xAOD::TrackParticles from Trk::Tracks"
if doConversion:
    print "Converting Rec::TrackParticles to xAOD::TrackParticles"

_perigee_expression = InDetFlags.perigeeExpression()
# need to treat Vertex specifically because at the time of
# the track particle creation the primary vertex does not yet exist.
# The problem is solved by first creating track particles wrt. the beam line
# and correcting the parameters after the vertex finding.
if _perigee_expression == 'Vertex':
    _perigee_expression = 'BeamLine'

# Run the xAOD truth builder for PU if needed
if InDetFlags.doSplitReco():
    from xAODTruthCnv.xAODTruthCnvConf import xAODMaker__xAODTruthCnvAlg
    xAODTruthCnvPU = xAODMaker__xAODTruthCnvAlg("xAODTruthCnvPU")
    xAODTruthCnvPU.WriteInTimePileUpTruth = False
    xAODTruthCnvPU.WriteAllPileUpTruth = True
    xAODTruthCnvPU.AODContainerName = "GEN_EVENT_PU"
    xAODTruthCnvPU.xAODTruthEventContainerName = "TruthEvents_PU"  #output
    xAODTruthCnvPU.xAODTruthPileupEventContainerName = "TruthPileupEvents_PU"  #output
    xAODTruthCnvPU.xAODTruthParticleContainerName = "TruthParticles_PU"  #output