67 if (
m_fitSvc.retrieve().isFailure()) {
68 ATH_MSG_ERROR(
"initialize: Can't find Trk::TrkVKalVrtFitter");
69 return StatusCode::SUCCESS;
77 ATH_MSG_INFO(
"initialize: Cannot retrieve Trk::TruthToTrack Tool!");
78 return StatusCode::FAILURE;
86 ATH_MSG_ERROR(
"initialize: failed to retrieve trackToVertex tool ");
87 return StatusCode::SUCCESS;
94 ATH_MSG_ERROR(
"initialize: failed to retrieve trackToVertexIPEstimator tool ");
95 return StatusCode::SUCCESS;
101 if(
detStore()->retrieve(
m_atlasId,
"AtlasID").isFailure() )
return StatusCode::FAILURE;
102 if(
detStore()->retrieve(
m_pixelId,
"PixelID").isFailure() )
return StatusCode::FAILURE;
103 if(
detStore()->retrieve(
m_sctId,
"SCT_ID") .isFailure() )
return StatusCode::FAILURE;
106 ATH_MSG_ERROR(
"initialize: failed to retrieve PixelConditionsSummaryTool");
107 return StatusCode::SUCCESS;
113 ATH_MSG_ERROR(
"initialize: failed to retrieve SCTConditionsSummaryTool");
114 return StatusCode::SUCCESS;
171 std::vector<double> rbins = { 0.1, 0.3, 0.5, 1, 2, 3, 5, 7, 10, 14, 20, 28, 38, 50, 64, 80, 100, 130, 170, 220, 280, 350, 450, 600 };
172 std::vector<double> nbins = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 20, 24, 28, 38, 50, 70, 100, 150 };
178 m_hists[
"trkSelCuts"] =
new TH1F(
"trkSelCuts",
";Cut Order;Tracks", 10, -0.5, 10-0.5 );
179 m_hists[
"selTracksDist"] =
new TH1F(
"selTracksDist",
";Selected Tracks;Events", 2000, -0.5, 2000-0.5 );
180 m_hists[
"initVertexDispD0"] =
new TH2F(
"initVertexDispD0",
";Rough d0 wrt init [mm];r [mm];Vertices", 1000, -100, 100, rbins.size()-1, &(rbins[0]) );
181 m_hists[
"initVertexDispZ0"] =
new TH2F(
"initVertexDispZ0",
";Rough z0 wrt init [mm];z [mm];Vertices", 1000, -100, 100, 100, -1000, 1000 );
182 m_hists[
"incompMonitor"] =
new TH1F(
"incompMonitor",
";Setp;Track Pairs", 10, -0.5, 10-0.5 );
183 m_hists[
"2trkVerticesDist"] =
new TH1F(
"2trkVerticesDist",
";2-track Vertices;Events", 1000, -0.5, 1000-0.5 );
184 m_hists[
"2trkChi2Dist"] =
new TH1F(
"2trkChi2Dist",
";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
185 m_hists[
"NtrkChi2Dist"] =
new TH1F(
"NtrkChi2Dist",
";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
186 m_hists[
"vPosDist"] =
new TH2F(
"vPosDist",
";r;#vec{x}*#vec{p}/p_{T} [mm]", rbins.size()-1, &(rbins[0]), 200, -1000, 1000 );
187 m_hists[
"vPosMomAngTDist"] =
new TH2F(
"vPosMomAngDistT",
";r;cos(#vec{r},#vec{p}_{T})", rbins.size()-1, &(rbins[0]), 200, -1.0, 1.0 );
188 m_hists[
"disabledCount"] =
new TH1F(
"disabledCount",
";N_{modules};Tracks", 20, -0.5, 10-0.5 );
189 m_hists[
"vertexYield"] =
new TH1F(
"vertexYield",
";Algorithm Step;Vertices", nAlgs, -0.5, nAlgs-0.5 );
190 m_hists[
"vertexYieldNtrk"] =
new TH2F(
"vertexYieldNtrk",
";Ntrk;Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
191 m_hists[
"vertexYieldChi2"] =
new TH2F(
"vertexYieldChi2",
";#chi^{2}/N_{dof};Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
192 m_hists[
"mergeType"] =
new TH1F(
"mergeType",
";Merge Algorithm Type;Entries", 10, -0.5, 10-0.5 );
193 m_hists[
"associateMonitor"] =
new TH1F(
"associateMonitor",
";Step;Vertices", 10, -0.5, 10-0.5 );
194 m_hists[
"shuffleMinSignif1"] =
new TH1F(
"shuffleMinSignif1",
";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
195 m_hists[
"shuffleMinSignif2"] =
new TH1F(
"shuffleMinSignif2",
";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
196 m_hists[
"shuffleMinSignif3"] =
new TH1F(
"shuffleMinSignif3",
";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
197 m_hists[
"finalCutMonitor"] =
new TH1F(
"finalCutMonitor",
";Step;Vertices", 6, -0.5, 6-0.5 );
198 m_hists[
"finalVtxNtrk"] =
new TH1F(
"finalVtxNtrk",
";N_{trk};Vertices", nbins.size()-1, &(nbins[0]) );
199 m_hists[
"finalVtxR"] =
new TH1F(
"finalVtxR",
";r [mm];Vertices", 600, 0, 600 );
200 m_hists[
"finalVtxNtrkR"] =
new TH2F(
"finalVtxNtrkR",
";N_{trk};r [mm];Vertices", nbins.size()-1, &(nbins[0]), rbins.size()-1, &(rbins[0]) );
201 m_hists[
"CPUTime"] =
new TH1F(
"CPUTime",
";Step;Accum. CPU Time [s]", 10, -0.5, 10-0.5 );
202 m_hists[
"nMatchedTruths"] =
new TH2F(
"nMatchedTruths",
";Step;;r [mm];Matched truth vertices", 11, -0.5, 11-0.5, rbins.size()-1, &(rbins[0]) );
203 m_hists[
"vPosMomAngT"] =
new TH1F(
"vPosMomAngT",
";cos(#vec{r},#vec{p}_{T}", 200, -1.0, 1.0 );
204 m_hists[
"vPosMomAng3D"] =
new TH1F(
"vPosMomAng3D",
";cos(#vec{r},#vec{p})", 200, -1.0, 1.0 );
205 m_hists[
"2trkVtxDistFromPV"] =
new TH1F(
"2trkVtDistFromPV",
";2tr vertex distance from PV;Events", 100, 0, 3 );
208 std::string histDir(
"/AANT/VrtSecInclusive" +
m_augVerString +
"/");
211 ATH_CHECK( hist_root->regHist( histDir + pair.first, pair.second ) );
220 m_tree_Vert =
new TTree(
"tree_VrtSecInclusive",
"TTree of VrtSecInclusive");
243 const std::string& nameAlgo = itr->first;
244 std::string fullName =
"VrtSecInclusive_IntermediateVertices_" + nameAlgo +
m_augVerString;
258 ATH_MSG_INFO(
"initialize: Exit VrtSecInclusive::initialize()");
259 return StatusCode::SUCCESS;
268 std::make_unique<xAOD::VertexAuxContainer>() ) );
270 return StatusCode::SUCCESS;
291 return StatusCode::SUCCESS;
308 return StatusCode::SUCCESS;
316 const EventContext& ctx = Gaudi::Hive::currentContext();
331 return StatusCode::FAILURE;
342 return StatusCode::SUCCESS;
348 if (
sc.isFailure() ) {
352 return StatusCode::SUCCESS;
364 std::set<std::string> userContainerNamesSet;
365 for(
auto& name : userContainerNames ) userContainerNamesSet.insert( name );
366 if( userContainerNamesSet.size() != userContainerNames.size() ) {
367 ATH_MSG_ERROR(
" > " << __FUNCTION__ <<
": detected duplicated user-specified container name. Please check your job property" );
368 return StatusCode::FAILURE;
393 if( sc.isFailure() or !
m_thePV ) {
398 return StatusCode::SUCCESS;
415 ATH_MSG_DEBUG(
"execute: Too few (<2) selected reco tracks. Terminated reconstruction." );
420 return StatusCode::SUCCESS;
424 ATH_MSG_INFO(
"execute: Too many selected reco tracks. Terminated reconstruction." );
429 return StatusCode::SUCCESS;
441 std::vector<WrkVrt> workVerticesContainer;
447 auto& name = itr->first;
448 auto alg = itr->second;
450 auto t_start = std::chrono::system_clock::now();
452 ATH_CHECK( (this->*alg)( ctx, &workVerticesContainer ) );
454 auto t_end = std::chrono::system_clock::now();
457 auto sec = std::chrono::duration_cast<std::chrono::microseconds>( t_end - t_start ).count();
487 return StatusCode::SUCCESS;
496 if (onlySelection)
return;
506 cont_nc->lockDecoration (p.second.auxid());
514 if (dec.isAvailable (*cont)) {
515 cont_nc->lockDecoration (dec.auxid());
527 const EventContext& ctx )
const
546 if (
const xAOD::TrackParticle* trk = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ) ) {
561 if( electron->nTrackParticles() > 0 ) {
571 for(
const auto *trk : *IDtracks ) {
575 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Handle class for adding a decoration to an object.
#define ATLAS_THREAD_SAFE
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
const SG::AuxVectorData * container() const
Return the container holding this element.
Manage lookup of vectors of auxiliary data.
void lockDecoration(SG::auxid_t auxid)
Explicitly lock a decoration.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
const std::string & key() const
Return the StoreGate ID for the referenced object.
Handle class for adding a decoration to an object.
Property holding a SG store/key/clid from which a WriteHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Gaudi::Property< bool > m_doSelectIDAndGSFTracks
SG::AuxElement::Decorator< std::vector< std::vector< float > > > IPDecoratorType
VrtSecInclusive(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
std::map< std::string, PatternStrategyFunc > m_patternStrategyFuncs
const xAOD::Vertex * m_thePV
SG::ReadHandleKey< xAOD::MuonContainer > m_MuonLocation
StatusCode setupNtupleVariables()
bool checkTrackHitPatternToVertex(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
bool checkTrackHitPatternToVertexByExtrapolationAssist(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
Gaudi::Property< bool > m_doMergeFinalVerticesDistance
bool checkTrackHitPatternToVertexByExtrapolation(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
Condition service.
SG::WriteHandleKey< xAOD::VertexContainer > m_vertexKey
Gaudi::Property< bool > m_doReassembleVertices
void lockTrackDecorations(const xAOD::TrackParticle *trk, bool onlySelection) const
lock decorations at the end of the algorithm
StatusCode selectTracksFromElectrons(const EventContext &ctx)
StatusCode selectTracksFromMuons(const EventContext &ctx)
std::map< unsigned, SG::Decorator< float > > m_trkDecors
void lockLeptonDecorations(const SG::AuxVectorData *cont) const
PublicToolHandle< Trk::IVertexMapper > m_vertexMapper
Gaudi::Property< unsigned int > m_SelTrkMaxCutoff
Gaudi::Property< bool > m_doMergeByShuffling
std::unique_ptr< NtupleVars > m_ntupleVars
SG::ReadHandleKey< xAOD::ElectronContainer > m_ElectronLocation
std::unordered_map< std::string, bool > m_vertexCollectionsDefinitions
StatusCode clearNtupleVariables()
ToolHandle< IInDetConditionsTool > m_sctCondSummaryTool
StatusCode associateNonSelectedTracks(const EventContext &ctx, std::vector< WrkVrt > *)
in addition to selected tracks, associate as much tracks as possible
PublicToolHandle< Trk::ITruthToTrack > m_truthToTrack
unsigned m_vertexingAlgorithmStep
Gaudi::Property< bool > m_doSelectTracksFromElectrons
Gaudi::Property< std::string > m_all2trksVerticesContainerName
StatusCode fillAANT_SelectedBaseTracks()
Gaudi::Property< bool > m_FillHist
bool checkTrackHitPatternToVertexOuterOnly(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
A classical method with hard-coded geometry.
std::optional< SG::Decorator< char > > m_decor_isSelected
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackLocation
const PixelID * m_pixelId
std::map< std::string, TH1 * > m_hists
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Read/Write Handle Keys.
Gaudi::Property< std::string > m_secondaryVerticesContainerName
StatusCode reassembleVertices(const EventContext &ctx, std::vector< WrkVrt > *)
attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact param...
StatusCode mergeFinalVertices(const EventContext &ctx, std::vector< WrkVrt > *)
attempt to merge vertices by lookng at the distance between two vertices
Gaudi::Property< bool > m_FillNtuple
std::optional< SG::Decorator< char > > m_decor_is_svtrk_final
std::optional< VertexELType > m_decor_svLink
const AtlasDetectorID * m_atlasId
virtual StatusCode execute() override
virtual StatusCode initialize() override
PublicToolHandle< Trk::IExtrapolator > m_extrapolator
StatusCode processPrimaryVertices()
StatusCode defineDummyCollections(const EventContext &ctx)
std::vector< IPDecoratorType > m_ipDecors
StatusCode refitAndSelectGoodQualityVertices(const EventContext &ctx, std::vector< WrkVrt > *)
finalization of the vertex and store to xAOD::VertexContainer
std::vector< const xAOD::TrackParticle * > m_associatedTracks
PublicToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
get a handle on the Track to Vertex tool
ToolHandle< Trk::ITrkVKalVrtFitter > m_fitSvc
SG::ReadHandleKey< xAOD::VertexContainer > m_PrimVrtLocation
std::vector< const xAOD::TrackParticle * > m_selectedTracks
StatusCode rearrangeTracks(const EventContext &ctx, std::vector< WrkVrt > *)
Gaudi::Property< bool > m_doMapToLocal
StatusCode dummyVertexContainer(const EventContext &ctx, const SG::WriteHandleKey< xAOD::VertexContainer > &handleKey)
std::vector< std::pair< std::string, vertexingAlg > > m_vertexingAlgorithms
Gaudi::Property< std::string > m_augVerString
PublicToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
SG::WriteDecorHandleKey< xAOD::EventInfo > m_vertexingStatusKey
StatusCode selectTracksInDet(const EventContext &ctx)
std::vector< const xAOD::TrackParticle * > m_leptonicTracks
StatusCode monitorVertexingAlgorithmStep(const EventContext &ctx, std::vector< WrkVrt > *, const std::string &name, bool final=false)
monitor the intermediate status of vertexing
Gaudi::Property< bool > m_doAssociateNonSelectedTracks
StatusCode addEventInfo()
Gaudi::Property< bool > m_FillIntermediateVertices
PatternBank m_extrapolatedPatternBank
virtual ~VrtSecInclusive() override
Default Destructor.
StatusCode mergeByShuffling(const EventContext &ctx, std::vector< WrkVrt > *)
attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior ...
std::map< std::string, SG::WriteHandleKey< xAOD::VertexContainer > > m_intermediateVertexKey
std::optional< SG::Decorator< char > > m_decor_isAssociated
virtual StatusCode initEvent()
void dumpTruthInformation()
StatusCode extractIncompatibleTrackPairs(const EventContext &ctx, std::vector< WrkVrt > *)
related to the graph method and verte finding
SG::WriteHandleKey< xAOD::VertexContainer > m_twoTrksVertexKey
StatusCode findNtrackVertices(const EventContext &ctx, std::vector< WrkVrt > *)
Gaudi::Property< bool > m_doSelectTracksFromMuons
StatusCode selectInDetAndGSFTracks(const EventContext &ctx)
std::vector< TrackSelectionAlg > m_trackSelectionAlgs
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
std::size_t erase_if(T_container &container, T_Func pred)
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".
Electron_v1 Electron
Definition of the current "egamma version".
unsigned nTracksTotal() const