ATLAS Offline Software
Loading...
Searching...
No Matches
JiveXML::CompositeParticleRetriever Class Reference

Retrieves all CompositeParticle objects (AllObjects) More...

#include <CompositeParticleRetriever.h>

Inheritance diagram for JiveXML::CompositeParticleRetriever:
Collaboration diagram for JiveXML::CompositeParticleRetriever:

Public Member Functions

 CompositeParticleRetriever (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor.
virtual StatusCode retrieve (ToolHandle< IFormatTool > &FormatTool)
 Retrieve all the data.
const DataMap getData (const CompositeParticleContainer *)
 Retrieve basic parameters, mainly four-vectors, for each collection.
virtual std::string dataTypeName () const
 Return the name of the data type.
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Return the interface identifier.

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

const std::string m_typeName
 The data type that is generated by this retriever.
std::string m_sgKey
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

Retrieves all CompositeParticle objects (AllObjects)

  • Properties
    • StoreGateKey: First collection to be retrieved, displayed in Atlantis without switching. All other collections are also retrieved.
  • Retrieved Data
    • Usual four-vectors: phi, eta, et

Definition at line 31 of file CompositeParticleRetriever.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CompositeParticleRetriever()

JiveXML::CompositeParticleRetriever::CompositeParticleRetriever ( const std::string & type,
const std::string & name,
const IInterface * parent )

Standard Constructor.

This is the standard AthAlgTool constructor.

Parameters
typeAlgTool type name
nameAlgTool instance name
parentAlgTools parent owning this tool

Definition at line 20 of file CompositeParticleRetriever.cxx.

20 :
21 AthAlgTool(type,name,parent),
22 m_typeName("CompositeParticle"){
23 //Only declare the interface
24 declareInterface<IDataRetriever>(this);
25 declareProperty("StoreGateKey", m_sgKey = "AllObjects",
26 "Collection to be first in output, shown in Atlantis without switching");
27 }
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const std::string m_typeName
The data type that is generated by this retriever.

Member Function Documentation

◆ dataTypeName()

virtual std::string JiveXML::CompositeParticleRetriever::dataTypeName ( ) const
inlinevirtual

Return the name of the data type.

Implements JiveXML::IDataRetriever.

Definition at line 44 of file CompositeParticleRetriever.h.

44{ return m_typeName; };

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ getData()

const DataMap JiveXML::CompositeParticleRetriever::getData ( const CompositeParticleContainer * cpcont)

Retrieve basic parameters, mainly four-vectors, for each collection.

Also association with clusters (ElementLink).

Definition at line 74 of file CompositeParticleRetriever.cxx.

74 {
75 ATH_MSG_DEBUG( "retrieve()");
77 const auto nParticles = cpcont->size();
78 DataVect phi; phi.reserve(nParticles);
79 DataVect eta; eta.reserve(nParticles);
80 DataVect et; et.reserve(nParticles);
81 DataVect mass; mass.reserve(nParticles);
82 DataVect energy; energy.reserve(nParticles);
83 DataVect px; px.reserve(nParticles);
84 DataVect py; py.reserve(nParticles);
85 DataVect pz; pz.reserve(nParticles);
86 DataVect pdgId; pdgId.reserve(nParticles);
87 DataVect typeEV; typeEV.reserve(nParticles);
88 DataVect charge; charge.reserve(nParticles);
89 DataVect dataType; dataType.reserve(nParticles);
90 DataVect label; label.reserve(nParticles);
91
93 CompositeParticleContainer::const_iterator compPartItrE = cpcont->end();
94
95 std::string typeLabel = "n_a"; // same as in TruthParticleRetriever
96 int pdgId2 = 0;
97 for (; compPartItr != compPartItrE; ++compPartItr) {
98 const auto & pCompPart = *compPartItr;
99 phi.emplace_back(pCompPart->phi());
100 eta.emplace_back(pCompPart->eta());
101 et.emplace_back(pCompPart->et()/CLHEP::GeV);
102 mass.emplace_back(pCompPart->m()/CLHEP::GeV);
103 energy.emplace_back( pCompPart->e()/CLHEP::GeV );
104 px.emplace_back( pCompPart->px()/CLHEP::GeV );
105 py.emplace_back( pCompPart->py()/CLHEP::GeV );
106 pz.emplace_back( pCompPart->pz()/CLHEP::GeV );
107
108 charge.emplace_back( pCompPart->charge() );
109 dataType.emplace_back( pCompPart->dataType() );
110 pdgId2 = pCompPart->pdgId();
111 pdgId.emplace_back(pdgId2);
112 const auto absId = std::abs(pdgId2);
113 switch (absId){
114 case 11:
115 typeLabel = "EV_Electron";
116 break;
117 case 12:
118 typeLabel = "EV_NeutrinoElectron";
119 break;
120 case 13:
121 typeLabel = "EV_Muon";
122 break;
123 case 14:
124 typeLabel = "EV_NeutrinoMuon";
125 break;
126 case 15:
127 typeLabel = "EV_Tau";
128 break;
129 case 16:
130 typeLabel = "EV_NeutrinoTau";
131 break;
132 case 6:
133 typeLabel = "EV_Top";
134 break;
135 case 5:
136 typeLabel = "EV_Bottom";
137 break;
138 case 22:
139 typeLabel = "EV_Photon";
140 break;
141 case 23:
142 typeLabel = "EV_Z0";
143 break;
144 case 24:
145 typeLabel = ( pdgId2 == 24) ? "EV_Wplus": "EV_Wminus";
146 break;
147 default:
148 typeLabel = "n_a";
149 break;
150 }
151
152 typeEV.emplace_back(typeLabel);
153 label.emplace_back( "none" );
154 }
155 // four-vectors
156 const auto nEntries = phi.size();
157 DataMap["phi"] = std::move(phi);
158 DataMap["eta"] = std::move(eta);
159 DataMap["et"] = std::move(et);
160 DataMap["energy"] = std::move(energy);
161 DataMap["mass"] = std::move(mass);
162 DataMap["px"] = std::move(px);
163 DataMap["py"] = std::move(py);
164 DataMap["pz"] = std::move(pz);
165 DataMap["pdgId"] = std::move(pdgId);
166 DataMap["typeEV"] = std::move(typeEV);
167 DataMap["charge"] = std::move(charge);
168 DataMap["dataType"] = std::move(dataType);
169 DataMap["label"] = std::move(label);
170
171 ATH_MSG_DEBUG( " retrieved with " << nEntries << " entries");
172
173
174 //All collections retrieved okay
175 return DataMap;
176
177 } // retrieve
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
float et(const xAOD::jFexSRJetRoI *j)
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
std::string label(const std::string &format, int i)
Definition label.h:19
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58

◆ inputHandles()

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

◆ interfaceID()

const InterfaceID & JiveXML::IDataRetriever::interfaceID ( )
inlinestaticinherited

Return the interface identifier.

Definition at line 40 of file IDataRetriever.h.

40{ return IID_IDataRetriever; }
static const InterfaceID IID_IDataRetriever("JiveXML::IDataRetriever", 3, 0)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ retrieve()

StatusCode JiveXML::CompositeParticleRetriever::retrieve ( ToolHandle< IFormatTool > & FormatTool)
virtual

Retrieve all the data.

For each jet collections retrieve basic parameters.

Parameters
FormatToolthe tool that will create formated output from the DataMap

Implements JiveXML::IDataRetriever.

Definition at line 33 of file CompositeParticleRetriever.cxx.

33 {
34 ATH_MSG_DEBUG("in retrieveAll()" );
35 SG::ConstIterator<CompositeParticleContainer> iterator, end;
36 const CompositeParticleContainer* compPart{};
37 //obtain the default collection first
38 ATH_MSG_DEBUG( "Trying to retrieve " << dataTypeName() << " (" << m_sgKey << ")");
39 StatusCode sc = evtStore()->retrieve(compPart, m_sgKey);
40 if (sc.isFailure() ) {
41 ATH_MSG_WARNING( "Collection " << m_sgKey << " not found in SG " );
42 }else{
43 DataMap data = getData(compPart);
44 if ( FormatTool->AddToEvent(dataTypeName(), m_sgKey, &data).isFailure()){
45 ATH_MSG_WARNING( "Collection " << m_sgKey << " not found in SG " );
46 }else{
47 ATH_MSG_DEBUG( dataTypeName() << " (" << m_sgKey << ") CompositeParticle retrieved" );
48 }
49 }
50 //obtain all other collections from StoreGate
51 if (( evtStore()->retrieve(iterator, end)).isFailure()){
52 ATH_MSG_WARNING( "Unable to retrieve iterator for Jet collection" );
53 }
54 for (; iterator!=end; ++iterator) {
55 if (iterator.key()!=m_sgKey) {
56 ATH_MSG_DEBUG( "Trying to retrieve all " << dataTypeName() << " (" << iterator.key() << ")" );
57 DataMap data = getData(&(*iterator));
58 if ( FormatTool->AddToEvent(dataTypeName(), iterator.key(), &data).isFailure()){
59 ATH_MSG_WARNING( "Collection " << iterator.key() << " not found in SG " );
60 }else{
61 ATH_MSG_DEBUG( dataTypeName() << " (" << iterator.key() << ") CompositeParticle retrieved");
62 }
63 }
64 }
65 //All collections retrieved okay
66 return StatusCode::SUCCESS;
67 }
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
static Double_t sc
CompositeParticleContainer
ServiceHandle< StoreGateSvc > & evtStore()
const DataMap getData(const CompositeParticleContainer *)
Retrieve basic parameters, mainly four-vectors, for each collection.
virtual std::string dataTypeName() const
Return the name of the data type.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
Retrieve all the data.
::StatusCode StatusCode
StatusCode definition for legacy code.
JetConstituentVector::iterator iterator

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_sgKey

std::string JiveXML::CompositeParticleRetriever::m_sgKey
private

Definition at line 50 of file CompositeParticleRetriever.h.

◆ m_typeName

const std::string JiveXML::CompositeParticleRetriever::m_typeName
private

The data type that is generated by this retriever.

Definition at line 48 of file CompositeParticleRetriever.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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