diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py index 82b4e5f71c3e038f84dbf93998002a6e3cc5b541..ecd768873b242efdf91c18a9f87ebaa878f77f26 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py @@ -512,6 +512,12 @@ class useZvertexTool(InDetFlagsJobProperty): allowedTypes = ['bool'] StoredValue = False +class useActsPriVertexing(InDetFlagsJobProperty): + """ use ACTS primary vertexing """ + statusOn = True + allowedTypes = ['bool'] + StoredValue = False + class doSiSPSeededTrackFinder(InDetFlagsJobProperty): """ use track finding in silicon """ statusOn = True @@ -2378,6 +2384,8 @@ class InDetJobProperties(JobPropertyContainer): print('* - primary vertexing cut setup : ',self.primaryVertexCutSetup()) if self.doPrimaryVertex3DFinding() : print('* - use 3D seed finding') + if self.useActsPriVertexing(): + print('* - use Acts primary vertex finding') print('* - privtx cut level : ', self.priVtxCutLevel()) if self.doParticleCreation() : print('* create TrackParticles') @@ -2663,6 +2671,7 @@ _list_InDetJobProperties = [Enabled, trackFitterType, doHolesOnTrack, useZvertexTool, + useActsPriVertexing, doSiSPSeededTrackFinder, # doTRTExtension, doTRTExtensionNew, diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index 16c6014dc09b44f3e71a7f34c4478804fcc72085..5b6012e177ae740bcf0402bf37ffc9bcc93e8cf6 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -896,16 +896,29 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o # # --- load adaptive multi primary vertex finder # - from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptiveMultiPriVxFinderTool - InDetPriVxFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool( - name="InDetAdaptiveMultiPriVxFinderTool", - SeedFinder=InDetVtxSeedFinder, - VertexFitterTool=InDetVxFitterTool, - TrackSelector=InDetTrackSelectorTool, - useBeamConstraint=InDetFlags.useBeamConstraint(), - selectiontype=0, - TracksMaxZinterval=3, # mm - do3dSplitting=InDetFlags.doPrimaryVertex3DFinding()) + if not InDetFlags.useActsPriVertexing(): + from InDetPriVxFinderTool.InDetPriVxFinderToolConf import InDet__InDetAdaptiveMultiPriVxFinderTool + InDetPriVxFinderTool = InDet__InDetAdaptiveMultiPriVxFinderTool(name = "InDetAdaptiveMultiPriVxFinderTool", + SeedFinder = InDetVtxSeedFinder, + VertexFitterTool = InDetVxFitterTool, + TrackSelector = InDetTrackSelectorTool, + useBeamConstraint = InDetFlags.useBeamConstraint(), + selectiontype = 0, + TracksMaxZinterval = 3,#mm + do3dSplitting = InDetFlags.doPrimaryVertex3DFinding()) + else: + from ActsGeometry.ActsTrackingGeometryTool import ActsTrackingGeometryTool + from ActsPriVtxFinder.ActsPriVtxFinderConf import ActsAdaptiveMultiPriVtxFinderTool + actsTrackingGeometryTool = getattr(ToolSvc,"ActsTrackingGeometryTool") + actsExtrapolationTool = CfgMgr.ActsExtrapolationTool("ActsExtrapolationTool") + actsExtrapolationTool.TrackingGeometryTool = actsTrackingGeometryTool + InDetPriVxFinderTool = ActsAdaptiveMultiPriVtxFinderTool(name = "ActsAdaptiveMultiPriVtxFinderTool", + TrackSelector = InDetTrackSelectorTool, + useBeamConstraint = InDetFlags.useBeamConstraint(), + tracksMaxZinterval = 3,#mm + do3dSplitting = InDetFlags.doPrimaryVertex3DFinding(), + TrackingGeometryTool = actsTrackingGeometryTool, + ExtrapolationTool = actsExtrapolationTool) else: # diff --git a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h index 905114c8fd399c0c080157ad6885ffcdbaa89a5f..e22abc87746931e68e7a91696c5909308b3c0bd0 100755 --- a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h +++ b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/InDetPriVxFinder/InDetPriVxFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -20,15 +20,17 @@ #ifndef INDETPRIVXFINDER_INDETPRIVXFINDER_H #define INDETPRIVXFINDER_INDETPRIVXFINDER_H -#include "AthenaBaseComps/AthAlgorithm.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "GaudiKernel/ToolHandle.h" #include "TrkTrack/TrackCollection.h" #include "xAODTracking/TrackParticleContainer.h" #include "xAODTracking/VertexContainer.h" #include "xAODTracking/VertexAuxContainer.h" - #include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "InDetRecToolInterfaces/IVertexFinder.h" +#include "TrkVertexFitterInterfaces/IVertexMergingTool.h" +#include "TrkVertexFitterInterfaces/IVertexCollectionSortingTool.h" /** Primary Vertex Finder. InDetPriVxFinder uses the InDetPrimaryVertexFinderTool in the package @@ -36,49 +38,37 @@ and records the returned VxContainer. */ -/* Forward declarations */ - -namespace Trk -{ - class IVertexMergingTool; - class IVertexCollectionSortingTool; -} - namespace InDet -{ - class IVertexFinder; - - class InDetPriVxFinder : public AthAlgorithm +{ + class InDetPriVxFinder : public AthReentrantAlgorithm { public: InDetPriVxFinder(const std::string &name, ISvcLocator *pSvcLocator); - virtual ~InDetPriVxFinder(); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); + + virtual ~InDetPriVxFinder() = default; - //Monitoring of the vertex variables - void monitor_vertex( const std::string &prefix, xAOD::Vertex vertex ); - + // Gaudi algorithm hooks + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + virtual StatusCode finalize() override; private: + + //Monitoring of the vertex variables + void monitor_vertex( const std::string &prefix, xAOD::Vertex vertex ) const; + SG::ReadHandleKey<TrackCollection> m_trkTracksName{this,"TrkTracksName","Tracks","Trk::Track Collection used in Vertexing"}; SG::ReadHandleKey<xAOD::TrackParticleContainer> m_tracksName{this,"TracksName","InDetTrackParticles","xAOD::TrackParticle Collection used in Vertexing"}; SG::WriteHandleKey<xAOD::VertexContainer> m_vxCandidatesOutputName{this,"VxCandidatesOutputName","PrimaryVertices","Output Vertex Collection"}; - ToolHandle< IVertexFinder > m_VertexFinderTool; - ToolHandle<Trk::IVertexMergingTool > m_VertexMergingTool; - ToolHandle<Trk::IVertexCollectionSortingTool > m_VertexCollectionSortingTool; - - bool m_doVertexMerging; - bool m_doVertexSorting; - bool m_useTrackParticles;//use TrackParticles or Trk::Tracks as input - - // for summary output at the end - unsigned int m_numEventsProcessed; - unsigned int m_totalNumVerticesWithoutDummy; - + ToolHandle< IVertexFinder > m_VertexFinderTool{this, "VertexFinderTool", "", "Primary vertex finder tool"}; + ToolHandle<Trk::IVertexMergingTool > m_VertexMergingTool{this, "VertexMergingTool", "", "Vertex merging tool"}; + ToolHandle<Trk::IVertexCollectionSortingTool > m_VertexCollectionSortingTool{this, "VertexCollectionSortingTool", "", "Vertex collection sorting tool"}; ToolHandle<GenericMonitoringTool> m_monTool{this, "PriVxMonTool", "", "Monitoring tool"}; + + BooleanProperty m_doVertexMerging{this, "doVertexMerging", false, "Do vertex merging"}; + BooleanProperty m_doVertexSorting{this, "doVertexSorting", false, "Do vertex sorting"}; + BooleanProperty m_useTrackParticles{this, "useTrackParticles", true, "Use track particles as input"}; }; } #endif diff --git a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx index d508a6f4099afdb025b674bafbd1dedfa94ec4cf..a69afcffd895d0e3e7772d523bf94d248aaa9e8d 100755 --- a/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx +++ b/InnerDetector/InDetRecAlgs/InDetPriVxFinder/src/InDetPriVxFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -11,45 +11,21 @@ changes : ***************************************************************************/ #include "InDetPriVxFinder/InDetPriVxFinder.h" -// forward declares -#include "InDetRecToolInterfaces/IVertexFinder.h" -#include "TrkVertexFitterInterfaces/IVertexMergingTool.h" -#include "TrkVertexFitterInterfaces/IVertexCollectionSortingTool.h" #include "xAODTracking/Vertex.h" #include "xAODTracking/TrackParticle.h" #include "xAODTracking/TrackParticleAuxContainer.h" +#include "AthenaMonitoringKernel/Monitored.h" // normal includes #include "TrkParticleBase/TrackParticleBaseCollection.h" -#include "AthenaMonitoringKernel/Monitored.h" - namespace InDet { - InDetPriVxFinder::InDetPriVxFinder ( const std::string &n, ISvcLocator *pSvcLoc ) - : AthAlgorithm ( n, pSvcLoc ), - m_VertexFinderTool ( "InDet::InDetPriVxFinderTool" ), - m_VertexMergingTool( "Trk::VertexMergingTool" ), - m_VertexCollectionSortingTool ("Trk::VertexCollectionSortingTool"), - m_doVertexMerging(false), - m_doVertexSorting(false), - m_useTrackParticles(true), - // for summary output at the end - m_numEventsProcessed(0), - m_totalNumVerticesWithoutDummy(0) +InDetPriVxFinder::InDetPriVxFinder + (const std::string& name,ISvcLocator* pSvcLocator) : AthReentrantAlgorithm(name, pSvcLocator) + { } - { - declareProperty ( "VertexFinderTool",m_VertexFinderTool ); - declareProperty ( "VertexMergingTool",m_VertexMergingTool ); - declareProperty ( "VertexCollectionSortingTool",m_VertexCollectionSortingTool ); - declareProperty ( "doVertexMerging",m_doVertexMerging ); - declareProperty ( "doVertexSorting",m_doVertexSorting ); - declareProperty ( "useTrackParticles", m_useTrackParticles); - } - - InDetPriVxFinder::~InDetPriVxFinder() - {} StatusCode InDetPriVxFinder::initialize() { @@ -64,7 +40,7 @@ namespace InDet msg(MSG::INFO) << "Retrieved tool " << m_VertexFinderTool << endmsg; } - /*Get the Vertex Mergin Tool*/ + /*Get the Vertex Merging Tool*/ if (m_doVertexMerging) { if ( m_VertexMergingTool.retrieve().isFailure() ) { @@ -93,23 +69,21 @@ namespace InDet } else { m_VertexCollectionSortingTool.disable(); } + if (!m_monTool.empty()) CHECK(m_monTool.retrieve()); ATH_CHECK(m_trkTracksName.initialize(!m_useTrackParticles)); ATH_CHECK(m_tracksName.initialize(m_useTrackParticles)); ATH_CHECK(m_vxCandidatesOutputName.initialize()); - - if (!m_monTool.empty()) CHECK(m_monTool.retrieve()); msg(MSG::INFO) << "Initialization successful" << endmsg; return StatusCode::SUCCESS; } - StatusCode InDetPriVxFinder::execute() + StatusCode InDetPriVxFinder::execute(const EventContext& ctx) const { - m_numEventsProcessed++; - SG::WriteHandle<xAOD::VertexContainer> outputVertices (m_vxCandidatesOutputName); + SG::WriteHandle<xAOD::VertexContainer> outputVertices (m_vxCandidatesOutputName, ctx); xAOD::VertexContainer* vertexContainer = 0; xAOD::VertexAuxContainer* vertexAuxContainer = 0; @@ -117,9 +91,10 @@ namespace InDet = std::make_pair( vertexContainer, vertexAuxContainer ); if(m_useTrackParticles){ - SG::ReadHandle<xAOD::TrackParticleContainer> trackParticleCollection(m_tracksName); + SG::ReadHandle<xAOD::TrackParticleContainer> trackParticleCollection(m_tracksName, ctx); if(trackParticleCollection.isValid()){ - vertexContainerPair = m_VertexFinderTool->findVertex ( trackParticleCollection.cptr() ); + + vertexContainerPair = m_VertexFinderTool->findVertex ( trackParticleCollection.cptr() ); } else{ ATH_MSG_ERROR("No TrackParticle Collection with key "<<m_tracksName.key()<<" exists in StoreGate. No Vertexing Possible"); @@ -127,7 +102,7 @@ namespace InDet } } else{ - SG::ReadHandle<TrackCollection> trackCollection(m_trkTracksName); + SG::ReadHandle<TrackCollection> trackCollection(m_trkTracksName, ctx); if(trackCollection.isValid()){ vertexContainerPair = m_VertexFinderTool->findVertex ( trackCollection.cptr() ); } @@ -174,7 +149,6 @@ namespace InDet } ATH_MSG_DEBUG("Successfully reconstructed " << myVertexContainerPair.first->size()-1 << " vertices (excluding dummy)"); - m_totalNumVerticesWithoutDummy += (myVertexContainerPair.first->size()-1); } ATH_CHECK(outputVertices.record(std::unique_ptr<xAOD::VertexContainer>(myVertexContainerPair.first),std::unique_ptr<xAOD::VertexAuxContainer>(myVertexContainerPair.second))); @@ -196,16 +170,10 @@ namespace InDet StatusCode InDetPriVxFinder::finalize() { - if (msgLvl(MSG::INFO)) - { - msg() << "Summary from Primary Vertex Finder (InnerDetector/InDetRecAlgs/InDetPriVxFinder)" << endmsg; - msg() << "=== " << m_totalNumVerticesWithoutDummy << " vertices recoed in " << m_numEventsProcessed << " events (excluding dummy)." << endmsg; - if (m_numEventsProcessed!=0) msg() << "=== " << double(m_totalNumVerticesWithoutDummy)/double(m_numEventsProcessed) << " vertices per event (excluding dummy)." << endmsg; - } return StatusCode::SUCCESS; } - void InDetPriVxFinder::monitor_vertex( const std::string &prefix, xAOD::Vertex vertex ){ + void InDetPriVxFinder::monitor_vertex( const std::string &prefix, xAOD::Vertex vertex ) const { if (prefix == "allVertex"){ auto x = Monitored::Scalar<double>( "allVertexX", vertex.x() ); auto y = Monitored::Scalar<double>( "allVertexY", vertex.y() ); @@ -225,7 +193,5 @@ namespace InDet auto mon = Monitored::Group(m_monTool, x, y, z, chi2, nDoF, NTracks ); } } - - } // end namespace InDet diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py index 2dc4fc298f19c42e1a0ef6aa45cd8994d76cde6e..1d2e09aba1d661fec2468e0ea1b4f740735d0855 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValDecoration.py @@ -183,8 +183,12 @@ def getTrackDecorators(**kwargs) : of the algorithms will be extended by the collection name. ''' # only valid kwarg : TrackParticleContainerName - return [ getInDetPhysHitDecoratorAlg(**kwargs), - getParameterErrDecoratorAlg(**kwargs) ] + from RecExConfig.AutoConfiguration import IsInInputFile + if not IsInInputFile('Trk::TrackCollection','CombinedInDetTracks') : + return [ getParameterErrDecoratorAlg(**kwargs) ] + else : + return [ getInDetPhysHitDecoratorAlg(**kwargs), + getParameterErrDecoratorAlg(**kwargs) ] def getDBMTrackDecorators(**kwargs) : from InDetRecExample.InDetKeys import InDetKeys diff --git a/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py b/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py new file mode 100644 index 0000000000000000000000000000000000000000..0537e430445c037d5230c3e65760aaab34f1bab1 --- /dev/null +++ b/Tracking/Acts/ActsGeometry/python/ActsTrackingGeometryTool.py @@ -0,0 +1,60 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +################################################################################## +# The ActsTrackingGeometryTool fragment +# +# usage: +# include('ActsGeometry/ActsTrackingGeometryTool.py') +################################################################################## + +from __future__ import print_function + +# import the DetFlags for the setting +from AthenaCommon.DetFlags import DetFlags + +from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags + +# import the Extrapolator configurable +from ActsGeometry.ActsGeometryConf import ActsTrackingGeometryTool + +class ConfiguredActsTrackingGeometry( ActsTrackingGeometryTool ) : + # constructor + def __init__(self,name): + + subDetectors = [] + if DetFlags.pixel_on(): + subDetectors += ["Pixel"] + if DetFlags.SCT_on(): + subDetectors += ["SCT"] + if DetFlags.TRT_on(): + subDetectors += ["TRT"] + if DetFlags.Calo_on(): + subDetectors += ["Calo"] + + from ActsGeometry.ActsGeometryConf import ActsTrackingGeometrySvc + actsTrackingGeometrySvc = ActsTrackingGeometrySvc(name = "ActsTrackingGeometrySvc", + BuildSubDetectors = subDetectors) + + from AthenaCommon.AppMgr import ServiceMgr + ServiceMgr += actsTrackingGeometrySvc + + + from ActsGeometry.ActsGeometryConf import NominalAlignmentCondAlg + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "NominalAlignmentCondAlg"): + condSeq += NominalAlignmentCondAlg(name = "NominalAlignmentCondAlg") + + ActsTrackingGeometryTool.__init__(self, + name, + ActsTrackingGeometrySvc=actsTrackingGeometrySvc) + +################################################################################## + +# now create the instance +from AthenaCommon.AppMgr import ToolSvc +if not hasattr(ToolSvc, "ActsTrackingGeometryTool"): + actsTrackingGeometryTool = ConfiguredActsTrackingGeometry(name = "ActsTrackingGeometryTool") + # add it to the ServiceManager + ToolSvc += actsTrackingGeometryTool + diff --git a/Tracking/Acts/ActsPriVtxFinder/share/ActsPriVtxFinder_jobOptions.py b/Tracking/Acts/ActsPriVtxFinder/share/ActsPriVtxFinder_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..4189a85049cac4640b2cda11c2e743f326d25de6 --- /dev/null +++ b/Tracking/Acts/ActsPriVtxFinder/share/ActsPriVtxFinder_jobOptions.py @@ -0,0 +1,237 @@ +from AthenaCommon.AppMgr import ServiceMgr +#-------------------------------------------------------------- +# control input +#-------------------------------------------------------------- +# --- specify input type +#if not 'readAOD' in dir(): +readAOD = True +readESD = not readAOD + +# Use Acts AMVF +doAMVF = True +useActs = True +#-------------------------------------------------------------- +# Event related parameters +#-------------------------------------------------------------- +nEvents = 30 + +# Set your input AOD file here +myfile = "" + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + +if readESD: + athenaCommonFlags.FilesInput = [ "ESD.pool.root" ] +elif readAOD: + athenaCommonFlags.FilesInput = [ myfile ] + +import AthenaPython.ConfigLib as apcl +cfg = apcl.AutoCfg(name = 'InDetRecExampleAutoConfig', input_files=athenaCommonFlags.FilesInput()) + +theApp.EvtMax = nEvents + +#-------------------------------------------------------------- +# control output (here so RecExCommon via auto-config doesn't delete the global flags) +#-------------------------------------------------------------- +# --- controls what is written out. ESD includes AOD, so it's normally enough +doWriteESD = False and readESD +doWriteAOD = True + +#-------------------------------------------------------------- +# control algorithms to be rerun +#-------------------------------------------------------------- +# --- run InDetRecStatistics (only possible if readESD = True) +doInDetRecStatistics = True and readESD +# --- refit the EXISTING tracks in ESD (only possible if readESD = True) +doRefitTracks = False and readESD +# --- redo the pattern reco and the tracking (do not use that in conjunction with doRefitTracks above) +redoPatternRecoAndTracking = False and not doRefitTracks and readESD +# --- redo primary vertexing (will be set to true later automatically if you redid the tracking and want to redo the TrackParticle creation) +reDoPrimaryVertexing = True +# --- redo particle creation (recommended after revertexing on ESD, otherwise trackparticles are inconsistent) +reDoParticleCreation = False and readESD and reDoPrimaryVertexing +# --- redo conversion finding +reDoConversions = False +# --- redo V0 finding +reDoV0Finder = False + +#-------------------------------------------------------------- +# Control - standard options (as in jobOptions.py) +#-------------------------------------------------------------- +# --- Set output level threshold (2=DEBUG, 3=INFO, 4=WARNING, 5=ERROR, 6=FATAL ) +OutputLevel = INFO +# --- produce an atlantis data file +doJiveXML = False +# --- run the Virtual Point 1 event visualisation +doVP1 = False +# --- do auditors ? +doAuditors = True + +import os +if os.environ['CMTCONFIG'].endswith('-dbg'): + # --- do EDM monitor (debug mode only) + doEdmMonitor = True + # --- write out a short message upon entering or leaving each algorithm + doNameAuditor = True +else: + doEdmMonitor = False + doNameAuditor = False + +# safety section ... redoing tracking/vertexing is a tricky business to stay consistent ... +if redoPatternRecoAndTracking and reDoParticleCreation: + reDoPrimaryVertexing = True + +if not (readESD or readAOD): + print( "You have to turn on reading of ESD or AOD! That's the purpose of this jobO!") +if readESD and readAOD: + print( "I can either read ESD or AOD but not both at the same time! Turn one or the other off!") +if readESD and reDoPrimaryVertexing and not reDoParticleCreation: + print( "INFO! You are running on ESD, redoing the vertexing but not recreating the TrackParticles!") + print( "INFO! To avoid inconsistencies do not use the old track particles in conjunction with the new vertex!") + if doWriteESD or doWriteAOD: + print( "INFO! To avoid inconsistencies the old track particle (truth) container will not be in the new ESD/AOD!") +if readAOD and reDoPrimaryVertexing: + print( "INFO! You are running on AOD, and redoing the vertexing. At the moment new track particles cannot be made from old ones.") + print( "INFO! To avoid inconsistencies do not use the old track particles in conjunction with the new vertex!") + if doWriteAOD: + print( "INFO! To avoid inconsistencies the old track particle (truth) container will not be in the new AOD!") +if doRefitTracks and (reDoPrimaryVertexing or reDoParticleCreation): + print( "INFO! You are refitting tracks and also revertex and/or recreate track particles") + print( "INFO! The input for that will be the refitted tracks!") + +#-------------------------------------------------------------- +# Additional Detector setup +#-------------------------------------------------------------- + +from RecExConfig.RecFlags import rec +rec.Commissioning=False + +from AthenaCommon.DetFlags import DetFlags +# --- switch on InnerDetector +DetFlags.ID_setOn() +# --- and switch off all the rest +DetFlags.Calo_setOff() +DetFlags.Muon_setOff() +# --- print(out) +DetFlags.Print() + +#-------------------------------------------------------------- +# Load Reconstruction configuration for tools only +#-------------------------------------------------------------- +#-------------------------------------------------------------- +# Load InDet configuration +#-------------------------------------------------------------- +import MagFieldServices.SetupField + +from AthenaCommon.GlobalFlags import globalflags +globalflags.DetDescrVersion = "ATLAS-R2-2016-00-01-00" + +# --- setup InDetJobProperties +from InDetRecExample.InDetJobProperties import InDetFlags +InDetFlags.doTruth = (globalflags.DataSource == 'geant4' and globalflags.InputFormat == "pool") +InDetFlags.preProcessing = redoPatternRecoAndTracking +InDetFlags.doPRDFormation = False # those two will be (later) automatically false if +InDetFlags.doSpacePointFormation = redoPatternRecoAndTracking # preProcessing is false +InDetFlags.doNewTracking = redoPatternRecoAndTracking +#InDetFlags.doiPatRec = False +#InDetFlags.doxKalman = False +InDetFlags.doLowPt = False +InDetFlags.doBackTracking = redoPatternRecoAndTracking +InDetFlags.doTRTStandalone = redoPatternRecoAndTracking +InDetFlags.doTrtSegments = redoPatternRecoAndTracking +InDetFlags.postProcessing = reDoPrimaryVertexing or reDoParticleCreation or reDoConversions or doInDetRecStatistics or reDoV0Finder +InDetFlags.doTrackSegmentsPixel = False +InDetFlags.doTrackSegmentsSCT = False +InDetFlags.doTrackSegmentsTRT = False +InDetFlags.doSlimming = False +InDetFlags.loadTools = True +InDetFlags.doVertexFinding = reDoPrimaryVertexing +InDetFlags.doParticleCreation = reDoParticleCreation +InDetFlags.doConversions = reDoConversions +InDetFlags.doSecVertexFinder = False +InDetFlags.doV0Finder = reDoV0Finder +InDetFlags.doSimpleV0Finder = False +InDetFlags.doTrkNtuple = False +InDetFlags.doPixelTrkNtuple = False +InDetFlags.doSctTrkNtuple = False +InDetFlags.doTrtTrkNtuple = False +#InDetFlags.doPixelClusterNtuple = False +InDetFlags.doSctClusterNtuple = False +#InDetFlags.doTrtDriftCircleNtuple = False +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" + +toolString = "" +if useActs: + toolString = "acts" +else: + toolString = "athena" + +if doWriteAOD: + InDetKeys.OutputAODFileName = "InDetRecAOD_{}_n{}.root".format(toolString,nEvents) + +print( "Printing InDetKeys") +InDetKeys.lockAllExceptAlias() +InDetKeys.print_JobProperties() + +#-------------------------------------------------------------- +# enable statistics for reading ESD testing +#-------------------------------------------------------------- + +InDetFlags.doStatistics = doInDetRecStatistics +TrackCollectionKeys = [InDetKeys.Tracks()] +TrackCollectionTruthKeys = [InDetKeys.TracksTruth()] + +# Uncomment to use variant vertex seeding and/or finding +if doAMVF: + InDetFlags.primaryVertexSetup = "GaussAdaptiveMultiFinding" +# Use Acts primary vertexing +InDetFlags.useActsPriVertexing = useActs + +#-------------------------------------------------------------- +# load master joboptions file +#-------------------------------------------------------------- + +include("InDetRecExample/InDetRec_all.py") + +from GaudiSvc.GaudiSvcConf import THistSvc +ServiceMgr += THistSvc() +ServiceMgr.THistSvc.Output += ["InDetAdaptiveMultiPriVxFinderTool DATAFILE='AMVF_{}_output_nEvent{}.root' OPT='RECREATE'".format(toolString,nEvents)] + +# Set to True if you want to write out all input data ("pass-through" mode) +if doWriteESD: + StreamESD.TakeItemsFromInput = False + +if doWriteAOD: + StreamAOD.TakeItemsFromInput = True + +from AthenaCommon.ConfigurationShelve import saveToAscii; saveToAscii("config_vertexing_{}.txt".format(toolString)); diff --git a/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx b/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx index 3cd5914f102f2921bbbfbb65943659944934fdb5..69d853cb9831bec7db9f5de319ddffe1630a781b 100755 --- a/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx +++ b/Tracking/Acts/ActsPriVtxFinder/src/ActsAdaptiveMultiPriVtxFinderTool.cxx @@ -104,7 +104,7 @@ ActsAdaptiveMultiPriVtxFinderTool::initialize() // Vertex seed finder VertexSeedFinder::Config seedFinderConfig; - //seedFinderConfig.trackDensityEstimator = trackDensity; + seedFinderConfig.trackDensityEstimator = trackDensity; VertexSeedFinder seedFinder(seedFinderConfig, extractParameters); VertexFinder::Config finderConfig(std::move(fitter), seedFinder, ipEst, linearizer);