46 m_fitSvc (
"Trk::TrkVKalVrtFitter", this ),
68 if(
m_jp.FillNtuple ) {
91 if (
m_fitSvc.retrieve().isFailure()) {
92 ATH_MSG_ERROR(
"initialize: Can't find Trk::TrkVKalVrtFitter");
93 return StatusCode::SUCCESS;
101 ATH_MSG_INFO(
"initialize: Cannot retrieve Trk::TruthToTrack Tool!");
102 return StatusCode::FAILURE;
110 ATH_MSG_ERROR(
"initialize: failed to retrieve trackToVertex tool ");
111 return StatusCode::SUCCESS;
118 ATH_MSG_ERROR(
"initialize: failed to retrieve trackToVertexIPEstimator tool ");
119 return StatusCode::SUCCESS;
125 if(
detStore()->retrieve(
m_atlasId,
"AtlasID").isFailure() )
return StatusCode::FAILURE;
126 if(
detStore()->retrieve(
m_pixelId,
"PixelID").isFailure() )
return StatusCode::FAILURE;
127 if(
detStore()->retrieve(
m_sctId,
"SCT_ID") .isFailure() )
return StatusCode::FAILURE;
130 ATH_MSG_ERROR(
"initialize: failed to retrieve PixelConditionsSummaryTool");
131 return StatusCode::SUCCESS;
137 ATH_MSG_ERROR(
"initialize: failed to retrieve SCTConditionsSummaryTool");
138 return StatusCode::SUCCESS;
147 if(
m_jp.doMapToLocal ) {
157 if( !
m_jp.doSelectTracksFromMuons && !
m_jp.doSelectTracksFromElectrons && !
m_jp.doSelectIDAndGSFTracks) {
169 if(
m_jp.doReassembleVertices ) {
173 if(
m_jp.doMergeByShuffling ) {
177 if (
m_jp.doMergeFinalVerticesDistance ) {
181 if(
m_jp.doAssociateNonSelectedTracks ) {
193 if(
m_jp.FillHist ) {
195 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 };
196 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 };
202 m_hists[
"trkSelCuts"] =
new TH1F(
"trkSelCuts",
";Cut Order;Tracks", 10, -0.5, 10-0.5 );
203 m_hists[
"selTracksDist"] =
new TH1F(
"selTracksDist",
";Selected Tracks;Events", 2000, -0.5, 2000-0.5 );
204 m_hists[
"initVertexDispD0"] =
new TH2F(
"initVertexDispD0",
";Rough d0 wrt init [mm];r [mm];Vertices", 1000, -100, 100, rbins.size()-1, &(rbins[0]) );
205 m_hists[
"initVertexDispZ0"] =
new TH2F(
"initVertexDispZ0",
";Rough z0 wrt init [mm];z [mm];Vertices", 1000, -100, 100, 100, -1000, 1000 );
206 m_hists[
"incompMonitor"] =
new TH1F(
"incompMonitor",
";Setp;Track Pairs", 10, -0.5, 10-0.5 );
207 m_hists[
"2trkVerticesDist"] =
new TH1F(
"2trkVerticesDist",
";2-track Vertices;Events", 1000, -0.5, 1000-0.5 );
208 m_hists[
"2trkChi2Dist"] =
new TH1F(
"2trkChi2Dist",
";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
209 m_hists[
"NtrkChi2Dist"] =
new TH1F(
"NtrkChi2Dist",
";log10(#chi^{2}/N_{dof});Entries", 100, -3, 7 );
210 m_hists[
"vPosDist"] =
new TH2F(
"vPosDist",
";r;#vec{x}*#vec{p}/p_{T} [mm]", rbins.size()-1, &(rbins[0]), 200, -1000, 1000 );
211 m_hists[
"vPosMomAngTDist"] =
new TH2F(
"vPosMomAngDistT",
";r;cos(#vec{r},#vec{p}_{T})", rbins.size()-1, &(rbins[0]), 200, -1.0, 1.0 );
212 m_hists[
"disabledCount"] =
new TH1F(
"disabledCount",
";N_{modules};Tracks", 20, -0.5, 10-0.5 );
213 m_hists[
"vertexYield"] =
new TH1F(
"vertexYield",
";Algorithm Step;Vertices", nAlgs, -0.5, nAlgs-0.5 );
214 m_hists[
"vertexYieldNtrk"] =
new TH2F(
"vertexYieldNtrk",
";Ntrk;Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
215 m_hists[
"vertexYieldChi2"] =
new TH2F(
"vertexYieldChi2",
";#chi^{2}/N_{dof};Algorithm Step;Vertices", 100, 0, 100, nAlgs, -0.5, nAlgs-0.5 );
216 m_hists[
"mergeType"] =
new TH1F(
"mergeType",
";Merge Algorithm Type;Entries", 10, -0.5, 10-0.5 );
217 m_hists[
"associateMonitor"] =
new TH1F(
"associateMonitor",
";Step;Vertices", 10, -0.5, 10-0.5 );
218 m_hists[
"shuffleMinSignif1"] =
new TH1F(
"shuffleMinSignif1",
";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
219 m_hists[
"shuffleMinSignif2"] =
new TH1F(
"shuffleMinSignif2",
";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
220 m_hists[
"shuffleMinSignif3"] =
new TH1F(
"shuffleMinSignif3",
";Min( log_{10}( Significance ) );Vertices", 100, -3, 5 );
221 m_hists[
"finalCutMonitor"] =
new TH1F(
"finalCutMonitor",
";Step;Vertices", 6, -0.5, 6-0.5 );
222 m_hists[
"finalVtxNtrk"] =
new TH1F(
"finalVtxNtrk",
";N_{trk};Vertices", nbins.size()-1, &(nbins[0]) );
223 m_hists[
"finalVtxR"] =
new TH1F(
"finalVtxR",
";r [mm];Vertices", 600, 0, 600 );
224 m_hists[
"finalVtxNtrkR"] =
new TH2F(
"finalVtxNtrkR",
";N_{trk};r [mm];Vertices", nbins.size()-1, &(nbins[0]), rbins.size()-1, &(rbins[0]) );
225 m_hists[
"CPUTime"] =
new TH1F(
"CPUTime",
";Step;Accum. CPU Time [s]", 10, -0.5, 10-0.5 );
226 m_hists[
"nMatchedTruths"] =
new TH2F(
"nMatchedTruths",
";Step;;r [mm];Matched truth vertices", 11, -0.5, 11-0.5, rbins.size()-1, &(rbins[0]) );
227 m_hists[
"vPosMomAngT"] =
new TH1F(
"vPosMomAngT",
";cos(#vec{r},#vec{p}_{T}", 200, -1.0, 1.0 );
228 m_hists[
"vPosMomAng3D"] =
new TH1F(
"vPosMomAng3D",
";cos(#vec{r},#vec{p})", 200, -1.0, 1.0 );
229 m_hists[
"2trkVtxDistFromPV"] =
new TH1F(
"2trkVtDistFromPV",
";2tr vertex distance from PV;Events", 100, 0, 3 );
232 std::string histDir(
"/AANT/VrtSecInclusive" +
m_jp.augVerString +
"/");
235 ATH_CHECK( hist_root->regHist( histDir + pair.first, pair.second ) );
240 if(
m_jp.FillNtuple ) {
244 m_tree_Vert =
new TTree(
"tree_VrtSecInclusive",
"TTree of VrtSecInclusive");
261 ATH_MSG_INFO(
"initialize: Exit VrtSecInclusive::initialize()");
262 return StatusCode::SUCCESS;
272 return StatusCode::SUCCESS;
282 if(
m_jp.FillNtuple ) {
288 return StatusCode::SUCCESS;
304 return StatusCode::FAILURE;
314 return StatusCode::SUCCESS;
320 if (
sc.isFailure() ) {
323 return StatusCode::SUCCESS;
334 std::vector<std::string> userContainerNames {
m_jp.secondaryVerticesContainerName,
m_jp.all2trksVerticesContainerName };
335 std::set<std::string> userContainerNamesSet;
336 for(
auto& name : userContainerNames ) userContainerNamesSet.insert( name );
337 if( userContainerNamesSet.size() != userContainerNames.size() ) {
338 ATH_MSG_ERROR(
" > " << __FUNCTION__ <<
": detected duplicated user-specified container name. Please check your job property" );
339 return StatusCode::FAILURE;
346 secondaryVertexContainer ->setStore( secondaryVertexAuxContainer );
348 ATH_CHECK(
evtStore()->record( secondaryVertexContainer,
"VrtSecInclusive_" +
m_jp.secondaryVerticesContainerName +
m_jp.augVerString ) );
349 ATH_CHECK(
evtStore()->record( secondaryVertexAuxContainer,
"VrtSecInclusive_" +
m_jp.secondaryVerticesContainerName +
m_jp.augVerString +
"Aux." ) );
351 if(
m_jp.FillIntermediateVertices ) {
355 twoTrksVertexContainer ->setStore( twoTrksVertexAuxContainer );
357 ATH_CHECK(
evtStore()->record( twoTrksVertexContainer,
"VrtSecInclusive_" +
m_jp.all2trksVerticesContainerName +
m_jp.augVerString ) );
358 ATH_CHECK(
evtStore()->record( twoTrksVertexAuxContainer,
"VrtSecInclusive_" +
m_jp.all2trksVerticesContainerName +
m_jp.augVerString +
"Aux." ) );
362 auto& name = itr->first;
367 intermediateVertexContainer ->setStore( intermediateVertexAuxContainer );
369 ATH_CHECK(
evtStore()->record( intermediateVertexContainer,
"VrtSecInclusive_IntermediateVertices_" + name +
m_jp.augVerString ) );
370 ATH_CHECK(
evtStore()->record( intermediateVertexAuxContainer,
"VrtSecInclusive_IntermediateVertices_" + name +
m_jp.augVerString +
"Aux." ) );
395 if( sc.isFailure() or !
m_thePV ) {
399 return StatusCode::SUCCESS;
407 if(
m_jp.FillNtuple )
416 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." );
428 return StatusCode::SUCCESS;
440 std::vector<WrkVrt> workVerticesContainer;
446 auto& name = itr->first;
447 auto alg = itr->second;
449 auto t_start = std::chrono::system_clock::now();
451 ATH_CHECK( (this->*alg)( &workVerticesContainer ) );
453 auto t_end = std::chrono::system_clock::now();
455 if(
m_jp.FillHist ) {
456 auto sec = std::chrono::duration_cast<std::chrono::microseconds>( t_end - t_start ).count();
476 if(
m_jp.FillNtuple ) {
485 return StatusCode::SUCCESS;
494 if (onlySelection)
return;
504 cont_nc->lockDecoration (p.second.auxid());
512 if (dec.isAvailable (*cont)) {
513 cont_nc->lockDecoration (dec.auxid());
541 if (
const xAOD::TrackParticle* trk = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ) ) {
555 if( electron->nTrackParticles() > 0 ) {
564 for(
const auto *trk : *IDtracks ) {
568 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:
ServiceHandle< StoreGateSvc > & evtStore()
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?
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Handle class for adding a decoration to an object.
StatusCode selectTracksFromMuons()
SG::AuxElement::Decorator< std::vector< std::vector< float > > > IPDecoratorType
StatusCode associateNonSelectedTracks(std::vector< WrkVrt > *)
in addition to selected tracks, associate as much tracks as possible
VrtSecInclusive(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
std::map< std::string, PatternStrategyFunc > m_patternStrategyFuncs
const xAOD::Vertex * m_thePV
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.
bool checkTrackHitPatternToVertexByExtrapolation(const xAOD::TrackParticle *trk, const Amg::Vector3D &vertex)
New method with track extrapolation.
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
Condition service.
StatusCode mergeFinalVertices(std::vector< WrkVrt > *)
attempt to merge vertices by lookng at the distance between two vertices
StatusCode refitAndSelectGoodQualityVertices(std::vector< WrkVrt > *)
finalization of the vertex and store to xAOD::VertexContainer
void lockTrackDecorations(const xAOD::TrackParticle *trk, bool onlySelection) const
lock decorations at the end of the algorithm
virtual StatusCode execute()
std::map< unsigned, SG::Decorator< float > > m_trkDecors
void lockLeptonDecorations(const SG::AuxVectorData *cont) const
StatusCode reassembleVertices(std::vector< WrkVrt > *)
attempt to merge vertices when all tracks of a vertex A is close to vertex B in terms of impact param...
std::unique_ptr< NtupleVars > m_ntupleVars
StatusCode rearrangeTracks(std::vector< WrkVrt > *)
StatusCode clearNtupleVariables()
ToolHandle< IInDetConditionsTool > m_sctCondSummaryTool
ToolHandle< Trk::IVertexMapper > m_vertexMapper
unsigned m_vertexingAlgorithmStep
StatusCode extractIncompatibleTrackPairs(std::vector< WrkVrt > *)
related to the graph method and verte finding
StatusCode fillAANT_SelectedBaseTracks()
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
ToolHandle< Trk::IExtrapolator > m_extrapolator
ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimatorTool
const PixelID * m_pixelId
std::map< std::string, TH1 * > m_hists
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Read/Write Handle Keys.
StatusCode findNtrackVertices(std::vector< WrkVrt > *)
StatusCode monitorVertexingAlgorithmStep(std::vector< WrkVrt > *, const std::string &name, bool final=false)
monitor the intermediate status of vertexing
std::optional< SG::Decorator< char > > m_decor_is_svtrk_final
std::optional< VertexELType > m_decor_svLink
const AtlasDetectorID * m_atlasId
ToolHandle< Reco::ITrackToVertex > m_trackToVertexTool
get a handle on the Track to Vertex tool
StatusCode processPrimaryVertices()
std::vector< IPDecoratorType > m_ipDecors
const xAOD::VertexContainer * m_primaryVertices
std::vector< const xAOD::TrackParticle * > m_associatedTracks
ToolHandle< Trk::ITrkVKalVrtFitter > m_fitSvc
StatusCode selectTracksFromElectrons()
std::vector< const xAOD::TrackParticle * > m_selectedTracks
virtual StatusCode initialize()
StatusCode selectTracksInDet()
std::string m_checkPatternStrategy
StatusCode mergeByShuffling(std::vector< WrkVrt > *)
attempt to merge splitted vertices when they are significantly distant due to the long-tail behavior ...
std::vector< std::pair< std::string, vertexingAlg > > m_vertexingAlgorithms
struct JobProperties m_jp
~VrtSecInclusive()
Default Destructor.
virtual StatusCode finalize()
SG::WriteDecorHandleKey< xAOD::EventInfo > m_vertexingStatusKey
std::vector< const xAOD::TrackParticle * > m_leptonicTracks
StatusCode addEventInfo()
ToolHandle< Trk::ITruthToTrack > m_truthToTrack
PatternBank m_extrapolatedPatternBank
StatusCode selectInDetAndGSFTracks()
std::optional< SG::Decorator< char > > m_decor_isAssociated
virtual StatusCode initEvent()
void dumpTruthInformation()
std::vector< TrackSelectionAlg > m_trackSelectionAlgs
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
std::size_t erase_if(T_container &container, T_Func pred)
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container 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