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

Writes data stored in a DataMap into an XML stream in the format required by the Atlantis event display. More...

#include <XMLFormatTool.h>

Inheritance diagram for JiveXML::XMLFormatTool:
Collaboration diagram for JiveXML::XMLFormatTool:

Public Member Functions

 XMLFormatTool (const std::string &, const std::string &, const IInterface *)
 Constructor.
virtual StatusCode initialize () override
 Initialize.
virtual StatusCode finalize () override
 Finalize.
virtual StatusCode SetTag (const TagType tag) override
 Set additional tags.
virtual StatusCode StartEvent (const unsigned long EventNumber, const unsigned int RunNumber, const std::string &DateTime, const unsigned int lumiBlock, const std::string &eventProperty, const std::string &geometryVersion) override
 Start a new event.
virtual StatusCode EndEvent () override
 Finialize this event.
virtual StatusCode AddToEvent (const std::string &component, const std::string &key, const DataMap *aMap) override
 Append a formatted version of one event component.
virtual const std::ostringstream * getFormattedEvent () const override
 Return the formated stringstream.
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 ()
 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

std::ostringstream * m_EventBuffer
 the string buffer that will hold the complete event
std::string m_release
 the release tag
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

Writes data stored in a DataMap into an XML stream in the format required by the Atlantis event display.

Author
J. Couchman
S. Boeser

Definition at line 21 of file XMLFormatTool.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

◆ XMLFormatTool()

JiveXML::XMLFormatTool::XMLFormatTool ( const std::string & type,
const std::string & name,
const IInterface * p )

Constructor.

  • setup message service

Definition at line 13 of file XMLFormatTool.cxx.

13 :
14 AthAlgTool(type,name,p){
15
16 //Provide interface
17 declareInterface<IFormatTool>(this);
18
19 //Intialize data members
20 m_EventBuffer = 0;
21 }
AthAlgTool()
Default constructor:
std::ostringstream * m_EventBuffer
the string buffer that will hold the complete event

Member Function Documentation

◆ AddToEvent()

StatusCode JiveXML::XMLFormatTool::AddToEvent ( const std::string & component,
const std::string & key,
const DataMap * aMap )
overridevirtual

Append a formatted version of one event component.

Add data from a certain component with a certain key to the event.

Parameters
componentthe component for which we write data
keythe name of the data field we write
aMapthe data that shall be written

Write a closing tag

Implements JiveXML::IFormatTool.

Definition at line 112 of file XMLFormatTool.cxx.

114 {
115
116 DataMap::const_iterator itr;
117
118 //check to see if any data is contained in the map before any formatting takes place
119 bool map_is_empty = true;
120 for(itr=aMap->begin(); itr!=aMap->end(); ++itr) {
121 if (itr->second.size()) {
122 map_is_empty = false;
123 break;
124 }
125 }
126
127 //return in case of empty map
128 if(map_is_empty) return StatusCode::SUCCESS;
129
130 //Open a new tag
131 (*m_EventBuffer) << "<" << component ;
132
133 //Write number of entries taken from first non-multiple collection
134 for (itr=aMap->begin(); itr!=aMap->end(); ++itr) {
135 if ((itr->first.find("multiple"))==std::string::npos) {
136 //Write out multiplicty and key
137 (*m_EventBuffer) <<" count=\""<< itr->second.size()<< "\""
138 <<" storeGateKey=\""<< key<< "\"";
139 break ;
140 }
141 }
142
143 //Close the opening tag
144 (*m_EventBuffer) << ">" << std::endl << std::endl;
145
146 //Now start writing event information
147 for(itr=aMap->begin(); itr!=aMap->end() ;++itr) {
148
149 // Write first key from map
150 (*m_EventBuffer) << "<" << (*itr).first <<">\n";
151
152 // Write the elements in groups of 10 per line
153 int ii=0;
154 for (DataVect::const_iterator itr2 = (*itr).second.begin(); itr2!=(*itr).second.end(); ++itr2){
155 ++ii;
156 (*m_EventBuffer) << (*itr2);
157 if ((*itr).first == "identifier"){
158 (*m_EventBuffer) <<"\n";
159 }
160 else if(ii>=10){
161 (*m_EventBuffer) <<"\n";
162 ii=0;
163 } else {
164 (*m_EventBuffer) << " ";
165 }
166 }
167
168 // I don't understand this bit
169 int i = (*itr).first.find(' ');
170 if (i != int(std::string::npos))
171 (*m_EventBuffer) << "\n</" << (*itr).first.substr(0,i) <<">\n";
172 else
173 (*m_EventBuffer) << "\n</" << (*itr).first <<">\n";
174 }
175
177 (*m_EventBuffer) << "</" << component << ">\n\n";
178
179 return StatusCode::SUCCESS;
180 }

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

◆ EndEvent()

StatusCode JiveXML::XMLFormatTool::EndEvent ( )
overridevirtual

Finialize this event.

Print event footer.

Implements JiveXML::IFormatTool.

Definition at line 97 of file XMLFormatTool.cxx.

97 {
98
99 //Print event close tag
100 (*m_EventBuffer) << "</Event>\n";
101
102 return StatusCode::SUCCESS;
103 }

◆ 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

◆ finalize()

StatusCode JiveXML::XMLFormatTool::finalize ( )
overridevirtual

Finalize.

Finalize - called once at the end.

Implements JiveXML::IFormatTool.

Definition at line 34 of file XMLFormatTool.cxx.

34 {
35
36 //Clear the event buffer if it exists
37 if (m_EventBuffer) delete m_EventBuffer;
38 return StatusCode::SUCCESS;
39 }

◆ getFormattedEvent()

const std::ostringstream * JiveXML::XMLFormatTool::getFormattedEvent ( ) const
overridevirtual

Return the formated stringstream.

Return the formatted event.

Implements JiveXML::IFormatTool.

Definition at line 183 of file XMLFormatTool.cxx.

183 {
184 return m_EventBuffer;
185 }

◆ initialize()

StatusCode JiveXML::XMLFormatTool::initialize ( )
overridevirtual

Initialize.

Intialize - called once at the beginning.

Implements JiveXML::IFormatTool.

Definition at line 26 of file XMLFormatTool.cxx.

26 {
27
28 return StatusCode::SUCCESS;
29 }

◆ 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::IFormatTool::interfaceID ( )
inlinestaticinherited

The interface identifier.

Definition at line 56 of file IFormatTool.h.

57 {
58 return IID_IFormatTool;
59 }
static const InterfaceID IID_IFormatTool("IFormatTool", 1, 0)
Must declare this, with name of interface.

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

◆ SetTag()

StatusCode JiveXML::XMLFormatTool::SetTag ( const TagType tag)
overridevirtual

Set additional tags.

Set the release tag.

Parameters
tagthe name of the release

Implements JiveXML::IFormatTool.

Definition at line 45 of file XMLFormatTool.cxx.

45 {
46
47 //Store this as release string
48 m_release = tag.second;
49 //Format properly
50 std::replace(m_release.begin(), m_release.end(), '/', '_');
51 return StatusCode::SUCCESS;
52 }
std::string m_release
the release tag

◆ StartEvent()

StatusCode JiveXML::XMLFormatTool::StartEvent ( const unsigned long EventNumber,
const unsigned int RunNumber,
const std::string & dateTime,
const unsigned int lumiBlock,
const std::string & eventProperty,
const std::string & geometryVersion )
overridevirtual

Start a new event.

Print the event header information.

Parameters
EventNumberthe event number
RunNumberthe run number
dataTimea date and time string

Implements JiveXML::IFormatTool.

Definition at line 60 of file XMLFormatTool.cxx.

64 {
65
66
67 //Recreate the event buffer if it does not exists
68 if (!m_EventBuffer)
69 m_EventBuffer = new std::ostringstream();
70
71 //Clear the event buffer
72 m_EventBuffer->str("");
73
74 //Print general XML header information
75 (*m_EventBuffer) << "<?xml version=\"1.0\"?>" << std::endl
76 << "<?xml-stylesheet type=\"text/xsl\" href=\"JiveXML_event.xsl\"?>" << std::endl
77 << "<?ATLAS Release: \"" << m_release << "\"?>" << std::endl
78 << "<!DOCTYPE Event SYSTEM \"event.dtd\">"
79 << std::endl << std::endl << std::endl;
80
81 //Print event open tag
82 (*m_EventBuffer) << "<Event version=\"" << m_release << "\""
83 << " runNumber=\"" << RunNumber << "\""
84 << " eventNumber=\"" << EventNumber << "\""
85 << " lumiBlock=\"" << lumiBlock << "\""
86 << " dateTime=\"" << dateTime << "\""
87 << " geometryVersion=\"" << geometryVersion << "\""
88 << " eventProperty=\"" << eventProperty << "\""
89 << ">" << std::endl << std::endl << std::endl;
90
91 return StatusCode::SUCCESS;
92 }
std::string dateTime()
setTeId lumiBlock

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

std::ostringstream* JiveXML::XMLFormatTool::m_EventBuffer
private

the string buffer that will hold the complete event

Definition at line 59 of file XMLFormatTool.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_release

std::string JiveXML::XMLFormatTool::m_release
private

the release tag

Definition at line 62 of file XMLFormatTool.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: