ATLAS Offline Software
RootReaderD3PDBase.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: RootReaderD3PDBase.cxx 595600 2014-05-06 12:18:26Z ssnyder $
6 
7 // ROOT include(s):
8 #include <Rtypes.h>
9 
10 // Gaudi/Athena include(s):
11 #include "GaudiKernel/System.h"
13 
14 // Local include(s):
15 #include "RootReaderD3PDBase.h"
16 
18 #if 0
19 namespace {
20 
22  bool isPrimitive( const std::type_info& ti ) {
23 
24  if( ( ti == typeid( char* ) ) ||
25  ( ti == typeid( Char_t ) ) ||
26  ( ti == typeid( UChar_t ) ) ||
27  ( ti == typeid( Short_t ) ) ||
28  ( ti == typeid( UShort_t ) ) ||
29  ( ti == typeid( Int_t ) ) ||
30  ( ti == typeid( UInt_t ) ) ||
31  ( ti == typeid( Float_t ) ) ||
32  ( ti == typeid( Double_t ) ) ||
33  ( ti == typeid( Long64_t ) ) ||
34  ( ti == typeid( ULong64_t ) ) ||
35  ( ti == typeid( Bool_t ) ) ) {
36 
37  return true;
38  }
39 
40  return false;
41  }
42 
44  const char* rootPrimitiveType( const std::type_info& ti ) {
45 
46  if( ti == typeid( char* ) ) {
47  return "char*";
48  } else if( ti == typeid( Char_t ) ) {
49  return "Char_t";
50  } else if( ti == typeid( UChar_t ) ) {
51  return "UChar_t";
52  } else if( ti == typeid( Short_t ) ) {
53  return "Short_t";
54  } else if( ti == typeid( UShort_t ) ) {
55  return "UShort_t";
56  } else if( ti == typeid( Int_t ) ) {
57  return "Int_t";
58  } else if( ti == typeid( UInt_t ) ) {
59  return "UInt_t";
60  } else if( ti == typeid( Float_t ) ) {
61  return "Float_t";
62  } else if( ti == typeid( Double_t ) ) {
63  return "Double_t";
64  } else if( ti == typeid( Long64_t ) ) {
65  return "Long64_t";
66  } else if( ti == typeid( ULong64_t ) ) {
67  return "ULong64_t";
68  } else if( ti == typeid( Bool_t ) ) {
69  return "Bool_t";
70  }
71 
72  return "\0";
73  }
74 
75 } // namespace
76 #endif
77 
78 namespace D3PD {
79 
81  : m_metadata() {
82 
83  }
84 
86  const std::type_info& ti,
87  void*& ptr,
88  const std::string& docstring,
89  const void* defval ) {
90 
91  CHECK( m_metadata.addVariable( name, ti, ptr, docstring, defval ) );
92  return StatusCode::SUCCESS;
93  }
94 
96  const std::type_info& ti,
97  void*& ptr,
98  const std::string& dim,
99  const std::string& docstring,
100  const void* defval ) {
101 
102  CHECK( m_metadata.addDimensionedVariable( name, ti, ptr, dim, docstring,
103  defval ) );
104  return StatusCode::SUCCESS;
105  }
106 
108  const void*,
109  const std::type_info& ) {
110 
111  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
112  << "addMetadata(...) not implemented";
113  return StatusCode::FAILURE;
114  }
115 
117 
118  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
119  << "capture() not implemented";
120  return StatusCode::FAILURE;
121  }
122 
124 
125  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
126  << "clear() not implemented";
127  return StatusCode::FAILURE;
128  }
129 
131 
132  REPORT_MESSAGE_WITH_CONTEXT( MSG::ERROR, "RootReaderD3PDBase" )
133  << "redim(...) not implemented";
134  return StatusCode::FAILURE;
135  }
136 
137  void RootReaderD3PDBase::setIsContainer( bool isContainer ) {
138 
140  return;
141  }
142 
144 
145  return m_metadata.container();
146  }
147 
148  void RootReaderD3PDBase::setPrefix( const std::string& prefix ) {
149 
151  return;
152  }
153 
154  const std::string& RootReaderD3PDBase::prefix() const {
155 
156  return m_metadata.prefix();
157  }
158 
167  void RootReaderD3PDBase::addSTLHeader( std::ostream& out, const char* name ) const {
168 
169  // Check if the STL name appears in the variable type names:
170  bool header_needed = false;
171  std::set< D3PD::ObjectMetadata::Variable >::const_iterator itr =
172  m_metadata.variables().begin();
173  std::set< D3PD::ObjectMetadata::Variable >::const_iterator end =
174  m_metadata.variables().end();
175  for( ; itr != end; ++itr ) {
176  if( itr->type().find( name ) != std::string::npos ) {
177  header_needed = true;
178  break;
179  }
180  }
181 
182  // If it does, let's include it:
183  if( header_needed ) {
184  out << "#include <" << name << ">" << std::endl;
185  }
186 
187  return;
188  }
189 
190 } // namespace D3PD
D3PD::RootReaderD3PDBase::clear
virtual StatusCode clear()
Function clearing the D3PD variables. Not implemented here!
Definition: RootReaderD3PDBase.cxx:123
D3PD::ObjectMetadata::variables
const std::set< Variable > & variables() const
Function for accessing all the variables of the D3PDObject.
Definition: ObjectMetadata.cxx:577
D3PD::ObjectMetadata::addDimensionedVariable
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
The object doesn't support dimensioned variables at the moment, like most of the D3PDMaker code doesn...
Definition: ObjectMetadata.cxx:157
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
D3PD::RootReaderD3PDBase::m_metadata
ObjectMetadata m_metadata
Object holding the information about the variables.
Definition: RootReaderD3PDBase.h:84
RootReaderD3PDBase.h
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
D3PD::isPrimitive
bool isPrimitive(const std::string &type)
This function is used in the code generator to determine from a type name if it's a primitive type or...
Definition: isPrimitive.cxx:24
D3PD::ObjectMetadata::setPrefix
void setPrefix(const std::string &prefix)
Set the prefix given to variables in this D3PDObject.
Definition: ObjectMetadata.cxx:224
D3PD::RootReaderD3PDBase::setIsContainer
virtual void setIsContainer(bool isContainer)
Set the "isCollection" parameter of the object.
Definition: RootReaderD3PDBase.cxx:137
D3PD::RootReaderD3PDBase::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
Main function for adding a variable to the D3PD.
Definition: RootReaderD3PDBase.cxx:85
D3PD::ObjectMetadata::container
bool container() const
Get whether the D3PDObject describes a container or not.
Definition: ObjectMetadata.cxx:230
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
D3PD
Block filler tool for noisy FEB information.
Definition: InnerDetector/InDetMonitoring/InDetGlobalMonitoring/macros/EnhancedPrimaryVertexMonitoring/TrigD3PD/ChainGroup.h:21
D3PD::RootReaderD3PDBase::redim
virtual StatusCode redim(const Dim_t *ptr)
Function currently not used by the D3PDMaker code.
Definition: RootReaderD3PDBase.cxx:130
D3PD::RootReaderD3PDBase::addDimensionedVariable
virtual StatusCode addDimensionedVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &dim, const std::string &docstring="", const void *defval=0)
Function currently not used by the D3PDMaker code.
Definition: RootReaderD3PDBase.cxx:95
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
D3PD::RootReaderD3PDBase::isContainer
virtual bool isContainer() const
Get the "isCollection" parameter of the object.
Definition: RootReaderD3PDBase.cxx:143
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
D3PD::ObjectMetadata::setContainer
void setContainer(bool container)
Set whether the D3PDObject describes a container or not.
Definition: ObjectMetadata.cxx:235
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
D3PD::RootReaderD3PDBase::addMetadata
virtual StatusCode addMetadata(const std::string &key, const void *obj, const std::type_info &ti)
Function adding metadata to the D3PD. Not implemented here!
Definition: RootReaderD3PDBase.cxx:107
errorcheck.h
Helpers for checking error return status codes and reporting errors.
D3PD::ObjectMetadata::addVariable
virtual StatusCode addVariable(const std::string &name, const std::type_info &ti, void *&ptr, const std::string &docstring="", const void *defval=0)
This function can be used to save the metadata about a D3PD variable.
Definition: ObjectMetadata.cxx:109
D3PD::ObjectMetadata::prefix
const std::string & prefix() const
Get the prefix given to variables in this D3PDObject.
Definition: ObjectMetadata.cxx:219
D3PD::ID3PD::Dim_t
unsigned int Dim_t
Currently unimplemented — see design note.
Definition: ID3PD.h:52
D3PD::RootReaderD3PDBase::addSTLHeader
void addSTLHeader(std::ostream &out, const char *name) const
Function adding STL include statements to the header when needed.
Definition: RootReaderD3PDBase.cxx:167
D3PD::RootReaderD3PDBase::RootReaderD3PDBase
RootReaderD3PDBase()
Quite empty constructor.
Definition: RootReaderD3PDBase.cxx:80
D3PD::RootReaderD3PDBase::prefix
virtual const std::string & prefix() const
Get the common prefix of the variables.
Definition: RootReaderD3PDBase.cxx:154
D3PD::RootReaderD3PDBase::setPrefix
virtual void setPrefix(const std::string &prefix)
Set the common prefix of the variables.
Definition: RootReaderD3PDBase.cxx:148
D3PD::RootReaderD3PDBase::capture
virtual StatusCode capture()
Function capturing the current value of the D3PD variables. Not implemented here!
Definition: RootReaderD3PDBase.cxx:116