ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
TBXMLEventWriterTool Class Reference

#include <TBXMLEventWriterTool.h>

Inheritance diagram for TBXMLEventWriterTool:
Collaboration diagram for TBXMLEventWriterTool:

Public Member Functions

 TBXMLEventWriterTool (const std::string &type, const std::string &name, const IInterface *parent)
 
 ~TBXMLEventWriterTool ()
 
virtual StatusCode initialize () override
 
virtual StatusCode writeOut (std::ostream &outStream, const std::string &entryTag=" ")
 
virtual StatusCode finalize () override
 
virtual StatusCode finalize (std::ostream &outStream)
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

virtual StatusCode writeRunFiles (const std::string &, unsigned int)
 
virtual StatusCode writeEvent (std::ostream &outFile, const std::string &entryTag)
 
virtual void openDictionary (std::ostream &outStream, const std::string &dictName, const std::vector< std::string > &listOfElements)
 
virtual void openDictionary (std::ostream &outStream, const std::string &dictName)
 
virtual void closeDictionary (std::ostream &outStream)
 
virtual void addDictElement (std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfElements)
 
virtual void addAttributes (std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfAttributes)
 
virtual void openElement (std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfAttr, const std::vector< std::string > &listOfValues)
 
virtual void closeElement (std::ostream &outStream, const std::string &theElement)
 
virtual void closeElement (std::ostream &outStream)
 
virtual void closeAllElements (std::ostream &outStream)
 
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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. More...
 

Protected Attributes

std::vector< std::string > m_elementList
 
std::string m_dictionary
 

Static Protected Attributes

static const std::string m_doubleQuote = "\042"
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

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

Detailed Description

Definition at line 19 of file TBXMLEventWriterTool.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

◆ TBXMLEventWriterTool()

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

Definition at line 20 of file TBXMLEventWriterTool.cxx.

24 {
25 }

◆ ~TBXMLEventWriterTool()

TBXMLEventWriterTool::~TBXMLEventWriterTool ( )

Definition at line 27 of file TBXMLEventWriterTool.cxx.

28 { }

Member Function Documentation

◆ addAttributes()

void TBXMLWriterToolBase::addAttributes ( std::ostream &  outStream,
const std::string &  theElement,
const std::vector< std::string > &  listOfAttributes 
)
protectedvirtualinherited

Definition at line 93 of file TBXMLWriterToolBase.cxx.

97 {
98  outStream << " <!ATTLIST " << theElement << std::endl;
99  for ( unsigned int i=0; i<listOfAttr.size(); i++ )
100  {
101  outStream << " " << listOfAttr[i] << std::endl;
102  }
103  outStream << ">" << std::endl;
104 }

◆ addDictElement()

void TBXMLWriterToolBase::addDictElement ( std::ostream &  outStream,
const std::string &  theElement,
const std::vector< std::string > &  listOfElements 
)
protectedvirtualinherited

Definition at line 59 of file TBXMLWriterToolBase.cxx.

63 {
64  outStream << "<!ELEMENT " << theElement;
65  // add document as element
66  if ( listOfElements.size() == 0 )
67  {
68  outStream << ">" << std::endl;
69  }
70  else
71  {
72  // store elements
73  if ( listOfElements[0] == "ANY" ||
74  listOfElements[0] == "EMPTY" ||
75  listOfElements[0] == "ALL" )
76  {
77  outStream << " " << listOfElements[0] << " >" << std::endl;
78  }
79  else
80  {
81  outStream << " (" << listOfElements[0];
82  for ( unsigned int i=1; i<listOfElements.size(); i++ )
83  {
84  outStream << "," << listOfElements[i];
85  }
86  outStream << ") >" << std::endl;
87  }
88  }
89 }

◆ closeAllElements()

void TBXMLWriterToolBase::closeAllElements ( std::ostream &  outStream)
protectedvirtualinherited

Definition at line 161 of file TBXMLWriterToolBase.cxx.

162 {
163  for ( int i=m_elementList.size()-1; i>=0; i-- )
164  {
165  outStream << "</" << m_elementList[i] << ">" << std::endl;
166  }
167  m_elementList.clear();
168 }

◆ closeDictionary()

void TBXMLWriterToolBase::closeDictionary ( std::ostream &  outStream)
protectedvirtualinherited

Definition at line 52 of file TBXMLWriterToolBase.cxx.

53 {
54  outStream << "]>" << std::endl;
55 }

◆ closeElement() [1/2]

void TBXMLWriterToolBase::closeElement ( std::ostream &  outStream)
protectedvirtualinherited

Definition at line 132 of file TBXMLWriterToolBase.cxx.

133 {
134  unsigned int thisSize = m_elementList.size() - 1;
135  outStream << "</" << m_elementList[thisSize] << ">" << std::endl;
136  m_elementList.resize(thisSize);
137 }

◆ closeElement() [2/2]

void TBXMLWriterToolBase::closeElement ( std::ostream &  outStream,
const std::string &  theElement 
)
protectedvirtualinherited

Definition at line 141 of file TBXMLWriterToolBase.cxx.

143 {
145  find( m_elementList.begin(), m_elementList.end(), theElement);
146  if ( inVec != m_elementList.end() )
147  {
148  outStream << "</" << (*inVec) << ">" << std::endl;
149  m_elementList.erase(inVec);
150  }
151  else
152  {
153  outStream << "<!-- XML Structural Problem! \n\n"
154  << " cannot find an element " << theElement << "!\n\n"
155  << "-->" << std::endl;
156  }
157 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

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

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

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

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

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

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

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

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

95 { return m_detStore; }

◆ evtStore() [1/2]

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.

85 { return m_evtStore; }

◆ evtStore() [2/2]

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

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

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ 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() [1/2]

virtual StatusCode TBXMLWriterToolBase::finalize ( )
inlineoverridevirtualinherited

Definition at line 51 of file TBXMLWriterToolBase.h.

52  {
53  return StatusCode::SUCCESS;
54  }

◆ finalize() [2/2]

virtual StatusCode TBXMLWriterToolBase::finalize ( std::ostream &  outStream)
inlinevirtualinherited

Definition at line 56 of file TBXMLWriterToolBase.h.

57  {
58  this->closeAllElements(outStream);
59  return this->finalize();
60  }

◆ initialize()

virtual StatusCode TBXMLWriterToolBase::initialize ( )
inlineoverridevirtualinherited

Reimplemented in TBXMLCaloCellWriterTool.

Definition at line 35 of file TBXMLWriterToolBase.h.

36  {
37  return StatusCode::SUCCESS;
38  }

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

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

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

◆ openDictionary() [1/2]

void TBXMLWriterToolBase::openDictionary ( std::ostream &  outStream,
const std::string &  dictName 
)
protectedvirtualinherited

Definition at line 43 of file TBXMLWriterToolBase.cxx.

45 {
46  std::vector<std::string> emptyList;
47  this->openDictionary(outStream,dictName, emptyList);
48 }

◆ openDictionary() [2/2]

void TBXMLWriterToolBase::openDictionary ( std::ostream &  outStream,
const std::string &  dictName,
const std::vector< std::string > &  listOfElements 
)
protectedvirtualinherited

Definition at line 20 of file TBXMLWriterToolBase.cxx.

24 {
25  // clean up
26  m_elementList.clear();
27  m_dictionary = dictName;
28 
29  // write header
30  outStream << "<?XML version=" << m_doubleQuote
31  << "1" << m_doubleQuote << "?>" << std::endl;
32 
33  // write begin of dictionary
34  outStream << "<!DOCTYPE " << dictName
35  << " [" << std::endl;
36 
37  // add doctype as element
38  this->addDictElement(outStream,dictName,listOfElements);
39 }

◆ openElement()

void TBXMLWriterToolBase::openElement ( std::ostream &  outStream,
const std::string &  theElement,
const std::vector< std::string > &  listOfAttr,
const std::vector< std::string > &  listOfValues 
)
protectedvirtualinherited

Definition at line 108 of file TBXMLWriterToolBase.cxx.

114 {
115  m_elementList.push_back(theElement);
116  outStream << "<" << theElement;
117  if ( listOfAttr.size() > 0 && listOfValues.size() == listOfAttr.size() )
118  {
119  for ( unsigned int i=0; i<listOfAttr.size(); i++ )
120  {
121  outStream << " " << listOfAttr[i] << "="
122  << m_doubleQuote
123  << listOfValues[i]
124  << m_doubleQuote;
125  }
126  }
127  outStream << ">" << std::endl;
128 }

◆ 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();
383  PBASE::renounce (h);
384  }

◆ 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  {
365  handlesArray.renounce();
366  }

◆ 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 DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ 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) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

◆ writeEvent()

StatusCode TBXMLEventWriterTool::writeEvent ( std::ostream &  outFile,
const std::string &  entryTag 
)
protectedvirtual

Implements TBXMLWriterToolBase.

Definition at line 31 of file TBXMLEventWriterTool.cxx.

33 {
34 
35  MsgStream log(msgSvc(),name());
36 
37  log << MSG::DEBUG << "EntryTag: "<< entryTag <<endmsg;
38 
39  // access some data
40  const EventContext& ctx = Gaudi::Hive::currentContext();
41  unsigned int theRun = ctx.eventID().run_number();
42  unsigned int theEvent = ctx.eventID().event_number();
43  unsigned int theType = 0;
44 
46  // Write XML Dictionary //
48 
49  // Document type
50  std::vector<std::string> theEventElements;
51  theEventElements.push_back("EventHeader");
52  theEventElements.push_back("(CaloCellContainer*)?");
53  theEventElements.push_back("(BeamWireChambers*)?");
54  theEventElements.push_back("(BeamProfileChambers*)?");
55  theEventElements.push_back("(BeamScintillators*)?");
56  theEventElements.push_back("(TailCatcher*)?");
57  theEventElements.push_back("(PatternUnit*)?");
58  this->openDictionary(outStream,"CTB_EC2Event",theEventElements);
59  std::vector<std::string> theEventAttr;
60  theEventAttr.push_back("name CDATA #REQUIRED");
61  this->addAttributes(outStream,"CTB_EC2Event",theEventAttr);
62 
63  // EventHeader
64  std::vector<std::string> theHeaderElements;
65  // theHeaderElements.push_back("TriggerWord?");
66  // theHeaderElements.push_back("TriggerPattern?");
67  this->addDictElement(outStream,"EventHeader",theHeaderElements);
68  std::vector<std::string> theHeaderAttr;
69  theHeaderAttr.push_back("name CDATA #REQUIRED");
70  theHeaderAttr.push_back("run CDATA #REQUIRED");
71  theHeaderAttr.push_back("event CDATA #REQUIRED");
72  theHeaderAttr.push_back("type CDATA #REQUIRED");
73  this->addAttributes(outStream,"EventHeader",theHeaderAttr);
74 
75  // Trigger etc
76  // std::vector<std::string> anyData;
77  // anyData.push_back("ANY");
78  // this->addDictElement(outStream,"TriggerWord",anyData);
79  // this->addDictElement(outStream,"TriggerPattern",anyData);
80 
81  // CaloCellContainer
82  std::vector<std::string> anyData;
83  anyData.push_back("ANY");
84  this->addDictElement(outStream,"CaloCellContainer",anyData);
85  std::vector<std::string> theCaloAttr;
86  theCaloAttr.push_back("name CDATA #REQUIRED");
87  theCaloAttr.push_back("ncols CDATA #REQUIRED");
88  theCaloAttr.push_back("nrows CDATA #REQUIRED");
89  theCaloAttr.push_back("idtype ( uint | int | short | ushort ) #REQUIRED");
90  theCaloAttr.push_back("etype ( float | double ) #REQUIRED");
91  this->addAttributes(outStream,"CaloCellContainer",theCaloAttr);
92 
93  // BPC Container
94  this->addDictElement(outStream,"BeamProfileChambers",anyData);
95  std::vector<std::string> theBPCAttr;
96  theBPCAttr.push_back("name CDATA #REQUIRED");
97  theBPCAttr.push_back("cols CDATA #REQUIRED");
98  theBPCAttr.push_back("idtype ( uint | int | short | ushort ) #REQUIRED");
99  theBPCAttr.push_back("xtype ( float | double ) #REQUIRED");
100  theBPCAttr.push_back("ytype ( float | double ) #REQUIRED");
101 
102  // MWPC Container
103  this->addDictElement(outStream,"BeamWireChambers",anyData);
104  std::vector<std::string> theMWPCAttr;
105  theMWPCAttr.push_back("name CDATA #REQUIRED");
106  theMWPCAttr.push_back("cols CDATA #REQUIRED");
107  theMWPCAttr.push_back("idtype ( uint | int | short | ushort ) #REQUIRED");
108  theMWPCAttr.push_back("xtype ( float | double ) #REQUIRED");
109  theMWPCAttr.push_back("ytype ( float | double ) #REQUIRED");
110 
111  // Scintillator Container
112  this->addDictElement(outStream,"BeamScinitllators",anyData);
113  std::vector<std::string> theScintAttr;
114  theScintAttr.push_back("name CDATA #REQUIRED");
115  theScintAttr.push_back("cols CDATA #REQUIRED");
116  theScintAttr.push_back("idtype ( uint | int | short | ushort ) #REQUIRED");
117  theScintAttr.push_back("signal ( float | double ) #REQUIRED");
118 
119  // close dictionary
120  this->closeDictionary(outStream);
121 
123  // Write Event //
125 
126  std::vector<std::string> theEventValues(theEventAttr.size());
127  for ( unsigned int i=0; i<theEventAttr.size(); i++ )
128  {
129  if ( (theEventAttr[i]).find("name") != std::string::npos )
130  {
131  theEventValues[i] = "EventInfo";
132  }
133  theEventAttr[i] =
134  theEventAttr[i].substr(0,theEventAttr[i].find_first_of(" "));
135  }
136  this->openElement(outStream,"EventInfo",theEventAttr,theEventValues);
137 
139  // Write EventHeader //
141 
142  std::vector<std::string> theHeaderValues(theHeaderAttr.size());
143  for ( unsigned int i=0; i<theHeaderAttr.size(); i++ )
144  {
145  if ( (theHeaderAttr[i]).find("name") != std::string::npos )
146  {
147  theHeaderValues[i] = "EventInfo";
148  }
149  else if ( (theHeaderAttr[i]).find("run") != std::string::npos )
150  {
151  std::ostringstream theValue; theValue << theRun << std::ends;
152  theHeaderValues[i] = theValue.str();
153  }
154  else if ( (theHeaderAttr[i]).find("event") != std::string::npos )
155  {
156  std::ostringstream theValue; theValue << theEvent << std::ends;
157  theHeaderValues[i] = theValue.str();
158  }
159  else if ( (theHeaderAttr[i]).find("type") != std::string::npos )
160  {
161  std::ostringstream theValue; theValue << theType << std::ends;
162  theHeaderValues[i] = theValue.str();
163  }
164  else
165  {
166  theHeaderValues[i] = "unknown";
167  }
168  theHeaderAttr[i] =
169  theHeaderAttr[i].substr(0,theHeaderAttr[i].find_first_of(" "));
170  }
171  // -------------------------- EventHeader
172  this->openElement(outStream,"EventHeader",
173  theHeaderAttr,theHeaderValues);
174  // ----------------------------- TriggerWord
175  // std::vector<std::string> emptyStr;
176  // this->openElement(outStream,"TriggerWord",
177  // emptyStr,emptyStr);
178  // unsigned short theTriggerWord =
179  // (unsigned short) (m_data->getTriggerWord() & 0xffff);
180  // outStream << " 0x"<< setw(4) << setfill(48) << hex << theTriggerWord
181  // << dec << std::endl;
182  // this->closeElement(outStream);
183  // ----------------------------- TriggerPattern
184  // this->openElement(outStream,"TriggerPattern",emptyStr,emptyStr);
185  // outStream << " ";
186  // std::map<std::string,unsigned int>::const_iterator
187  // first = m_triggerBitMap.begin();
188  // std::map<std::string,unsigned int>::const_iterator
189  // last = m_triggerBitMap.end();
190  // for ( ; first != last; first++ )
191  // {
192  // if ( ( theTriggerWord & (*first).second ) == (*first).second )
193  // {
194  // outStream << "\042" << (*first).first << "\042 ";
195  // }
196  // }
197  outStream << std::endl;
198  this->closeElement(outStream);
199 
200  // this->closeElement(outStream,"EventHeader");
201  return StatusCode::SUCCESS;
202 }

◆ writeOut()

virtual StatusCode TBXMLWriterToolBase::writeOut ( std::ostream &  outStream,
const std::string &  entryTag = " " 
)
inlinevirtualinherited

Definition at line 45 of file TBXMLWriterToolBase.h.

47  {
48  return this->writeEvent(outStream,entryTag);
49  }

◆ writeRunFiles()

StatusCode TBXMLEventWriterTool::writeRunFiles ( const std::string &  ,
unsigned int   
)
protectedvirtual

Implements TBXMLWriterToolBase.

Definition at line 205 of file TBXMLEventWriterTool.cxx.

207 {
208  return StatusCode::SUCCESS;
209 }

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_dictionary

std::string TBXMLWriterToolBase::m_dictionary
protectedinherited

Definition at line 107 of file TBXMLWriterToolBase.h.

◆ m_doubleQuote

const std::string TBXMLWriterToolBase::m_doubleQuote = "\042"
staticprotectedinherited

Definition at line 109 of file TBXMLWriterToolBase.h.

◆ m_elementList

std::vector<std::string> TBXMLWriterToolBase::m_elementList
protectedinherited

Definition at line 106 of file TBXMLWriterToolBase.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_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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
TBXMLWriterToolBase::openElement
virtual void openElement(std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfAttr, const std::vector< std::string > &listOfValues)
Definition: TBXMLWriterToolBase.cxx:108
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
TBXMLWriterToolBase::addDictElement
virtual void addDictElement(std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfElements)
Definition: TBXMLWriterToolBase.cxx:59
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TBXMLWriterToolBase::openDictionary
virtual void openDictionary(std::ostream &outStream, const std::string &dictName, const std::vector< std::string > &listOfElements)
Definition: TBXMLWriterToolBase.cxx:20
TBXMLWriterToolBase::addAttributes
virtual void addAttributes(std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfAttributes)
Definition: TBXMLWriterToolBase.cxx:93
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
TBXMLWriterToolBase::closeAllElements
virtual void closeAllElements(std::ostream &outStream)
Definition: TBXMLWriterToolBase.cxx:161
TBXMLWriterToolBase::closeElement
virtual void closeElement(std::ostream &outStream, const std::string &theElement)
Definition: TBXMLWriterToolBase.cxx:141
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
TBXMLWriterToolBase::finalize
virtual StatusCode finalize() override
Definition: TBXMLWriterToolBase.h:51
TBXMLWriterToolBase::writeEvent
virtual StatusCode writeEvent(std::ostream &theFile, const std::string &entryTag)=0
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
TBXMLWriterToolBase::m_elementList
std::vector< std::string > m_elementList
Definition: TBXMLWriterToolBase.h:106
TBXMLWriterToolBase::TBXMLWriterToolBase
TBXMLWriterToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TBXMLWriterToolBase.h:24
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
TBXMLWriterToolBase::m_dictionary
std::string m_dictionary
Definition: TBXMLWriterToolBase.h:107
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
a
TList * a
Definition: liststreamerinfos.cxx:10
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
PowhegPythia8EvtGen_jetjet.theRun
int theRun
Definition: PowhegPythia8EvtGen_jetjet.py:11
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
TBXMLWriterToolBase::m_doubleQuote
static const std::string m_doubleQuote
Definition: TBXMLWriterToolBase.h:109
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
TBXMLWriterToolBase::closeDictionary
virtual void closeDictionary(std::ostream &outStream)
Definition: TBXMLWriterToolBase.cxx:52