ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecTools
InDetSecVtxTrackSelectionTool
Root
InDetSecVtxTrackCut.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
//Author: Lianyou Shan <lianyou.shan@cern.ch>
5
// -*- c++ -*-
6
// InDetSecVtxTrackCut.h
7
// Declarations of objects to perform cuts for InDetTrackSelectionTool
8
9
#ifndef INDETSECVTXTRACKSELECTIONTOOL_INDETTRACKCUT_H
10
#define INDETSECVTXTRACKSELECTIONTOOL_INDETTRACKCUT_H
11
12
#include "
InDetSecVtxTrackAccessor.h
"
13
//#include "InDetSecVtxTrackSelectionTool/InDetSecVtxTrackSelectionTool.h"
14
15
#include <map>
16
#include <array>
17
18
namespace
InDet
{
19
20
// class InDetTrackSelectionTool;
21
class
InDetSecVtxTrackSelectionTool
;
22
23
// ---------------- SecVtxTrackCut ----------------
24
25
class
SecVtxTrackCut
:
public
asg::AsgMessaging
{
26
// abstract interface class for all cuts.
27
public
:
28
SecVtxTrackCut
(
InDetSecVtxTrackSelectionTool
*);
29
virtual
~SecVtxTrackCut
() = 0;
30
// initialize should find the accessor(s) or create them if they don't exist
31
virtual
StatusCode
initialize
();
32
virtual
bool
result
()
const
= 0;
// whether the cut passes
33
operator
bool()
const
{
return
this->
result
();}
34
protected
:
35
// a function that gets the accessor labelled by "name", adding it if it needs to.
36
template
<
class
AccessorType>
37
StatusCode
getAccessor
(
const
std::string& name, std::shared_ptr<AccessorType>& accessor);
38
private
:
39
// a pointer to the tool's accessors so we can modify it in initialize()
40
std::unordered_map< std::string, std::shared_ptr<SecVtxTrackAccessor> >*
m_trackAccessors
;
41
// a pointer to the tool so that we can create the accessors when need be, as they inherit from AsgMessaging and need a pointer to the tool
42
InDetSecVtxTrackSelectionTool
*
m_selectionTool
;
43
};
// class SecVtxTrackCut
44
45
class
D0minCut
:
public
virtual
SecVtxTrackCut
{
46
public
:
47
D0minCut
(
InDetSecVtxTrackSelectionTool
*, Double_t
min
=-99.);
48
void
setMinValue
(Double_t
min
) {
m_minValue
=
min
;}
49
virtual
StatusCode
initialize
();
50
virtual
bool
result
()
const
;
51
private
:
52
Double_t
m_minValue
;
53
std::shared_ptr< svParamAccessor<0> >
m_paramAccessor
;
54
};
// class D0Cut
55
56
template
<
size_t
N>
57
class
FuncSummaryValueCut
:
public
virtual
SecVtxTrackCut
{
58
public
:
59
FuncSummaryValueCut
(
InDetSecVtxTrackSelectionTool
*,
const
std::array<xAOD::SummaryType,N>&&);
60
void
setFunction
(std::function<
bool
(
const
std::array<uint8_t,N>&)> func) {
m_func
= std::move(func);}
61
virtual
StatusCode
initialize
();
62
virtual
bool
result
()
const
;
63
private
:
64
std::function<bool(
const
std::array<uint8_t,N>&)>
m_func
;
65
std::array< xAOD::SummaryType, N>
m_summaryTypes
;
66
std::array< std::shared_ptr<SummaryAccessor>,N >
m_summaryAccessors
;
67
};
// class FuncSummaryValueCut
68
69
}
// namespace InDet
70
71
template
<
class
AccessorType>
72
StatusCode
InDet::SecVtxTrackCut::getAccessor
(
const
std::string& accessorName,
73
std::shared_ptr<AccessorType>& accessor)
74
{
75
// this function looks for the accessor indicated by "name" in the tool's
76
// track accessors and assigns "accessor" to it if it exists, creating
77
// the accessor if it does not.
78
std::unordered_map< std::string, std::shared_ptr<SecVtxTrackAccessor> >
::const_iterator
it =
79
std::find_if(
m_trackAccessors
->begin(),
m_trackAccessors
->end(),
80
[&] (std::pair< std::string, std::shared_ptr<SecVtxTrackAccessor> > acc)
81
{return acc.first == accessorName;} );
82
if
(it ==
m_trackAccessors
->end()) {
83
// if we can't find the accessor, add one to the tool
84
if
(!
m_selectionTool
) {
85
ATH_MSG_ERROR
(
"Must initialize SecVtxTrackCut with pointer to the selection tool before adding accessors."
);
86
return
StatusCode::FAILURE;
87
}
88
accessor = std::make_shared<AccessorType>(
m_selectionTool
);
89
(*m_trackAccessors)[accessorName] = accessor;
90
ATH_MSG_DEBUG
(
"Adding accessor "
<< accessorName );
91
}
else
{
92
accessor = std::dynamic_pointer_cast<AccessorType>(it->second);
93
if
(accessor==
nullptr
) {
94
ATH_MSG_ERROR
(
"Logic error: could not cast accessor to type "
<<
typeid
(AccessorType).name() );
95
return
StatusCode::FAILURE;
96
}
97
}
98
99
if
(!accessor) {
100
// this could happen if the accessor indicated by "name" is not of type "AccessorType"
101
ATH_MSG_ERROR
(
"Could not instantiate "
<< accessorName <<
102
" accessor. Pointer to accessor is to type "
<<
103
typeid
(AccessorType).name() <<
". Is this correct?"
);
104
return
StatusCode::FAILURE;
105
}
106
return
StatusCode::SUCCESS;
107
}
108
109
110
#endif
// INDETTRACKSELECTIONTOOL_INDETTRACKCUT_H
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
InDetSecVtxTrackAccessor.h
min
#define min(a, b)
Definition
cfImp.cxx:40
const_iterator
InDet::D0minCut::initialize
virtual StatusCode initialize()
Definition
InDetSecVtxTrackCut.cxx:45
InDet::D0minCut::setMinValue
void setMinValue(Double_t min)
Definition
InDetSecVtxTrackCut.h:48
InDet::D0minCut::result
virtual bool result() const
Definition
InDetSecVtxTrackCut.cxx:52
InDet::D0minCut::m_paramAccessor
std::shared_ptr< svParamAccessor< 0 > > m_paramAccessor
Definition
InDetSecVtxTrackCut.h:53
InDet::D0minCut::m_minValue
Double_t m_minValue
Definition
InDetSecVtxTrackCut.h:52
InDet::D0minCut::D0minCut
D0minCut(InDetSecVtxTrackSelectionTool *, Double_t min=-99.)
Definition
InDetSecVtxTrackCut.cxx:38
InDet::FuncSummaryValueCut::m_func
std::function< bool(const std::array< uint8_t, N > &)> m_func
Definition
InDetSecVtxTrackCut.h:64
InDet::FuncSummaryValueCut::FuncSummaryValueCut
FuncSummaryValueCut(InDetSecVtxTrackSelectionTool *, const std::array< xAOD::SummaryType, N > &&)
Definition
InDetSecVtxTrackCut.cxx:64
InDet::FuncSummaryValueCut::result
virtual bool result() const
Definition
InDetSecVtxTrackCut.cxx:90
InDet::FuncSummaryValueCut::initialize
virtual StatusCode initialize()
Definition
InDetSecVtxTrackCut.cxx:71
InDet::FuncSummaryValueCut::m_summaryTypes
std::array< xAOD::SummaryType, N > m_summaryTypes
Definition
InDetSecVtxTrackCut.h:65
InDet::FuncSummaryValueCut::setFunction
void setFunction(std::function< bool(const std::array< uint8_t, N > &)> func)
Definition
InDetSecVtxTrackCut.h:60
InDet::FuncSummaryValueCut::m_summaryAccessors
std::array< std::shared_ptr< SummaryAccessor >, N > m_summaryAccessors
Definition
InDetSecVtxTrackCut.h:66
InDet::InDetSecVtxTrackSelectionTool
Implementation of the track selector tool.
Definition
InDetSecVtxTrackSelectionTool.h:37
InDet::SecVtxTrackCut::SecVtxTrackCut
SecVtxTrackCut(InDetSecVtxTrackSelectionTool *)
Definition
InDetSecVtxTrackCut.cxx:16
InDet::SecVtxTrackCut::m_trackAccessors
std::unordered_map< std::string, std::shared_ptr< SecVtxTrackAccessor > > * m_trackAccessors
Definition
InDetSecVtxTrackCut.h:40
InDet::SecVtxTrackCut::getAccessor
StatusCode getAccessor(const std::string &name, std::shared_ptr< AccessorType > &accessor)
Definition
InDetSecVtxTrackCut.h:72
InDet::SecVtxTrackCut::~SecVtxTrackCut
virtual ~SecVtxTrackCut()=0
InDet::SecVtxTrackCut::m_selectionTool
InDetSecVtxTrackSelectionTool * m_selectionTool
Definition
InDetSecVtxTrackCut.h:42
InDet::SecVtxTrackCut::initialize
virtual StatusCode initialize()
Definition
InDetSecVtxTrackCut.cxx:26
InDet::SecVtxTrackCut::result
virtual bool result() const =0
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition
AsgMessaging.h:40
InDet
Primary Vertex Finder.
Definition
VP1ErrorUtils.h:36
Generated on
for ATLAS Offline Software by
1.17.0