ATLAS Offline Software
Loading...
Searching...
No Matches
egammaTrackThinner Class Reference

GSFTrackParticle collection. More...

#include <egammaTrackThinner.h>

Inheritance diagram for egammaTrackThinner:
Collaboration diagram for egammaTrackThinner:

Public Member Functions

StatusCode initialize () override final
 initialize method
StatusCode finalize () override final
 finalize method
StatusCode execute (const EventContext &ctx) const override final
 execute method
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual unsigned int cardinality () const override
 Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
virtual void setFilterPassed (bool state, const EventContext &ctx) const
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.

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

SG::ReadHandleKey< xAOD::ElectronContainerm_InputElectronContainerKey
 electron collection input name
SG::ReadHandleKey< xAOD::PhotonContainerm_InputPhotonContainerKey
 photon collection input name
SG::ReadHandleKey< xAOD::ElectronContainerm_InputForwardElectronContainerKey
 forward electron collection input name
SG::ThinningHandleKey< xAOD::TrackParticleContainerm_TrackParticlesKey
 GSF Track Particle container to thin.
SG::ThinningHandleKey< xAOD::VertexContainerm_VertexKey
 GSF vertex container to thin.
StringProperty m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
 Name of the stream being thinned.
Gaudi::Property< bool > m_doThinning {this, "doThinning", true, "Bool to do Thinning"}
 Bool to decide if we actually do the Thinning.
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
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

GSFTrackParticle collection.

Definition at line 24 of file egammaTrackThinner.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ cardinality()

unsigned int AthCommonReentrantAlgorithm< Gaudi::Algorithm >::cardinality ( ) const
overridevirtualinherited

Cardinality (Maximum number of clones that can exist) special value 0 means that algorithm is reentrant.

Override this to return 0 for reentrant algorithms.

Definition at line 75 of file AthCommonReentrantAlgorithm.cxx.

64{
65 return 0;
66}

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::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 egammaTrackThinner::execute ( const EventContext & ctx) const
finaloverride

execute method

Definition at line 54 of file egammaTrackThinner.cxx.

54 {
55
56 ATH_MSG_DEBUG("Executing egammaTrackThinner");
57 if(!m_doThinning){
58 ATH_MSG_DEBUG("Thinning not requested do nothing");
59 return StatusCode::SUCCESS;
60 }
61
62 /*
63 * GSF Track Particles
64 * The vector that we'll use to filter the track particles:
65 */
66 std::vector<bool> keptTrackParticles;
67 SG::ThinningHandle<xAOD::TrackParticleContainer> trackPC(m_TrackParticlesKey, ctx);
68 // check is only used for serial running; remove when MT scheduler used
69 ATH_CHECK(trackPC.isValid());
70 ATH_MSG_DEBUG("Number of TrackParticles "<< trackPC->size());
71 keptTrackParticles.resize( trackPC->size(), false );
72
73 /*
74 * GSF Vertices
75 * The vector that we'll use to filter the GSF vertices:
76 */
77 std::vector<bool> keptVertices;
78 SG::ThinningHandle<xAOD::VertexContainer> vertices(m_VertexKey, ctx);
79 // check is only used for serial running; remove when MT scheduler used
80 ATH_CHECK(vertices.isValid());
81 ATH_MSG_DEBUG("Number of Vertices "<< vertices->size());
82 keptVertices.resize( vertices->size(), false );
83
84 /*
85 * In Det Track Particles
86 * TRT standalone tracks are now centrally thinned by ThinTRTStandaloneTrackAlg for e/gamma and taus
87 */
88
89 /*
90 * Electron track particle Thinning
91 */
92 SG::ReadHandle<xAOD::ElectronContainer> electrons(m_InputElectronContainerKey, ctx);
93 // check is only used for serial running; remove when MT scheduler used
94 ATH_CHECK(electrons.isValid());
95
96 //Loop over electrons
97 auto el_itr = electrons->begin();
98 auto el_end = electrons->end();
99 for( ; el_itr != el_end; ++el_itr ) {
100
101 auto trackParticleLinks = (*el_itr)->trackParticleLinks();
102 for (const auto& link : trackParticleLinks){
103 if( ! link.isValid() ){
104 continue;
105 }
106 ATH_MSG_DEBUG("Electrons : Keeping GSF Track Particle with index : "<< link.index() );
107 keptTrackParticles[link.index() ] = true;
108 }
109 }
110
111 /*
112 * Photon Vertex and track particle Thinning
113 */
114 SG::ReadHandle<xAOD::PhotonContainer> photons(m_InputPhotonContainerKey, ctx);
115 // check is only used for serial running; remove when MT scheduler used
116 ATH_CHECK(photons.isValid());
117
118 //Loop over photons
119 auto ph_itr = photons->begin();
120 auto ph_end = photons->end();
121 for( ; ph_itr != ph_end; ++ph_itr ) {
122
123 auto vertexLinks= (*ph_itr) ->vertexLinks();
124 for ( const auto& vxlink : vertexLinks){
125 if( ! vxlink.isValid() ){
126 continue;
127 }
128 ATH_MSG_DEBUG("Photons : Keeping GSF Vertex with index : "<< vxlink.index() );
129 keptVertices[vxlink.index()]=true;
130 const xAOD::Vertex* vx = *(vxlink);
131 if(!vx){
132 continue;
133 }
134
136 for ( const auto& link : trackParticleLinks){
137 if( ! link.isValid() ){
138 continue;
139 }
140 ATH_MSG_DEBUG("Photons : Keeping GSF Track Particle with index : "<< link.index() );
141 keptTrackParticles[link.index() ] = true;
142 }
143 }
144 }
145
147 SG::ReadHandle<xAOD::ElectronContainer>
148 fwdelectrons(m_InputForwardElectronContainerKey, ctx);
149 // check is only used for serial running; remove when MT scheduler used
150 ATH_CHECK(fwdelectrons.isValid());
151
152 //Loop over forward electrons
153 for (const auto *el : *fwdelectrons) {
154
155 auto trackParticleLinks = el->trackParticleLinks();
156 for (const auto& link : trackParticleLinks){
157 if (!link.isValid()) {
158 continue;
159 }
160 ATH_MSG_DEBUG("ForwardElectrons : "
161 "Keeping GSF Track Particle with index : "
162 << link.index());
163 keptTrackParticles[link.index()] = true;
164 }
165 }
166 }
167
168 //Do the Thinning
169 ATH_MSG_DEBUG("Do the Thinning");
170 trackPC.keep (keptTrackParticles);
171 vertices.keep (keptVertices);
172 ATH_MSG_DEBUG("completed successfully");
173
174 //Return Gracefully
175 return StatusCode::SUCCESS;
176}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
SG::ThinningHandleKey< xAOD::VertexContainer > m_VertexKey
GSF vertex container to thin.
SG::ReadHandleKey< xAOD::ElectronContainer > m_InputForwardElectronContainerKey
forward electron collection input name
SG::ReadHandleKey< xAOD::ElectronContainer > m_InputElectronContainerKey
electron collection input name
SG::ThinningHandleKey< xAOD::TrackParticleContainer > m_TrackParticlesKey
GSF Track Particle container to thin.
Gaudi::Property< bool > m_doThinning
Bool to decide if we actually do the Thinning.
SG::ReadHandleKey< xAOD::PhotonContainer > m_InputPhotonContainerKey
photon collection input name
const TrackParticleLinks_t & trackParticleLinks() const
Get all the particles associated with the vertex.
std::vector< ElementLink< xAOD::TrackParticleContainer > > trackParticleLinks(const xAOD::TauJet *tau, xAOD::TauJetParameters::TauTrackFlag flag=xAOD::TauJetParameters::TauTrackFlag::classifiedCharged)
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::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 & AthCommonReentrantAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

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

Definition at line 94 of file AthCommonReentrantAlgorithm.cxx.

90{
91 // If we didn't find any symlinks to add, just return the collection
92 // from the base class. Otherwise, return the extended collection.
93 if (!m_extendedExtraObjects.empty()) {
95 }
97}
An algorithm that can be simultaneously executed in multiple threads.

◆ filterPassed()

virtual bool AthCommonReentrantAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Definition at line 96 of file AthCommonReentrantAlgorithm.h.

96 {
97 return execState( ctx ).filterPassed();
98 }
virtual bool filterPassed(const EventContext &ctx) const

◆ finalize()

StatusCode egammaTrackThinner::finalize ( )
finaloverride

finalize method

Definition at line 47 of file egammaTrackThinner.cxx.

47 {
48 return StatusCode::SUCCESS;
49}

◆ initialize()

StatusCode egammaTrackThinner::initialize ( )
finaloverride

initialize method

Definition at line 30 of file egammaTrackThinner.cxx.

31{
32
33 // initialize data handles
36 bool includeFwdEl =
38 ATH_CHECK(m_InputForwardElectronContainerKey.initialize(includeFwdEl));
41
42 return StatusCode::SUCCESS;
43}
StringProperty m_streamName
Name of the stream being thinned.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::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.

◆ isClonable()

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Gaudi::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< Gaudi::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< Gaudi::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< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterPassed()

virtual void AthCommonReentrantAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Definition at line 100 of file AthCommonReentrantAlgorithm.h.

100 {
102 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const

◆ sysExecute()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Definition at line 85 of file AthCommonReentrantAlgorithm.cxx.

77{
78 return BaseAlg::sysExecute (ctx);
79}

◆ sysInitialize()

StatusCode AthCommonReentrantAlgorithm< Gaudi::Algorithm >::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< Gaudi::Algorithm > >.

Reimplemented in HypoBase, and InputMakerBase.

Definition at line 61 of file AthCommonReentrantAlgorithm.cxx.

107 {
109
110 if (sc.isFailure()) {
111 return sc;
112 }
113
114 ServiceHandle<ICondSvc> cs("CondSvc",name());
115 for (auto h : outputHandles()) {
116 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
117 // do this inside the loop so we don't create the CondSvc until needed
118 if ( cs.retrieve().isFailure() ) {
119 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
120 return StatusCode::SUCCESS;
121 }
122 if (cs->regHandle(this,*h).isFailure()) {
124 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
125 << " with CondSvc");
126 }
127 }
128 }
129 return sc;
130}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::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< Gaudi::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 }

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doThinning

Gaudi::Property<bool> egammaTrackThinner::m_doThinning {this, "doThinning", true, "Bool to do Thinning"}
private

Bool to decide if we actually do the Thinning.

Definition at line 78 of file egammaTrackThinner.h.

78{this, "doThinning", true, "Bool to do Thinning"};

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonReentrantAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 114 of file AthCommonReentrantAlgorithm.h.

◆ m_InputElectronContainerKey

SG::ReadHandleKey<xAOD::ElectronContainer> egammaTrackThinner::m_InputElectronContainerKey
private
Initial value:
{this,
"InputElectronContainerName",
"Electrons",
"Name of the input electron container"}

electron collection input name

Definition at line 43 of file egammaTrackThinner.h.

43 {this,
44 "InputElectronContainerName",
45 "Electrons",
46 "Name of the input electron container"};

◆ m_InputForwardElectronContainerKey

SG::ReadHandleKey<xAOD::ElectronContainer> egammaTrackThinner::m_InputForwardElectronContainerKey
private
Initial value:
{ this,
"InputForwardElectronContainerName",
"",
"Name of the input electron container" }

forward electron collection input name

Definition at line 55 of file egammaTrackThinner.h.

56 { this,
57 "InputForwardElectronContainerName",
58 "",
59 "Name of the input electron container" };

◆ m_InputPhotonContainerKey

SG::ReadHandleKey<xAOD::PhotonContainer> egammaTrackThinner::m_InputPhotonContainerKey
private
Initial value:
{this,
"InputPhotonContainerName",
"Photons",
"Name of the input photon container"}

photon collection input name

Definition at line 49 of file egammaTrackThinner.h.

49 {this,
50 "InputPhotonContainerName",
51 "Photons",
52 "Name of the input photon container"};

◆ m_streamName

StringProperty egammaTrackThinner::m_streamName { this, "StreamName", "", "Name of the stream being thinned" }
private

Name of the stream being thinned.

Definition at line 74 of file egammaTrackThinner.h.

75{ this, "StreamName", "", "Name of the stream being thinned" };

◆ m_TrackParticlesKey

SG::ThinningHandleKey<xAOD::TrackParticleContainer> egammaTrackThinner::m_TrackParticlesKey
private
Initial value:
{this,
"TrackParticleContainerName",
"",
"Name of the Track Particle container to thin"}

GSF Track Particle container to thin.

Definition at line 62 of file egammaTrackThinner.h.

62 {this,
63 "TrackParticleContainerName",
64 "",
65 "Name of the Track Particle container to thin"};

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_VertexKey

SG::ThinningHandleKey<xAOD::VertexContainer> egammaTrackThinner::m_VertexKey
private
Initial value:
{this,
"VertexContainerName",
"",
"Name of the Vertex container to thin"}

GSF vertex container to thin.

Definition at line 68 of file egammaTrackThinner.h.

68 {this,
69 "VertexContainerName",
70 "",
71 "Name of the Vertex container to thin"};

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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