Пример #1
0
    def __init__(self,
                 extension="",
                 InputTrackCollection=None,
                 InputTrackCollectionTruth=None,
                 VxCandidates=None,
                 TrackParticles=None,
                 TrackParticlesTruth=None):

        # get ToolSvc and topSequence
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        # get InDetFlags
        from InDetRecExample.InDetJobProperties import InDetFlags

        # ------------------------------------------------------------
        #
        #  --- now load primary vertex finder
        #
        # ------------------------------------------------------------

        # For ITK we *do* want vertexing to run on forward tracks, so we don't leave out SLHCForward/VeryForward
        if InDetFlags.doVertexFinding() and not extension == "ForwardTracks":

            if InDetFlags.primaryVertexSetup() == 'DummyVxFinder':
                from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxDummyFinder
                InDetPriVxFinder = InDet__InDetPriVxDummyFinder(
                    name="InDet" + extension + "PriVxDummyFinder",
                    VxCandidatesOutputName=VxCandidates)
            else:

                # the loading of all tools for the primary vertex finding has been moved to InDetRecLoadTools.py
                from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
                InDetPriVxFinder = InDet__InDetPriVxFinder(
                    name="InDet" + extension + "PriVxFinder",
                    VertexFinderTool=InDetPriVxFinderTool,
                    TracksName=InputTrackCollection,
                    VxCandidatesOutputName=VxCandidates,
                    VertexCollectionSortingTool=VertexCollectionSortingTool)

                if InDetFlags.primaryVertexSortingSetup() == 'NoReSorting':
                    InDetPriVxFinder.doVertexSorting = False
                else:
                    InDetPriVxFinder.doVertexSorting = True

            topSequence += InDetPriVxFinder
            if InDetFlags.doPrintConfigurables():
                printfunc(InDetPriVxFinder)
  def __init__(self,
               extension                 = "",
               InputTrackCollection      = None, 
               InputTrackCollectionTruth = None, 
               VxCandidates              = None,
               TrackParticles            = None,
               TrackParticlesTruth       = None):
               
    # get ToolSvc and topSequence
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()
    # get InDetFlags
    from InDetRecExample.InDetJobProperties import InDetFlags

    # ------------------------------------------------------------
    #
    #  --- now load primary vertex finder
    #
    # ------------------------------------------------------------

    # For ITK we *do* want vertexing to run on forward tracks, so we don't leave out SLHCForward/VeryForward
    if InDetFlags.doVertexFinding() and not extension == "ForwardTracks":
    
      if InDetFlags.primaryVertexSetup() == 'DummyVxFinder':
        from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxDummyFinder
        InDetPriVxFinder = InDet__InDetPriVxDummyFinder(name                        = "InDet"+extension+"PriVxDummyFinder",
                                                        VxCandidatesOutputName      = VxCandidates)
      else:

        # the loading of all tools for the primary vertex finding has been moved to InDetRecLoadTools.py
        from InDetPriVxFinder.InDetPriVxFinderConf import InDet__InDetPriVxFinder
        InDetPriVxFinder = InDet__InDetPriVxFinder(name                        = "InDet"+extension+"PriVxFinder",
                                                   VertexFinderTool            = InDetPriVxFinderTool,
                                                   TracksName                  = InputTrackCollection,
                                                   VxCandidatesOutputName      = VxCandidates,
                                                   VertexCollectionSortingTool = VertexCollectionSortingTool,
                                                   InternalEdmFactory          = InDetVxEdmCnv)

        if InDetFlags.primaryVertexSortingSetup() == 'NoReSorting':
          InDetPriVxFinder.doVertexSorting = False
        else:
          InDetPriVxFinder.doVertexSorting = True

      topSequence += InDetPriVxFinder
      if InDetFlags.doPrintConfigurables():
        print InDetPriVxFinder
     def __init__(self, InputTrackCollection = None, InputTrackTruthCollection = None, OutputTrackParticleContainer = None):


         from InDetRecExample.InDetJobProperties import InDetFlags
         from InDetRecExample.InDetKeys import InDetKeys
         #
         # --- get ToolSvc and topSequence
         #
         from AthenaCommon.AppMgr                import ToolSvc
         from AthenaCommon.AlgSequence           import AlgSequence
         topSequence = AlgSequence()

         #Always the same (so far) so can in principle go in InDetRecLoadTools
         from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool
         InDetxAODParticleCreatorTool = Trk__TrackParticleCreatorTool(name = "InDetxAODParticleCreatorTool"+InputTrackCollection, 
                                                                      Extrapolator            = InDetExtrapolator,
                                                                      TrackSummaryTool        = InDetTrackSummaryToolSharedHits,
                                                                      BadClusterID            = InDetFlags.pixelClusterBadClusterID(),
                                                                      ForceTrackSummaryUpdate = False,
                                                                      KeepParameters          = True)

         ToolSvc += InDetxAODParticleCreatorTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetxAODParticleCreatorTool

         from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
         xAODTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg(name = "InDetxAODParticleCreatorAlg"+InputTrackCollection,
                                                                  ConvertTracks = True,
                                                                  ConvertTrackParticles = False,
                                                                  TrackContainerName = InputTrackCollection,
                                                                  xAODContainerName = OutputTrackParticleContainer,
                                                                  xAODTrackParticlesFromTracksContainerName = OutputTrackParticleContainer,
                                                                  TrackParticleCreator = InDetxAODParticleCreatorTool,
                                                                  PrintIDSummaryInfo = True)

         if (InDetFlags.doTruth() and not InputTrackTruthCollection == ''):
             xAODTrackParticleCnvAlg.AddTruthLink = True
             xAODTrackParticleCnvAlg.TrackTruthContainerName = InputTrackTruthCollection
         elif (InDetFlags.doTruth() and InputTrackTruthCollection == ''):
             print "WARNING: ConfiguredxAODTrackParticleCreation - doTruth = True, but no input Truth collection specified!"
         else:
            xAODTrackParticleCnvAlg.AddTruthLink = False

         topSequence += xAODTrackParticleCnvAlg
         if (InDetFlags.doPrintConfigurables()):
            print xAODTrackParticleCnvAlg
Пример #4
0
    def setup(self):
        print 'Initializing InDetJobPhysValProperties with InDetFlags.'
        # THIS METHOD MUST BE THE FIRST TO BE CALLED. DO NOT MOVE IT OR ADD THINGS IN FRONT
        self.setupDefaults()

        # for backward compatibility check whether DBM has been added already
        from InDetRecExample.InDetJobProperties import InDetFlags
        if hasattr(InDetFlags, 'doDBM') and not InDetFlags.doDBM():
            self.checkThenSet(self.doValidateDBMTracks, False)
        print self
Пример #5
0
def InDetTrackFitter(name='InDetTrackFitter', **kwargs):
    from InDetRecExample.InDetJobProperties import InDetFlags
    return {
        'KalmanFitter': KalmanFitter,
        'KalmanDNAFitter': KalmanDNAFitter,
        'ReferenceKalmanFitter': ReferenceKalmanFitter,
        'DistributedKalmanFilter': DistributedKalmanFilter,
        'GlobalChi2Fitter': InDetGlobalChi2Fitter,
        'GaussianSumFilter': GaussianSumFitter
    }[InDetFlags.trackFitterType()](name, **kwargs)
Пример #6
0
def getInDetxAODParticleCreatorTool(prd_to_track_map=None, suffix=""):
    from AthenaCommon.AppMgr import ToolSvc
    if hasattr(ToolSvc, 'InDetxAODParticleCreatorTool' + suffix):
        return getattr(ToolSvc, 'InDetxAODParticleCreatorTool')

    _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'

    from InDetRecExample import TrackingCommon as TrackingCommon
    from InDetRecExample.TrackingCommon import setDefaults
    if prd_to_track_map is None:
        track_summary_tool = TrackingCommon.getInDetTrackSummaryToolSharedHits(
        )
    else:
        prop_args = setDefaults({}, nameSuffix=suffix)
        asso_tool = TrackingCommon.getConstPRD_AssociationTool(
            **setDefaults(prop_args, PRDtoTrackMap=prd_to_track_map))
        helper_tool = TrackingCommon.getInDetSummaryHelperSharedHits(
            **setDefaults(prop_args, AssoTool=asso_tool))
        track_summary_tool = TrackingCommon.getInDetTrackSummaryToolSharedHits(
            **setDefaults(prop_args, InDetSummaryHelperTool=helper_tool))

    from TrkParticleCreator.TrkParticleCreatorConf import Trk__TrackParticleCreatorTool
    InDetxAODParticleCreatorTool = Trk__TrackParticleCreatorTool(
        name="InDetxAODParticleCreatorTool" + suffix,
        Extrapolator=InDetExtrapolator,
        TrackSummaryTool=track_summary_tool,
        BadClusterID=InDetFlags.pixelClusterBadClusterID(),
        KeepParameters=True,
        KeepFirstParameters=InDetFlags.KeepFirstParameters(),
        PerigeeExpression=_perigee_expression)

    ToolSvc += InDetxAODParticleCreatorTool
    if InDetFlags.doPrintConfigurables():
        printfunc(InDetxAODParticleCreatorTool)
    return InDetxAODParticleCreatorTool
Пример #7
0
def createTrackParticles(track_in,
                         track_particle_truth_in,
                         track_particle_out,
                         topSequence,
                         prd_to_track_map=None,
                         suffix=""):
    '''
    create algorithm to convert the input tracks into track xAOD track particles.
    @param track_in the name of the input TrackCollection
    @param track_particle_truth_in optional truth track collection to link to
    @param track_particle_out the name of the output xAOD track particle collection
    @param topSequence the sequence to which the algorithm is added
    @param prd_to_track_map None or if shared hits are to be recomputed a PRDtoTrackMap filled by a preceding
           algorithms e.g. a TrackCollectionMerger.
    @param suffix which makes the names of the particle creator tool and sub-tools unique in case a prd_to_track_map
           is provided.
    '''
    if isValid(track_in) and isValid(track_particle_out):
        from xAODTrackingCnv.xAODTrackingCnvConf import xAODMaker__TrackParticleCnvAlg
        xAODTrackParticleCnvAlg = xAODMaker__TrackParticleCnvAlg(
            track_particle_out)
        xAODTrackParticleCnvAlg.xAODContainerName = ""
        xAODTrackParticleCnvAlg.xAODTrackParticlesFromTracksContainerName = track_particle_out
        xAODTrackParticleCnvAlg.TrackContainerName = track_in
        xAODTrackParticleCnvAlg.TrackParticleCreator = getInDetxAODParticleCreatorTool(
            prd_to_track_map, suffix)
        xAODTrackParticleCnvAlg.AODContainerName = ""
        xAODTrackParticleCnvAlg.AODTruthContainerName = ""
        xAODTrackParticleCnvAlg.ConvertTrackParticles = False
        xAODTrackParticleCnvAlg.ConvertTracks = True
        xAODTrackParticleCnvAlg.AddTruthLink = InDetFlags.doTruth(
        ) and is_mc and isValid(track_particle_truth_in)
        xAODTrackParticleCnvAlg.xAODTruthLinkVector = passCollectionName(
            'xAODTruthLinks',
            InDetFlags.doTruth() and is_mc
            and isValid(track_particle_truth_in))
        xAODTrackParticleCnvAlg.TrackTruthContainerName = passCollectionName(
            track_particle_truth_in, (is_mc and InDetFlags.doTruth()))
        from MCTruthClassifier.MCTruthClassifierBase import MCTruthClassifier
        xAODTrackParticleCnvAlg.MCTruthClassifier = MCTruthClassifier
        topSequence += xAODTrackParticleCnvAlg
Пример #8
0
def _get_purity(args, hookargs):
    from AthenaCommon.AppMgr import ToolSvc
    from InDetRecExample.InDetKeys import InDetKeys
    from InDetRecExample.InDetJobProperties import InDetFlags
    # this tool is only needed for D3PD writing and hence it is configured here
    from TrkVertexFitterValidationUtils.TrkVertexFitterValidationUtilsConf import Trk__TrkPriVxPurityTool
    mckey = resolveSGKey('McEventCollection', D3PDMakerFlags.TruthSGKey())
    TrkPriVxPurityTool = Trk__TrkPriVxPurityTool(MonteCarloCollection=mckey)
    ToolSvc += TrkPriVxPurityTool
    if InDetFlags.doPrintConfigurables():
        print TrkPriVxPurityTool
    return
Пример #9
0
    def configure(self):
        # objKeyStore stuff needed?

        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # ---------------------------------------------------------------
        # DiTauRec Tools
        # ---------------------------------------------------------------
        import DiTauRec.DiTauAlgorithmsHolder as DiTauAlgs
        from DiTauRec.DiTauRecFlags import diTauFlags
        from DiTauRec.DiTauRecConf import DiTauBuilder

        tools = []
        tools.append(DiTauAlgs.getSeedJetBuilder(_jet_container))
        tools.append(DiTauAlgs.getElMuFinder())
        tools.append(DiTauAlgs.getSubjetBuilder())
        from InDetRecExample.InDetJobProperties import InDetFlags
        from JetRec.JetRecFlags import jetFlags
        if (InDetFlags.doVertexFinding()
                and jetFlags.useTracks()) or diTauFlags.doVtxFinding:
            tools.append(DiTauAlgs.getVertexFinder())
            pass
        tools.append(DiTauAlgs.getDiTauTrackFinder())
        if diTauFlags.doCellFinding:
            tools.append(
                DiTauAlgs.getCellFinder(self.write_jet_cells,
                                        self.write_subjet_cells))
            pass

        if not diTauFlags.doCellFinding:
            self.use_cells = False
        tools.append(DiTauAlgs.getIDVarCalculator(self.use_cells))

        # ---------------------------------------------------------------
        # add DiTauBuilder to Algorithm Sequence
        # ---------------------------------------------------------------
        DiTauBuilder = DiTauBuilder(name=self.name,
                                    DiTauContainer=_outputKey,
                                    DiTauAuxContainer=_outputAuxKey,
                                    Tools=tools,
                                    SeedJetName=_jet_container,
                                    minPt=diTauFlags.diTauRecJetSeedPt(),
                                    maxEta=2.5,
                                    OutputLevel=3,
                                    Rjet=self.R_jet,
                                    Rsubjet=self.R_subjet,
                                    Rcore=self.R_core)

        topSequence += DiTauBuilder
        #print topSequence
        return True
Пример #10
0
    def configure(self):
        mlog = logging.getLogger(
            'ThinInDetForwardTrackParticles.py::configure:')
        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        from RecExConfig.InputFilePeeker import inputFileSummary

        have_InDetForwardParticles = (
            inputFileSummary['eventdata_items']
            and any(InDetKeys.xAODForwardTrackParticleContainer() in elements
                    for elements in inputFileSummary['eventdata_items']))
        if not have_InDetForwardParticles and (
                not InDetFlags.doForwardTracks()
                or not InDetFlags.doParticleCreation()):
            mlog.error(
                "Not attempting to thin InDetForwardParticles, because the container %s does not seem to be available"
                % (InDetKeys.xAODForwardTrackParticleContainer()))
            return True

        mlog.info('entering')
        try:
            from ThinningUtils.ThinningUtilsConf import ThinInDetForwardTrackParticlesAlg
            theInDetFwdThinner = ThinInDetForwardTrackParticlesAlg(
                "ThinInDetForwardTrackParticlesAlg",
                ThinInDetForwardTrackParticles=True,
                StreamName='StreamAOD')
            print(theInDetFwdThinner)
        except Exception:
            import traceback
            mlog.error(
                "could not get handle to ThinInDetForwardTrackParticlesAlg")
            traceback.print_exc()
            return False
        mlog.info("now adding to topSequence")
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        topSequence += theInDetFwdThinner
        return True
Пример #11
0
def InDetGlobalChi2FitterTRT(name='InDetGlobalChi2FitterTRT', **kwargs):
    '''
    Global Chi2 Fitter for TRT segments with different settings
    '''
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

    if 'RotCreatorTool' not in kwargs:
        from InDetRecExample import TrackingCommon as TrackingCommon
        kwargs = setDefaults(
            kwargs,
            RotCreatorTool=TrackingCommon.getInDetRefitRotCreator(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))

    from InDetRecExample.InDetJobProperties import InDetFlags
    return InDetGlobalChi2FitterBase(
        name,
        **setDefaults(
            kwargs,
            MaterialUpdateTool='',  # default
            TrackingGeometrySvc='',  # default
            SignedDriftRadius=True,  # default,
            RecalibrateSilicon=False,  # default,
            RecalibrateTRT=False,  # default,
            TRTTubeHitCut=2.5,  # default,
            MaxIterations=10,
            Acceleration=False,  # default,
            RecalculateDerivatives=False,
            TRTExtensionCuts=True,  # default,
            TrackChi2PerNDFCut=999999,
            Momentum=1000. * Units.MeV if InDetFlags.materialInteractions()
            and not InDetFlags.solenoidOn() else 0,  # default,
            OutlierCut=5,  # default
            MaxOutliers=99 if InDetFlags.doRobustReco()
            or InDetFlags.doCosmics() else 10,  # default,
            ReintegrateOutliers=False
            if InDetFlags.doRefit() else False  # default
        ))
Пример #12
0
    def __init__(
            self,
            name="FTKTruthMaker",
            TrackCollectionName="FTK_Trk_Tracks_Refit",
            TrackTruthName="FTK_Trk_Tracks_RefitTruthCollection",
            TrackDetailedTruthName="FTK_Trk_Tracks_RefitDetailedTruthCollection"
    ):

        if InDetFlags.truthMatchStrategy() == 'TruthMatchRatio':
            from TrkTruthCreatorTools.TrkTruthCreatorToolsConf import Trk__TruthMatchRatio as InDetTruthMatchTool
        elif InDetFlags.truthMatchStrategy() == 'TruthMatchTanimoto':
            from TrkTruthCreatorTools.TrkTruthCreatorToolsConf import Trk__TruthMatchTanimoto as InDetTruthMatchTool
        else:
            print "ConfiguredInDetTrackTruth: error! InDetFlags.truthMatchStrategy must be TruthMatchRatio or TruthMatchTanimoto but is: " + InDetFlags.truthMatchStrategy(
            )

        FTKTruthMatchSimilarityTool = InDetTruthMatchTool(
            name="FTKTruthMatchTool",
            WeightPixel=10.,
            WeightSCT=5.,
            WeightTRT=1.)
        from AthenaCommon.AppMgr import ToolSvc
        print "Trying to print toolsvc again"
        print ToolSvc.__class__
        # --- only add this once !!!
        if not hasattr(ToolSvc, "InDetTruthMatchTool"):
            ToolSvc += FTKTruthMatchSimilarityTool
            if (InDetFlags.doPrintConfigurables()):
                print FTKTruthMatchSimilarityTool

        super(ConfiguredTrigFTKTruthMaker, self).__init__(
            name=name,
            TrackCollectionName=TrackCollectionName,
            DetailedTrackTruthName=TrackDetailedTruthName,
            OutputName=TrackTruthName,
            TrackTruthSimilarityTool=FTKTruthMatchSimilarityTool)
Пример #13
0
def MuonCombinedInDetCandidateAlg(name="MuonCombinedInDetCandidateAlg",
                                  **kwargs):
    from InDetRecExample.InDetJobProperties import InDetFlags
    kwargs.setdefault(
        "TrackSelector",
        getPublicTool("MuonCombinedInDetDetailedTrackSelectorTool"))
    if muonCombinedRecFlags.doSiAssocForwardMuons(
    ) and InDetFlags.doForwardTracks():
        kwargs.setdefault("DoSiliconAssocForwardMuons", True)
        kwargs.setdefault(
            "InDetForwardTrackSelector",
            getPublicTool("MuonCombinedInDetDetailedForwardTrackSelectorTool"))

    kwargs.setdefault("MuonSystemExtensionTool",
                      getPublicTool("MuonSystemExtensionTool"))

    return CfgMgr.MuonCombinedInDetCandidateAlg(name, **kwargs)
Пример #14
0
    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 __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)
Пример #16
0
    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)
    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
Пример #18
0
 def __init__(self, **kwargs):
     from AthenaCommon.AppMgr import ToolSvc, ServiceMgr
     # If InDetSCT_ConditionsSummarySvc instance configured by InDetRecConditionsAccess.py is available, use it.
     # Otherwise, the default SCT_ConditionsSummarySvc instance is used.
     # @TODO find a better to solution to get the correct service for the current job.
     SctSummarySvc = "InDetSCT_ConditionsSummarySvc"
     if not hasattr(ServiceMgr, SctSummarySvc):
         SctSummarySvc = "SCT_ConditionsSummarySvc"
     from InDetRecExample.InDetJobProperties import InDetFlags
     super(InDetHoleSearchTool.PhysValMonInDetHoleSearchTool,
           self).__init__(**_args(
               kwargs,
               name=self.__class__.__name__,
               Extrapolator=ToolSvc.InDetExtrapolator,
               SctSummarySvc=SctSummarySvc,
               usePixel=True,
               useSCT=True,
               checkBadSCTChip=InDetFlags.checkDeadElementsOnTrack(),
               # OutputLevel  = 1,
               CountDeadModulesAfterLastHit=True))
   def __init__(self, NewTrackingCuts = None, SiTrackCollection = None, ExtendedTrackCollection = None, ExtendedTracksMap = None, TrackCollectionKeys=[], TrackCollectionTruthKeys=[] , doPhase = True):
      
      from InDetRecExample.InDetJobProperties import InDetFlags
      from AthenaCommon.DetFlags              import DetFlags
      from InDetRecExample.InDetKeys          import InDetKeys
      #
      # get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr                import ToolSvc
      from AthenaCommon.AlgSequence           import AlgSequence
      topSequence = AlgSequence()
      
      #    
      # ---------- TRT_TrackExtension
      #
      if InDetFlags.doTRTExtension():


         #
         # Track extension to TRT algorithm
         #
         # set output extension map name
         OutputExtendedTracks = ExtendedTracksMap

         if doPhase:

           from TRT_TrackExtensionTool_xk.TRT_TrackExtensionTool_xkConf import InDet__TRT_TrackExtensionToolCosmics
           InDetTRTExtensionToolPhase = InDet__TRT_TrackExtensionToolCosmics(name                  = 'InDetTRT_ExtensionToolPhase',
                                                                             Propagator            = InDetPropagator,
                                                                             Extrapolator          = InDetExtrapolator,
                                                                             TRT_ClustersContainer = InDetKeys.TRT_DriftCirclesUncalibrated(),
                                                                             SearchNeighbour       = False, #needs debugging!!!
                                                                             RoadWidth             = 20.)

           ToolSvc += InDetTRTExtensionToolPhase
      

           from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
           InDetTRTExtensionPhase    = InDet__TRT_TrackExtensionAlg (name                   = 'InDetTRT_ExtensionPhase'+NewTrackingCuts.extension(),
                                                                     InputTracksLocation    = SiTrackCollection,
                                                                     ExtendedTracksLocation = OutputExtendedTracks,
                                                                     TrackExtensionTool     = InDetTRTExtensionToolPhase)
           
           topSequence += InDetTRTExtensionPhase
           if (InDetFlags.doPrintConfigurables()):
            print InDetTRTExtensionPhase
           
         #
         else: 
          from TRT_TrackExtensionAlg.TRT_TrackExtensionAlgConf import InDet__TRT_TrackExtensionAlg
          InDetTRTExtension    = InDet__TRT_TrackExtensionAlg (name                   = 'InDetTRT_Extension'+NewTrackingCuts.extension(),
                                                              InputTracksLocation    = SiTrackCollection,
                                                              ExtendedTracksLocation = OutputExtendedTracks,
                                                              TrackExtensionTool     = InDetTRTExtensionTool)
          #InDetTRTExtension.OutputLevel = VERBOSE
          topSequence += InDetTRTExtension
          if (InDetFlags.doPrintConfigurables()):
            print InDetTRTExtension
   
      #
      # ------------ Track Extension Processor
      #
      if InDetFlags.doExtensionProcessor():
            
         if InDetFlags.trtExtensionType() is 'DAF' :
            #
            # --- DAF Fitter setup
            #
            from TrkCompetingRIOsOnTrackTool.TrkCompetingRIOsOnTrackToolConf import Trk__CompetingRIOsOnTrackTool
            InDetCompetingRotCreator =  Trk__CompetingRIOsOnTrackTool( name                        = 'InDetCompetingRotCreator'+NewTrackingCuts.extension(),
                                                                       ToolForCompPixelClusters    = None,      # default
                                                                       ToolForCompSCT_Clusters     = None,      # default
                                                                       ToolForCompTRT_DriftCircles = InDetCompetingTRT_DC_Tool )
            ToolSvc += InDetCompetingRotCreator
            if (InDetFlags.doPrintConfigurables()):
               print InDetCompetingRotCreator
            #
            from TrkDeterministicAnnealingFilter.TrkDeterministicAnnealingFilterConf import Trk__DeterministicAnnealingFilter
            InDetExtensionFitter =  Trk__DeterministicAnnealingFilter( name = 'InDetDAF'+NewTrackingCuts.extension(),
                                                                       ToolForExtrapolation           = InDetExtrapolator,
                                                                       ToolForCompetingROTsCreation   = InDetCompetingRotCreator,
                                                                       ToolForUpdating                = InDetUpdator,
                                                                       AnnealingScheme                = [200., 81., 9., 4., 1., 1., 1.],
                                                                       DropOutlierCutValue            = 1.E-7,
                                                                       OutlierCutValue                = 0.01 )
            ToolSvc += InDetExtensionFitter
            if (InDetFlags.doPrintConfigurables()):
               print InDetExtensionFitter
         else:
            InDetExtensionFitter = InDetTrackFitter
            if NewTrackingCuts.mode() == "LowPt":
               InDetExtensionFitter = InDetTrackFitterLowPt

         #
         # --- load scoring for extension
         #
         if InDetFlags.doCosmics():
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
            InDetExtenScoringTool = InDet__InDetCosmicScoringTool(name                 = 'InDetCosmicExtenScoringTool',
                                                                  nWeightedClustersMin = 0,
                                                                  minTRTHits           = NewTrackingCuts.minTRTonTrk(),
                                                                  SummaryTool          = InDetTrackSummaryTool)
            
         else:
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
            InDetExtenScoringTool = InDet__InDetAmbiScoringTool(name                    = 'InDetExtenScoringTool'+NewTrackingCuts.extension(),
                                                                Extrapolator            = InDetExtrapolator,
                                                                SummaryTool             = InDetTrackSummaryTool,
                                                                DriftCircleCutTool      = InDetTRTDriftCircleCut,
                                                                useAmbigFcn             = True,  # this is NewTracking  
                                                                useTRT_AmbigFcn         = False,
                                                                minPt                   = NewTrackingCuts.minPT(),
                                                                maxRPhiImp              = NewTrackingCuts.maxPrimaryImpact(),
                                                                maxZImp                 = NewTrackingCuts.maxZImpact(),
                                                                maxEta                  = NewTrackingCuts.maxEta(),
                                                                minSiClusters           = NewTrackingCuts.minClusters(),
                                                                minPixel                = NewTrackingCuts.minPixel(),
                                                                maxSiHoles              = NewTrackingCuts.maxHoles(),
                                                                maxPixelHoles           = NewTrackingCuts.maxPixelHoles(),
                                                                maxSCTHoles             = NewTrackingCuts.maxSCTHoles(),
                                                                maxDoubleHoles          = NewTrackingCuts.maxDoubleHoles(),
                                                                usePixel                = NewTrackingCuts.usePixel(),
                                                                useSCT                  = NewTrackingCuts.useSCT(),
                                                                minTRTonTrk             = NewTrackingCuts.minTRTonTrk(),
                                                                minTRTPrecisionFraction = NewTrackingCuts.minTRTPrecFrac())
            
            if InDetFlags.trackFitterType() in ['KalmanFitter', 'KalmanDNAFitter', 'ReferenceKalmanFitter']:
               InDetExtenScoringTool.minTRTPrecisionFraction = 0.2

         #InDetExtenScoringTool.OutputLevel = VERBOSE 
         ToolSvc += InDetExtenScoringTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetExtenScoringTool     
         
         #
         # --- output track collection
         #
         self.__ForwardTrackCollection = ExtendedTrackCollection 
         #
         # --- get configured track extension processor
         #
         if doPhase:
         
          from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
          InDetExtensionProcessorPhase = InDet__InDetExtensionProcessor ( name               = "InDetExtensionProcessorPhase"+NewTrackingCuts.extension(),
                                                                    TrackName          = SiTrackCollection,
                                                                    Cosmics            = True,
                                                                    ExtensionMap       = OutputExtendedTracks,
                                                                    NewTrackName       = self.__ForwardTrackCollection,
                                                                    TrackFitter        = InDetExtensionFitter,
                                                                    ScoringTool        = InDetExtenScoringTool,
                                                                    suppressHoleSearch = False,  # does not work properly
                                                                    tryBremFit         = InDetFlags.doBremRecovery(),
                                                                    caloSeededBrem     = InDetFlags.doCaloSeededBrem(),
                                                                    pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                                    RefitPrds          = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() is 'DAF')))
         #InDetExtensionProcessor.OutputLevel = VERBOSE
          if InDetFlags.materialInteractions():
             InDetExtensionProcessorPhase.matEffects = InDetFlags.materialInteractionsType()
          else:
             InDetExtensionProcessorPhase.matEffects = 0
   
          topSequence += InDetExtensionProcessorPhase
          if (InDetFlags.doPrintConfigurables()):
              print InDetExtensionProcessorPhase

         else:

          from InDetExtensionProcessor.InDetExtensionProcessorConf import InDet__InDetExtensionProcessor   
          InDetExtensionProcessor = InDet__InDetExtensionProcessor ( name               = "InDetExtensionProcessor"+NewTrackingCuts.extension(),
                                                                    TrackName          = SiTrackCollection,
                                                                    Cosmics            = InDetFlags.doCosmics(),
                                                                    ExtensionMap       = OutputExtendedTracks,
                                                                    NewTrackName       = self.__ForwardTrackCollection,
                                                                    TrackFitter        = InDetExtensionFitter,
                                                                    ScoringTool        = InDetExtenScoringTool,
                                                                    suppressHoleSearch = False,  # does not work properly
                                                                    tryBremFit         = InDetFlags.doBremRecovery(),
                                                                    caloSeededBrem     = InDetFlags.doCaloSeededBrem(),
                                                                    pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                                    RefitPrds          = not (InDetFlags.refitROT() or (InDetFlags.trtExtensionType() is 'DAF')))
          #InDetExtensionProcessor.OutputLevel = VERBOSE
          if InDetFlags.materialInteractions():
             InDetExtensionProcessor.matEffects = InDetFlags.materialInteractionsType()
          else:
             InDetExtensionProcessor.matEffects = 0
   
          topSequence += InDetExtensionProcessor

          if (InDetFlags.doPrintConfigurables()):
             print InDetExtensionProcessor
         
         # --- Delete Resolved Si tracks and extension map
         from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg         
         InDetSGDeletionAlg(container = "TrackExtensionMap#", key = OutputExtendedTracks)
         if not InDetFlags.doMonitoringAlignment():
            InDetSGDeletionAlg(key = SiTrackCollection)
         
         #
         # ------------ Track truth.
         #
         if not InDetFlags.doSGDeletion():
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__ForwardTrackCollection,
                                                            self.__ForwardTrackCollection+"DetailedTruth",
                                                            self.__ForwardTrackCollection+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__ForwardTrackCollection ]
               
         #
      else:
         self.__ForwardTrackCollection = SiTrackCollection
Пример #20
0
def InDetGlobalChi2Fitter(name='InDetGlobalChi2Fitter', **kwargs):
    split_cluster_map_extension = kwargs.pop('SplitClusterMapExtension', '')

    from InDetRecExample import TrackingCommon as TrackingCommon
    if 'RotCreatorTool' not in kwargs:
        kwargs = setDefaults(
            kwargs,
            RotCreatorTool=TrackingCommon.getInDetRotCreator(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))

    from InDetRecExample.InDetJobProperties import InDetFlags
    use_broad_cluster_any = InDetFlags.useBroadClusterErrors() and (
        not InDetFlags.doDBMstandalone())
    if 'BroadRotCreatorTool' not in kwargs and not InDetFlags.doRefit():
        kwargs = setDefaults(
            kwargs,
            BroadRotCreatorTool=TrackingCommon.getInDetBroadRotCreator(
                nameSuffix=split_cluster_map_extension,
                SplitClusterMapExtension=split_cluster_map_extension))

    if InDetFlags.doDBMstandalone():
        kwargs = setDefaults(kwargs,
                             StraightLine=True,
                             OutlierCut=5,
                             RecalibrateTRT=False,
                             TRTExtensionCuts=False,
                             TrackChi2PerNDFCut=20)

    if InDetFlags.doRefit() or use_broad_cluster_any is True:
        kwargs = setDefaults(kwargs, RecalibrateSilicon=False)
    if InDetFlags.doRefit():
        kwargs = setDefaults(kwargs,
                             BroadRotCreatorTool=None,
                             ReintegrateOutliers=False,
                             RecalibrateTRT=False)
    if InDetFlags.doRobustReco():
        kwargs = setDefaults(
            kwargs,
            # BroadRotCreatorTool = None
            OutlierCut=10.0,
            TrackChi2PerNDFCut=20)

    if InDetFlags.doRobustReco() or InDetFlags.doCosmics():
        kwargs = setDefaults(kwargs, MaxOutliers=99)
    if InDetFlags.doCosmics() or InDetFlags.doBeamHalo():
        kwargs = setDefaults(kwargs, Acceleration=False)

    if InDetFlags.materialInteractions() and not InDetFlags.solenoidOn():
        kwargs = setDefaults(kwargs, Momentum=1000. * Units.MeV)
    return InDetGlobalChi2FitterBase(name, **kwargs)
    def __init__(self,
                 InputCollections=None,
                 ResolvedTrackCollectionKey=None,
                 SiSPSeededTrackCollectionKey=None,
                 NewTrackingCuts=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[]):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        #
        # --- get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        #
        # --- decide if use the association tool
        #
        if (len(InputCollections) > 0) and (
                NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode()
                == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0"
                or NewTrackingCuts.mode() == "LowPtLargeD0"
                or NewTrackingCuts.mode() == "DisplacedSoftPion"
                or NewTrackingCuts.mode() == "BeamGas"
                or NewTrackingCuts.mode() == "ForwardTracks"
                or NewTrackingCuts.mode() == "ForwardSLHCTracks"
                or NewTrackingCuts.mode() == "PixelPrdAssociation"
                or NewTrackingCuts.mode() == "VeryForwardSLHCTracks"
                or NewTrackingCuts.mode() == "SLHCConversionFinding"):
            usePrdAssociationTool = True
        else:
            usePrdAssociationTool = False

        #
        # --- get list of already associated hits (always do this, even if no other tracking ran before)
        #
        if usePrdAssociationTool:
            from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
            InDetPRD_Association = InDet__InDetTrackPRD_Association(
                name='InDetPRD_Association' + NewTrackingCuts.extension(),
                AssociationTool=InDetPrdAssociationTool,
                TracksName=list(InputCollections))
            topSequence += InDetPRD_Association
            if (InDetFlags.doPrintConfigurables()):
                print InDetPRD_Association

        # ------------------------------------------------------------
        #
        # ----------- SiSPSeededTrackFinder
        #
        # ------------------------------------------------------------

        if InDetFlags.doSiSPSeededTrackFinder():
            #
            # --- Space points seeds maker, use different ones for cosmics and collisions
            #
            if NewTrackingCuts.mode() == "DBM":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
            elif InDetFlags.doCosmics():
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_Cosmic as SiSpacePointsSeedMaker
            elif InDetFlags.doHeavyIon():
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_HeavyIon as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_LowMomentum as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "BeamGas":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_BeamGas as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ITK as SiSpacePointsSeedMaker
            elif NewTrackingCuts.mode() == "DisplacedSoftPion":
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_TrkSeeded as SiSpacePointsSeedMaker
            else:
                from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker

            InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker(
                name="InDetSpSeedsMaker" + NewTrackingCuts.extension(),
                pTmin=NewTrackingCuts.minPT(),
                maxdImpact=NewTrackingCuts.maxPrimaryImpact(),
                maxZ=NewTrackingCuts.maxZImpact(),
                minZ=-NewTrackingCuts.maxZImpact(),
                usePixel=NewTrackingCuts.usePixel(),
                SpacePointsPixelName=InDetKeys.PixelSpacePoints(),
                # useSCT                 = NewTrackingCuts.useSCT(),
                useSCT=(NewTrackingCuts.useSCT()
                        and NewTrackingCuts.useSCTSeeding()),
                SpacePointsSCTName=InDetKeys.SCT_SpacePoints(),
                # useOverlapSpCollection = NewTrackingCuts.useSCT(),
                useOverlapSpCollection=(NewTrackingCuts.useSCT()
                                        and NewTrackingCuts.useSCTSeeding()),
                SpacePointsOverlapName=InDetKeys.OverlapSpacePoints(),
                radMax=NewTrackingCuts.radMax(),
                RapidityCut=NewTrackingCuts.maxEta())

            if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon(
            ) or NewTrackingCuts.mode() == "ForwardTracks":
                InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds(
                )
                InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds(
                )
            if usePrdAssociationTool:
                # not all classes have that property !!!
                InDetSiSpacePointsSeedMaker.UseAssociationTool = True
                InDetSiSpacePointsSeedMaker.AssociationTool = InDetPrdAssociationTool
            if not InDetFlags.doCosmics():
                InDetSiSpacePointsSeedMaker.maxRadius1 = 0.75 * NewTrackingCuts.radMax(
                )
                InDetSiSpacePointsSeedMaker.maxRadius2 = NewTrackingCuts.radMax(
                )
                InDetSiSpacePointsSeedMaker.maxRadius3 = NewTrackingCuts.radMax(
                )
            if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                try:
                    InDetSiSpacePointsSeedMaker.pTmax = NewTrackingCuts.maxPT()
                except:
                    pass
                InDetSiSpacePointsSeedMaker.mindRadius = 4.0
            if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "SLHCConversionFinding":
                InDetSiSpacePointsSeedMaker.minRadius1 = 0
                InDetSiSpacePointsSeedMaker.minRadius2 = 0
                InDetSiSpacePointsSeedMaker.minRadius3 = 0
                InDetSiSpacePointsSeedMaker.maxRadius1 = 1000. * Units.mm
                InDetSiSpacePointsSeedMaker.maxRadius2 = 1000. * Units.mm
                InDetSiSpacePointsSeedMaker.maxRadius3 = 1000. * Units.mm
            if NewTrackingCuts.mode(
            ) == "ForwardTracks" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                InDetSiSpacePointsSeedMaker.checkEta = True
                InDetSiSpacePointsSeedMaker.etaMin = NewTrackingCuts.minEta()
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.RapidityCut = NewTrackingCuts.maxEta(
                )
            if NewTrackingCuts.mode() == "DBM":
                InDetSiSpacePointsSeedMaker.etaMin = NewTrackingCuts.minEta()
                InDetSiSpacePointsSeedMaker.etaMax = NewTrackingCuts.maxEta()
                InDetSiSpacePointsSeedMaker.useDBM = True
            if NewTrackingCuts.mode() == "PixelThreeLayer":
                InDetSiSpacePointsSeedMaker.SkipIBLcut = True
            if NewTrackingCuts.mode() == "DisplacedSoftPion":
                InDetSiSpacePointsSeedMaker.maxSeedsForSpacePoint = 50
                InDetSiSpacePointsSeedMaker.DeltaThetaRoISP = 0.8
                InDetSiSpacePointsSeedMaker.DeltaPhiRoISP = 0.8
                InDetSiSpacePointsSeedMaker.RoISeedTool = RoISeedTool

            #InDetSiSpacePointsSeedMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiSpacePointsSeedMaker
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiSpacePointsSeedMaker

            #
            # --- Z-coordinates primary vertices finder (only for collisions)
            #
            if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
                from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
                InDetZvertexMaker = InDet__SiZvertexMaker_xk(
                    name='InDetZvertexMaker' + NewTrackingCuts.extension(),
                    Zmax=NewTrackingCuts.maxZImpact(),
                    Zmin=-NewTrackingCuts.maxZImpact(),
                    minRatio=0.17)  # not default
                InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker

                if InDetFlags.doHeavyIon():
                    InDetZvertexMaker.HistSize = 2000
                    ###InDetZvertexMaker.minContent = 200
                    InDetZvertexMaker.minContent = 30

                ToolSvc += InDetZvertexMaker
                if (InDetFlags.doPrintConfigurables()):
                    print InDetZvertexMaker

            else:
                InDetZvertexMaker = None

            #
            # --- SCT and Pixel detector elements road builder
            #
            from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
            InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(
                name='InDetSiRoadMaker' + NewTrackingCuts.extension(),
                PropagatorTool=InDetPatternPropagator,
                usePixel=NewTrackingCuts.usePixel(),
                PixManagerLocation=InDetKeys.PixelManager(),
                useSCT=NewTrackingCuts.useSCT(),
                SCTManagerLocation=InDetKeys.SCT_Manager(),
                RoadWidth=NewTrackingCuts.RoadWidth())
            #InDetSiDetElementsRoadMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiDetElementsRoadMaker
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiDetElementsRoadMaker

            #
            # --- Local track finding using sdCaloSeededSSSpace point seed
            #

            useBremMode = NewTrackingCuts.mode(
            ) == "Offline" or NewTrackingCuts.mode(
            ) == "SLHC" or NewTrackingCuts.mode() == "DBM"
            from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
            InDetSiTrackMaker = SiTrackMaker(
                name='InDetSiTrackMaker' + NewTrackingCuts.extension(),
                useSCT=NewTrackingCuts.useSCT(),
                usePixel=NewTrackingCuts.usePixel(),
                RoadTool=InDetSiDetElementsRoadMaker,
                CombinatorialTrackFinder=InDetSiComTrackFinder,
                pTmin=NewTrackingCuts.minPT(),
                pTminBrem=NewTrackingCuts.minPTBrem(),
                pTminSSS=InDetFlags.pT_SSScut(),
                nClustersMin=NewTrackingCuts.minClusters(),
                nHolesMax=NewTrackingCuts.nHolesMax(),
                nHolesGapMax=NewTrackingCuts.nHolesGapMax(),
                SeedsFilterLevel=NewTrackingCuts.seedFilterLevel(),
                Xi2max=NewTrackingCuts.Xi2max(),
                Xi2maxNoAdd=NewTrackingCuts.Xi2maxNoAdd(),
                nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(),
                CosmicTrack=InDetFlags.doCosmics(),
                Xi2maxMultiTracks=NewTrackingCuts.Xi2max(),  # was 3.
                useSSSseedsFilter=InDetFlags.doSSSfilter(),
                doMultiTracksProd=True,
                useBremModel=InDetFlags.doBremRecovery() and
                useBremMode,  # only for NewTracking the brem is debugged !!!
                doCaloSeededBrem=InDetFlags.doCaloSeededBrem(),
                doHadCaloSeedSSS=InDetFlags.doHadCaloSeededSSS(),
                phiWidth=NewTrackingCuts.phiWidthBrem(),
                etaWidth=NewTrackingCuts.etaWidthBrem(),
                InputClusterContainerName=InDetKeys.CaloClusterROIContainer(
                ),  # "InDetCaloClusterROIs" 
                InputHadClusterContainerName=InDetKeys.
                HadCaloClusterROIContainer(),  # "InDetCaloClusterROIs" 
                UseAssociationTool=usePrdAssociationTool)

            if NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "VeryForwardSLHCTracks":
                InDetSiTrackMaker.ITKGeometry = True

            if NewTrackingCuts.mode() == "DBM":
                InDetSiTrackMaker.MagneticFieldMode = "NoField"
                InDetSiTrackMaker.useBremModel = False
                InDetSiTrackMaker.doMultiTracksProd = False
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
                InDetSiTrackMaker.pTminSSS = -1
                InDetSiTrackMaker.CosmicTrack = False
                InDetSiTrackMaker.useSSSseedsFilter = False
                InDetSiTrackMaker.doCaloSeededBrem = False
                InDetSiTrackMaker.doHadCaloSeedSSS = False
                InDetSiTrackMaker.UseAssociationTool = False

            elif InDetFlags.doCosmics():
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'

            elif InDetFlags.doHeavyIon():
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'

            elif NewTrackingCuts.mode() == "LowPt":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'

            elif NewTrackingCuts.mode() == "VeryLowPt" or (
                    NewTrackingCuts.mode() == "Pixel"
                    and InDetFlags.doMinBias()):
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'

            elif NewTrackingCuts.mode() == "BeamGas":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'

            elif NewTrackingCuts.mode() == "ForwardTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'

            elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'

            elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks'

            elif NewTrackingCuts.mode() == "SLHCConversionFinding":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_SLHCConversionTracks'

            elif NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode(
            ) == "LowPtLargeD0" or NewTrackingCuts.mode(
            ) == "DisplacedSoftPion":
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'

            elif NewTrackingCuts.mode() == "PixelThreeLayer":
                InDetSiTrackMaker.CombinatorialTrackFinder = InDetSiComTrackFinderThreeLayerTracking

            else:
                InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'

            if InDetFlags.doStoreTrackSeeds():
                InDetSiTrackMaker.SeedSegmentsWrite = True
                InDetSiTrackMaker.SeedToTrackConversion = InDet_SeedToTrackConversion
            #InDetSiTrackMaker.OutputLevel = VERBOSE
            ToolSvc += InDetSiTrackMaker
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiTrackMaker
            #
            # set output track collection name
        #
            self.__SiTrackCollection = SiSPSeededTrackCollectionKey
            #
            # --- Setup Track finder using space points seeds
            #

            from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder

            if NewTrackingCuts.mode(
            ) == "ForwardSLHCTracks" or NewTrackingCuts.mode(
            ) == "ForwardTracks":

                InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(
                    name='InDetSiSpTrackFinder' + NewTrackingCuts.extension(),
                    TrackTool=InDetSiTrackMaker,
                    TracksLocation=self.__SiTrackCollection,
                    SeedsTool=InDetSiSpacePointsSeedMaker,
                    useZvertexTool=InDetFlags.useZvertexTool(),
                    ZvertexTool=InDetZvertexMaker,
                    useNewStrategy=False,
                    useMBTSTimeDiff=InDetFlags.useMBTSTimeDiff(),
                    useZBoundFinding=False)
                if InDetFlags.doHeavyIon():
                    InDetSiSPSeededTrackFinder.FreeClustersCut = 2  #Heavy Ion optimization from Igor

            else:
                InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(
                    name='InDetSiSpTrackFinder' + NewTrackingCuts.extension(),
                    TrackTool=InDetSiTrackMaker,
                    TracksLocation=self.__SiTrackCollection,
                    SeedsTool=InDetSiSpacePointsSeedMaker,
                    useZvertexTool=InDetFlags.useZvertexTool()
                    and NewTrackingCuts.mode() != "DBM",
                    ZvertexTool=InDetZvertexMaker,
                    useNewStrategy=InDetFlags.useNewSiSPSeededTF()
                    and NewTrackingCuts.mode() != "DBM",
                    useMBTSTimeDiff=InDetFlags.useMBTSTimeDiff(),
                    useZBoundFinding=NewTrackingCuts.doZBoundary()
                    and NewTrackingCuts.mode() != "DBM")

                if InDetFlags.doHeavyIon():
                    InDetSiSPSeededTrackFinder.FreeClustersCut = 2  #Heavy Ion optimization from Igor

            #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE
            topSequence += InDetSiSPSeededTrackFinder
            if (InDetFlags.doPrintConfigurables()):
                print InDetSiSPSeededTrackFinder

            if not InDetFlags.doSGDeletion():
                if InDetFlags.doTruth():
                    #
                    # set up the truth info for this container
                    #
                    include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                    InDetTracksTruth = ConfiguredInDetTrackTruth(
                        self.__SiTrackCollection,
                        self.__SiTrackCollection + "DetailedTruth",
                        self.__SiTrackCollection + "TruthCollection")
                    #
                    # add final output for statistics
                    #
                    TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                    TrackCollectionTruthKeys += [
                        InDetTracksTruth.TracksTruth()
                    ]
                else:
                    TrackCollectionKeys += [self.__SiTrackCollection]

        # ------------------------------------------------------------
        #
        # ---------- Ambiguity solving
        #
        # ------------------------------------------------------------

        if InDetFlags.doAmbiSolving():
            #
            # --- load InnerDetector TrackSelectionTool
            #

            prob1 = InDetFlags.pixelClusterSplitProb1()
            prob2 = InDetFlags.pixelClusterSplitProb2()
            nhitsToAllowSplitting = 9

            if geoFlags.Run() == 1:
                prob1 = InDetFlags.pixelClusterSplitProb1_run1()
                prob2 = InDetFlags.pixelClusterSplitProb2_run1()
                nhitsToAllowSplitting = 8

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetDenseEnvAmbiTrackSelectionTool as AmbiTrackSelectionTool
            else:
                from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool as AmbiTrackSelectionTool
            InDetAmbiTrackSelectionTool = AmbiTrackSelectionTool(
                name='InDetAmbiTrackSelectionTool' +
                NewTrackingCuts.extension(),
                AssociationTool=InDetPrdAssociationTool,
                DriftCircleCutTool=InDetTRTDriftCircleCut,
                minHits=NewTrackingCuts.minClusters(),
                minNotShared=NewTrackingCuts.minSiNotShared(),
                maxShared=NewTrackingCuts.maxShared(),
                minTRTHits=0,  # used for Si only tracking !!!
                sharedProbCut=0.10,
                UseParameterization=False,
                Cosmics=InDetFlags.doCosmics(),
                doPixelSplitting=InDetFlags.doPixelClusterSplitting()
                and NewTrackingCuts.mode != "DBM")
            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                InDetAmbiTrackSelectionTool.sharedProbCut = prob1
                InDetAmbiTrackSelectionTool.sharedProbCut2 = prob2
                InDetAmbiTrackSelectionTool.minSiHitsToAllowSplitting = nhitsToAllowSplitting
                InDetAmbiTrackSelectionTool.minUniqueSCTHits = 4
                InDetAmbiTrackSelectionTool.minTrackChi2ForSharedHits = 3
                InDetAmbiTrackSelectionTool.InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer(
                )
                InDetAmbiTrackSelectionTool.doHadCaloSeed = False  #Only split in cluster in region of interest
                InDetAmbiTrackSelectionTool.minPtSplit = InDetFlags.pixelClusterSplitMinPt(
                )  #Only allow split clusters on track withe pt greater than this MeV
                InDetAmbiTrackSelectionTool.phiWidth = 0.2  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.etaWidth = 0.2  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.InputEmClusterContainerName = InDetKeys.CaloClusterROIContainer(
                )
                InDetAmbiTrackSelectionTool.doEmCaloSeed = False  #Only split in cluster in region of interest
                InDetAmbiTrackSelectionTool.minPtConv = 10000  #Only allow split clusters on track withe pt greater than this MeV
                InDetAmbiTrackSelectionTool.phiWidthEM = 0.05  #Split cluster ROI size
                InDetAmbiTrackSelectionTool.etaWidthEM = 0.05  #Split cluster ROI size

            if NewTrackingCuts.mode() == "DBM":
                InDetAmbiTrackSelectionTool.Cosmics = False
                InDetAmbiTrackSelectionTool.UseParameterization = False
                InDetAmbiTrackSelectionTool.doPixelSplitting = False
                InDetAmbiTrackSelectionTool.maxShared = 1000
                InDetAmbiTrackSelectionTool.maxTracksPerSharedPRD = 2
                InDetAmbiTrackSelectionTool.minHits = 0
                InDetAmbiTrackSelectionTool.minNotShared = 0
                InDetAmbiTrackSelectionTool.minScoreShareTracks = 0.0
                InDetAmbiTrackSelectionTool.minTRTHits = 0
                InDetAmbiTrackSelectionTool.sharedProbCut = 0.1
            if InDetFlags.doTIDE_AmbiTrackMonitoring(
            ) and InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "PixelPrdAssociation"
                    or NewTrackingCuts.mode() == "DBM"
                    or NewTrackingCuts.mode() == "PixelFourLayer"
                    or NewTrackingCuts.mode() == "PixelThreeLayer"):
                InDetAmbiTrackSelectionTool.ObserverTool = TrackObserverTool  #observerTool
                InDetAmbiTrackSelectionTool.MonitorAmbiguitySolving = True

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #    InDetAmbiTrackSelectionTool.OutputLevel = VERBOSE

            ToolSvc += InDetAmbiTrackSelectionTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiTrackSelectionTool
            #
            # --- set up different Scoring Tool for collisions and cosmics
            #
            if InDetFlags.doCosmics() and NewTrackingCuts.mode() != "DBM":
                from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
                InDetAmbiScoringTool = InDet__InDetCosmicScoringTool(
                    name='InDetCosmicsScoringTool' +
                    NewTrackingCuts.extension(),
                    nWeightedClustersMin=NewTrackingCuts.nWeightedClustersMin(
                    ),
                    minTRTHits=0,
                    SummaryTool=InDetTrackSummaryTool)
            else:
                from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
                InDetAmbiScoringTool = InDet__InDetAmbiScoringTool(
                    name='InDetAmbiScoringTool' + NewTrackingCuts.extension(),
                    Extrapolator=InDetExtrapolator,
                    SummaryTool=InDetTrackSummaryTool,
                    DriftCircleCutTool=InDetTRTDriftCircleCut,
                    useAmbigFcn=True,  # this is NewTracking
                    useTRT_AmbigFcn=False,
                    minPt=NewTrackingCuts.minPT(),
                    maxRPhiImp=NewTrackingCuts.maxPrimaryImpact(),
                    maxZImp=NewTrackingCuts.maxZImpact(),
                    maxEta=NewTrackingCuts.maxEta(),
                    minSiClusters=NewTrackingCuts.minClusters(),
                    minPixel=NewTrackingCuts.minPixel(),
                    maxSiHoles=NewTrackingCuts.maxHoles(),
                    maxPixelHoles=NewTrackingCuts.maxPixelHoles(),
                    maxSCTHoles=NewTrackingCuts.maxSCTHoles(),
                    maxDoubleHoles=NewTrackingCuts.maxDoubleHoles(),
                    usePixel=NewTrackingCuts.usePixel(),
                    useSCT=NewTrackingCuts.useSCT(),
                    InputEmClusterContainerName=InDetKeys.
                    CaloClusterROIContainer(),
                    doEmCaloSeed=True and InDetFlags.doCaloSeededBrem(),
                    minTRTonTrk=0,
                    minTRTPrecisionFraction=0)
                # allow for some overlap for low-pt tracking
                #if InDetFlags.doLowPt() and not NewTrackingCuts.mode() == "LowPt":
                #   InDetAmbiScoringTool.minPt = NewTrackingCuts.minPT()-100.*Units.MeV

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #   InDetAmbiScoringTool.OutputLevel = VERBOSE

            ToolSvc += InDetAmbiScoringTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiScoringTool
            #
            # --- load Ambiguity Processor
            #
            useBremMode = NewTrackingCuts.mode(
            ) == "Offline" or NewTrackingCuts.mode() == "SLHC"

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityProcessorTool as ProcessorTool
                use_low_pt_fitter = True if NewTrackingCuts.mode(
                ) == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (
                    NewTrackingCuts.mode() == "Pixel"
                    and InDetFlags.doMinBias()) else False
                fitter_list = [(InDetTrackFitter if not use_low_pt_fitter else
                                InDetTrackFitterLowPt)]
                if InDetFlags.doRefitInvalidCov():
                    from AthenaCommon import CfgGetter
                    fitter_list.append(CfgGetter.getPublicTool('KalmanFitter'))
                    fitter_list.append(
                        CfgGetter.getPublicTool('ReferenceKalmanFitter'))

                InDetAmbiguityProcessor = ProcessorTool(
                    name='InDetAmbiguityProcessor' +
                    NewTrackingCuts.extension(),
                    Fitter=fitter_list,
                    ScoringTool=InDetAmbiScoringTool,
                    SelectionTool=InDetAmbiTrackSelectionTool,
                    SuppressHoleSearch=False,
                    tryBremFit=InDetFlags.doBremRecovery() and useBremMode
                    and NewTrackingCuts.mode() != "DBM",
                    caloSeededBrem=InDetFlags.doCaloSeededBrem()
                    and NewTrackingCuts.mode() != "DBM",
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=True,
                    RejectTracksWithInvalidCov=InDetFlags.doRejectInvalidCov())
            else:
                from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool as ProcessorTool
                InDetAmbiguityProcessor = ProcessorTool(
                    name='InDetAmbiguityProcessor' +
                    NewTrackingCuts.extension(),
                    Fitter=InDetTrackFitter,
                    ScoringTool=InDetAmbiScoringTool,
                    SelectionTool=InDetAmbiTrackSelectionTool,
                    SuppressHoleSearch=False,
                    tryBremFit=InDetFlags.doBremRecovery() and useBremMode
                    and NewTrackingCuts.mode() != "DBM",
                    caloSeededBrem=InDetFlags.doCaloSeededBrem()
                    and NewTrackingCuts.mode() != "DBM",
                    pTminBrem=NewTrackingCuts.minPTBrem(),
                    RefitPrds=True)

            if InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "DBM"):
                InDetAmbiguityProcessor.SplitProbTool = NnPixelClusterSplitProbTool
                InDetAmbiguityProcessor.sharedProbCut = prob1
                InDetAmbiguityProcessor.sharedProbCut2 = prob2
                InDetAmbiguityProcessor.SplitClusterAmbiguityMap = InDetKeys.SplitClusterAmbiguityMap(
                )
                if InDetFlags.doTIDE_RescalePixelCovariances():
                    InDetAmbiguityProcessor.applydRcorrection = True

            if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode(
            ) == "DBM":
                InDetAmbiguityProcessor.SuppressHoleSearch = True
            if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode(
            ) == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel"
                                 and InDetFlags.doMinBias()):
                if InDetAmbiguityProcessor.getName().find('Dense'):
                    pass
                else:
                    InDetAmbiguityProcessor.Fitter = InDetTrackFitterLowPt

            if InDetFlags.materialInteractions():
                InDetAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType(
                )
            else:
                InDetAmbiguityProcessor.MatEffects = 0

            # if NewTrackingCuts.mode() == "ForwardTracks":
            #    InDetAmbiguityProcessor.OutputLevel = VERBOSE

            if InDetFlags.doTIDE_AmbiTrackMonitoring(
            ) and InDetFlags.doTIDE_Ambi() and not (
                    NewTrackingCuts.mode() == "ForwardSLHCTracks"
                    or NewTrackingCuts.mode() == "ForwardTracks"
                    or NewTrackingCuts.mode() == "PixelPrdAssociation"
                    or NewTrackingCuts.mode() == "DBM"
                    or NewTrackingCuts.mode() == "PixelFourLayer"
                    or NewTrackingCuts.mode() == "PixelThreeLayer"):
                InDetAmbiguityProcessor.ObserverTool = TrackObserverTool  #observerTool
                InDetAmbiguityProcessor.MonitorAmbiguitySolving = True

            ToolSvc += InDetAmbiguityProcessor
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiguityProcessor
            #
            # --- set input and output collection
            #
            InputTrackCollection = self.__SiTrackCollection
            self.__SiTrackCollection = ResolvedTrackCollectionKey
            #
            # --- configure Ambiguity solver
            #
            from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
            InDetAmbiguitySolver = Trk__TrkAmbiguitySolver(
                name='InDetAmbiguitySolver' + NewTrackingCuts.extension(),
                TrackInput=[InputTrackCollection],
                TrackOutput=self.__SiTrackCollection,
                AmbiguityProcessor=InDetAmbiguityProcessor)
            topSequence += InDetAmbiguitySolver
            if (InDetFlags.doPrintConfigurables()):
                print InDetAmbiguitySolver

            #
            # --- Delete Silicon Sp-Seeded tracks
            #
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(key=SiSPSeededTrackCollectionKey)

            if ((NewTrackingCuts.mode() in ["Pixel", "SCT"])
                    or not InDetFlags.doSGDeletion()):
                if InDetFlags.doTruth():
                    #
                    # set up the truth info for this container
                    #
                    include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                    InDetTracksTruth = ConfiguredInDetTrackTruth(
                        self.__SiTrackCollection,
                        self.__SiTrackCollection + "DetailedTruth",
                        self.__SiTrackCollection + "TruthCollection")
                    #
                    # add final output for statistics
                    #
                    TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                    TrackCollectionTruthKeys += [
                        InDetTracksTruth.TracksTruth()
                    ]
                else:
                    TrackCollectionKeys += [self.__SiTrackCollection]
Пример #22
0
                FatrasKeyFlags.RefittedTrackCollection()
            ]
            TrkValNtupleWriter.TrackTruthCollection += [
                FatrasKeyFlags.RefittedTrackCollection() + 'Truth'
            ]

####################################################
# File Output
include('FatrasExample/FatrasOutput.py')

####################################################
# this is the place to modify the previous (external) settings
# (a) D3PD in case of single track simulation
if FatrasFlags.SingleTrackSimulation():
    from InDetRecExample.InDetJobProperties import InDetFlags
    if InDetFlags.doTrkD3PD():
        topSequence.D3PD.WriteInputDataHeader = False
        topSequence.D3PD.ExistDataHeader = False

#from AthenaCommon.AppMgr import ServiceMgr
#ServiceMgr.StoreGateSvc.Dump = True

####################################################
# Auditors
if FatrasFlags.RunAuditors():
    # --- load AuditorSvc
    theAuditorSvc = ServiceMgr.AuditorSvc
    # --- write out summary of the memory usage
    #   | number of events to be skip to detect memory leak
    #   | 20 is default. May need to be made larger for complete jobs.
    theAuditorSvc.Auditors += ['ChronoAuditor']

#--------------------------------------------------------------
# Load POOL support, setup for reconstruction
#--------------------------------------------------------------

# --- GeoModel
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit
include("BFieldAth/BFieldAth_jobOptions.py")

# LEVEL 5: Extrapolator

include('TrkDetDescrSvc/AtlasTrackingGeometrySvc.py')

if InDetFlags.propagatorType() is "STEP":
  from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator as Propagator
else:
  from TrkExRungeKuttaPropagator.TrkExRungeKuttaPropagatorConf import Trk__RungeKuttaPropagator as Propagator
InDetPropagator = Propagator(name = 'InDetPropagator')
if InDetFlags.propagatorType() is "RungeKutta":
  InDetPropagator.AccuracyParameter = 0.0001
ToolSvc += InDetPropagator

# set up the propagator for outside ID (A.S. needed as a fix for 14.5.0 )
from TrkExSTEP_Propagator.TrkExSTEP_PropagatorConf import Trk__STEP_Propagator as StepPropagator
InDetStepPropagator = StepPropagator(name = 'InDetStepPropagator')
ToolSvc += InDetStepPropagator
if InDetFlags.doPrintConfigurables: print      InDetPropagator

#
Пример #24
0
InDetFlags.doVtxNtuple = False
InDetFlags.doConvVtxNtuple = False
InDetFlags.doV0VtxNtuple = False
InDetFlags.doRefit = doRefitTracks
InDetFlags.doLowBetaFinder = False
InDetFlags.doPrintConfigurables = True

# --- activate (memory/cpu) monitoring
#InDetFlags.doPerfMon = True

# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
# This way RecExCommon just needs to import the properties without doing anything else!
# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!

from InDetRecExample.InDetKeys import InDetKeys
if InDetFlags.doVertexFinding() and readAOD:
    InDetKeys.Tracks = InDetKeys.TrackParticles()

# uncomment if you don't want to overwrite the original fits (e.g. for comparison)
# this would also require enabling "pass-through" output mode (see bottom of this file)
# or else manually adding the input collection to the output stream
#if InDetFlags.doVertexFinding():
#  InDetKeys.xAODVertexContainer = "RefitPrimaryVertices"

if readESD and not redoPatternRecoAndTracking:
    InDetKeys.UnslimmedTracks = 'Tracks'
    InDetKeys.UnslimmedTracksTruth = 'TrackTruthCollection'

# Set container names
if doWriteESD:
    InDetKeys.OutputESDFileName = "InDetRecESD_new.root"
Пример #25
0
def VertexGroupD3PD(alg=None,
                    file=VertexD3PDAnalysisKeys.D3PDFileName(),
                    treeName=VertexD3PDAnalysisKeys.D3PDTreeName(),
                    **kw):

    print '[TrackD3PDMaker.VertexGroupD3PD] Vertex group D3PD settings:'
    print 'VertexD3PDAnalysisFlags'
    print VertexD3PDAnalysisFlags
    print 'VertexD3PDAnalysisKeys'
    print VertexD3PDAnalysisKeys

    if not alg:
        ## Create a new algorithm
        from OutputStreamAthenaPool.MultipleStreamManager import MSMgr
        alg = MSMgr.NewRootStream(treeName, file)

    ## General event information (custom options prefix: 'ei_')
    if VertexD3PDAnalysisFlags.useEventInfo():
        from EventCommonD3PDMaker.EventInfoD3PDObject import EventInfoD3PDObject
        alg += EventInfoD3PDObject(**_args('ei_', kw, level=0, prefix='ei_'))

    ## Trigger information (custom options prefix: 'trig_')
    if VertexD3PDAnalysisFlags.useTrigger():
        from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
        cfg = TriggerConfigGetter("ReadPool")
        from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits
        from TriggerD3PDMaker.TrigConfMetadata import addTrigConfMetadata
        from TriggerD3PDMaker.TrigDecisionD3PDObject import TrigDecisionD3PDObject
        alg += TrigDecisionD3PDObject(**_args('trig_', kw, level=2))
        addTrigConfMetadata(alg)
    if VertexD3PDAnalysisFlags.useTriggerRaw():
        from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter
        cfg = TriggerConfigGetter("ReadPool")
        from TriggerD3PDMaker.defineTriggerBits import defineTriggerBits
        from TriggerD3PDMaker.TrigConfMetadata import addTrigConfMetadata
        #Setup custom D3PD object with raw trigger info only (e.g. calibration_vdM streams)
        from D3PDMakerCoreComps.D3PDObject import make_Void_D3PDObject
        import TriggerD3PDMaker
        TrigDecisionD3PDObjectRaw = make_Void_D3PDObject(
            "trigRaw_",
            "TrigDecisionD3PDObjectRaw",
            default_name="TrigDecisionFillerRaw")
        if not VertexD3PDAnalysisFlags.useTrigger():
            TrigDecisionD3PDObjectRaw.defineBlock(
                0,
                "TriggerRawInfo",
                TriggerD3PDMaker.TrigDecisionFillerTool,
                SaveLVL1Raw=True,
                SaveHLTRaw=True,
                SaveBGCode=True)
        else:
            TrigDecisionD3PDObjectRaw.defineBlock(
                0,
                "TriggerRawInfo",
                TriggerD3PDMaker.TrigDecisionFillerTool,
                SaveHLTRaw=True,
                SaveBGCode=True)
        #Finally add object to algorithms
        alg += TrigDecisionD3PDObjectRaw(**_args('trig_', kw, level=0))
        if not VertexD3PDAnalysisFlags.useTrigger():
            #unless we've already added it, add meta-data as well
            addTrigConfMetadata(alg)

    ## Beam background information (custom options prefix: 'bkg_')
    if VertexD3PDAnalysisFlags.useBackgroundWord():
        from BackgroundD3PDMaker.BackgroundWordD3PDObject import BackgroundWordD3PDObject
        alg += BackgroundWordD3PDObject(**_args('bkg_', kw, level=0))

    ## Tracks and V0 information (custom options prefix: 'trk_', and 'v0_')
    if VertexD3PDAnalysisFlags.useTracks():
        labelDefaultVtx = VertexD3PDAnalysisKeys.LabelDefaultVtx()
        prefixDefaultVtx = labelDefaultVtx + '_'  #Add trailing '_'

        import TrackD3PDMaker
        from TrackD3PDMaker.TrackD3PDMakerFlags import TrackD3PDFlags
        from TrackD3PDMaker.TrackD3PDObject import TrackD3PDObject
        from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags
        from TruthD3PDMaker.TruthD3PDMakerFlags import TruthD3PDFlags
        from TruthD3PDMaker.TruthD3PDMakerKeys import TruthD3PDKeys
        VtxD3PD_Track_Exclude = ['vx_weight']
        TrackD3PDMaker.PerigeeUnbiasedIPAtPVFillerTool.DoBiased = False  #Switch off biased perigee
        TrackParticleD3PDObjectForVertex = TrackD3PDObject(
            _label='trk',
            _prefix='trk_',
            _sgkey=D3PDMakerFlags.TrackSGKey(),
            _object_name='TrackParticleD3PDObjectForVertex',
            typeName='Rec::TrackParticleContainer',
            vertexTarget=labelDefaultVtx,
            vertexPrefix=prefixDefaultVtx,
            vertexSGKey='VxPrimaryCandidate',
            truthTarget=TruthD3PDFlags.GenParticleAssocLabel(),
            truthPrefix=TruthD3PDKeys.GenParticlePrefix(),
            detailedTruthPrefix='',  # 'mc_detailed_'
            SGKeyForTruth=D3PDMakerFlags.TrackSGKey(),
            truthMapKey='TrackParticleTruthCollection',
            detailedTruthMapKey='',  #'DetailedTrackTruth'
            flags=TrackD3PDFlags)
        alg += TrackParticleD3PDObjectForVertex(
            **_args('trk_', kw, level=8, exclude=VtxD3PD_Track_Exclude))

    if VertexD3PDAnalysisFlags.useSecondaryVertex():
        from TrackD3PDMaker.V0D3PDObject import V0D3PDObject
        alg += V0D3PDObject(**_args('v0_', kw, level=10))

    ## Store beamspot information (custom option perfix: 'bs_')
    if VertexD3PDAnalysisFlags.useBeamspot():
        from TrackD3PDMaker.BeamSpotD3PDObject import BeamSpotD3PDObject
        alg += BeamSpotD3PDObject(**_args('bs_', kw, level=0))

    ## Store vertex information (custom options prefix: 'vtx_' or 'vtx' for BuildVertexD3PDObject)
    from TrackD3PDMaker.VertexD3PDObject import PrimaryVertexD3PDObject
    from TrackD3PDMaker.VertexD3PDObject import BuildVertexD3PDObject
    from InDetRecExample.InDetKeys import InDetKeys
    from InDetRecExample.InDetJobProperties import InDetFlags
    #First dump existing content
    labelDefaultVtx = VertexD3PDAnalysisKeys.LabelDefaultVtx()
    prefixDefaultVtx = labelDefaultVtx + '_'  #Add trailing '_'
    VtxDefaultD3PDObj = BuildVertexD3PDObject(
        **_args('vtx',
                kw,
                _prefix=prefixDefaultVtx,
                _label=labelDefaultVtx,
                _sgkey=InDetKeys.PrimaryVertices(),
                trackTarget='trk',
                trackPrefix='trk_',
                trackType='Rec::TrackParticleContainer'))
    alg += VtxDefaultD3PDObj(**_args('vtx_', kw, level=10))
    #Then also dump the other vertex collections
    if VertexD3PDAnalysisFlags.useAllVertexCollections:
        #Use non BC and split collections (sorry, no customization of parameters here)
        if not InDetFlags.doSplitVertexFindingForMonitoring():
            #raise NameError('Requesting split vertices but algorith has not run!')
            #pass
            print(
                '[TrackD3PDMaker.VertexGroupD3PD] WARNING: Requested split vertices, but algorithm has not run! Skipped.'
            )
        else:
            SplitPrimaryVertexD3PDObject = BuildVertexD3PDObject(
                _prefix='vxsplit_',
                _label='vxsplit',
                _sgkey=InDetKeys.PrimaryVerticesSplitStream(),
                trackTarget='trk',
                trackPrefix='trk_',
                trackType='Rec::TrackParticleContainer')
            alg += SplitPrimaryVertexD3PDObject(8)

        #Then store also non beamspot constrained ones
        if not InDetFlags.doVertexFindingForMonitoring():
            #raise NameError('Requesting NBC vertices but algorith has not run!')
            #pass
            print(
                '[TrackD3PDMaker.VertexGroupD3PD] WARNING: Requested non beamspot constrained vertices, but algorithm has not run! Skipped.'
            )
        else:
            NoBeamConstraintPrimaryVertexD3PDObject = BuildVertexD3PDObject(
                _prefix='vxnbc_',
                _label='vxnbc',
                _sgkey=InDetKeys.PrimaryVerticesWithoutBeamConstraint(),
                trackTarget='trk',
                trackPrefix='trk_',
                trackType='Rec::TrackParticleContainer')
            alg += NoBeamConstraintPrimaryVertexD3PDObject(8)

    ## Store truth-level information (custom options prefix: 'tuthVtx_', 'truthEvt_', 'truthPart_')
    if VertexD3PDAnalysisFlags.useTruth():
        from TruthD3PDAnalysis.TruthD3PDAnalysisConf import D3PD__GenObjectsFilterTool
        trackGenObjectsFilterTool = D3PD__GenObjectsFilterTool(
            "trackGenObjectsFilterTool")
        from AthenaCommon.AppMgr import ToolSvc
        ToolSvc += trackGenObjectsFilterTool

        if (VertexD3PDAnalysisFlags.filterTightTruth()):
            trackGenObjectsFilterTool.SelectTruthTracks = True
            trackGenObjectsFilterTool.PtMin = VertexD3PDAnalysisKeys.TruthTrackCutPtMin(
            )
            trackGenObjectsFilterTool.EtaMax = VertexD3PDAnalysisKeys.TruthTrackCutEtaMax(
            )
            trackGenObjectsFilterTool.RemoveEmptyEvents = True
            trackGenObjectsFilterTool.RemoveDummyEvents = True
            trackGenObjectsFilterTool.RemoveInTimePileUp = False
            trackGenObjectsFilterTool.Remove2BCPileUp = True
            trackGenObjectsFilterTool.Remove800nsPileUp = True
            trackGenObjectsFilterTool.RemoveCavernBkg = False
            trackGenObjectsFilterTool.AddOnlyFirstVertex = VertexD3PDAnalysisKeys.TruthAddOnlyFirstVertex(
            )
        else:
            #Use a more inclusive truth policy
            trackGenObjectsFilterTool.SelectTruthTracks = False
            trackGenObjectsFilterTool.PtMin = VertexD3PDAnalysisKeys.TruthTrackCutPtMin(
            )
            trackGenObjectsFilterTool.EtaMax = VertexD3PDAnalysisKeys.TruthTrackCutEtaMax(
            )
            trackGenObjectsFilterTool.RemoveEmptyEvents = True
            trackGenObjectsFilterTool.RemoveDummyEvents = True
            trackGenObjectsFilterTool.AddOnlyFirstVertex = VertexD3PDAnalysisKeys.TruthAddOnlyFirstVertex(
            )

        from TruthD3PDMaker.GenEventD3PDObject import GenEventD3PDObject
        alg += GenEventD3PDObject(
            **_args('truthEvt_',
                    kw,
                    level=10,
                    filter=trackGenObjectsFilterTool,
                    pileup_CollectionGetterRegistry=alg.name() +
                    '_CollectionGetterRegistry'))

        from TruthD3PDMaker.GenVertexD3PDObject import GenVertexD3PDObject
        alg += GenVertexD3PDObject(**_args(
            'truthVtx_', kw, level=1, filter=trackGenObjectsFilterTool))

        from TruthD3PDMaker.GenParticleD3PDObject import GenParticleD3PDObject
        alg += GenParticleD3PDObject(**_args(
            'truthPart_', kw, level=10, filter=trackGenObjectsFilterTool))

        from TruthD3PDMaker.GenParticleD3PDObject import GenTruthTrackD3PDObject
        alg += GenTruthTrackD3PDObject(**_args('truthTrack_', kw, level=0))

    ## Dump higher level objects
    # Missing Energy (custom options prefix with VertexD3PDAnalysisKeys.MetCollections+'_')
    if VertexD3PDAnalysisFlags.useMET():
        for MET in VertexD3PDAnalysisKeys.MetCollections():
            VtxD3PD_Met_Key = MET
            VtxD3PD_Met_Prefix = MET.replace('_', '') + '_'
            VtxD3PD_Met_Level = 0  #Only basic info
            VtxD3PD_Met_Exclude = ['MET_Regions', 'L1_', 'L2_', 'EF_']
            from MissingETD3PDMaker.MissingETD3PDObject import RefFinalMETD3PDObject
            VtxD3PD_Met_Obj = RefFinalMETD3PDObject(
                **_args(MET + '_',
                        kw,
                        level=VtxD3PD_Met_Level,
                        sgkey=VtxD3PD_Met_Key,
                        prefix=VtxD3PD_Met_Prefix,
                        exclude=VtxD3PD_Met_Exclude))
            alg += VtxD3PD_Met_Obj

    #Muons (custom options prefix VtxD3PD_Muon_Prefix -- see below [e.g. muid_, staco_, ...])
    if VertexD3PDAnalysisFlags.useMuons():
        from MuonD3PDMaker.MuonD3PDObject import MuonD3PDObject
        for Muon in VertexD3PDAnalysisKeys.MuonCollections():
            VtxD3PD_Muon_Key = Muon
            VtxD3PD_Muon_Prefix = Muon + '_'
            if VtxD3PD_Muon_Key == 'MuidMuonCollection':
                VtxD3PD_Muon_Prefix = 'muid_'
            elif VtxD3PD_Muon_Key == 'StacoMuonCollection':
                VtxD3PD_Muon_Prefix = 'staco_'

            VtxD3PD_Muon_Level = 0  #Only basic info
            VtxD3PD_Muon_Exclude = [
                'EFCBInfo', 'EFMGInfo', 'EFMEInfo', 'L2CBInfo', 'L1Info',
                'L1_', 'L2_', 'EF_'
            ]
            VtxD3PD_Muon_Obj = MuonD3PDObject(
                **_args(VtxD3PD_Muon_Prefix,
                        kw,
                        level=VtxD3PD_Muon_Level,
                        sgkey=VtxD3PD_Muon_Key,
                        prefix=VtxD3PD_Muon_Prefix,
                        allowMissing=True,
                        exclude=VtxD3PD_Muon_Exclude))
            alg += VtxD3PD_Muon_Obj

    #Electrons (custom options prefix: 'el_')
    if VertexD3PDAnalysisFlags.useElectrons():
        from egammaD3PDMaker.ElectronD3PDObject import ElectronD3PDObject
        alg += ElectronD3PDObject(**_args('el_', kw, prefix='el_', level=0))

    #Photons (custom options prefix: 'ph_')
    if VertexD3PDAnalysisFlags.usePhotons():
        from egammaD3PDMaker.PhotonD3PDObject import PhotonD3PDObject
        alg += PhotonD3PDObject(**_args('ph_', kw, prefix='ph_', level=0))

    #Jets, JVF, b-jets (custom options prefix: 'jet_')
    if VertexD3PDAnalysisFlags.useJets():
        from JetD3PDMaker.JetD3PDObject import JetD3PDObject
        from JetTagD3PDMaker.JetTagD3PDMakerKeys import JetTagD3PDKeys
        from JetTagD3PDMaker.AddBTagD3PDInfo import addBTagInfoToJetObject
        addBTagInfoToJetObject(JetD3PDObject, btagLevelOffset=0)
        VtxD3PD_Jet_Include = [
            'Kinematics', 'JetVertexFraction', 'JVtx', 'EMFraction',
            'TrueFlavorComponents',
            JetTagD3PDKeys.BTagWeightsBlockName()
        ]
        for JET in VertexD3PDAnalysisKeys.JetCollections():
            VtxD3PD_Jet_Prefix = JET.replace('_', '') + '_'
            if len(VertexD3PDAnalysisKeys.JetCollections()) == 1:
                #only 1 element, simplify prefix
                VtxD3PD_Jet_Prefix = 'jet_'
            alg += JetD3PDObject(**_args('jet_',
                                         kw,
                                         sgkey=JET,
                                         prefix=VtxD3PD_Jet_Prefix,
                                         level=0,
                                         include=VtxD3PD_Jet_Include))

    #Taus
    if VertexD3PDAnalysisFlags.useTaus():
        from TauD3PDMaker.TauD3PDObject import TauD3PDObject
        VtxD3PD_Tau_Include = ['TauPriVtx']
        alg += TauD3PDObject(**_args(
            'tau_', kw, prefix='tau_', level=0, include=VtxD3PD_Tau_Include))

    ## Return algorithm
    return alg
Пример #26
0
InDetFlags.doVtxNtuple        = False
InDetFlags.doConvVtxNtuple    = False
InDetFlags.doV0VtxNtuple      = False
InDetFlags.doRefit            = doRefitTracks
InDetFlags.doLowBetaFinder    = False
InDetFlags.doPrintConfigurables = True

# --- activate (memory/cpu) monitoring
#InDetFlags.doPerfMon = True

# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
# This way RecExCommon just needs to import the properties without doing anything else!
# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!

from InDetRecExample.InDetKeys import InDetKeys
if InDetFlags.doVertexFinding() and readAOD:
  InDetKeys.Tracks = InDetKeys.TrackParticles()

# uncomment if you don't want to overwrite the original fits (e.g. for comparison)
# this would also require enabling "pass-through" output mode (see bottom of this file)
# or else manually adding the input collection to the output stream
#if InDetFlags.doVertexFinding():
#  InDetKeys.xAODVertexContainer = "RefitPrimaryVertices" 

if readESD and not redoPatternRecoAndTracking:
  InDetKeys.UnslimmedTracks              = 'Tracks'
  InDetKeys.UnslimmedTracksTruth         = 'TrackTruthCollection'

# Set container names
if doWriteESD:
  InDetKeys.OutputESDFileName = "InDetRecESD_new.root"
Пример #27
0
# ------------------------------------------------------------
#
# ----------- run monitoring
#
# this file is included from InDetRec_all.py (in case of ID standalone running)
# or through RecExCommon (data quality include)
# ------------------------------------------------------------
#
# --- checking for presence of flags
#
from InDetRecExample.InDetJobProperties import InDetFlags

if InDetFlags.doMonitoringGlobal() or InDetFlags.doMonitoringPrimaryVertexingEnhanced():
  include("InDetRecExample/InDetMonitoringGlobal.py")
if InDetFlags.doMonitoringPixel():
  include( "InDetRecExample/InDetMonitoringPixel.py")
if InDetFlags.doMonitoringSCT():
  include( "InDetRecExample/InDetMonitoringSCT.py" )
if InDetFlags.doMonitoringTRT():
  include( "InDetRecExample/InDetMonitoringTRT.py" )
if InDetFlags.doMonitoringAlignment():
  include("InDetRecExample/InDetMonitoringAlignment.py")
   def __init__(self, InputCollections = None, NewTrackingCuts = None, TrackCollectionKeys=[] , TrackCollectionTruthKeys=[]):

      from InDetRecExample.InDetJobProperties import InDetFlags
      from InDetRecExample.InDetKeys          import InDetKeys
      #
      # get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr                import ToolSvc
      from AthenaCommon.AlgSequence           import AlgSequence
      topSequence = AlgSequence()

      #
      # --- decide if use the association tool
      #
      if len(InputCollections) > 0:
         usePrdAssociationTool = True
      else:
         usePrdAssociationTool = False

      # --- the PRD association tool is filled by the Segment making
      #     no need to run again
      
      # ------------------------------------------------------------
      #
      # ---------- TRT Seeded Tracking
      #
      # ------------------------------------------------------------

      if InDetFlags.doTRTSeededTrackFinder():
         #
         # --- decide which TRT seed space point finder to use
         #
         if InDetFlags.loadTRTSeededSPFinder():
            #
            # --- defaul space point finder
            #
            from TRT_SeededSpacePointFinderTool.TRT_SeededSpacePointFinderToolConf import InDet__TRT_SeededSpacePointFinder_ATL
            InDetTRT_SeededSpacePointFinder = InDet__TRT_SeededSpacePointFinder_ATL(name                   = 'InDetTRT_SeededSpFinder'  ,
                                                                                    SpacePointsSCTName     = InDetKeys.SCT_SpacePoints(),
                                                                                    SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
                                                                                    AssociationTool        = InDetPrdAssociationTool    ,
                                                                                    UseAssociationTool     = usePrdAssociationTool      ,
                                                                                    NeighborSearch         = True,
                                                                                    LoadFull               = False,
                                                                                    DoCosmics              = InDetFlags.doCosmics(),
                                                                                    pTmin                  = NewTrackingCuts.minSecondaryPt())
            #InDetTRT_SeededSpacePointFinder.OutputLevel = VERBOSE

         elif InDetFlags.loadSimpleTRTSeededSPFinder():
            #
            # --- alternative version using the region selector
            #
            from RegionSelector.RegSelSvcDefault import RegSelSvcDefault
            InDetRegSelSvc             = RegSelSvcDefault()
            InDetRegSelSvc.enablePixel = DetFlags.pixel_on()
            InDetRegSelSvc.enableSCT   = DetFlags.SCT_on()

            ServiceMgr += InDetRegSelSvc
            if (InDetFlags.doPrintConfigurables()):
               print InDetRegSelSvc
               
            from TRT_SeededSpacePointFinderTool.TRT_SeededSpacePointFinderToolConf import InDet__SimpleTRT_SeededSpacePointFinder_ATL
            InDetTRT_SeededSpacePointFinder = InDet__SimpleTRT_SeededSpacePointFinder_ATL(name                   = 'InDetTRT_SeededSpFinder'  ,
                                                                                          SpacePointsSCTName     = InDetKeys.SCT_SpacePoints(),
                                                                                          SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
                                                                                          PerigeeCut             = 1000.,
                                                                                          DirectionPhiCut        = .3,
                                                                                          DirectionEtaCut        = 1.,
                                                                                          MaxHoles               = 2,
                                                                                          AssociationTool        = InDetPrdAssociationTool,
                                                                                          RestrictROI            = True)
            #InDetTRT_SeededSpacePointFinder.OutputLevel = VERBOSE
            if not usePrdAssociationTool:
               InDetTRT_SeededSpacePointFinder.AssociationTool = None 

         # add either into the Tool Service
         ToolSvc += InDetTRT_SeededSpacePointFinder
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededSpacePointFinder
         #
         # Silicon det elements road maker tool
         #
         from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
         InDetTRT_SeededSiRoadMaker = InDet__SiDetElementsRoadMaker_xk(name               = 'InDetTRT_SeededSiRoad'  ,
                                                                       PropagatorTool     = InDetPatternPropagator   ,
                                                                       usePixel           = NewTrackingCuts.usePixel(),
                                                                       PixManagerLocation = InDetKeys.PixelManager() ,
                                                                       useSCT             = NewTrackingCuts.useSCT(), 
                                                                       SCTManagerLocation = InDetKeys.SCT_Manager()  ,
                                                                       RoadWidth          = 35.,
                                                                       MaxStep            = 20.)                       # NOT DEFAULT ?
         #InDetTRT_SeededSiRoadMaker.OutputLevel = VERBOSE
         if InDetFlags.doCosmics():
            InDetTRT_SeededSiRoadMaker.RoadWidth = 50
      
         ToolSvc += InDetTRT_SeededSiRoadMaker
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededSiRoadMaker
         #
         # --- TRT seeded back tracking tool
         #
         from TRT_SeededTrackFinderTool.TRT_SeededTrackFinderToolConf import InDet__TRT_SeededTrackFinder_ATL
         InDetTRT_SeededTrackTool =  InDet__TRT_SeededTrackFinder_ATL(name                     = 'InDetTRT_SeededTrackMaker',
                                                                      PropagatorTool           = InDetPatternPropagator,
                                                                      UpdatorTool              = InDetPatternUpdator,
                                                                      RoadTool                 = InDetTRT_SeededSiRoadMaker,
                                                                      SeedTool                 = InDetTRT_SeededSpacePointFinder,
                                                                      CombinatorialTrackFinder = InDetSiComTrackFinder,
                                                                      pTmin                    = NewTrackingCuts.minSecondaryPt(),
                                                                      nHolesMax                = NewTrackingCuts.SecondarynHolesMax(),
                                                                      # ME bugfix: nHolesGapMax             = 2*NewTrackingCuts.SecondarynHolesGapMax(),
                                                                      nHolesGapMax             = NewTrackingCuts.SecondarynHolesGapMax(),
                                                                      Xi2max                   = NewTrackingCuts.SecondaryXi2max(),
                                                                      Xi2maxNoAdd              = NewTrackingCuts.SecondaryXi2maxNoAdd(),
                                                                      ConsistentSeeds          = True,
                                                                      #BremCorrection           = True,
                                                                      BremCorrection           = False,
                                                                      UseAssociationTool       = usePrdAssociationTool)
         if InDetFlags.doCosmics():
            InDetTRT_SeededTrackTool.nWClustersMin = 0
      
         ToolSvc   += InDetTRT_SeededTrackTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededTrackTool

         #
         # --- Output key for the finder
         #
         self.__TRTSeededTracks = InDetKeys.TRTSeededTracks()
         #
         # TRT seeded back tracking algorithm
         #
         from TRT_SeededTrackFinder.TRT_SeededTrackFinderConf import InDet__TRT_SeededTrackFinder
         InDetTRT_SeededTrackFinder = InDet__TRT_SeededTrackFinder(name                  = 'InDetTRT_SeededTrackFinder',
                                                                   RefitterTool          = InDetTrackFitter,
                                                                   TrackTool             = InDetTRT_SeededTrackTool,
                                                                   TrackExtensionTool    = InDetTRTExtensionTool,
                                                                   MinTRTonSegment       = NewTrackingCuts.minSecondaryTRTonTrk(),
                                                                   MinTRTonly            = NewTrackingCuts.minTRTonly(),
                                                                   TrtExtension          = True,
                                                                   SiExtensionCuts       = NewTrackingCuts.SiExtensionCuts(),
                                                                   minPt                 = NewTrackingCuts.minSecondaryPt(),
                                                                   maxRPhiImp            = NewTrackingCuts.maxSecondaryImpact(),
                                                                   maxZImp               = NewTrackingCuts.maxZImpact(),
                                                                   maxEta                = NewTrackingCuts.maxEta(),
                                                                   Extrapolator          = InDetExtrapolator,
                                                                   RejectShortExtension  = NewTrackingCuts.rejectShortExtensions(),
                                                                   FinalRefit            = False,
                                                                   FinalStatistics       = False,
                                                                   OutputSegments        = False,
                                                                   InputSegmentsLocation = InDetKeys.TRT_Segments(),
                                                                   OutputTracksLocation  = self.__TRTSeededTracks)
         # InDetTRT_SeededTrackFinder.OutputLevel = VERBOSE
         topSequence += InDetTRT_SeededTrackFinder
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededTrackFinder
            
         #
         # ------------ Track truth.
         #
         if not InDetFlags.doSGDeletion():
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__TRTSeededTracks,
                                                            self.__TRTSeededTracks+"DetailedTruth",
                                                            self.__TRTSeededTracks+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__TRTSeededTracks ]
               
         # --- output track collection
         self.__BackTrackingTracks = self.__TRTSeededTracks

      # ------------------------------------------------------------
      #
      # --- Resolve back tracking tracks ? 
      #
      # ------------------------------------------------------------

      if InDetFlags.doResolveBackTracks():
         #
         # --- set up special Scoring Tool for TRT seeded tracks
         #
         if InDetFlags.doCosmics():
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
            InDetTRT_SeededScoringTool = InDet__InDetCosmicScoringTool(name                 = 'InDetCosmicScoringTool_TRT',
                                                                       nWeightedClustersMin = 0,
                                                                       minTRTHits           = NewTrackingCuts.minSecondaryTRTonTrk(),
                                                                       SummaryTool          = InDetTrackSummaryTool)
         else:
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
            InDetTRT_SeededScoringTool = InDet__InDetAmbiScoringTool(name                    = 'InDetTRT_SeededScoringTool',
                                                                     Extrapolator            = InDetExtrapolator,
                                                                     DriftCircleCutTool      = InDetTRTDriftCircleCut,
                                                                     SummaryTool             = InDetTrackSummaryTool,
                                                                     useTRT_AmbigFcn         = InDetFlags.doNewTracking(),     # full search => use NewT
                                                                     useAmbigFcn             = not InDetFlags.doNewTracking(), # full search => use NewT
                                                                     minPt                   = NewTrackingCuts.minSecondaryPt(),
                                                                     maxRPhiImp              = NewTrackingCuts.maxSecondaryImpact(),
                                                                     maxZImp                 = NewTrackingCuts.maxZImpact(),
                                                                     maxEta                  = NewTrackingCuts.maxEta(),
                                                                     minSiClusters           = NewTrackingCuts.minSecondaryClusters(),
                                                                     maxSiHoles              = NewTrackingCuts.maxSecondaryHoles(),
                                                                     maxPixelHoles           = NewTrackingCuts.maxSecondaryPixelHoles(),
                                                                     maxSCTHoles             = NewTrackingCuts.maxSecondarySCTHoles(),
                                                                     maxDoubleHoles          = NewTrackingCuts.maxSecondaryDoubleHoles(),
                                                                     usePixel                = NewTrackingCuts.usePixel(),
                                                                     useSCT                  = NewTrackingCuts.useSCT(),
                                                                     minTRTonTrk             = NewTrackingCuts.minSecondaryTRTonTrk(),
                                                                     minTRTPrecisionFraction = NewTrackingCuts.minSecondaryTRTPrecFrac())
         # InDetTRT_SeededScoringTool.OutputLevel = DEBUG
         ToolSvc += InDetTRT_SeededScoringTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededScoringTool
      
         #
         # --- Load selection tool
         #
         from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool
         InDetTRT_SeededAmbiTrackSelectionTool = InDet__InDetAmbiTrackSelectionTool(name                = 'InDetTRT_SeededAmbiTrackSelectionTool',
                                                                                    AssociationTool     =  InDetPrdAssociationTool,
                                                                                    DriftCircleCutTool  =  InDetTRTDriftCircleCut,
                                                                                    minScoreShareTracks = -1., # off !
                                                                                    minHits             = NewTrackingCuts.minSecondaryClusters(),
                                                                                    minNotShared        = NewTrackingCuts.minSecondarySiNotShared(),
                                                                                    maxShared           = NewTrackingCuts.maxSecondaryShared(),
                                                                                    minTRTHits          = NewTrackingCuts.minSecondaryTRTonTrk(),
                                                                                    UseParameterization = NewTrackingCuts.useParameterizedTRTCuts(),
                                                                                    Cosmics             = InDetFlags.doCosmics(),
                                                                                    doPixelSplitting    = InDetFlags.doPixelClusterSplitting())
      
         # InDetTRT_SeededAmbiTrackSelectionTool.OutputLevel = DEBUG
         ToolSvc += InDetTRT_SeededAmbiTrackSelectionTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededAmbiTrackSelectionTool

         #
         # --- load Ambiguity Processor
         #
         from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool
         InDetTRT_SeededAmbiguityProcessor = Trk__SimpleAmbiguityProcessorTool(name               = 'InDetTRT_SeededAmbiguityProcessor',
                                                                               Fitter             = InDetTrackFitter,          
                                                                               SelectionTool      = InDetTRT_SeededAmbiTrackSelectionTool,
                                                                               RefitPrds          = not InDetFlags.refitROT(),
                                                                               SuppressTrackFit   = False,
                                                                               SuppressHoleSearch = False,
                                                                               ScoringTool        = InDetTRT_SeededScoringTool)
         # InDetTRT_SeededAmbiguityProcessor.OutputLevel = DEBUG
         if InDetFlags.materialInteractions():
            InDetTRT_SeededAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType()
         else:
            InDetTRT_SeededAmbiguityProcessor.MatEffects = 0
         #
         ToolSvc += InDetTRT_SeededAmbiguityProcessor
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededAmbiguityProcessor

         #
         # --- load the algorithm
         #
         self.__ResolvedTRTSeededTracks = InDetKeys.ResolvedTRTSeededTracks() 
         #
         from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
         InDetTRT_SeededAmbiguitySolver = Trk__TrkAmbiguitySolver(name               = 'InDetTRT_SeededAmbiguitySolver',
                                                                  TrackInput         = [ self.__TRTSeededTracks ],
                                                                  TrackOutput        = self.__ResolvedTRTSeededTracks,
                                                                  AmbiguityProcessor = InDetTRT_SeededAmbiguityProcessor)
         topSequence += InDetTRT_SeededAmbiguitySolver
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SeededAmbiguitySolver

         # --- Delete (non-resloved) TRT seeded tracks
         from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
         InDetSGDeletionAlg(key = InDetKeys.TRTSeededTracks())
         
         #
         # ------------ Track truth.
         #
         if not InDetFlags.doSGDeletion():
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__ResolvedTRTSeededTracks,
                                                            self.__ResolvedTRTSeededTracks+"DetailedTruth",
                                                            self.__ResolvedTRTSeededTracks+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__ResolvedTRTSeededTracks ]
               
         # --- output track collection
         self.__BackTrackingTracks = self.__ResolvedTRTSeededTracks
Пример #29
0
def InDetTrackFitterTRT(name='InDetTrackFitterTRT', **kwargs):
    from InDetRecExample.InDetJobProperties import InDetFlags
    if InDetFlags.trackFitterType() != 'GlobalChi2Fitter':
        return InDetTrackFitter(name, **kwargs)
    else:
        return InDetGlobalChi2FitterTRT(name, **kwargs)
Пример #30
0
print "EMCommonRefitter.py"
from InDetRecExample.InDetJobProperties import InDetFlags
from AthenaCommon.AppMgr import ToolSvc, ServiceMgr
from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.GlobalFlags import globalflags

from egammaRec import egammaRecFlags as egRecFlags

egammaRecFlags = egRecFlags.jobproperties.egammaRecFlags

#Deal with the Rot creator
if hasattr(ToolSvc, 'InDetRotCreator'):
    egRotCreator = ToolSvc.InDetRotCreator
else:
    #Setup e/gamma offline RotCreator if one is not present
    if InDetFlags.doPixelClusterSplitting(
    ) and InDetFlags.pixelClusterSplittingType() == 'NeuralNet':
        # --- temp: read calib file
        from AthenaCommon.AppMgr import ServiceMgr as svcMgr
        if not hasattr(svcMgr, 'THistSvc'):
            from GaudiSvc.GaudiSvcConf import THistSvc
            svcMgr += THistSvc()

        # --- neutral network tools
        import sys, os
        from TrkNeuralNetworkUtils.TrkNeuralNetworkUtilsConf import Trk__NeuralNetworkToHistoTool
        egNeuralNetworkToHistoTool = Trk__NeuralNetworkToHistoTool(
            name="egNeuralNetworkToHistoTool")
        ToolSvc += egNeuralNetworkToHistoTool

        #--- new NN factor
        # COOL binding
Пример #31
0
    def __init__(self,
                 Tracks=None,
                 DetailedTruth=None,
                 TracksTruth=None,
                 PixelClustersTruth=InDetKeys.PixelClustersTruth(),
                 SCT_ClustersTruth=InDetKeys.SCT_ClustersTruth(),
                 TRT_DriftCirclesTruth=InDetKeys.TRT_DriftCirclesTruth()):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from AthenaCommon.DetFlags import DetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        from RecExConfig.hideInput import hideInput
        topSequence = AlgSequence()
        #
        # --- Enable the detailed track truth
        #
        from InDetTruthAlgs.InDetTruthAlgsConf import InDet__InDetDetailedTrackTruthMaker
        hideInput('DetailedTrackTruthCollection', DetailedTruth)
        DetailedTruthMaker = InDet__InDetDetailedTrackTruthMaker(
            name=DetailedTruth + "Maker",
            TrackCollectionName=Tracks,
            DetailedTrackTruthName=DetailedTruth,
            TruthNamePixel=PixelClustersTruth,
            TruthNameSCT=SCT_ClustersTruth,
            TruthNameTRT=TRT_DriftCirclesTruth)

        # this is how the truth maker gets to know which detector is on ...
        if (not DetFlags.haveRIO.pixel_on()):
            DetailedTruthMaker.TruthNamePixel = ""
        if (not DetFlags.haveRIO.SCT_on()):
            DetailedTruthMaker.TruthNameSCT = ""
        # for cosmics, at the stage of SiPatternRecognition, the TRT truth information is not yet available
        if ((not DetFlags.haveRIO.TRT_on())
                or (InDetFlags.doCosmics() and
                    (DetailedTruth == "SiSPSeededTracksDetailedTruth"
                     or DetailedTruth == "ResolvedTracksDetailedTruth"))):
            DetailedTruthMaker.TruthNameTRT = ""

        #if Tracks == "Tracks":
        #    DetailedTruthMaker.OutputLevel = VERBOSE
        topSequence += DetailedTruthMaker
        if (InDetFlags.doPrintConfigurables()):
            printfunc(DetailedTruthMaker)
        #
        # --- Detailed to old TrackTruth
        #
        if InDetFlags.truthMatchStrategy() == 'TruthMatchRatio':
            from TrkTruthCreatorTools.TrkTruthCreatorToolsConf import Trk__TruthMatchRatio as InDetTruthMatchTool
        elif InDetFlags.truthMatchStrategy() == 'TruthMatchTanimoto':
            from TrkTruthCreatorTools.TrkTruthCreatorToolsConf import Trk__TruthMatchTanimoto as InDetTruthMatchTool
        else:
            printfunc(
                "ConfiguredInDetTrackTruth: error! InDetFlags.truthMatchStrategy must be TruthMatchRatio or TruthMatchTanimoto but is: "
                + InDetFlags.truthMatchStrategy())

        InDetTruthMatchSimilarityTool = InDetTruthMatchTool(
            name="InDetTruthMatchTool",
            WeightPixel=10.,
            WeightSCT=5.,
            WeightTRT=1.)

        # --- only add this once !!!
        if not hasattr(ToolSvc, "InDetTruthMatchTool"):
            ToolSvc += InDetTruthMatchSimilarityTool
            if (InDetFlags.doPrintConfigurables()):
                printfunc(InDetTruthMatchSimilarityTool)

        from TrkTruthAlgs.TrkTruthAlgsConf import TrackTruthSimilaritySelector
        InDetTruthSimilaritySelector = TrackTruthSimilaritySelector(
            name=TracksTruth + "Selector",
            DetailedTrackTruthName=DetailedTruth,
            OutputName=TracksTruth,
            TrackTruthSimilarityTool=InDetTruthMatchSimilarityTool)
        #if Tracks == "Tracks":
        #    InDetTruthSimilaritySelector.OutputLevel = VERBOSE
        topSequence += InDetTruthSimilaritySelector
        if (InDetFlags.doPrintConfigurables()):
            printfunc(InDetTruthSimilaritySelector)

        # --- remember imput
        self.__Tracks = Tracks
        self.__TracksTruth = TracksTruth
        self.__DetailedTruth = DetailedTruth
Пример #32
0
    def __init__(self,
                 extension="",
                 InputCollections=None,
                 NewTrackingCuts=None,
                 BarrelSegments=None,
                 TrackCollectionKeys=[],
                 TrackCollectionTruthKeys=[]):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        from AthenaCommon.DetFlags import DetFlags
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        # --- Always use PRD association tool (even if only 1 collection) to remove TRT
        #     segments with significant overlaping hits
        usePrdAssociationTool = True
        #usePrdAssociationTool = True if len(InputCollections) > 0 else False

        #
        # --- get list of already associated hits (always do this, even if no other tracking ran before)
        #
        if usePrdAssociationTool:
            from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
            InDetTRTonly_PRD_Association = InDet__InDetTrackPRD_Association(
                name='InDetTRTonly_PRD_Association' + extension,
                AssociationTool=InDetPrdAssociationTool,
                TracksName=list(InputCollections))
            topSequence += InDetTRTonly_PRD_Association
            if (InDetFlags.doPrintConfigurables()):
                print InDetTRTonly_PRD_Association

        #
        # Cut values and output key for the TRT segments standalone TRT track finder
        #
        if extension == "_TRT":
            # TRT track segments
            pTmin = NewTrackingCuts.minPT()
            self.__TRTStandaloneTracks = InDetKeys.TRTTracks()
        else:
            # TRT standalone
            # pTmin                      = NewTrackingCuts.minSecondaryPt()
            pTmin = NewTrackingCuts.minTRTonlyPt(
            )  # new cut parameter to make it flexible...
            self.__TRTStandaloneTracks = InDetKeys.TRTTracks_NewT()

        #
        # --- set up special Scoring Tool for standalone TRT tracks
        #
        from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetTrtTrackScoringTool
        InDetTRT_StandaloneScoringTool = InDet__InDetTrtTrackScoringTool(
            name='InDetTRT_StandaloneScoringTool' + extension,
            SummaryTool=InDetTrackSummaryTool,
            DriftCircleCutTool=InDetTRTDriftCircleCut,
            useAmbigFcn=True,
            useSigmaChi2=False,
            PtMin=pTmin,
            minTRTonTrk=NewTrackingCuts.minTRTonly(),
            maxEta=2.1,
            UseParameterization=NewTrackingCuts.useTRTonlyParamCuts(),
            OldTransitionLogic=NewTrackingCuts.useTRTonlyOldLogic(),
            minTRTPrecisionFraction=NewTrackingCuts.minSecondaryTRTPrecFrac())
        # InDetTRT_StandaloneScoringTool.OutputLevel = VERBOSE
        ToolSvc += InDetTRT_StandaloneScoringTool
        if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_StandaloneScoringTool

        #
        # set up TRT_SegmentToTrackTool
        #
        from TRT_SegmentToTrackTool.TRT_SegmentToTrackToolConf import InDet__TRT_SegmentToTrackTool
        InDetTRT_SegmentToTrackTool = InDet__TRT_SegmentToTrackTool(
            name='InDetTRT_SegmentToTrackTool' + extension,
            RefitterTool=InDetTrackFitterTRT,
            UseAssociationTool=usePrdAssociationTool,
            AssociationTool=InDetPrdAssociationTool,
            ScoringTool=InDetTRT_StandaloneScoringTool,
            Extrapolator=InDetExtrapolator,
            FinalRefit=True,
            MaxSharedHitsFraction=NewTrackingCuts.maxTRTonlyShared(),
            SuppressHoleSearch=True)
        ToolSvc += InDetTRT_SegmentToTrackTool
        if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_SegmentToTrackTool

        if not InDetFlags.doCosmics():
            #
            # --- TRT standalone tracks algorithm
            #

            from TRT_StandaloneTrackFinder.TRT_StandaloneTrackFinderConf import InDet__TRT_StandaloneTrackFinder
            InDetTRT_StandaloneTrackFinder = InDet__TRT_StandaloneTrackFinder(
                name='InDetTRT_StandaloneTrackFinder' + extension,
                MinNumDriftCircles=NewTrackingCuts.minTRTonly(),
                MinPt=NewTrackingCuts.minTRTonlyPt(),
                InputSegmentsLocation=BarrelSegments,
                MaterialEffects=0,
                ResetPRD=True if extension == "_TRT" else False,
                OldTransitionLogic=NewTrackingCuts.useTRTonlyOldLogic(),
                OutputTracksLocation=self.__TRTStandaloneTracks,
                TRT_SegToTrackTool=InDetTRT_SegmentToTrackTool)
            #InDetTRT_StandaloneTrackFinder.OutputLevel = VERBOSE
            topSequence += InDetTRT_StandaloneTrackFinder
            if InDetFlags.doPrintConfigurables():
                print InDetTRT_StandaloneTrackFinder

            # --- Delete TRT segments for the subdetector pattern only (back-tracking has already run by this point)
            from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
            InDetSGDeletionAlg(container="Trk::SegmentCollection#",
                               key=BarrelSegments)

        else:
            #
            # --- cosmics segment to track conversion for Barrel
            #

            from TRT_SegmentsToTrack.TRT_SegmentsToTrackConf import InDet__TRT_SegmentsToTrack
            InDetTrkSegmenttoTrk = InDet__TRT_SegmentsToTrack(
                name="InDetTRT_SegmentsToTrack_Barrel" + extension,
                InputSegmentsCollection=BarrelSegments,
                OutputTrackCollection=self.__TRTStandaloneTracks,
                TrackFitter=InDetTrackFitter,
                MinNHit=NewTrackingCuts.minTRTonly(),
                CombineTracks=False,
                OutputCombiCollection="",
                InputSCTCollection="",
                OutlierRemoval=True,
                MaterialEffects=False)
            #InDetTrkSegmenttoTrk.OutputLevel = VERBOSE
            topSequence += InDetTrkSegmenttoTrk
            if InDetFlags.doPrintConfigurables():
                print InDetTrkSegmenttoTrk

        #
        #
        # ------------ Track truth.
        #
        if (extension == "_TRT" or not InDetFlags.doSGDeletion()):
            if InDetFlags.doTruth():
                #
                # set up the truth info for this container
                #
                include("InDetRecExample/ConfiguredInDetTrackTruth.py")
                InDetTracksTruth = ConfiguredInDetTrackTruth(
                    self.__TRTStandaloneTracks,
                    self.__TRTStandaloneTracks + "DetailedTruth",
                    self.__TRTStandaloneTracks + "TruthCollection")
                #
                # add final output for statistics
                #
                TrackCollectionKeys += [InDetTracksTruth.Tracks()]
                TrackCollectionTruthKeys += [InDetTracksTruth.TracksTruth()]
            else:
                TrackCollectionKeys += [self.__TRTStandaloneTracks]
    def __init__(self, InputTrackCollections = [], TRT_Segments_EC = None):
        
        from InDetRecExample.InDetJobProperties import InDetFlags
        from AthenaCommon.DetFlags import DetFlags
        from InDetRecExample.InDetKeys import InDetKeys
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()
        
        if InDetFlags.doPRDFormation() and DetFlags.makeRIO.TRT_on():

            #    
            # --- calculation of the event phase from all 3 input collections
            #

            useNewEP = True
            if globalflags.DataSource == 'data':
                if InDetFlags.doCosmics():
                    globalOffset = 8
                else:
                    globalOffset = 0
            else:
                globalOffset = -3.125
            cutWindowCenter  = -8.5
            numberIterations = 5
            cutWindowSize    = 7
                                                    
            #    
            # --- load tool
            #
            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetCosmicsEventPhaseTool
            InDetCosmicsEventPhaseTool = InDet__InDetCosmicsEventPhaseTool(name              = "InDetCosmicsEventPhaseTool",
                                                                           UseTRTCalibration = True,
                                                                           UseNewEP          = useNewEP,
                                                                           GlobalOffset      = globalOffset
                                                                           )
                                                                           
            ToolSvc += InDetCosmicsEventPhaseTool
            if(InDetFlags.doPrintConfigurables()):
                print InDetCosmicsEventPhaseTool
            
            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetFixedWindowTrackTimeTool
            InDetFixedWindowTrackTimeTool = InDet__InDetFixedWindowTrackTimeTool(name              = "InDetFixedWindowTrackTimeTool",
                                                                                 UseTRTCalibration = True,
                                                                                 UseNewEP          = useNewEP,
                                                                                 GlobalOffset      = globalOffset,
                                                                                 WindowCenter      = cutWindowCenter,
                                                                                 WindowSize        = cutWindowSize
                                                                                 )
                                                                           
            ToolSvc += InDetFixedWindowTrackTimeTool
            if(InDetFlags.doPrintConfigurables()):
                print InDetFixedWindowTrackTimeTool
            
            
            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetSlidingWindowTrackTimeTool
            InDetSlidingWindowTrackTimeTool = InDet__InDetSlidingWindowTrackTimeTool(name              = "InDetSlidingWindowTrackTimeTool",
                                                                                     UseTRTCalibration = True,
                                                                                     UseNewEP          = useNewEP,
                                                                                     GlobalOffset      = globalOffset,
                                                                                     NumberIterations  = numberIterations,
                                                                                     WindowSize        = cutWindowSize
                                                                                     )
                                                                           
            ToolSvc += InDetSlidingWindowTrackTimeTool
            if(InDetFlags.doPrintConfigurables()):
                print InDetSlidingWindowTrackTimeTool

            #
            # --- load algorithm
            #
            from InDetCosmicsEventPhase.InDetCosmicsEventPhaseConf import InDet__InDetCosmicsEventPhase
            InDetCosmicsEventPhase = InDet__InDetCosmicsEventPhase(name              = "InDetCosmicsEventPhase",
                                                                   InputTracksNames  = InputTrackCollections,
                                                                 #  InputSegmentsName = TRT_Segments_EC,
                                                                   TrackSummaryTool  = InDetTrackSummaryTool,
                                                                   #EventPhaseTool    = InDetCosmicsEventPhaseTool)
                                                                   #EventPhaseTool    = InDetFixedWindowTrackTimeTool)
                                                                   EventPhaseTool    = InDetSlidingWindowTrackTimeTool)
            if InDetFlags.doCosmics():
                InDetCosmicsEventPhase.EventPhaseTool=InDetCosmicsEventPhaseTool
            topSequence += InDetCosmicsEventPhase
            if (InDetFlags.doPrintConfigurables()):
                print InDetCosmicsEventPhase
Пример #34
0
from InDetRecExample.InDetJobProperties import InDetFlags
from InDetRecExample.InDetKeys import InDetKeys
# --- load cabling setup
include("InDetRecExample/InDetRecCabling.py")

if DetFlags.readRDOBS.pixel_on():
    from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRodDecoder
    InDetPixelRodDecoder = PixelRodDecoder(name="InDetPixelRodDecoder")
    # Disable duplcated pixel check for data15 because duplication mechanism was used.
    from RecExConfig.RecFlags import rec
    if len(rec.projectName()) >= 6 and rec.projectName()[:6] == "data15":
        InDetPixelRodDecoder.CheckDuplicatedPixel = False
    ToolSvc += InDetPixelRodDecoder
    if (InDetFlags.doPrintConfigurables()):
        printfunc(InDetPixelRodDecoder)
    #InDetPixelRodDecoder.OutputLevel = VERBOSE

    from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProviderTool
    InDetPixelRawDataProviderTool = PixelRawDataProviderTool(
        name="InDetPixelRawDataProviderTool", Decoder=InDetPixelRodDecoder)
    #ToolSvc += InDetPixelRawDataProviderTool
    if (InDetFlags.doPrintConfigurables()):
        printfunc(InDetPixelRawDataProviderTool)
    #InDetPixelRawDataProviderTool.OutputLevel = VERBOSE

    # load the PixelRawDataProvider
    from PixelRawDataByteStreamCnv.PixelRawDataByteStreamCnvConf import PixelRawDataProvider
    InDetPixelRawDataProvider = PixelRawDataProvider(
        name="InDetPixelRawDataProvider",
        RDOKey=InDetKeys.PixelRDOs(),
        ProviderTool=InDetPixelRawDataProviderTool)
Пример #35
0
from AtlasGeoModel import SetGeometryVersion
from AtlasGeoModel import GeoModelInit

# --- setup InDetJobProperties
from InDetRecExample.InDetJobProperties import InDetFlags
InDetFlags.doTruth = (globalflags.DataSource == 'geant4'
                      and globalflags.InputFormat() == 'pool')

InDetFlags.doTrkNtuple.set_Value_and_Lock(True)
InDetFlags.doTrkD3PD.set_Value_and_Lock(True)
# --- uncomment to change the default of one of the following options:
#OutputLevel          = VERBOSE

# --- Set output names such that they work with Reco_trf.py
from InDetRecExample.InDetKeys import InDetKeys
if athenaCommonFlags.PoolESDOutput():
    InDetKeys.OutputESDFileName = athenaCommonFlags.PoolESDOutput()
if athenaCommonFlags.PoolAODOutput():
    InDetKeys.OutputAODFileName = athenaCommonFlags.PoolAODOutput()
if InDetFlags.doTrkNtuple():
    InDetKeys.trkValidationNtupleName = 'myTrkValidation_singleMuon_IBL.root'
if InDetFlags.doTrkD3PD():
    InDetKeys.trkD3PDFileName.set_Value_and_Lock('InDetTrackD3PD.pool.root')

#--------------------------------------------------------------
# load master joboptions file
#--------------------------------------------------------------

include("RecExCommon/RecExCommon_topOptions.py")
InDetFlags.doxKalman            = False
InDetFlags.doiPatRec            = False
InDetFlags.doBackTracking       = False
InDetFlags.doTRTStandalone      = False
InDetFlags.postProcessing       = False
InDetFlags.doParticleCreation   = False
InDetFlags.doTrackSegmentsPixel = False
InDetFlags.doTrackSegmentsSCT   = False
InDetFlags.doTrackSegmentsTRT   = False
InDetFlags.doTruth              = False
InDetFlags.loadTools            = False

# IMPORTANT NOTE: initialization of the flags and locking them cannot be postponed to
# InDetRec_jobOptions.py because doWriteBS=True uses another jobO.
# --- initialize the flags (and lock them)
InDetFlags.init()

# --- flags have been setup: print and lock the job properties (flags are print out later)
InDetFlags.printInfo()
InDetFlags.print_JobProperties()
#InDetFlags.lock_JobProperties() # this is already done in InDetFlags.init()
# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!

#--------------------------------------------------------------
# load master joboptions file
#--------------------------------------------------------------
  
include("InDetRecExample/InDetRec_all.py")

#--------------------------------------------------------------
# Event related parameters
    def __init__(self, Tracks = None, DetailedTruth = None, TracksTruth = None):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from AthenaCommon.DetFlags              import DetFlags
        from InDetRecExample.InDetKeys          import InDetKeys
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr                import ToolSvc
        from AthenaCommon.AlgSequence           import AlgSequence
        topSequence = AlgSequence()
        #
        # --- Enable the detailed track truth
        #
        from InDetTruthAlgs.InDetTruthAlgsConf import InDet__InDetDetailedTrackTruthMaker
        DetailedTruthMaker = InDet__InDetDetailedTrackTruthMaker(name                   = DetailedTruth+"Maker",
                                                                 TrackCollectionName    = Tracks,
                                                                 DetailedTrackTruthName = DetailedTruth,
                                                                 TruthNamePixel         = InDetKeys.PixelClustersTruth(),
                                                                 TruthNameSCT           = InDetKeys.SCT_ClustersTruth(),
                                                                 TruthNameTRT           = InDetKeys.TRT_DriftCirclesTruth())
        # this is how the truth maker gets to know which detector is on ...
        if (not DetFlags.haveRIO.pixel_on()):
            DetailedTruthMaker.TruthNamePixel = ""
        if (not DetFlags.haveRIO.SCT_on()):
            DetailedTruthMaker.TruthNameSCT = ""
        # for cosmics, at the stage of SiPatternRecognition, the TRT truth information is not yet available
        if ((not DetFlags.haveRIO.TRT_on()) or
            (InDetFlags.doCosmics() and (DetailedTruth == "SiSPSeededTracksDetailedTruth" or DetailedTruth == "ResolvedTracksDetailedTruth"))):
            DetailedTruthMaker.TruthNameTRT = ""

        #if Tracks == "Tracks":
        #    DetailedTruthMaker.OutputLevel = VERBOSE    
        topSequence += DetailedTruthMaker
        if (InDetFlags.doPrintConfigurables()):
            print DetailedTruthMaker        
        #
        # --- Detailed to old TrackTruth
        #
        if InDetFlags.truthMatchStrategy() == 'TruthMatchRatio':
            from TrkTruthCreatorTools.TrkTruthCreatorToolsConf import Trk__TruthMatchRatio as InDetTruthMatchTool
        elif InDetFlags.truthMatchStrategy() == 'TruthMatchTanimoto':
            from TrkTruthCreatorTools.TrkTruthCreatorToolsConf import Trk__TruthMatchTanimoto as InDetTruthMatchTool
        else:
            print "ConfiguredInDetTrackTruth: error! InDetFlags.truthMatchStrategy must be TruthMatchRatio or TruthMatchTanimoto but is: "+InDetFlags.truthMatchStrategy()

        InDetTruthMatchSimilarityTool = InDetTruthMatchTool(name        = "InDetTruthMatchTool",
                                                            WeightPixel =  10.,
                                                            WeightSCT   =   5.,
                                                            WeightTRT   =   1.)
        
        # --- only add this once !!!
        if not hasattr(ToolSvc, "InDetTruthMatchTool"):
            ToolSvc += InDetTruthMatchSimilarityTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetTruthMatchSimilarityTool

        from TrkTruthAlgs.TrkTruthAlgsConf import TrackTruthSimilaritySelector
        InDetTruthSimilaritySelector = TrackTruthSimilaritySelector(name                     = TracksTruth+"Selector",
                                                                    DetailedTrackTruthName   = DetailedTruth,
                                                                    OutputName               = TracksTruth,
                                                                    TrackTruthSimilarityTool = InDetTruthMatchSimilarityTool)
        #if Tracks == "Tracks":
        #    InDetTruthSimilaritySelector.OutputLevel = VERBOSE    
        topSequence += InDetTruthSimilaritySelector
        if (InDetFlags.doPrintConfigurables()):
            print InDetTruthSimilaritySelector

        # --- remember imput
        self.__Tracks        = Tracks
        self.__TracksTruth   = TracksTruth
        self.__DetailedTruth = DetailedTruth
  def __init__(self, extension = "",InputCollections = None, NewTrackingCuts = None,
               BarrelSegments = None,
               TrackCollectionKeys=[], TrackCollectionTruthKeys=[] ):

    from InDetRecExample.InDetJobProperties import InDetFlags
    from InDetRecExample.InDetKeys          import InDetKeys
    from AthenaCommon.DetFlags              import DetFlags
    #
    # get ToolSvc and topSequence
    #
    from AthenaCommon.AppMgr import ToolSvc
    from AthenaCommon.AlgSequence import AlgSequence
    topSequence = AlgSequence()

    # --- Always use PRD association tool (even if only 1 collection) to remove TRT
    #     segments with significant overlaping hits 
    usePrdAssociationTool = True
    #usePrdAssociationTool = True if len(InputCollections) > 0 else False

    #
    # --- get list of already associated hits (always do this, even if no other tracking ran before)
    #
    if usePrdAssociationTool:
      from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
      InDetTRTonly_PRD_Association = InDet__InDetTrackPRD_Association(name            = 'InDetTRTonly_PRD_Association'+extension,
                                                                      AssociationTool = InDetPrdAssociationTool,
                                                                      TracksName      = list(InputCollections)) 
      topSequence += InDetTRTonly_PRD_Association
      if (InDetFlags.doPrintConfigurables()):
        print InDetTRTonly_PRD_Association

    #
    # Cut values and output key for the TRT segments standalone TRT track finder
    #
    if extension == "_TRT":
      # TRT track segments
      pTmin                      = NewTrackingCuts.minPT()
      self.__TRTStandaloneTracks = InDetKeys.TRTTracks()
    else:
      # TRT standalone
      # pTmin                      = NewTrackingCuts.minSecondaryPt()       
      pTmin                      = NewTrackingCuts.minTRTonlyPt() # new cut parameter to make it flexible...
      self.__TRTStandaloneTracks = InDetKeys.TRTTracks_NewT()

    #
    # --- set up special Scoring Tool for standalone TRT tracks
    #
    from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetTrtTrackScoringTool
    InDetTRT_StandaloneScoringTool = InDet__InDetTrtTrackScoringTool(name                = 'InDetTRT_StandaloneScoringTool'+extension,
                                                                     SummaryTool         = InDetTrackSummaryTool,
                                                                     DriftCircleCutTool  = InDetTRTDriftCircleCut,
                                                                     useAmbigFcn         = True,
                                                                     useSigmaChi2        = False,
                                                                     PtMin               = pTmin,
                                                                     minTRTonTrk         = NewTrackingCuts.minTRTonly(),
                                                                     maxEta              = 2.1,
                                                                     UseParameterization = NewTrackingCuts.useTRTonlyParamCuts(),
                                                                     OldTransitionLogic  = NewTrackingCuts.useTRTonlyOldLogic())
    # InDetTRT_StandaloneScoringTool.OutputLevel = VERBOSE 
    ToolSvc += InDetTRT_StandaloneScoringTool
    if (InDetFlags.doPrintConfigurables()):
      print InDetTRT_StandaloneScoringTool


    #
    # set up TRT_SegmentToTrackTool
    #
    from TRT_SegmentToTrackTool.TRT_SegmentToTrackToolConf import InDet__TRT_SegmentToTrackTool
    InDetTRT_SegmentToTrackTool = InDet__TRT_SegmentToTrackTool(name = 'InDetTRT_SegmentToTrackTool'+extension,
                                                                    RefitterTool          = InDetTrackFitterTRT,
                                                                    UseAssociationTool    = usePrdAssociationTool,
                                                                    AssociationTool       = InDetPrdAssociationTool,
                                                                    ScoringTool           = InDetTRT_StandaloneScoringTool,
                                                                    Extrapolator          = InDetExtrapolator,
                                                                    FinalRefit            = True,
                                                                    MaxSharedHitsFraction = NewTrackingCuts.maxTRTonlyShared(),
                                                                    SuppressHoleSearch    = True
                                                                    )
    ToolSvc += InDetTRT_SegmentToTrackTool
    if (InDetFlags.doPrintConfigurables()):
      print InDetTRT_SegmentToTrackTool

    if not InDetFlags.doCosmics():
      #
      # --- TRT standalone tracks algorithm
      #

      from TRT_StandaloneTrackFinder.TRT_StandaloneTrackFinderConf import InDet__TRT_StandaloneTrackFinder
      InDetTRT_StandaloneTrackFinder = InDet__TRT_StandaloneTrackFinder(name                  = 'InDetTRT_StandaloneTrackFinder'+extension,
                                                                        MinNumDriftCircles    = NewTrackingCuts.minTRTonly(),
                                                                        MinPt                 = NewTrackingCuts.minTRTonlyPt(),
                                                                        InputSegmentsLocation = BarrelSegments,
                                                                        MaterialEffects       = 0,
                                                                        ResetPRD              = True if extension == "_TRT" else False,
                                                                        OldTransitionLogic    = NewTrackingCuts.useTRTonlyOldLogic(),
                                                                        OutputTracksLocation  = self.__TRTStandaloneTracks,
                                                                        TRT_SegToTrackTool    = InDetTRT_SegmentToTrackTool
                                                                        )
      #InDetTRT_StandaloneTrackFinder.OutputLevel = VERBOSE
      topSequence += InDetTRT_StandaloneTrackFinder
      if InDetFlags.doPrintConfigurables():
        print InDetTRT_StandaloneTrackFinder

      # --- Delete TRT segments for the subdetector pattern only (back-tracking has already run by this point)
      from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
      InDetSGDeletionAlg(container = "Trk::SegmentCollection#", key = BarrelSegments)
    
    else: 
      #
      # --- cosmics segment to track conversion for Barrel
      #

      from TRT_SegmentsToTrack.TRT_SegmentsToTrackConf import InDet__TRT_SegmentsToTrack
      InDetTrkSegmenttoTrk = InDet__TRT_SegmentsToTrack(name                      = "InDetTRT_SegmentsToTrack_Barrel"+extension,
                                                        InputSegmentsCollection   = BarrelSegments,
                                                        OutputTrackCollection     = self.__TRTStandaloneTracks,
                                                        TrackFitter               = InDetTrackFitter,
                                                        MinNHit                   = NewTrackingCuts.minTRTonly(),
                                                        CombineTracks             = False,
                                                        OutputCombiCollection     = "",
                                                        InputSCTCollection        = "",
                                                        OutlierRemoval            = True,
                                                        MaterialEffects           = False)
      #InDetTrkSegmenttoTrk.OutputLevel = VERBOSE
      topSequence += InDetTrkSegmenttoTrk
      if InDetFlags.doPrintConfigurables():
        print InDetTrkSegmenttoTrk


    #
    #
    # ------------ Track truth.
    #
    if ( extension == "_TRT" or not InDetFlags.doSGDeletion() ):
      if InDetFlags.doTruth():
        #
        # set up the truth info for this container
        #
        include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
        InDetTracksTruth = ConfiguredInDetTrackTruth(self.__TRTStandaloneTracks,
                                                     self.__TRTStandaloneTracks+"DetailedTruth",
                                                     self.__TRTStandaloneTracks+"TruthCollection")
        #
        # add final output for statistics
        #
        TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
        TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
      else:
        TrackCollectionKeys      += [ self.__TRTStandaloneTracks ]
Пример #39
0
    def __init__(self, useTimeInfo=True, usePhase=False):

        from InDetRecExample.InDetJobProperties import InDetFlags
        from AthenaCommon.DetFlags import DetFlags
        from AthenaCommon.GlobalFlags import globalflags
        from AthenaCommon.BeamFlags import jobproperties
        #
        # get ToolSvc and topSequence
        #
        from AthenaCommon.AppMgr import ToolSvc
        from AthenaCommon.AlgSequence import AlgSequence
        topSequence = AlgSequence()

        if InDetFlags.doPRDFormation() and DetFlags.makeRIO.TRT_on(
        ) and InDetFlags.doTRT_PRDFormation():

            #
            # --- setup naming of tools and algs
            #
            if useTimeInfo:
                prefix = "InDetTRT_"
                collection = InDetKeys.TRT_DriftCircles()
                if InDetFlags.doSplitReco():
                    collectionPU = InDetKeys.TRT_PU_DriftCircles()
            else:
                prefix = "InDetTRT_noTime_"
                collection = InDetKeys.TRT_DriftCirclesUncalibrated()
                if InDetFlags.doSplitReco():
                    collectionPU = InDetKeys.TRT_PU_DriftCirclesUncalibrated()
            #
            # --- TRT_DriftFunctionTool
            #
            from TRT_DriftFunctionTool.TRT_DriftFunctionToolConf import TRT_DriftFunctionTool
            InDetTRT_DriftFunctionTool = TRT_DriftFunctionTool(
                name=prefix + "DriftFunctionTool",
                TRTCalDbTool=InDetTRTCalDbSvc)
            # --- overwrite for uncalibrated DC production
            if (not useTimeInfo) or InDetFlags.noTRTTiming():
                InDetTRT_DriftFunctionTool.DummyMode = True
                InDetTRT_DriftFunctionTool.UniversalError = 1.15
            # --- overwrite for calibration of MC
            if usePhase and jobproperties.Beam.beamType(
            ) == 'cosmics' and globalflags.DataSource == "geant4":
                InDetTRT_DriftFunctionTool.AllowDigiVersionOverride = True
                InDetTRT_DriftFunctionTool.ForcedDigiVersion = 9

            ToolSvc += InDetTRT_DriftFunctionTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetTRT_DriftFunctionTool
            #
            # --- TRT_DriftCircleTool
            #
            if usePhase:
                from TRT_DriftCircleTool.TRT_DriftCircleToolConf import InDet__TRT_DriftCircleToolCosmics as InDet__TRT_DriftCircleTool
            else:
                from TRT_DriftCircleTool.TRT_DriftCircleToolConf import InDet__TRT_DriftCircleTool

            #
            # set gating values for MC/DATA
            MinTrailingEdge = 11.0 * ns
            MaxDriftTime = 60.0 * ns
            LowGate = 14.0625 * ns  # 4.5*3.125 ns
            HighGate = 42.1875 * ns  # LowGate + 9*3.125 ns
            if InDetFlags.doCosmics():
                LowGate = 19.0 * ns
                HighGate = 44.0 * ns
            if globalflags.DataSource == 'data':
                MinTrailingEdge = 11.0 * ns
                MaxDriftTime = 60.0 * ns
                LowGate = 14.0625 * ns  # 4.5*3.125 ns
                HighGate = 42.1875 * ns  # LowGate + 9*3.125 ns
                if InDetFlags.doCosmics():
                    LowGate = 19.0 * ns
                    HighGate = 44.0 * ns

            InDetTRT_DriftCircleTool = InDet__TRT_DriftCircleTool(
                name=prefix + "DriftCircleTool",
                TRTDriftFunctionTool=InDetTRT_DriftFunctionTool,
                TrtDescrManageLocation=InDetKeys.TRT_Manager(),
                ConditionsSummaryTool=InDetTRTStrawStatusSummarySvc,
                #used to be InDetTRTConditionsSummaryService,
                UseConditionsStatus=True,
                UseConditionsHTStatus=True,
                SimpleOutOfTimePileupSupression=InDetFlags.doCosmics(),
                RejectIfFirstBit=False,  # fixes 50 nsec issue 
                MinTrailingEdge=MinTrailingEdge,
                MaxDriftTime=MaxDriftTime,
                ValidityGateSuppression=not InDetFlags.doCosmics(),
                LowGate=LowGate,
                HighGate=HighGate,
                MaskFirstHTBit=False,
                MaskMiddleHTBit=False,
                MaskLastHTBit=False,
                SimpleOutOfTimePileupSupressionArgon=InDetFlags.doCosmics(),
                RejectIfFirstBitArgon=False,  # fixes 50 nsec issue 
                MinTrailingEdgeArgon=MinTrailingEdge,
                MaxDriftTimeArgon=MaxDriftTime,
                ValidityGateSuppressionArgon=not InDetFlags.doCosmics(),
                LowGateArgon=LowGate,
                HighGateArgon=HighGate,
                MaskFirstHTBitArgon=False,
                MaskMiddleHTBitArgon=False,
                MaskLastHTBitArgon=False,
                useDriftTimeHTCorrection=True,
                useDriftTimeToTCorrection=True)  # reenable ToT

            from AthenaCommon.BeamFlags import jobproperties
            if InDetFlags.InDet25nsec() and jobproperties.Beam.beamType(
            ) == "collisions":
                InDetTRT_DriftCircleTool.ValidityGateSuppression = True
                InDetTRT_DriftCircleTool.SimpleOutOfTimePileupSupression = False
            if jobproperties.Beam.beamType() == "cosmics":
                InDetTRT_DriftCircleTool.SimpleOutOfTimePileupSupression = False


# --- overwrite for phase usage
            if usePhase:
                InDetTRT_DriftCircleTool.ComTimeName = "TRT_Phase"

            ToolSvc += InDetTRT_DriftCircleTool
            if (InDetFlags.doPrintConfigurables()):
                print InDetTRT_DriftCircleTool

            #
            # --- TRT_RIO_Maker Algorithm
            #
            from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__TRT_RIO_Maker
            InDetTRT_RIO_Maker = InDet__TRT_RIO_Maker(
                name=prefix + "RIO_Maker",
                TRT_DriftCircleTool=InDetTRT_DriftCircleTool,
                TrtDescrManageLocation=InDetKeys.TRT_Manager(),
                TRTRDOLocation=InDetKeys.TRT_RDOs(),
                TRTRIOLocation=collection)
            topSequence += InDetTRT_RIO_Maker
            if (InDetFlags.doPrintConfigurables()):
                print InDetTRT_RIO_Maker
            if InDetFlags.doSplitReco():
                InDetTRT_RIO_MakerPU = InDet__TRT_RIO_Maker(
                    name=prefix + "RIO_MakerPU",
                    TRT_DriftCircleTool=InDetTRT_DriftCircleTool,
                    TrtDescrManageLocation=InDetKeys.TRT_Manager(),
                    TRTRDOLocation=InDetKeys.TRT_PU_RDOs(),
                    TRTRIOLocation=collectionPU)
                topSequence += InDetTRT_RIO_MakerPU
                if (InDetFlags.doPrintConfigurables()):
                    print InDetTRT_RIO_MakerPU

            #
            #    Include alg to save the local occupancy inside xAOD::EventInfo
            #
            if InDetFlags.doTRTGlobalOccupancy():
                from TRT_ElectronPidTools.TRT_ElectronPidToolsConf import InDet__TRT_LocalOccupancy
                InDetTRT_LocalOccupancy = InDet__TRT_LocalOccupancy(
                    name="InDet_TRT_LocalOccupancy", isTrigger=False)

                ToolSvc += InDetTRT_LocalOccupancy
                if (InDetFlags.doPrintConfigurables()):
                    print InDetTRT_LocalOccupancy

                from TRT_CalibAlgs.TRT_CalibAlgsConf import TRTOccupancyInclude
                TRTOccupancyInclude = TRTOccupancyInclude(
                    name=prefix + "TRTOccupancyInclude",
                    TRT_LocalOccupancyTool=InDetTRT_LocalOccupancy)

                topSequence += TRTOccupancyInclude
                if (InDetFlags.doPrintConfigurables()):
                    print TRTOccupancyInclude

            #
            # --- we need to do truth association if requested (not for uncalibrated hits in cosmics)
            #
            if InDetFlags.doTruth() and useTimeInfo:
                from InDetTruthAlgs.InDetTruthAlgsConf import InDet__PRD_MultiTruthMaker
                InDetPRD_MultiTruthMakerTRT = InDet__PRD_MultiTruthMaker(
                    name=prefix + "PRD_MultiTruthMaker",
                    PixelClusterContainerName="",
                    SCTClusterContainerName="",
                    TRTDriftCircleContainerName=InDetKeys.TRT_DriftCircles(),
                    SimDataMapNamePixel="",
                    SimDataMapNameSCT="",
                    SimDataMapNameTRT=InDetKeys.TRT_SDOs(),
                    TruthNamePixel="",
                    TruthNameSCT="",
                    TruthNameTRT=InDetKeys.TRT_DriftCirclesTruth())
                topSequence += InDetPRD_MultiTruthMakerTRT
                if (InDetFlags.doPrintConfigurables()):
                    print InDetPRD_MultiTruthMakerTRT

                if InDetFlags.doSplitReco():
                    InDetPRD_MultiTruthMakerTRTPU = InDet__PRD_MultiTruthMaker(
                        name=prefix + "PRD_MultiTruthMakerPU",
                        PixelClusterContainerName="",
                        SCTClusterContainerName="",
                        TRTDriftCircleContainerName=InDetKeys.
                        TRT_PU_DriftCircles(),
                        SimDataMapNamePixel="",
                        SimDataMapNameSCT="",
                        SimDataMapNameTRT=InDetKeys.TRT_PU_SDOs(),
                        TruthNamePixel="",
                        TruthNameSCT="",
                        TruthNameTRT=InDetKeys.TRT_PU_DriftCirclesTruth())
                    topSequence += InDetPRD_MultiTruthMakerTRTPU
                    if (InDetFlags.doPrintConfigurables()):
                        print InDetPRD_MultiTruthMakerTRTPU
  def __init__(self, extension = "",InputCollections = None, NewTrackingCuts = None, BarrelSegments = None, EndcapSegments = None, doPhase = False):

    from InDetRecExample.InDetJobProperties import InDetFlags
    from InDetRecExample.InDetKeys          import InDetKeys
    from AthenaCommon.DetFlags              import DetFlags
    #
    # get ToolSvc and topSequence
    #
    from AthenaCommon.AppMgr                import ToolSvc
    from AthenaCommon.AlgSequence           import AlgSequence
    topSequence = AlgSequence()

    #
    # --- decide if use the association tool
    #
    if len(InputCollections) > 0:
      usePrdAssociationTool = True
    else:
      usePrdAssociationTool = False
    #
    # --- get list of already associated hits (always do this, even if no other tracking ran before)
    #
    if usePrdAssociationTool:
      from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
      InDetSegmentPRD_Association = InDet__InDetTrackPRD_Association(name            = 'InDetSegmentPRD_Association'+extension,
                                                                     AssociationTool = InDetPrdAssociationTool,
                                                                     TracksName      = list(InputCollections)) 
      topSequence += InDetSegmentPRD_Association
      if (InDetFlags.doPrintConfigurables()):
        print InDetSegmentPRD_Association

    # ---------------------------------------------------------------
    #
    # --- now the main steering of the TRT segments finding
    #
    # ---------------------------------------------------------------

    if InDetFlags.doCosmics():
      #
      # --- cosmics barrel segments (use TRT track segements even for NewT) 
      #
      
      if doPhase:
       from TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf import InDet__TRT_TrackSegmentsMaker_BarrelCosmics
       InDetTRT_TrackSegmentsMakerPhase = InDet__TRT_TrackSegmentsMaker_BarrelCosmics(name = 'InDetTRTSegmentsMakerPhase'+extension,
                                                                                      TrtManagerLocation      = InDetKeys.TRT_Manager(),
                                                                                      TRT_ClustersContainer   = InDetKeys.TRT_DriftCirclesUncalibrated(),
                                                                                      AssosiationTool         = InDetPrdAssociationTool,
                                                                                      UseAssosiationTool      = usePrdAssociationTool,
                                                                                      IsMagneticFieldOn       = InDetFlags.solenoidOn())
       ToolSvc += InDetTRT_TrackSegmentsMakerPhase
       #InDetTRT_TrackSegmentsMakerPhase.OutputLevel = VERBOSE 
       if (InDetFlags.doPrintConfigurables()):
         print InDetTRT_TrackSegmentsMakerPhase

      else:
       from TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf import InDet__TRT_TrackSegmentsMaker_BarrelCosmics
       InDetTRT_TrackSegmentsMaker = InDet__TRT_TrackSegmentsMaker_BarrelCosmics(name = 'InDetTRTSegmentsMaker'+extension,
                                                                                 TrtManagerLocation      = InDetKeys.TRT_Manager(),
                                                                                 TRT_ClustersContainer   = InDetKeys.TRT_DriftCircles(),
                                                                                 AssosiationTool         = InDetPrdAssociationTool,
                                                                                 UseAssosiationTool      = usePrdAssociationTool,
                                                                                 IsMagneticFieldOn       = InDetFlags.solenoidOn()) 

       ToolSvc += InDetTRT_TrackSegmentsMaker
       #InDetTRT_TrackSegmentsMaker.OutputLevel = VERBOSE
       if (InDetFlags.doPrintConfigurables()):
         print InDetTRT_TrackSegmentsMaker

    else:
      #
      # --- cut values
      #
      if extension == "_TRT":
        # TRT Subdetector segment finding
        MinNumberDCs   = NewTrackingCuts.minTRTonly()
        pTmin          = NewTrackingCuts.minPT()
        sharedFrac     = NewTrackingCuts.maxTRTonlyShared()
      else:
        # TRT-only/back-tracking segment finding
        MinNumberDCs   = NewTrackingCuts.minSecondaryTRTonTrk()
        pTmin          = NewTrackingCuts.minSecondaryPt()
        sharedFrac     = NewTrackingCuts.maxSecondaryTRTShared()
      #
      # --- offline version  of TRT segemnt making
      #
      from TRT_TrackSegmentsTool_xk.TRT_TrackSegmentsTool_xkConf import InDet__TRT_TrackSegmentsMaker_ATLxk
      InDetTRT_TrackSegmentsMaker = InDet__TRT_TrackSegmentsMaker_ATLxk(name                    = 'InDetTRT_SeedsMaker'+extension,
                                                                        TrtManagerLocation      = InDetKeys.TRT_Manager(),
                                                                        TRT_ClustersContainer   = InDetKeys.TRT_DriftCircles(),
                                                                        PropagatorTool          = InDetPatternPropagator,
                                                                        TrackExtensionTool      = InDetTRTExtensionTool,
                                                                        UseAssosiationTool      = usePrdAssociationTool,
                                                                        AssosiationTool         = InDetPrdAssociationTool,
                                                                        RemoveNoiseDriftCircles = InDetFlags.removeTRTNoise(),
                                                                        MinNumberDriftCircles   = MinNumberDCs,
                                                                        NumberMomentumChannel   = NewTrackingCuts.TRTSegFinderPtBins(),
                                                                        pTmin                   = pTmin,
                                                                        sharedFrac              = sharedFrac)
      ToolSvc += InDetTRT_TrackSegmentsMaker
      if (InDetFlags.doPrintConfigurables()):
        print InDetTRT_TrackSegmentsMaker

    #
    # --- TRT track reconstruction
    #
    from TRT_TrackSegmentsFinder.TRT_TrackSegmentsFinderConf import InDet__TRT_TrackSegmentsFinder
    
    if doPhase: 
      InDetTRT_TrackSegmentsFinderPhase = InDet__TRT_TrackSegmentsFinder(name              = 'InDetTRT_TrackSegmentsFinderPhase'+extension,
                                                                         SegmentsMakerTool   = InDetTRT_TrackSegmentsMakerPhase,
                                                                         SegmentsLocation    = BarrelSegments)

      topSequence += InDetTRT_TrackSegmentsFinderPhase
      if (InDetFlags.doPrintConfigurables()):
       print InDetTRT_TrackSegmentsFinderPhase

    else:

     if InDetFlags.doCaloSeededTRTSegments() or NewTrackingCuts.RoISeededBackTracking():
      InDetTRT_TrackSegmentsFinder = InDet__TRT_TrackSegmentsFinder(name              = 'InDetTRT_TrackSegmentsFinder'+extension,
                                                                    SegmentsMakerTool   = InDetTRT_TrackSegmentsMaker,
                                                                    SegmentsLocation    = BarrelSegments,
                                                                    useCaloSeeds        = True,
                                                                    InputClusterContainerName = InDetKeys.CaloClusterROIContainer())

     else:
      InDetTRT_TrackSegmentsFinder = InDet__TRT_TrackSegmentsFinder(name              = 'InDetTRT_TrackSegmentsFinder'+extension,
                                                                    SegmentsMakerTool   = InDetTRT_TrackSegmentsMaker,
                                                                    SegmentsLocation    = BarrelSegments) 


     topSequence += InDetTRT_TrackSegmentsFinder
     if (InDetFlags.doPrintConfigurables()):
      print InDetTRT_TrackSegmentsFinder
      
    #
    # --- load TRT validation alg
    #
    if InDetFlags.doTruth() and not InDetFlags.doCosmics():
      from InDetSegmentDriftCircleAssValidation.InDetSegmentDriftCircleAssValidationConf import InDet__SegmentDriftCircleAssValidation
      InDetSegmentDriftCircleAssValidation = InDet__SegmentDriftCircleAssValidation(name                 = "InDetSegmentDriftCircleAssValidation"+extension,
                                                                                    OrigTracksLocation   = BarrelSegments                  ,
                                                                                    TRT_DriftCirclesName = InDetKeys.TRT_DriftCircles()    ,
                                                                                    pTmin                = pTmin                           ,
                                                                                    Pseudorapidity       = 2.1                             , # end of TRT
                                                                                    RadiusMin            = 0.                              ,
                                                                                    RadiusMax            = 600.                            ,
                                                                                    MinNumberDCs         = MinNumberDCs)
      topSequence += InDetSegmentDriftCircleAssValidation
      if (InDetFlags.doPrintConfigurables()):
        print InDetSegmentDriftCircleAssValidation
Пример #41
0
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)
   def __init__(self, useTimeInfo = True, usePhase = False):

      from InDetRecExample.InDetJobProperties import InDetFlags
      from AthenaCommon.DetFlags              import DetFlags
      from AthenaCommon.GlobalFlags           import globalflags
      from AthenaCommon.BeamFlags             import jobproperties
      #
      # get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr      import ToolSvc
      from AthenaCommon.AlgSequence import AlgSequence
      topSequence = AlgSequence()
      
      if InDetFlags.doPRDFormation() and DetFlags.makeRIO.TRT_on() and InDetFlags.doTRT_PRDFormation():

         #
         # --- setup naming of tools and algs
         #
         if useTimeInfo:
            prefix     = "InDetTRT_"
            collection = InDetKeys.TRT_DriftCircles()
         else:
            prefix     = "InDetTRT_noTime_"
            collection = InDetKeys.TRT_DriftCirclesUncalibrated()
         #
         # --- TRT_DriftFunctionTool
         #
         from TRT_DriftFunctionTool.TRT_DriftFunctionToolConf import TRT_DriftFunctionTool
         InDetTRT_DriftFunctionTool = TRT_DriftFunctionTool(name                = prefix+"DriftFunctionTool",
                                                            TRTCalDbTool        = InDetTRTCalDbSvc)
         # --- overwrite for uncalibrated DC production
         if (not useTimeInfo) or InDetFlags.noTRTTiming():
            InDetTRT_DriftFunctionTool.DummyMode      = True
            InDetTRT_DriftFunctionTool.UniversalError = 1.15
         # --- overwrite for calibration of MC
         if usePhase and jobproperties.Beam.beamType()=='cosmics' and globalflags.DataSource == "geant4":
            InDetTRT_DriftFunctionTool.AllowDigiVersionOverride = True
            InDetTRT_DriftFunctionTool.ForcedDigiVersion        = 9

         ToolSvc += InDetTRT_DriftFunctionTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_DriftFunctionTool
         #
         # --- TRT_DriftCircleTool
         #
         if usePhase:
            from TRT_DriftCircleTool.TRT_DriftCircleToolConf import InDet__TRT_DriftCircleToolCosmics as InDet__TRT_DriftCircleTool
         else:
            from TRT_DriftCircleTool.TRT_DriftCircleToolConf import InDet__TRT_DriftCircleTool

         #
         # set gating values for MC/DATA
         MinTrailingEdge = 11.0*ns
         MaxDriftTime    = 60.0*ns
         LowGate         = 14.0625*ns # 4.5*3.125 ns
         HighGate        = 42.1875*ns # LowGate + 9*3.125 ns
         if InDetFlags.doCosmics():
            LowGate         = 19.0*ns
            HighGate        = 44.0*ns
         if globalflags.DataSource == 'data':
            MinTrailingEdge = 11.0*ns
            MaxDriftTime    = 60.0*ns
            LowGate         = 14.0625*ns # 4.5*3.125 ns
            HighGate        = 42.1875*ns # LowGate + 9*3.125 ns
            if InDetFlags.doCosmics():
               LowGate         = 19.0*ns
               HighGate        = 44.0*ns

         InDetTRT_DriftCircleTool = InDet__TRT_DriftCircleTool(name                            = prefix+"DriftCircleTool",
                                                               TRTDriftFunctionTool            = InDetTRT_DriftFunctionTool,
                                                               TrtDescrManageLocation          = InDetKeys.TRT_Manager(),
                                                               ConditionsSummaryTool           = InDetTRTStrawStatusSummarySvc,
                                                               #used to be InDetTRTConditionsSummaryService,
                                                               UseConditionsStatus             = True,
                                                               UseConditionsHTStatus           = True,
                                                               SimpleOutOfTimePileupSupression = InDetFlags.doCosmics(),
                                                               RejectIfFirstBit                = False, # fixes 50 nsec issue 
                                                               MinTrailingEdge                 = MinTrailingEdge,
                                                               MaxDriftTime                    = MaxDriftTime,
                                                               ValidityGateSuppression         = not InDetFlags.doCosmics(),
                                                               LowGate                         = LowGate,
                                                               HighGate                        = HighGate,
                                                               MaskFirstHTBit                  = False,
                                                               MaskMiddleHTBit                 = False,
                                                               MaskLastHTBit                   = False,
                                                               SimpleOutOfTimePileupSupressionArgon = InDetFlags.doCosmics(),
                                                               RejectIfFirstBitArgon                = False, # fixes 50 nsec issue 
                                                               MinTrailingEdgeArgon                 = MinTrailingEdge,
                                                               MaxDriftTimeArgon                    = MaxDriftTime,
                                                               ValidityGateSuppressionArgon         = not InDetFlags.doCosmics(),
                                                               LowGateArgon                         = LowGate,
                                                               HighGateArgon                        = HighGate,
                                                               MaskFirstHTBitArgon                  = False,
                                                               MaskMiddleHTBitArgon                 = False,
                                                               MaskLastHTBitArgon                   = False,
                                                               useDriftTimeHTCorrection        = True,
                                                               useDriftTimeToTCorrection       = True) # reenable ToT

         from AthenaCommon.BeamFlags import jobproperties 
         if InDetFlags.InDet25nsec() and jobproperties.Beam.beamType()=="collisions": 
            InDetTRT_DriftCircleTool.ValidityGateSuppression=True  
            InDetTRT_DriftCircleTool.SimpleOutOfTimePileupSupression=False  
         if jobproperties.Beam.beamType()=="cosmics": 
            InDetTRT_DriftCircleTool.SimpleOutOfTimePileupSupression=False 

# --- overwrite for phase usage
         if usePhase:
            InDetTRT_DriftCircleTool.ComTimeName = "TRT_Phase"

         ToolSvc += InDetTRT_DriftCircleTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_DriftCircleTool
         
         #
         # --- TRT_RIO_Maker Algorithm
         #
         from InDetPrepRawDataFormation.InDetPrepRawDataFormationConf import InDet__TRT_RIO_Maker
         InDetTRT_RIO_Maker = InDet__TRT_RIO_Maker(name                   = prefix+"RIO_Maker",
                                                   TRT_DriftCircleTool    = InDetTRT_DriftCircleTool,
                                                   TrtDescrManageLocation = InDetKeys.TRT_Manager(),
                                                   TRTRDOLocation         = InDetKeys.TRT_RDOs(),
                                                   TRTRIOLocation         = collection)
         topSequence += InDetTRT_RIO_Maker
         if (InDetFlags.doPrintConfigurables()):
            print InDetTRT_RIO_Maker

         #
         #    Include alg to save the local occupancy inside xAOD::EventInfo
         #
         if InDetFlags.doTRTGlobalOccupancy():
          from TRT_ElectronPidTools.TRT_ElectronPidToolsConf import InDet__TRT_LocalOccupancy
          InDetTRT_LocalOccupancy = InDet__TRT_LocalOccupancy(  name 		= "InDet_TRT_LocalOccupancy",
								isTrigger	= False
	  )

          ToolSvc += InDetTRT_LocalOccupancy
          if (InDetFlags.doPrintConfigurables()):
              print InDetTRT_LocalOccupancy


          from TRT_CalibAlgs.TRT_CalibAlgsConf import TRTOccupancyInclude
          TRTOccupancyInclude = TRTOccupancyInclude( name = prefix+"TRTOccupancyInclude",
                                                   TRT_LocalOccupancyTool = InDetTRT_LocalOccupancy)
         
          topSequence += TRTOccupancyInclude
          if (InDetFlags.doPrintConfigurables()):
                  print TRTOccupancyInclude

       
         #
         # --- we need to do truth association if requested (not for uncalibrated hits in cosmics)
         #
         if InDetFlags.doTruth() and useTimeInfo:
            from InDetTruthAlgs.InDetTruthAlgsConf import InDet__PRD_MultiTruthMaker
            InDetPRD_MultiTruthMakerTRT = InDet__PRD_MultiTruthMaker (name                        = prefix+"PRD_MultiTruthMaker",
                                                                      PixelClusterContainerName   = "",
                                                                      SCTClusterContainerName     = "",
                                                                      TRTDriftCircleContainerName = InDetKeys.TRT_DriftCircles(),
                                                                      SimDataMapNamePixel         = "",
                                                                      SimDataMapNameSCT           = "",
                                                                      SimDataMapNameTRT           = InDetKeys.TRT_SDOs(),
                                                                      TruthNamePixel              = "",
                                                                      TruthNameSCT                = "",
                                                                      TruthNameTRT                = InDetKeys.TRT_DriftCirclesTruth())
            topSequence += InDetPRD_MultiTruthMakerTRT
            if (InDetFlags.doPrintConfigurables()):
               print InDetPRD_MultiTruthMakerTRT
Пример #43
0
from AthenaCommon.CfgGetter import getPublicTool
from InDetRecExample.InDetJobProperties import InDetFlags

beamFlags = jobproperties.Beam

atlasExtrapolator = getPublicTool('AtlasExtrapolator')
muonTrackSummaryHelper = getPublicTool('MuonTrackSummaryHelper')

# load InDetHoleSearchTool
from InDetTrackHoleSearch.InDetTrackHoleSearchConf import InDet__InDetTrackHoleSearchTool
ToolSvc += InDet__InDetTrackHoleSearchTool( \
  name                         = "CombinedMuonIDHoleSearch",
Extrapolator                 = atlasExtrapolator,
usePixel                     = DetFlags.haveRIO.pixel_on(),
useSCT                       = DetFlags.haveRIO.SCT_on(),
checkBadSCTChip = InDetFlags.checkDeadElementsOnTrack(),
CountDeadModulesAfterLastHit = True)

if muonCombinedRecFlags.useDetailedPixelHoleSearch():
    # now get the InDet tools as used for InDet tracks
    #   (duplication for ESD running in case InDet not rerun)
    #   attention: defaults defined first with some DetFlag specific properties added further down
    from InDetTestPixelLayer.InDetTestPixelLayerConf import InDet__InDetTestPixelLayerTool
    ToolSvc += InDet__InDetTestPixelLayerTool(
        name="CombinedMuonInDetTestPixelLayerTool",
        Extrapolator=atlasExtrapolator,
        PixelSummarySvc=ServiceMgr.PixelConditionsSummarySvc,
        CheckActiveAreas=True,
        CheckDeadRegions=True)
    ToolSvc.CombinedMuonIDHoleSearch.PixelLayerTool = ToolSvc.CombinedMuonInDetTestPixelLayerTool
# modified for use in Fatras refit mode: [email protected]
# --------------------------------------------------------------

from AthenaCommon.DetFlags import DetFlags
from AthenaCommon.BeamFlags import jobproperties

# check (for robustness) if ID is on at all!
if not DetFlags.detdescr.ID_on():
    print "InDetRec_jobOptions.py: DetFlags ID is turned off. Not including anything!"
else:
    # +++++++++++++++++++++++
    # Control
    # +++++++++++++++++++++++
    #
    from InDetRecExample.InDetJobProperties import InDetFlags
    InDetFlags.init()
    #
    if InDetFlags.Enabled():

        InDetFlags.printInfo()
        InDetFlags.print_JobProperties()

        from AthenaCommon.GlobalFlags import globalflags
        # rec flags are needed (e.g. for commissioning steering ...)
        from RecExConfig.RecFlags import rec

        #
        # ----------- import, lock and print InDetKeys
        #
        from InDetRecExample.InDetKeys import InDetKeys
        InDetKeys.lockAllExceptAlias()
   def __init__(self, InputCollections = None, ResolvedTrackCollectionKey = None, SiSPSeededTrackCollectionKey = None , NewTrackingCuts = None, TrackCollectionKeys=[] , TrackCollectionTruthKeys=[]):
      
      from InDetRecExample.InDetJobProperties import InDetFlags
      from InDetRecExample.InDetKeys          import InDetKeys
      #
      # --- get ToolSvc and topSequence
      #
      from AthenaCommon.AppMgr                import ToolSvc
      from AthenaCommon.AlgSequence           import AlgSequence
      topSequence = AlgSequence()

      #
      # --- decide if use the association tool
      #
      if (len(InputCollections) > 0) and (NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or NewTrackingCuts.mode() == "LargeD0" or NewTrackingCuts.mode() == "BeamGas" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks"  or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks"):
         usePrdAssociationTool = True
      else:
         usePrdAssociationTool = False

      #
      # --- get list of already associated hits (always do this, even if no other tracking ran before)
      #
      if usePrdAssociationTool:
         from InDetTrackPRD_Association.InDetTrackPRD_AssociationConf import InDet__InDetTrackPRD_Association
         InDetPRD_Association = InDet__InDetTrackPRD_Association(name            = 'InDetPRD_Association'+NewTrackingCuts.extension(),
                                                                 AssociationTool = InDetPrdAssociationTool,
                                                                 TracksName      = list(InputCollections)) 
         topSequence += InDetPRD_Association
         if (InDetFlags.doPrintConfigurables()):
            print InDetPRD_Association

      # ------------------------------------------------------------
      #
      # ----------- SiSPSeededTrackFinder
      #
      # ------------------------------------------------------------

      if InDetFlags.doSiSPSeededTrackFinder():
         #
         # --- Space points seeds maker, use different ones for cosmics and collisions
         #
         if NewTrackingCuts.mode() == "DBM":
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker
         elif InDetFlags.doCosmics():
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_Cosmic as SiSpacePointsSeedMaker
         elif InDetFlags.doHeavyIon():
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_HeavyIon as SiSpacePointsSeedMaker
         elif NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()) :
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_LowMomentum as SiSpacePointsSeedMaker
         elif NewTrackingCuts.mode() == "BeamGas":
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_BeamGas as SiSpacePointsSeedMaker
         else:
            from SiSpacePointsSeedTool_xk.SiSpacePointsSeedTool_xkConf import InDet__SiSpacePointsSeedMaker_ATLxk as SiSpacePointsSeedMaker

         InDetSiSpacePointsSeedMaker = SiSpacePointsSeedMaker (name                   = "InDetSpSeedsMaker"+NewTrackingCuts.extension(),
                                                               pTmin                  = NewTrackingCuts.minPT(),
                                                               maxdImpact             = NewTrackingCuts.maxPrimaryImpact(),
                                                               maxZ                   = NewTrackingCuts.maxZImpact(),
                                                               minZ                   = -NewTrackingCuts.maxZImpact(),
                                                               usePixel               = NewTrackingCuts.usePixel(),
                                                               SpacePointsPixelName   = InDetKeys.PixelSpacePoints(),
                                                               # useSCT                 = NewTrackingCuts.useSCT(),
                                                               useSCT                 = (NewTrackingCuts.useSCT() and NewTrackingCuts.useSCTSeeding()),
                                                               SpacePointsSCTName     = InDetKeys.SCT_SpacePoints(),
                                                               # useOverlapSpCollection = NewTrackingCuts.useSCT(),
                                                               useOverlapSpCollection = (NewTrackingCuts.useSCT() and NewTrackingCuts.useSCTSeeding()),
                                                               SpacePointsOverlapName = InDetKeys.OverlapSpacePoints(),
                                                               radMax                 = NewTrackingCuts.radMax(),
                                                               RapidityCut            = NewTrackingCuts.maxEta())
            
         if NewTrackingCuts.mode() == "Offline" or InDetFlags.doHeavyIon() or  NewTrackingCuts.mode() == "ForwardTracks":
            InDetSiSpacePointsSeedMaker.maxdImpactPPS = NewTrackingCuts.maxdImpactPPSSeeds()
            InDetSiSpacePointsSeedMaker.maxdImpactSSS = NewTrackingCuts.maxdImpactSSSSeeds()
         if usePrdAssociationTool:
            # not all classes have that property !!!
            InDetSiSpacePointsSeedMaker.UseAssociationTool = True
            InDetSiSpacePointsSeedMaker.AssociationTool    = InDetPrdAssociationTool
         if not InDetFlags.doCosmics():
            InDetSiSpacePointsSeedMaker.maxRadius1         = 0.75*NewTrackingCuts.radMax()
            InDetSiSpacePointsSeedMaker.maxRadius2         = NewTrackingCuts.radMax()
            InDetSiSpacePointsSeedMaker.maxRadius3         = NewTrackingCuts.radMax()
         if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
            InDetSiSpacePointsSeedMaker.pTmax              = NewTrackingCuts.maxPT()
            InDetSiSpacePointsSeedMaker.mindRadius         = 4.0
         if NewTrackingCuts.mode() == "SLHC":
            InDetSiSpacePointsSeedMaker.minRadius1         = 0
            InDetSiSpacePointsSeedMaker.minRadius2         = 0
            InDetSiSpacePointsSeedMaker.minRadius3         = 0
            InDetSiSpacePointsSeedMaker.maxRadius1         =1000.*Units.mm
            InDetSiSpacePointsSeedMaker.maxRadius2         =1000.*Units.mm
            InDetSiSpacePointsSeedMaker.maxRadius3         =1000.*Units.mm
         if NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "VeryForwardSLHCTracks":
            InDetSiSpacePointsSeedMaker.checkEta           = True
            InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
            InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
            InDetSiSpacePointsSeedMaker.RapidityCut        = NewTrackingCuts.maxEta()
         if NewTrackingCuts.mode() == "DBM":
            InDetSiSpacePointsSeedMaker.etaMin             = NewTrackingCuts.minEta()
            InDetSiSpacePointsSeedMaker.etaMax             = NewTrackingCuts.maxEta()
            InDetSiSpacePointsSeedMaker.useDBM = True

                    
         #InDetSiSpacePointsSeedMaker.OutputLevel = VERBOSE
         ToolSvc += InDetSiSpacePointsSeedMaker
         if (InDetFlags.doPrintConfigurables()):
            print InDetSiSpacePointsSeedMaker
            
         #
         # --- Z-coordinates primary vertices finder (only for collisions)
         #
         if InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM":
            from SiZvertexTool_xk.SiZvertexTool_xkConf import InDet__SiZvertexMaker_xk
            InDetZvertexMaker = InDet__SiZvertexMaker_xk(name          = 'InDetZvertexMaker'+NewTrackingCuts.extension(),
                                                         Zmax          = NewTrackingCuts.maxZImpact(),
                                                         Zmin          = -NewTrackingCuts.maxZImpact(),
                                                         minRatio      = 0.17) # not default
            InDetZvertexMaker.SeedMakerTool = InDetSiSpacePointsSeedMaker

            if InDetFlags.doHeavyIon():
               InDetZvertexMaker.HistSize = 2000
               ###InDetZvertexMaker.minContent = 200 
               InDetZvertexMaker.minContent = 30
               
            ToolSvc += InDetZvertexMaker
            if (InDetFlags.doPrintConfigurables()):
               print InDetZvertexMaker

         else:
            InDetZvertexMaker = None

         #
         # --- SCT and Pixel detector elements road builder
         #
         from SiDetElementsRoadTool_xk.SiDetElementsRoadTool_xkConf import InDet__SiDetElementsRoadMaker_xk
         InDetSiDetElementsRoadMaker = InDet__SiDetElementsRoadMaker_xk(name               = 'InDetSiRoadMaker'+NewTrackingCuts.extension(),
                                                                        PropagatorTool     = InDetPatternPropagator,
                                                                        usePixel           = NewTrackingCuts.usePixel(),
                                                                        PixManagerLocation = InDetKeys.PixelManager(),
                                                                        useSCT             = NewTrackingCuts.useSCT(), 
                                                                        SCTManagerLocation = InDetKeys.SCT_Manager(),         
                                                                        RoadWidth          = NewTrackingCuts.RoadWidth())
         #InDetSiDetElementsRoadMaker.OutputLevel = VERBOSE
         ToolSvc += InDetSiDetElementsRoadMaker
         if (InDetFlags.doPrintConfigurables()):
            print      InDetSiDetElementsRoadMaker

         #
         # --- Local track finding using sdCaloSeededSSSpace point seed
         #

         useBremMode = NewTrackingCuts.mode() == "Offline" or NewTrackingCuts.mode() == "SLHC" or NewTrackingCuts.mode() == "DBM"
         from SiTrackMakerTool_xk.SiTrackMakerTool_xkConf import InDet__SiTrackMaker_xk as SiTrackMaker
         InDetSiTrackMaker = SiTrackMaker(name                      = 'InDetSiTrackMaker'+NewTrackingCuts.extension(),
                                          useSCT                    = NewTrackingCuts.useSCT(),
                                          usePixel                  = NewTrackingCuts.usePixel(),
                                          RoadTool                  = InDetSiDetElementsRoadMaker,
                                          CombinatorialTrackFinder  = InDetSiComTrackFinder,
                                          pTmin                     = NewTrackingCuts.minPT(),
                                          pTminBrem                 = NewTrackingCuts.minPTBrem(),
                                          pTminSSS                  = InDetFlags.pT_SSScut(),
                                          nClustersMin              = NewTrackingCuts.minClusters(),
                                          nHolesMax                 = NewTrackingCuts.nHolesMax(),
                                          nHolesGapMax              = NewTrackingCuts.nHolesGapMax(),
                                          SeedsFilterLevel          = NewTrackingCuts.seedFilterLevel(),
                                          Xi2max                    = NewTrackingCuts.Xi2max(),
                                          Xi2maxNoAdd               = NewTrackingCuts.Xi2maxNoAdd(),
                                          nWeightedClustersMin      = NewTrackingCuts.nWeightedClustersMin(),
                                          CosmicTrack               = InDetFlags.doCosmics(),
                                          Xi2maxMultiTracks         = NewTrackingCuts.Xi2max(), # was 3.
                                          useSSSseedsFilter         = InDetFlags.doSSSfilter(), 
                                          doMultiTracksProd         = True,
                                          useBremModel              = InDetFlags.doBremRecovery() and useBremMode, # only for NewTracking the brem is debugged !!!
                                          doCaloSeededBrem          = InDetFlags.doCaloSeededBrem(),
                                          doHadCaloSeedSSS          = InDetFlags.doHadCaloSeededSSS(),
                                          phiWidth                  = NewTrackingCuts.phiWidthBrem(),
                                          etaWidth                  = NewTrackingCuts.etaWidthBrem(),
                                          InputClusterContainerName = InDetKeys.CaloClusterROIContainer(), # "InDetCaloClusterROIs" 
                                          InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer(), # "InDetCaloClusterROIs" 
                                          UseAssociationTool        = usePrdAssociationTool)
					  
         if NewTrackingCuts.mode() == "DBM":
            InDetSiTrackMaker.MagneticFieldMode = "NoField"
            InDetSiTrackMaker.useBremModel = False
            InDetSiTrackMaker.doMultiTracksProd = False
            InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'			
            InDetSiTrackMaker.pTminSSS = -1
            InDetSiTrackMaker.CosmicTrack = False
            InDetSiTrackMaker.useSSSseedsFilter = False
            InDetSiTrackMaker.doCaloSeededBrem = False
            InDetSiTrackMaker.doHadCaloSeedSSS = False
            InDetSiTrackMaker.UseAssociationTool = False
					
         elif InDetFlags.doCosmics():
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_Cosmic'
	   
         elif InDetFlags.doHeavyIon():
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_HeavyIon'
         
         elif NewTrackingCuts.mode() == "LowPt":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LowMomentum'

         elif NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryLowMomentum'           

         elif NewTrackingCuts.mode() == "BeamGas":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_BeamGas'
 
         elif NewTrackingCuts.mode() == "ForwardTracks":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardTracks'

         elif NewTrackingCuts.mode() == "ForwardSLHCTracks":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_ForwardSLHCTracks'

         elif NewTrackingCuts.mode() == "VeryForwardSLHCTracks": 
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_VeryForwardSLHCTracks' 

         elif NewTrackingCuts.mode() == "LargeD0":
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSpacePointsSeedMaker_LargeD0'
         
         else:
           InDetSiTrackMaker.TrackPatternRecoInfo = 'SiSPSeededFinder'
					  
         #InDetSiTrackMaker.OutputLevel = VERBOSE				  
         ToolSvc += InDetSiTrackMaker
         if (InDetFlags.doPrintConfigurables()):
            print InDetSiTrackMaker
         #
         # set output track collection name
         #
         self.__SiTrackCollection = SiSPSeededTrackCollectionKey
         #
         # --- Setup Track finder using space points seeds
         #

         from SiSPSeededTrackFinder.SiSPSeededTrackFinderConf import InDet__SiSPSeededTrackFinder

         if NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks":

          InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name           = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                    TrackTool      = InDetSiTrackMaker,
                                                                    TracksLocation = self.__SiTrackCollection,
                                                                    SeedsTool      = InDetSiSpacePointsSeedMaker,
                                                                    useZvertexTool = InDetFlags.useZvertexTool(),
                                                                    ZvertexTool    = InDetZvertexMaker,
                                                                    useNewStrategy = False,
                                                                    useMBTSTimeDiff = InDetFlags.useMBTSTimeDiff(),
                                                                    useZBoundFinding = False)
         
         else:
          InDetSiSPSeededTrackFinder = InDet__SiSPSeededTrackFinder(name           = 'InDetSiSpTrackFinder'+NewTrackingCuts.extension(),
                                                                    TrackTool      = InDetSiTrackMaker,
                                                                    TracksLocation = self.__SiTrackCollection,
                                                                    SeedsTool      = InDetSiSpacePointsSeedMaker,
                                                                    useZvertexTool = InDetFlags.useZvertexTool() and NewTrackingCuts.mode() != "DBM",
                                                                    ZvertexTool    = InDetZvertexMaker,
                                                                    useNewStrategy = InDetFlags.useNewSiSPSeededTF() and NewTrackingCuts.mode() != "DBM",
                                                                    useMBTSTimeDiff = InDetFlags.useMBTSTimeDiff(),
                                                                    useZBoundFinding = NewTrackingCuts.doZBoundary() and NewTrackingCuts.mode() != "DBM")   

         #InDetSiSPSeededTrackFinder.OutputLevel =VERBOSE 
         topSequence += InDetSiSPSeededTrackFinder
         if (InDetFlags.doPrintConfigurables()):
            print InDetSiSPSeededTrackFinder

         if not InDetFlags.doSGDeletion():
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__SiTrackCollection,
                                                            self.__SiTrackCollection+"DetailedTruth",
                                                            self.__SiTrackCollection+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__SiTrackCollection ]
               
      # ------------------------------------------------------------
      #
      # ---------- Ambiguity solving
      #
      # ------------------------------------------------------------

      if InDetFlags.doAmbiSolving():
         #
         # --- load InnerDetector TrackSelectionTool
         #
         
         prob1 = InDetFlags.pixelClusterSplitProb1()
         prob2 = InDetFlags.pixelClusterSplitProb2()
         nhitsToAllowSplitting = 9

         if geoFlags.Run() == 1:
            prob1 = InDetFlags.pixelClusterSplitProb1_run1()
            prob2 = InDetFlags.pixelClusterSplitProb2_run1() 
            nhitsToAllowSplitting = 8

         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetDenseEnvAmbiTrackSelectionTool as AmbiTrackSelectionTool
         else:
           from InDetAmbiTrackSelectionTool.InDetAmbiTrackSelectionToolConf import InDet__InDetAmbiTrackSelectionTool as AmbiTrackSelectionTool
         InDetAmbiTrackSelectionTool = AmbiTrackSelectionTool(name                = 'InDetAmbiTrackSelectionTool'+NewTrackingCuts.extension(),
                                                              AssociationTool     = InDetPrdAssociationTool,
                                                              DriftCircleCutTool  = InDetTRTDriftCircleCut,
                                                              minHits             = NewTrackingCuts.minClusters(),
                                                              minNotShared        = NewTrackingCuts.minSiNotShared(),
                                                              maxShared           = NewTrackingCuts.maxShared(),
                                                              minTRTHits          = 0, # used for Si only tracking !!!
                                                              sharedProbCut       = 0.10,
                                                              UseParameterization = False,
                                                              Cosmics             = InDetFlags.doCosmics(),
                                                              doPixelSplitting    = InDetFlags.doPixelClusterSplitting() and NewTrackingCuts.mode != "DBM")

         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           InDetAmbiTrackSelectionTool.sharedProbCut             = prob1
           InDetAmbiTrackSelectionTool.sharedProbCut2            = prob2
           InDetAmbiTrackSelectionTool.minSiHitsToAllowSplitting = nhitsToAllowSplitting
           InDetAmbiTrackSelectionTool.minUniqueSCTHits          = 4
           InDetAmbiTrackSelectionTool.minTrackChi2ForSharedHits = 3
           InDetAmbiTrackSelectionTool.InputHadClusterContainerName = InDetKeys.HadCaloClusterROIContainer()
           InDetAmbiTrackSelectionTool.doHadCaloSeed             = False   #Only split in cluster in region of interest
           InDetAmbiTrackSelectionTool.minPtSplit                = InDetFlags.pixelClusterSplitMinPt()       #Only allow split clusters on track withe pt greater than this MeV
           InDetAmbiTrackSelectionTool.phiWidth                  = 0.2     #Split cluster ROI size
           InDetAmbiTrackSelectionTool.etaWidth                  = 0.2     #Split cluster ROI size
         if NewTrackingCuts.mode() == "DBM":
           InDetAmbiTrackSelectionTool.Cosmics = False
           InDetAmbiTrackSelectionTool.UseParameterization   = False
           InDetAmbiTrackSelectionTool.doPixelSplitting      = False
           InDetAmbiTrackSelectionTool.maxShared             = 1000
           InDetAmbiTrackSelectionTool.maxTracksPerSharedPRD = 2
           InDetAmbiTrackSelectionTool.minHits               = 0
           InDetAmbiTrackSelectionTool.minNotShared          = 0
           InDetAmbiTrackSelectionTool.minScoreShareTracks   = 0.0
           InDetAmbiTrackSelectionTool.minTRTHits            = 0
           InDetAmbiTrackSelectionTool.sharedProbCut         = 0.1
        
         # if NewTrackingCuts.mode() == "ForwardTracks":
         #    InDetAmbiTrackSelectionTool.OutputLevel = VERBOSE

         ToolSvc += InDetAmbiTrackSelectionTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiTrackSelectionTool
         #
         # --- set up different Scoring Tool for collisions and cosmics
         #
         if InDetFlags.doCosmics() and NewTrackingCuts.mode() != "DBM":
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetCosmicScoringTool
            InDetAmbiScoringTool = InDet__InDetCosmicScoringTool(name                 = 'InDetCosmicsScoringTool'+NewTrackingCuts.extension(),
                                                                 nWeightedClustersMin = NewTrackingCuts.nWeightedClustersMin(),
                                                                 minTRTHits           = 0,
                                                                 SummaryTool          = InDetTrackSummaryTool)
         else:
            from InDetTrackScoringTools.InDetTrackScoringToolsConf import InDet__InDetAmbiScoringTool
            InDetAmbiScoringTool = InDet__InDetAmbiScoringTool(name                    = 'InDetAmbiScoringTool'+NewTrackingCuts.extension(),
                                                               Extrapolator            = InDetExtrapolator,
                                                               SummaryTool             = InDetTrackSummaryTool,
                                                               DriftCircleCutTool      = InDetTRTDriftCircleCut,
                                                               useAmbigFcn             = True,  # this is NewTracking
                                                               useTRT_AmbigFcn         = False,
                                                               minPt                   = NewTrackingCuts.minPT(),
                                                               maxRPhiImp              = NewTrackingCuts.maxPrimaryImpact(),
                                                               maxZImp                 = NewTrackingCuts.maxZImpact(),
                                                               maxEta                  = NewTrackingCuts.maxEta(),
                                                               minSiClusters           = NewTrackingCuts.minClusters(),
                                                               minPixel                = NewTrackingCuts.minPixel(),                                     
                                                               maxSiHoles              = NewTrackingCuts.maxHoles(),
                                                               maxPixelHoles           = NewTrackingCuts.maxPixelHoles(),
                                                               maxSCTHoles             = NewTrackingCuts.maxSCTHoles(),
                                                               maxDoubleHoles          = NewTrackingCuts.maxDoubleHoles(),
                                                               usePixel                = NewTrackingCuts.usePixel(),
                                                               useSCT                  = NewTrackingCuts.useSCT(),
                                                               minTRTonTrk             = 0,
                                                               minTRTPrecisionFraction = 0);
            # allow for some overlap for low-pt tracking
            #if InDetFlags.doLowPt() and not NewTrackingCuts.mode() == "LowPt":
            #   InDetAmbiScoringTool.minPt = NewTrackingCuts.minPT()-100.*Units.MeV

         # if NewTrackingCuts.mode() == "ForwardTracks":
         #   InDetAmbiScoringTool.OutputLevel = VERBOSE   

         ToolSvc += InDetAmbiScoringTool
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiScoringTool
         #
         # --- load Ambiguity Processor
         #
         useBremMode = NewTrackingCuts.mode() == "Offline" or NewTrackingCuts.mode() == "SLHC"

         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__DenseEnvironmentsAmbiguityProcessorTool as ProcessorTool
         else:
           from TrkAmbiguityProcessor.TrkAmbiguityProcessorConf import Trk__SimpleAmbiguityProcessorTool as ProcessorTool
         InDetAmbiguityProcessor = ProcessorTool(name               = 'InDetAmbiguityProcessor'+NewTrackingCuts.extension(),
                                                 Fitter             = InDetTrackFitter,
                                                 ScoringTool        = InDetAmbiScoringTool,
                                                 SelectionTool      = InDetAmbiTrackSelectionTool,
                                                 SuppressHoleSearch = False,
                                                 tryBremFit         = InDetFlags.doBremRecovery() and useBremMode and NewTrackingCuts.mode() != "DBM",
                                                 caloSeededBrem     = InDetFlags.doCaloSeededBrem() and NewTrackingCuts.mode() != "DBM",
                                                 pTminBrem          = NewTrackingCuts.minPTBrem(),
                                                 RefitPrds          = not InDetFlags.refitROT())
         if InDetFlags.doTIDE_Ambi() and not (NewTrackingCuts.mode() == "ForwardSLHCTracks" or NewTrackingCuts.mode() == "ForwardTracks" or NewTrackingCuts.mode() == "PixelPrdAssociation" or NewTrackingCuts.mode() == "DBM"):
           InDetAmbiguityProcessor.sharedProbCut             = prob1
           InDetAmbiguityProcessor.sharedProbCut2            = prob2
           InDetAmbiguityProcessor.SplitClusterAmbiguityMap  = InDetKeys.SplitClusterAmbiguityMap()

         if NewTrackingCuts.mode() == "Pixel" or NewTrackingCuts.mode() == "DBM":
            InDetAmbiguityProcessor.SuppressHoleSearch = True
         if NewTrackingCuts.mode() == "LowPt" or NewTrackingCuts.mode() == "VeryLowPt" or (NewTrackingCuts.mode() == "Pixel" and InDetFlags.doMinBias()):
            InDetAmbiguityProcessor.Fitter = InDetTrackFitterLowPt
             
         if InDetFlags.materialInteractions():
            InDetAmbiguityProcessor.MatEffects = InDetFlags.materialInteractionsType()
         else:
            InDetAmbiguityProcessor.MatEffects = 0

         # if NewTrackingCuts.mode() == "ForwardTracks":
         #    InDetAmbiguityProcessor.OutputLevel = VERBOSE

         ToolSvc += InDetAmbiguityProcessor
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiguityProcessor
         #
         # --- set input and output collection
         #
         InputTrackCollection     = self.__SiTrackCollection
         self.__SiTrackCollection = ResolvedTrackCollectionKey
         #
         # --- configure Ambiguity solver
         #
         from TrkAmbiguitySolver.TrkAmbiguitySolverConf import Trk__TrkAmbiguitySolver
         InDetAmbiguitySolver = Trk__TrkAmbiguitySolver(name               = 'InDetAmbiguitySolver'+NewTrackingCuts.extension(),
                                                        TrackInput         = [ InputTrackCollection ],
                                                        TrackOutput        = self.__SiTrackCollection,
                                                        AmbiguityProcessor = InDetAmbiguityProcessor)
         topSequence += InDetAmbiguitySolver
         if (InDetFlags.doPrintConfigurables()):
            print InDetAmbiguitySolver

         #
         # --- Delete Silicon Sp-Seeded tracks
         #
         from InDetRecExample.ConfiguredInDetSGDeletion import InDetSGDeletionAlg
         InDetSGDeletionAlg(key = SiSPSeededTrackCollectionKey)

         if ( ( NewTrackingCuts.mode() in ["Pixel", "SCT"] ) or not InDetFlags.doSGDeletion()):
            if InDetFlags.doTruth():
               #
               # set up the truth info for this container
               #
               include ("InDetRecExample/ConfiguredInDetTrackTruth.py")
               InDetTracksTruth = ConfiguredInDetTrackTruth(self.__SiTrackCollection,
                                                            self.__SiTrackCollection+"DetailedTruth",
                                                            self.__SiTrackCollection+"TruthCollection")
               #
               # add final output for statistics
               #
               TrackCollectionKeys      += [ InDetTracksTruth.Tracks() ]
               TrackCollectionTruthKeys += [ InDetTracksTruth.TracksTruth() ]
            else:
               TrackCollectionKeys      += [ self.__SiTrackCollection ]
#--- for MajorityConditionsSvc
# use new CONDBR2, A.N., 2014-11-30
year=int(projectName[4:6])
if (year > 13):
    conddb.addFolder('',"<db>COOLOFL_DCS/CONDBR2</db> /SCT/DCS/MAJ")
else:
    conddb.addFolder('',"<db>COOLOFL_DCS/COMP200</db> /SCT/DCS/MAJ")


from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_MajorityConditionsSvc
InDetSCT_MajorityConditionsSvc = SCT_MajorityConditionsSvc( name = "InDetSCT_MajorityConditionsSvc" )
InDetSCT_MajorityConditionsSvc.UseOverall       = True
InDetSCT_MajorityConditionsSvc.MajorityFraction = 0.9
ServiceMgr += InDetSCT_ConfigurationConditionsSvc
if ( InDetFlags.doPrintConfigurables() ):
    print InDetSCT_MajorityConditionsSvc

#--- conditions tag
conddb.setGlobalTag( globalflags.ConditionsTag() ) 
#IOVDbSvc.CacheRun = M    # can also just do M runs at a time. 
#IOVDbSvc.CacheTime = 3600 # in seconds

#--------------------------------------------------------------
# Saving ROOT histograms
#--------------------------------------------------------------
from GaudiSvc.GaudiSvcConf import THistSvc
ServiceMgr += THistSvc()
if DoHitMaps : 
    ServiceMgr.THistSvc.Output += [ "HitMaps  DATAFILE='SCTHitMaps.root'  OPT='RECREATE'" ]
if DoNoisyLB :    
Пример #47
0
include.block('InDetRecExample/InDetRecCabling.py')

from InDetRecExample.InDetJobProperties import InDetFlags

if not ('conddb' in dir()):
    IOVDbSvc = Service("IOVDbSvc")
    from IOVDbSvc.CondDB import conddb

#
# --- Pixel cabling
#
if DetFlags.detdescr.pixel_on() and not 'PixelCabling' in dir():
    from AthenaCommon.CfgGetter import getService
    PixelCablingSvc = getService("PixelCablingSvc")
    ServiceMgr += PixelCablingSvc
    if (InDetFlags.doPrintConfigurables()):
        print PixelCablingSvc

#
# --- SCT cabling
#
if DetFlags.detdescr.SCT_on() and not 'SCT_CablingSvc' in dir():
    SCTCablingDataSource = 'CORACOOL'
    SCTConfigurationFolderPath = '/SCT/DAQ/Config/'
    #if its COMP200, use old folders...
    if (conddb.dbdata == "COMP200"):
        SCTConfigurationFolderPath = '/SCT/DAQ/Configuration/'
    #...but now check if we want to override that decision with explicit flag (if there is one)
    try:
        if InDetFlags.ForceCoraCool():
            SCTConfigurationFolderPath = '/SCT/DAQ/Configuration/'
Пример #48
0
									InDetFlags.doVtxNtuple        = False and readAOD # for now only possible on AOD
									InDetFlags.doConvVtxNtuple    = False
									InDetFlags.doRefit            = doRefitTracks
									InDetFlags.doPrintConfigurables = True
									
									# --- activate (memory/cpu) monitoring
                                                                        #InDetFlags.doPerfMon = True
									
									# IMPORTANT NOTE: initialization of the flags and locking them is done in InDetRec_jobOptions.py!
									# This way RecExCommon just needs to import the properties without doing anything else!
									# DO NOT SET JOBPROPERTIES AFTER THIS LINE! The change will be ignored!

									# next section assures that keys are ok and nothing inconsistent is written out ...
									print "InDetRec_jobOptions: InDetKeys not set - setting to defaults"
									from InDetRecExample.InDetKeys import InDetKeys
									if InDetFlags.doVertexFinding():
										print "reDoPrimaryVertexing enabled: adjusting some StoreGate keys:"
										
										InDetKeys.PrimaryVertices = "New"+InDetKeys.PrimaryVertices()
										print "InDetKeys.PrimaryVertices = "+InDetKeys.PrimaryVertices()
										
										if readAOD: # this one is mutally exclusive with useRefittedTrack.. and the doParticleCreation flag
											InDetKeys.Tracks = InDetKeys.TrackParticles()
											print "InDetKeys.Tracks = "+InDetKeys.Tracks()
											
											if InDetFlags.doParticleCreation():
												InDetKeys.TrackParticles      = "New"+InDetKeys.TrackParticles()
												InDetKeys.TrackParticlesTruth = "New"+InDetKeys.TrackParticlesTruth()
												print "InDetKeys.TrackParticles      = "+InDetKeys.TrackParticles()
												print "InDetKeys.TrackParticlesTruth = "+InDetKeys.TrackParticlesTruth()
											else: