ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::BPhysMetadataBase Class Reference

#include <BPhysMetadataBase.h>

Inheritance diagram for DerivationFramework::BPhysMetadataBase:

Public Member Functions

 BPhysMetadataBase (const std::string &t, const std::string &n, const IInterface *p)
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode addBranches (const EventContext &ctx) const

Protected Member Functions

virtual void recordPropertyI (const std::string &name, int val)
virtual void recordPropertyL (const std::string &name, long val)
virtual void recordPropertyD (const std::string &name, double val)
virtual void recordPropertyB (const std::string &name, bool val)
virtual void recordPropertyS (const std::string &name, const std::string &val)
virtual void recordPropertyVI (const std::string &name, const std::vector< int > &val)
virtual void recordPropertyVL (const std::string &name, const std::vector< long > &val)
virtual void recordPropertyVD (const std::string &name, const std::vector< double > &val)
virtual void recordPropertyVB (const std::string &name, const std::vector< bool > &val)
virtual void recordPropertyVS (const std::string &name, const std::vector< std::string > &val)

Private Member Functions

virtual StatusCode saveMetaDataBPhys () const
virtual std::string buildFolderName (const std::string &fname="") const
virtual std::string vecToString (const std::vector< int > &v) const
virtual std::string vecToString (const std::vector< long > &v) const
virtual std::string vecToString (const std::vector< double > &v) const
virtual std::string vecToString (const std::vector< bool > &v) const
virtual std::string vecToString (const std::vector< std::string > &v) const

Private Attributes

ServiceHandle< StoreGateSvcm_outputMetaStore
 Object accessing the output metadata store.
std::string m_derivationName
std::string m_mdFolderName
std::string m_prefix
std::map< std::string, int > m_propInt
std::map< std::string, long > m_propLong
std::map< std::string, double > m_propDouble
std::map< std::string, bool > m_propBool
std::map< std::string, std::string > m_propString
std::map< std::string, std::vector< int > > m_propVInt
std::map< std::string, std::vector< long > > m_propVLong
std::map< std::string, std::vector< double > > m_propVDouble
std::map< std::string, std::vector< bool > > m_propVBool
std::map< std::string, std::vector< std::string > > m_propVString

Detailed Description

Definition at line 43 of file BPhysMetadataBase.h.

Constructor & Destructor Documentation

◆ BPhysMetadataBase()

DerivationFramework::BPhysMetadataBase::BPhysMetadataBase ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 45 of file BPhysMetadataBase.cxx.

48 : base_class(t,n,p),
49 m_outputMetaStore("StoreGateSvc/MetaDataStore", n) {
50
51
52 // Declare derivation format name
53 declareProperty("DerivationName", m_derivationName = "_NOSUCHFORMAT_");
54
55 // Declare metadata folder name (should start with derivation name)
56 declareProperty("MetadataFolderName", m_mdFolderName = "_NONE_");
57
58 // Prefix would typically be the derivation format name
59 declareProperty("Prefix", m_prefix = "");
60
61 }
ServiceHandle< StoreGateSvc > m_outputMetaStore
Object accessing the output metadata store.

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::BPhysMetadataBase::addBranches ( const EventContext & ctx) const
virtual

Definition at line 91 of file BPhysMetadataBase.cxx.

91 {
92
93 // nothing to do here
94 return StatusCode::SUCCESS;
95 }

◆ buildFolderName()

std::string DerivationFramework::BPhysMetadataBase::buildFolderName ( const std::string & fname = "") const
privatevirtual

Definition at line 149 of file BPhysMetadataBase.cxx.

149 {
150
151 std::string result = fname;
152 if ( m_mdFolderName != "_NONE_" && m_mdFolderName != "" ) {
154 } else {
155 if ( m_derivationName != "_NOSUCHFORMAT_" && m_derivationName != "" ) {
157 } else {
158 // default to the tool's name
159 result += name();
160 }
161 }
162 return result;
163 }

◆ finalize()

StatusCode DerivationFramework::BPhysMetadataBase::finalize ( )
virtual

Definition at line 83 of file BPhysMetadataBase.cxx.

83 {
84
85 ATH_MSG_DEBUG("BPhysMetaDataBase::finalize()");
86
87 // everything all right
88 return StatusCode::SUCCESS;
89 }
#define ATH_MSG_DEBUG(x)

◆ initialize()

StatusCode DerivationFramework::BPhysMetadataBase::initialize ( )
virtual

Definition at line 63 of file BPhysMetadataBase.cxx.

63 {
64
65 ATH_MSG_DEBUG("BPhysMetaDataBase::initialize() -- begin");
66
67 // handle general prefix
68 if ( m_prefix == "" ) {
69 if ( m_derivationName == "_NOSUCHFORMAT_" ) {
70 m_prefix = name() +"_";
71 } else {
73 }
74 }
75
77
78 ATH_MSG_DEBUG("BPhysMetaDataBase::initialize() -- end");
79
80 return StatusCode::SUCCESS;
81 }
#define CHECK(...)
Evaluate an expression and check for errors.
virtual StatusCode saveMetaDataBPhys() const

◆ recordPropertyB()

void DerivationFramework::BPhysMetadataBase::recordPropertyB ( const std::string & name,
bool val )
protectedvirtual

Definition at line 180 of file BPhysMetadataBase.cxx.

180 {
181 ATH_MSG_INFO("Calling recordProperty(bool)");
182 declareProperty(name, m_propBool[name] = val);
183 }
#define ATH_MSG_INFO(x)
std::map< std::string, bool > m_propBool

◆ recordPropertyD()

void DerivationFramework::BPhysMetadataBase::recordPropertyD ( const std::string & name,
double val )
protectedvirtual

Definition at line 175 of file BPhysMetadataBase.cxx.

175 {
176 ATH_MSG_INFO("Calling recordProperty(double)");
177 declareProperty(name, m_propDouble[name] = val);
178 }
std::map< std::string, double > m_propDouble

◆ recordPropertyI()

void DerivationFramework::BPhysMetadataBase::recordPropertyI ( const std::string & name,
int val )
protectedvirtual

Definition at line 165 of file BPhysMetadataBase.cxx.

165 {
166 ATH_MSG_INFO("Calling recordProperty(int)");
167 declareProperty(name, m_propInt[name] = val);
168 }
std::map< std::string, int > m_propInt

◆ recordPropertyL()

void DerivationFramework::BPhysMetadataBase::recordPropertyL ( const std::string & name,
long val )
protectedvirtual

Definition at line 170 of file BPhysMetadataBase.cxx.

170 {
171 ATH_MSG_INFO("Calling recordProperty(long)");
172 declareProperty(name, m_propLong[name] = val);
173 }
std::map< std::string, long > m_propLong

◆ recordPropertyS()

void DerivationFramework::BPhysMetadataBase::recordPropertyS ( const std::string & name,
const std::string & val )
protectedvirtual

Definition at line 185 of file BPhysMetadataBase.cxx.

185 {
186 ATH_MSG_INFO("Calling recordProperty(string)");
187 declareProperty(name, m_propString[name] = val);
188 }
std::map< std::string, std::string > m_propString

◆ recordPropertyVB()

void DerivationFramework::BPhysMetadataBase::recordPropertyVB ( const std::string & name,
const std::vector< bool > & val )
protectedvirtual

Definition at line 208 of file BPhysMetadataBase.cxx.

209 {
210 ATH_MSG_INFO("Calling recordProperty(vector<bool>)");
211 declareProperty(name, m_propVBool[name] = val);
212 }
std::map< std::string, std::vector< bool > > m_propVBool

◆ recordPropertyVD()

void DerivationFramework::BPhysMetadataBase::recordPropertyVD ( const std::string & name,
const std::vector< double > & val )
protectedvirtual

Definition at line 202 of file BPhysMetadataBase.cxx.

203 {
204 ATH_MSG_INFO("Calling recordProperty(vector<double>)");
205 declareProperty(name, m_propVDouble[name] = val);
206 }
std::map< std::string, std::vector< double > > m_propVDouble

◆ recordPropertyVI()

void DerivationFramework::BPhysMetadataBase::recordPropertyVI ( const std::string & name,
const std::vector< int > & val )
protectedvirtual

Definition at line 190 of file BPhysMetadataBase.cxx.

191 {
192 ATH_MSG_INFO("Calling recordProperty(vector<int>)");
193 declareProperty(name, m_propVInt[name] = val);
194 }
std::map< std::string, std::vector< int > > m_propVInt

◆ recordPropertyVL()

void DerivationFramework::BPhysMetadataBase::recordPropertyVL ( const std::string & name,
const std::vector< long > & val )
protectedvirtual

Definition at line 196 of file BPhysMetadataBase.cxx.

197 {
198 ATH_MSG_INFO("Calling recordProperty(vector<long>)");
199 declareProperty(name, m_propVLong[name] = val);
200 }
std::map< std::string, std::vector< long > > m_propVLong

◆ recordPropertyVS()

void DerivationFramework::BPhysMetadataBase::recordPropertyVS ( const std::string & name,
const std::vector< std::string > & val )
protectedvirtual

Definition at line 214 of file BPhysMetadataBase.cxx.

215 {
216 ATH_MSG_INFO("Calling recordProperty(vector<string>)");
217 declareProperty(name, m_propVString[name] = val);
218 }
std::map< std::string, std::vector< std::string > > m_propVString

◆ saveMetaDataBPhys()

StatusCode DerivationFramework::BPhysMetadataBase::saveMetaDataBPhys ( ) const
privatevirtual

Definition at line 103 of file BPhysMetadataBase.cxx.

103 {
104
105 ATH_MSG_DEBUG("BPhysMetaDataBase::saveMetaDataBPhys() -- begin");
106
107 std::string mdFolderKey = buildFolderName() + "_MetaData";
108 // protection
109 if ( m_outputMetaStore->contains< xAOD::FileMetaData >( mdFolderKey ) ) {
110 ATH_MSG_WARNING("saveMetaDataBPhys2: "
111 "xAOD::FileMetaData already in output: "
112 << mdFolderKey
113 << " -- BPhys metadata will NOT be saved!");
114 } else {
115 // create a FileMetaData object
116 auto fm = std::make_unique< xAOD::FileMetaData >();
117 auto fmAux = std::make_unique< xAOD::FileMetaDataAuxInfo >();
118 fm->setStore( fmAux.get() );
119
120 // fill it
121 SG::Accessor<std::string> DerivationNameAcc(m_prefix+"DerivationName");
122 DerivationNameAcc(*fm) = m_derivationName;
123
124 SG::Accessor<std::string> MetaDatafolderNameAcc(m_prefix+"MetaDataFolderName");
125 MetaDatafolderNameAcc(*fm) = m_mdFolderName;
126
127 // fill it with contents of maps
128 SET_VALUES_IMP( int , m_propInt );
129 SET_VALUES_IMP( long , m_propLong );
130 SET_VALUES_IMP( double , m_propDouble );
131 SET_VALUES_IMP( bool , m_propBool );
132 SET_VALUES_IMP( std::string , m_propString );
133 SET_VALUES_IMP( std::vector<int> , m_propVInt );
134 SET_VALUES_IMP( std::vector<long> , m_propVLong );
135 SET_VALUES_IMP( std::vector<double> , m_propVDouble );
136 SET_VALUES_IMP( std::vector<bool> , m_propVBool );
137 SET_VALUES_IMP( std::vector<std::string>, m_propVString );
138
139 // record it
140 ATH_CHECK( m_outputMetaStore->record( std::move(fm), mdFolderKey ) );
141 ATH_CHECK( m_outputMetaStore->record( std::move(fmAux),
142 mdFolderKey+"Aux." ) );
143 }
144
145 return StatusCode::SUCCESS;
146 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
#define SET_VALUES_IMP(TYPE, MAP)
virtual std::string buildFolderName(const std::string &fname="") const
FileMetaData_v1 FileMetaData
Declare the latest version of the class.

◆ vecToString() [1/5]

std::string DerivationFramework::BPhysMetadataBase::vecToString ( const std::vector< bool > & v) const
privatevirtual

Definition at line 250 of file BPhysMetadataBase.cxx.

250 {
251 std::string str("[");
252 for (unsigned int i=0; i<v.size(); ++i) {
253 str += std::to_string(v[i]);
254 if ( i < v.size()-1 ) str += ",";
255 }
256 str += "]";
257 return str;
258 }

◆ vecToString() [2/5]

std::string DerivationFramework::BPhysMetadataBase::vecToString ( const std::vector< double > & v) const
privatevirtual

Definition at line 240 of file BPhysMetadataBase.cxx.

240 {
241 std::string str("[");
242 for (unsigned int i=0; i<v.size(); ++i) {
243 str += std::to_string(v[i]);
244 if ( i < v.size()-1 ) str += ",";
245 }
246 str += "]";
247 return str;
248 }

◆ vecToString() [3/5]

std::string DerivationFramework::BPhysMetadataBase::vecToString ( const std::vector< int > & v) const
privatevirtual

Definition at line 220 of file BPhysMetadataBase.cxx.

220 {
221 std::string str("[");
222 for (unsigned int i=0; i<v.size(); ++i) {
223 str += std::to_string(v[i]);
224 if ( i < v.size()-1 ) str += ",";
225 }
226 str += "]";
227 return str;
228 }

◆ vecToString() [4/5]

std::string DerivationFramework::BPhysMetadataBase::vecToString ( const std::vector< long > & v) const
privatevirtual

Definition at line 230 of file BPhysMetadataBase.cxx.

230 {
231 std::string str("[");
232 for (unsigned int i=0; i<v.size(); ++i) {
233 str += std::to_string(v[i]);
234 if ( i < v.size()-1 ) str += ",";
235 }
236 str += "]";
237 return str;
238 }

◆ vecToString() [5/5]

std::string DerivationFramework::BPhysMetadataBase::vecToString ( const std::vector< std::string > & v) const
privatevirtual

Definition at line 260 of file BPhysMetadataBase.cxx.

260 {
261 std::string str("[");
262 for (unsigned int i=0; i<v.size(); ++i) {
263 str += "'";
264 str += v[i];
265 str += "'";
266 if ( i < v.size()-1 ) str += ",";
267 }
268 str += "]";
269 return str;
270 }

Member Data Documentation

◆ m_derivationName

std::string DerivationFramework::BPhysMetadataBase::m_derivationName
private

Definition at line 81 of file BPhysMetadataBase.h.

◆ m_mdFolderName

std::string DerivationFramework::BPhysMetadataBase::m_mdFolderName
private

Definition at line 82 of file BPhysMetadataBase.h.

◆ m_outputMetaStore

ServiceHandle< StoreGateSvc > DerivationFramework::BPhysMetadataBase::m_outputMetaStore
private

Object accessing the output metadata store.

Definition at line 78 of file BPhysMetadataBase.h.

◆ m_prefix

std::string DerivationFramework::BPhysMetadataBase::m_prefix
private

Definition at line 83 of file BPhysMetadataBase.h.

◆ m_propBool

std::map<std::string, bool> DerivationFramework::BPhysMetadataBase::m_propBool
private

Definition at line 89 of file BPhysMetadataBase.h.

◆ m_propDouble

std::map<std::string, double> DerivationFramework::BPhysMetadataBase::m_propDouble
private

Definition at line 88 of file BPhysMetadataBase.h.

◆ m_propInt

std::map<std::string, int> DerivationFramework::BPhysMetadataBase::m_propInt
private

Definition at line 86 of file BPhysMetadataBase.h.

◆ m_propLong

std::map<std::string, long> DerivationFramework::BPhysMetadataBase::m_propLong
private

Definition at line 87 of file BPhysMetadataBase.h.

◆ m_propString

std::map<std::string, std::string> DerivationFramework::BPhysMetadataBase::m_propString
private

Definition at line 90 of file BPhysMetadataBase.h.

◆ m_propVBool

std::map<std::string, std::vector<bool> > DerivationFramework::BPhysMetadataBase::m_propVBool
private

Definition at line 94 of file BPhysMetadataBase.h.

◆ m_propVDouble

std::map<std::string, std::vector<double> > DerivationFramework::BPhysMetadataBase::m_propVDouble
private

Definition at line 93 of file BPhysMetadataBase.h.

◆ m_propVInt

std::map<std::string, std::vector<int> > DerivationFramework::BPhysMetadataBase::m_propVInt
private

Definition at line 91 of file BPhysMetadataBase.h.

◆ m_propVLong

std::map<std::string, std::vector<long> > DerivationFramework::BPhysMetadataBase::m_propVLong
private

Definition at line 92 of file BPhysMetadataBase.h.

◆ m_propVString

std::map<std::string, std::vector<std::string> > DerivationFramework::BPhysMetadataBase::m_propVString
private

Definition at line 95 of file BPhysMetadataBase.h.


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