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

Retrieves the Calo Cluster objects. More...

#include <xAODCaloClusterRetriever.h>

Inheritance diagram for JiveXML::xAODCaloClusterRetriever:
Collaboration diagram for JiveXML::xAODCaloClusterRetriever:

Public Member Functions

 xAODCaloClusterRetriever (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor.
virtual StatusCode retrieve (ToolHandle< IFormatTool > &FormatTool)
 For each cluster collection retrieve basic parameters.
virtual StatusCode initialize ()
const DataMap getData (const xAOD::CaloClusterContainer *)
 Puts the variables into a DataMap.
virtual std::string dataTypeName () const
 Return the name of the data type that is generated by this retriever.
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 = "Cluster"
 The data type that is generated by this retriever.
SG::ReadHandleKeyArray< xAOD::CaloClusterContainerm_keys {this,"ClusterCollections", {"egammaClusters","CaloCalTopoClusters"}, "Name of the Cluster containers that will be written out to the JiveXML file"}
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 the Calo Cluster objects.

  • Properties
    • ClusterCollections
  • Retrieved Data
    • Usual four-vector: phi, eta, et
    • No cells in AOD Clusters. numCells is placeholder for compatibility with 'full' clusters in AtlantisJava

Definition at line 32 of file xAODCaloClusterRetriever.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

◆ xAODCaloClusterRetriever()

JiveXML::xAODCaloClusterRetriever::xAODCaloClusterRetriever ( 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 19 of file xAODCaloClusterRetriever.cxx.

19 :
20 AthAlgTool(type,name,parent)
21 {}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ dataTypeName()

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

Return the name of the data type that is generated by this retriever.

Implements JiveXML::IDataRetriever.

Definition at line 45 of file xAODCaloClusterRetriever.h.

45{ return m_typeName; };
const std::string m_typeName
The data type that is generated by this retriever.

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ 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::xAODCaloClusterRetriever::getData ( const xAOD::CaloClusterContainer * ccc)

Puts the variables into a DataMap.

Retrieve basic parameters, mainly four-vectors.

AOD Clusters have no cells (trying to access them without back-navigation causes Athena crash).

Parameters
FormatToolthe tool that will create formated output from the DataMap

Definition at line 64 of file xAODCaloClusterRetriever.cxx.

64 {
65
66 ATH_MSG_DEBUG("in getData()");
67
69
70 DataVect phi; phi.reserve(ccc->size());
71 DataVect eta; eta.reserve(ccc->size());
72 DataVect et; et.reserve(ccc->size());
73 DataVect cells; cells.reserve(ccc->size());
74 DataVect numCells; numCells.reserve(ccc->size());
75 DataVect idVec; idVec.reserve(ccc->size());
76 DataVect emfracVec; emfracVec.reserve(ccc->size());
77 DataVect labelVec; labelVec.reserve(ccc->size());
78
79 std::string label="";
80 int id = 0;
81 int s = 0;
82 float eInSample = 0.;
83 float eInSampleFull = 0.;
84 float emfrac = 0.;
85 float rawemfrac = 0.;
86
87 // cells n/a in AOD, but keep this for compatibility
88 // with 'full' clusters in AtlantisJava
89 std::string tagCells;
90 tagCells = "cells multiple=\"1.0\"";
91
93 for (; itr != ccc->end(); ++itr) {
94
95 // sum over samplings to get EMfraction:
97 // full sum:
98 for (s=0;s<CaloSampling::Unknown; s++){
99 eInSampleFull += (*itr)->eSample(CaloSampling::CaloSample(s));
100 }
101 // Now only EMB1-3, EME1-3 and FCAL1:
102 eInSample += (*itr)->eSample(CaloSampling::EMB1);
103 eInSample += (*itr)->eSample(CaloSampling::EMB2);
104 eInSample += (*itr)->eSample(CaloSampling::EMB3);
105 eInSample += (*itr)->eSample(CaloSampling::EME1);
106 eInSample += (*itr)->eSample(CaloSampling::EME2);
107 eInSample += (*itr)->eSample(CaloSampling::EME3);
108 eInSample += (*itr)->eSample(CaloSampling::FCAL1);
109
110 emfrac = eInSample/eInSampleFull;
111 rawemfrac = emfrac;
112 // sanity cut: emfrac should be within [0,1]
113 if ( emfrac > 1.0 ) emfrac = 1.;
114 if ( emfrac < 0.0 ) emfrac = 0.;
115 emfracVec.emplace_back( DataType(emfrac).toString() );
116
117 if ( DataType( eInSample ).toString() != "0." ){
118 label = "AllMeV_SumEMSampl=" + DataType( eInSample ).toString() +
119 "_SumAllSampl=" + DataType( eInSampleFull ).toString() +
120 "_calcEMFrac=" + DataType( rawemfrac ).toString()+
121 "_outEMFrac=" + DataType( emfrac ).toString();
122 }else{ label = "n_a"; }
123 eInSample = 0.;
124 eInSampleFull = 0.;
125
126 labelVec.emplace_back( label );
127 ATH_MSG_VERBOSE("label is " << label);
128
129 // now the standard variables
130 // getBasicEnergy n/a in xAOD !
131
132 phi.emplace_back(DataType((*itr)->phi()));
133 eta.emplace_back(DataType((*itr)->eta()));
134 et.emplace_back(DataType((*itr)->et()/GeV));
135 numCells.emplace_back(DataType( "0" ));
136 cells.emplace_back(DataType( "0" ));
137 idVec.emplace_back(DataType( ++id ));
138
139 ATH_MSG_VERBOSE( dataTypeName() << " cluster #" << id
140 << " ,e=" << (*itr)->e()/GeV << ", et="
141 << (*itr)->et()/GeV << ", eta=" << (*itr)->eta()
142 << ", phi=" << (*itr)->phi());
143 }
144 // Start with mandatory entries
145 const auto n = phi.size();
146 DataMap["phi"] = std::move(phi);
147 DataMap["eta"] = std::move(eta);
148 DataMap["et"] = std::move(et);
149 DataMap[tagCells] = std::move(cells);
150 DataMap["numCells"] = std::move(numCells);
151 DataMap["id"] = std::move(idVec);
152 DataMap["emfrac"] = std::move(emfracVec); // not in Atlantis yet ! Could be used in legoplot
153 DataMap["label"] = std::move(labelVec); // not in Atlantis yet !
154
155 ATH_MSG_DEBUG(dataTypeName() << " (AOD, no cells), collection: " << dataTypeName()
156 << " retrieved with " << n << " entries");
157 return DataMap;
158 }
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
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.
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
std::string label(const std::string &format, int i)
Definition label.h:19
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
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

◆ initialize()

StatusCode JiveXML::xAODCaloClusterRetriever::initialize ( )
virtual

Definition at line 24 of file xAODCaloClusterRetriever.cxx.

24 {
25 ATH_CHECK(m_keys.initialize());
26 return StatusCode::SUCCESS;
27 }
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKeyArray< xAOD::CaloClusterContainer > m_keys

◆ 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::xAODCaloClusterRetriever::retrieve ( ToolHandle< IFormatTool > & FormatTool)
virtual

For each cluster collection retrieve basic parameters.

'Favourite' cluster collection first, then 'Other' collections.

Parameters
FormatToolthe tool that will create formated output from the DataMap

Implements JiveXML::IDataRetriever.

Definition at line 35 of file xAODCaloClusterRetriever.cxx.

35 {
36
37 ATH_MSG_DEBUG("In retrieve()");
38
39 // Loop through the keys and retrieve the corresponding data
40 for (const auto& key : m_keys) {
41 SG::ReadHandle<xAOD::CaloClusterContainer> cont(key);
42 if (cont.isValid()) {
43 DataMap data = getData(&(*cont));
44 if (FormatTool->AddToEvent(dataTypeName(), key.key() + "_xAOD", &data).isFailure()) {
45 ATH_MSG_WARNING("Failed to add collection " << key.key());
46 } else {
47 ATH_MSG_DEBUG(" (" << key.key() << ") retrieved");
48 }
49 } else {
50 ATH_MSG_WARNING("Collection " << key.key() << " not found in SG");
51 }
52 }
53
54 return StatusCode::SUCCESS;
55 }
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
const DataMap getData(const xAOD::CaloClusterContainer *)
Puts the variables into a DataMap.

◆ 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_keys

SG::ReadHandleKeyArray<xAOD::CaloClusterContainer> JiveXML::xAODCaloClusterRetriever::m_keys {this,"ClusterCollections", {"egammaClusters","CaloCalTopoClusters"}, "Name of the Cluster containers that will be written out to the JiveXML file"}
private

Definition at line 52 of file xAODCaloClusterRetriever.h.

52{this,"ClusterCollections", {"egammaClusters","CaloCalTopoClusters"}, "Name of the Cluster containers that will be written out to the JiveXML file"};

◆ m_typeName

const std::string JiveXML::xAODCaloClusterRetriever::m_typeName = "Cluster"
private

The data type that is generated by this retriever.

Definition at line 50 of file xAODCaloClusterRetriever.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: