ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::InDetV0Finder Class Reference

#include <InDetV0Finder.h>

Inheritance diagram for InDet::InDetV0Finder:
Collaboration diagram for InDet::InDetV0Finder:

Public Member Functions

 InDetV0Finder (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~InDetV0Finder ()
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
StatusCode resetStatistics ()
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

SG::ReadHandleKey< xAOD::VertexContainerm_vertexKey
SG::WriteHandleKey< xAOD::VertexContainerm_v0Key { this, "V0ContainerName", "V0Candidates", "V0 container" }
SG::WriteHandleKey< xAOD::VertexContainerm_ksKey { this, "KshortContainerName", "KshortCandidates", "Ks container" }
SG::WriteHandleKey< xAOD::VertexContainerm_laKey
SG::WriteHandleKey< xAOD::VertexContainerm_lbKey
ToolHandle< InDet::InDetV0FinderToolm_v0FinderTool {this, "InDetV0FinderToolName", "InDet::InDetV0FinderTool"}
ToolHandle< InDet::V0MainDecoratorm_v0DecoTool {this, "Decorator", "InDet::V0MainDecorator"}
BooleanProperty m_decorate {this, "decorateV0", true}
 decorate V0 containers
long m_events_processed = 0
long m_V0s_stored = 0
long m_Kshort_stored = 0
long m_Lambda_stored = 0
long m_Lambdabar_stored = 0

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 38 of file InDetV0Finder.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ InDetV0Finder()

InDet::InDetV0Finder::InDetV0Finder ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 30 of file InDetV0Finder.cxx.

31 :
32 AthAlgorithm(n, pSvcLoc) {}
AthAlgorithm()
Default constructor:

◆ ~InDetV0Finder()

InDet::InDetV0Finder::~InDetV0Finder ( )
virtualdefault

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode InDet::InDetV0Finder::execute ( )

Definition at line 57 of file InDetV0Finder.cxx.

58{
59
61 const EventContext& ctx = Gaudi::Hive::currentContext();
62// Get primary vertex from StoreGate
63 const xAOD::Vertex* primaryVertex = nullptr;
64 SG::ReadHandle<xAOD::VertexContainer> importedVxContainer( m_vertexKey, ctx );
65 if ( !importedVxContainer.isValid() )
66 {
67 ATH_MSG_WARNING("No xAOD::VertexContainer named " << m_vertexKey.key() << " found in StoreGate");
68 return StatusCode::RECOVERABLE;
69 } else {
70 ATH_MSG_DEBUG("Found xAOD::VertexContainer named " << m_vertexKey.key() );
71 }
72 if ( importedVxContainer->empty() ){
73 ATH_MSG_WARNING("Primary vertex container is empty.");
74 } else {
75 primaryVertex = importedVxContainer->front();
76 }
77
78 //---- Recording section: write the results to StoreGate ---//
79 SG::WriteHandle<xAOD::VertexContainer> h_V0( m_v0Key, ctx );
80 if ( h_V0.record(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
81 ATH_MSG_ERROR("Storegate record of v0Container failed.");
82 return StatusCode::FAILURE;
83 }
84
85 SG::WriteHandle<xAOD::VertexContainer> h_Ks( m_ksKey, ctx );
86 if ( h_Ks.record(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
87 ATH_MSG_ERROR("Storegate record of ksContainer failed.");
88 return StatusCode::FAILURE;
89 }
90
91 SG::WriteHandle<xAOD::VertexContainer> h_La( m_laKey, ctx );
92 if( h_La.record(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
93 ATH_MSG_ERROR("Storegate record of laContainer failed.");
94 return StatusCode::FAILURE;
95
96 }
97 SG::WriteHandle<xAOD::VertexContainer> h_Lb( m_lbKey, ctx );
98 if(h_Lb.record(std::make_unique<xAOD::VertexContainer>() ,std::make_unique<xAOD::VertexAuxContainer>()).isFailure()){
99 ATH_MSG_ERROR("Storegate record of lbContainer failed.");
100 return StatusCode::FAILURE;
101 }
102
103
104 const auto statusOfSearch = m_v0FinderTool->performSearch(h_V0.ptr(),
105 h_Ks.ptr(),
106 h_La.ptr(),
107 h_Lb.ptr(),
108 primaryVertex, importedVxContainer.cptr(), ctx);
109
110 if (statusOfSearch != StatusCode::SUCCESS){
111 ATH_MSG_ERROR("Vertex search of v0Container failed.");
112 return StatusCode::FAILURE;
113 }
114
115 if (m_decorate) {
116 ATH_CHECK(m_v0DecoTool->decorateV0(h_V0.ptr(), ctx));
117 ATH_CHECK(m_v0DecoTool->decorateks(h_Ks.ptr() ,ctx));
118 ATH_CHECK(m_v0DecoTool->decoratela(h_La.ptr(), ctx));
119 ATH_CHECK(m_v0DecoTool->decoratelb(h_Lb.ptr(), ctx));
120 }
121
122 m_V0s_stored += h_V0->size();
123 m_Kshort_stored += h_Ks->size();
124 m_Lambda_stored += h_La->size();
125 m_Lambdabar_stored += h_Lb->size();
126
127 return StatusCode::SUCCESS;
128}// end execute block
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
SG::WriteHandleKey< xAOD::VertexContainer > m_lbKey
ToolHandle< InDet::InDetV0FinderTool > m_v0FinderTool
BooleanProperty m_decorate
decorate V0 containers
SG::WriteHandleKey< xAOD::VertexContainer > m_laKey
SG::WriteHandleKey< xAOD::VertexContainer > m_v0Key
SG::WriteHandleKey< xAOD::VertexContainer > m_ksKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexKey
ToolHandle< InDet::V0MainDecorator > m_v0DecoTool
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode InDet::InDetV0Finder::finalize ( )

Definition at line 130 of file InDetV0Finder.cxx.

131{
132 msg(MSG::INFO)
133 << "----------------------------------------------------------------------------------------------------------------------------------------------" << endmsg
134 << "\tSummary" << endmsg
135 << "\tProcessed : " << m_events_processed << " events" << endmsg
136 << "\tStored : " << m_V0s_stored << " V0s" << endmsg
137 << "\tof which : " << m_Kshort_stored << " Kshorts" << endmsg
138 << "\t : " << m_Lambda_stored << " Lambdas" << endmsg
139 << "\t : " << m_Lambdabar_stored << " Lambdabars" << endmsg;
140 msg(MSG::INFO) << "----------------------------------------------------------------------------------------------------------------------------------------------" << endmsg;
141
142 return StatusCode::SUCCESS;
143}
#define endmsg
MsgStream & msg() const

◆ initialize()

StatusCode InDet::InDetV0Finder::initialize ( )

Definition at line 36 of file InDetV0Finder.cxx.

37{
39
40 ATH_CHECK( m_vertexKey.initialize() );
41 ATH_CHECK( m_v0Key.initialize() );
42 ATH_CHECK( m_ksKey.initialize() );
43 ATH_CHECK( m_laKey.initialize() );
44 ATH_CHECK( m_lbKey.initialize() );
45
46// uploading the V0Finding tools
47 ATH_CHECK( m_v0FinderTool.retrieve() );
48 ATH_MSG_DEBUG("Retrieved tool " << m_v0FinderTool);
49 ATH_CHECK(m_v0DecoTool.retrieve(DisableTool{!m_decorate}));
50
51 ATH_MSG_DEBUG("Initialization successful");
52
53 return StatusCode::SUCCESS;
54}
StatusCode resetStatistics()

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ resetStatistics()

StatusCode InDet::InDetV0Finder::resetStatistics ( )

Definition at line 145 of file InDetV0Finder.cxx.

145 {
147 m_V0s_stored = 0;
148 m_Kshort_stored = 0;
150 m_Lambda_stored = 0;
151
152 return StatusCode :: SUCCESS;
153}

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_decorate

BooleanProperty InDet::InDetV0Finder::m_decorate {this, "decorateV0", true}
protected

decorate V0 containers

Definition at line 68 of file InDetV0Finder.h.

68{this, "decorateV0", true};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_events_processed

long InDet::InDetV0Finder::m_events_processed = 0
protected

Definition at line 70 of file InDetV0Finder.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_Kshort_stored

long InDet::InDetV0Finder::m_Kshort_stored = 0
protected

Definition at line 72 of file InDetV0Finder.h.

◆ m_ksKey

SG::WriteHandleKey<xAOD::VertexContainer> InDet::InDetV0Finder::m_ksKey { this, "KshortContainerName", "KshortCandidates", "Ks container" }
protected

Definition at line 55 of file InDetV0Finder.h.

55{ this, "KshortContainerName", "KshortCandidates", "Ks container" };

◆ m_laKey

SG::WriteHandleKey<xAOD::VertexContainer> InDet::InDetV0Finder::m_laKey
protected
Initial value:
{ this, "LambdaContainerName", "LambdaCandidates",
"Lambda container" }

Definition at line 56 of file InDetV0Finder.h.

56 { this, "LambdaContainerName", "LambdaCandidates",
57 "Lambda container" };

◆ m_Lambda_stored

long InDet::InDetV0Finder::m_Lambda_stored = 0
protected

Definition at line 73 of file InDetV0Finder.h.

◆ m_Lambdabar_stored

long InDet::InDetV0Finder::m_Lambdabar_stored = 0
protected

Definition at line 74 of file InDetV0Finder.h.

◆ m_lbKey

SG::WriteHandleKey<xAOD::VertexContainer> InDet::InDetV0Finder::m_lbKey
protected
Initial value:
{ this, "LambdabarContainerName", "LambdabarCandidates",
"Lambdabar container" }

Definition at line 58 of file InDetV0Finder.h.

58 { this, "LambdabarContainerName", "LambdabarCandidates",
59 "Lambdabar container" };

◆ m_v0DecoTool

ToolHandle<InDet::V0MainDecorator> InDet::InDetV0Finder::m_v0DecoTool {this, "Decorator", "InDet::V0MainDecorator"}
protected

Definition at line 64 of file InDetV0Finder.h.

64{this, "Decorator", "InDet::V0MainDecorator"};

◆ m_v0FinderTool

ToolHandle<InDet::InDetV0FinderTool> InDet::InDetV0Finder::m_v0FinderTool {this, "InDetV0FinderToolName", "InDet::InDetV0FinderTool"}
protected

Definition at line 63 of file InDetV0Finder.h.

63{this, "InDetV0FinderToolName", "InDet::InDetV0FinderTool"};

◆ m_v0Key

SG::WriteHandleKey<xAOD::VertexContainer> InDet::InDetV0Finder::m_v0Key { this, "V0ContainerName", "V0Candidates", "V0 container" }
protected

Definition at line 54 of file InDetV0Finder.h.

54{ this, "V0ContainerName", "V0Candidates", "V0 container" };

◆ m_V0s_stored

long InDet::InDetV0Finder::m_V0s_stored = 0
protected

Definition at line 71 of file InDetV0Finder.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexKey

SG::ReadHandleKey<xAOD::VertexContainer> InDet::InDetV0Finder::m_vertexKey
protected
Initial value:
{ this, "VxPrimaryCandidateName", "PrimaryVertices",
"key for retrieving vertices" }

Definition at line 51 of file InDetV0Finder.h.

51 { this, "VxPrimaryCandidateName", "PrimaryVertices",
52 "key for retrieving vertices" };

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: