ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::FileMetaData_v1 Class Reference

Class holding file-level metadata about an xAOD file. More...

#include <FileMetaData_v1.h>

Inheritance diagram for xAOD::FileMetaData_v1:
Collaboration diagram for xAOD::FileMetaData_v1:

Public Types

enum  MetaDataType {
  productionRelease = 0 , amiTag = 1 , AODFixVersion = 2 , AODCalibVersion = 3 ,
  dataType = 4 , geometryVersion = 5 , conditionsTag = 6 , beamEnergy = 7 ,
  beamType = 8 , mcProcID = 9 , simFlavour = 10 , isDataOverlay = 11 ,
  mcCampaign = 12 , generatorsInfo = 13 , dataYear = 14 , END = 15
}
 Pre-defined metadata value types. More...

Public Member Functions

 FileMetaData_v1 ()
 Default constructor.
bool value (MetaDataType type, std::string &val) const
 Get a pre-defined string value out of the object.
bool value (const std::string &type, std::string &val) const
 Get a generic string value out of the object.
bool setValue (MetaDataType type, const std::string &val)
 Set a pre-defined string value on the object.
bool setValue (const std::string &type, const std::string &val)
 Set a generic string value on the object.
bool value (MetaDataType type, uint32_t &val) const
 Get a pre-defined uint32_t value out of the object.
bool value (const std::string &type, uint32_t &val) const
 Get a generic uint32_t value out of the object.
bool setValue (MetaDataType type, uint32_t val)
 Set a pre-defined uint32_t value on the object.
bool setValue (const std::string &type, uint32_t val)
 Set a generic uint32_t value on the object.
bool value (MetaDataType type, float &val) const
 Get a pre-defined float value out of the object.
bool value (const std::string &type, float &val) const
 Get a generic float value out of the object.
bool setValue (MetaDataType type, float val)
 Set a pre-defined float value on the object.
bool setValue (const std::string &type, float val)
 Set a generic float value on the object.
bool value (MetaDataType type, bool &val) const
 Get a pre-defined bool value out of the object.
bool value (const std::string &type, bool &val) const
 Get a generic bool value out of the object.
bool setValue (MetaDataType type, bool val)
 Set a pre-defined bool value on the object.
bool setValue (const std::string &type, bool val)
 Set a generic bool value on the object.
bool value (const std::string &type, std::vector< uint32_t > &val) const
 Get a generic list value out of the object.
bool setValue (const std::string &type, const std::vector< uint32_t > &val)
 Set a generic list value on the object.
Comparison operators
bool operator== (const FileMetaData_v1 &rhs) const
 Operator testing the equality of two objects.
bool operator!= (const FileMetaData_v1 &rhs) const
 Operator testing the inequality of two objects.
bool compareWith (const FileMetaData_v1 &rhs, const std::set< std::string > &ignore) const
 Compare this FMD object with another, optionally ignoring some attributes.

Detailed Description

Class holding file-level metadata about an xAOD file.

Each xAOD file is expected to hold exactly one object of this type to describe much of the simple metadata about the file. So, metadata that might change event-by-event in the file is not stored in such objects.

Parameters
AttilaKrasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Revision
685184
Date
2015-07-23 22:25:43 +0200 (Thu, 23 Jul 2015)

Definition at line 34 of file FileMetaData_v1.h.

Member Enumeration Documentation

◆ MetaDataType

Pre-defined metadata value types.

Enumerator
productionRelease 

Release that was used to make the file [string].

amiTag 

AMI tag used to process the file the last time [string].

AODFixVersion 

Version of AODFix that was used on the file last [string].

AODCalibVersion 

Version of AODCalib that was used on the file last [string].

dataType 

Data type that's in the file [string].

geometryVersion 

Geometry version [string].

conditionsTag 

Conditions version used for simulation/reconstruction [string].

beamEnergy 

Beam energy [float].

beamType 

Beam type [string].

mcProcID 

Same as mc_channel_number [float].

simFlavour 

Fast or Full sim [string].

isDataOverlay 

Used data overlay for backgrounds [bool].

mcCampaign 

MC campaign [string].

generatorsInfo 

Generators information [string].

dataYear 

Data year [uint32_t].

END 

End marker.

Definition at line 54 of file FileMetaData_v1.h.

54 {
58 amiTag = 1,
60 AODFixVersion = 2,
64 dataType = 4,
68 conditionsTag = 6,
70 beamEnergy = 7,
72 beamType = 8,
74 mcProcID = 9,
76 simFlavour = 10,
78 isDataOverlay = 11,
80 mcCampaign = 12,
82 generatorsInfo = 13,
84 dataYear = 14,
86 END = 15
87 }; // enum MetaDataType
@ AODCalibVersion
Version of AODCalib that was used on the file last [string].
@ beamEnergy
Beam energy [float].
@ mcProcID
Same as mc_channel_number [float].
@ conditionsTag
Conditions version used for simulation/reconstruction [string].
@ dataType
Data type that's in the file [string].
@ generatorsInfo
Generators information [string].
@ AODFixVersion
Version of AODFix that was used on the file last [string].
@ mcCampaign
MC campaign [string].
@ amiTag
AMI tag used to process the file the last time [string].
@ dataYear
Data year [uint32_t].
@ beamType
Beam type [string].
@ simFlavour
Fast or Full sim [string].
@ productionRelease
Release that was used to make the file [string].
@ isDataOverlay
Used data overlay for backgrounds [bool].
@ geometryVersion
Geometry version [string].

Constructor & Destructor Documentation

◆ FileMetaData_v1()

xAOD::FileMetaData_v1::FileMetaData_v1 ( )

Default constructor.

Definition at line 21 of file FileMetaData_v1.cxx.

22 { }
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.

Member Function Documentation

◆ compareWith()

bool xAOD::FileMetaData_v1::compareWith ( const FileMetaData_v1 & rhs,
const std::set< std::string > & ignore ) const

Compare this FMD object with another, optionally ignoring some attributes.

Definition at line 25 of file FileMetaData_v1.cxx.

26 {
27 // Get the variable types from both objects:
28 SG::auxid_set_t auxids1 = this->getAuxIDs();
29 SG::auxid_set_t auxids2 = rhs.getAuxIDs();
30 SG::AuxTypeRegistry& reg = SG::AuxTypeRegistry::instance();
31 for( const std::string& var : ignore ) {
32 SG::auxid_t varid = reg.findAuxID(var);
33 auxids1.erase(varid);
34 auxids2.erase(varid);
35 }
36
37 // They need to be the same. If the two objects have different variables,
38 // that's bad. Unfortunately there's no equivalency operator for
39 // auxid_set_t, so this check needs to be spelled out. :-(
40 if( auxids1.size() != auxids2.size() ) {
41 return false;
42 }
43 for( SG::auxid_t auxid : auxids1 ) {
44 if( auxids2.find( auxid ) == auxids2.end() ) {
45 return false;
46 }
47 }
48
49 // Now, compare all elements:
50 for( SG::auxid_t auxid : auxids1 ) {
51
52 // Check the type of the variable:
53 const std::type_info* ti = reg.getType( auxid );
54 if( ! ti ) {
55 // This is weird, but there's not much that we can do about it
56 // here...
57 continue;
58 }
59 if( ( *ti != typeid( std::string ) ) &&
60 ( *ti != typeid( uint32_t ) ) &&
61 ( *ti != typeid( float ) ) &&
62 ( *ti != typeid( char ) ) &&
63 ( *ti != typeid( std::vector< uint32_t > ) ) ) {
64 // We just ignore every other type. Still, this is strange, let's
65 // warn the user about it.
66 std::cerr << "xAOD::FileMetaData::operator== WARNING Unsupported "
67 << "variable (\"" << reg.getName( auxid ) << "\"/"
69 << ") encountered" << std::endl;
70 continue;
71 }
72
73 // The variable name:
74 const std::string name = reg.getName( auxid );
75
76 // Treat different types separately:
77 if( *ti == typeid( std::string ) ) {
78
79 // Retrieve the values:
81 const std::string& value1 = acc( *this );
82 const std::string& value2 = acc( rhs );
83 // And simply compare them:
84 if( value1 != value2 ) {
85 return false;
86 }
87
88 } else if( *ti == typeid( uint32_t ) ) {
89
90 // Retrieve the values:
92 const uint32_t& value1 = acc( *this );
93 const uint32_t& value2 = acc( rhs );
94 // And simply compare them:
95 if( value1 != value2 ) {
96 return false;
97 }
98
99 } else if( *ti == typeid( float ) ) {
100
101 // Retrieve the values:
102 SG::ConstAccessor< float >acc( name );
103 const float& value1 = acc( *this );
104 const float& value2 = acc( rhs );
105 // And (not so simply) compare them:
106 if( std::abs( value1 - value2 ) > 0.001 ) {
107 return false;
108 }
109
110 } else if( *ti == typeid( char ) ) {
111
112 // Retrieve the values:
113 SG::ConstAccessor< char >acc( name );
114 const char& value1 = acc( *this );
115 const char& value2 = acc( rhs );
116 // And (not so simply) compare them:
117 if( value1 != value2 ) {
118 return false;
119 }
120 } else if ( *ti == typeid( std::vector<uint32_t> ) ) {
121 // One code to retrieve them
123 const std::vector<uint32_t>& value1 = acc( *this );
124 const std::vector<uint32_t>& value2 = acc( rhs );
125 // and in simplicity compare them
126 if( value1 != value2 ) {
127 return false;
128 }
129 } else {
130 // We should really never end up here unless a coding mistake was
131 // made upstream.
132 std::abort();
133 }
134 }
135
136 /*
137 // Compare the string properties:
138 std::array< MetaDataType, 8 > stringTypes{ { productionRelease, amiTag,
139 AODFixVersion, AODCalibVersion, dataType, geometryVersion,
140 conditionsTag, beamType } };
141 for( MetaDataType type : stringTypes ) {
142 // (Try to) Retrieve the properties:
143 std::string val1, val2;
144 const bool found1 = this->value( type, val1 );
145 const bool found2 = rhs.value( type, val2 );
146 // If both of them failed, then let's continue. If both of them are
147 // missing this variable, that's fine.
148 if( ( ! found1 ) && ( ! found2 ) ) {
149 continue;
150 }
151 // If the variable is only available on one of them, then we already
152 // have a difference. Although this point could be fine-tuned later on.
153 if( ( found1 && ( ! found2 ) ) || ( ( ! found1 ) && found2 ) ) {
154 return false;
155 }
156 // If both values were found, then let's compare them:
157 if( val1 != val2 ) {
158 return false;
159 }
160 }
161
162 // Compare the float propery/properties:
163 std::array< MetaDataType, 1 > floatTypes{ { beamEnergy } };
164 for( MetaDataType type : floatTypes ) {
165 // (Try to) Retrieve the properties:
166 float val1 = 0.0, val2 = 0.0;
167 const bool found1 = this->value( type, val1 );
168 const bool found2 = rhs.value( type, val2 );
169 // If both of them failed, then let's continue. If both of them are
170 // missing this variable, that's fine.
171 if( ( ! found1 ) && ( ! found2 ) ) {
172 continue;
173 }
174 // If the variable is only available on one of them, then we already
175 // have a difference. Although this point could be fine-tuned later on.
176 if( ( found1 && ( ! found2 ) ) || ( ( ! found1 ) && found2 ) ) {
177 return false;
178 }
179 // If both values were found, then let's compare them:
180 if( std::abs( val1 - val2 ) > 0.001 ) {
181 return false;
182 }
183 }
184 */
185
186 // The two objects were found to be equivalent:
187 return true;
188 }
static AuxTypeRegistry & instance()
Return the singleton registry instance.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
std::string normalizedTypeinfoName(const std::type_info &info)
Convert a type_info to a normalized string representation (matching the names used in the root dictio...
const SG::auxid_set_t & getAuxIDs() const
Return a set of identifiers for existing data items for this object.
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
setEventNumber uint32_t
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.

◆ operator!=()

bool xAOD::FileMetaData_v1::operator!= ( const FileMetaData_v1 & rhs) const

Operator testing the inequality of two objects.

Definition at line 190 of file FileMetaData_v1.cxx.

190 {
191
192 return !( this->operator==( rhs ) );
193 }
bool operator==(const FileMetaData_v1 &rhs) const
Operator testing the equality of two objects.

◆ operator==()

bool xAOD::FileMetaData_v1::operator== ( const FileMetaData_v1 & rhs) const
inline

Operator testing the equality of two objects.

Definition at line 44 of file FileMetaData_v1.h.

44{ return compareWith(rhs, std::set<std::string>()); };
bool compareWith(const FileMetaData_v1 &rhs, const std::set< std::string > &ignore) const
Compare this FMD object with another, optionally ignoring some attributes.

◆ setValue() [1/9]

bool xAOD::FileMetaData_v1::setValue ( const std::string & type,
bool val )

Set a generic bool value on the object.

Definition at line 444 of file FileMetaData_v1.cxx.

444 {
445
446 // Create the accessor object:
447 const Accessor< char > acc( type );
448
449 // Set the value:
450 acc( *this ) = val;
451
452 // We were successful:
453 return true;
454 }

◆ setValue() [2/9]

bool xAOD::FileMetaData_v1::setValue ( const std::string & type,
const std::string & val )

Set a generic string value on the object.

Definition at line 248 of file FileMetaData_v1.cxx.

249 {
250
251 // Create the accessor object:
252 const Accessor< std::string > acc( type );
253
254 // Set the value:
255 acc( *this ) = val;
256
257 // We were successful:
258 return true;
259 }

◆ setValue() [3/9]

bool xAOD::FileMetaData_v1::setValue ( const std::string & type,
const std::vector< uint32_t > & val )

Set a generic list value on the object.

Definition at line 473 of file FileMetaData_v1.cxx.

474 {
475 // Create the accessor object:
476 const Accessor<std::vector<uint32_t> > acc(type);
477
478 // Set the value:
479 acc(*this) = val;
480
481 // We were successful:
482 return true;
483 }

◆ setValue() [4/9]

bool xAOD::FileMetaData_v1::setValue ( const std::string & type,
float val )

Set a generic float value on the object.

Definition at line 379 of file FileMetaData_v1.cxx.

379 {
380
381 // Create the accessor object:
382 const Accessor< float > acc( type );
383
384 // Set the value:
385 acc( *this ) = val;
386
387 // We were successful:
388 return true;
389 }

◆ setValue() [5/9]

bool xAOD::FileMetaData_v1::setValue ( const std::string & type,
uint32_t val )

Set a generic uint32_t value on the object.

Definition at line 314 of file FileMetaData_v1.cxx.

314 {
315
316 // Create the accessor object:
317 const Accessor< uint32_t > acc( type );
318
319 // Set the value:
320 acc( *this ) = val;
321
322 // We were successful:
323 return true;
324 }

◆ setValue() [6/9]

bool xAOD::FileMetaData_v1::setValue ( MetaDataType type,
bool val )

Set a pre-defined bool value on the object.

Definition at line 429 of file FileMetaData_v1.cxx.

429 {
430
431 // Get the accessor for this type:
432 const Accessor< char >* acc = metaDataTypeCharAccessorV1( type );
433 if( ! acc ) {
434 return false;
435 }
436
437 // Set the value:
438 ( *acc )( *this ) = val;
439
440 // We were successful:
441 return true;
442 }
const SG::AuxElement::Accessor< char > * metaDataTypeCharAccessorV1(FileMetaData_v1::MetaDataType type)
Helper function for getting an accessor for a pre-defined property.

◆ setValue() [7/9]

bool xAOD::FileMetaData_v1::setValue ( MetaDataType type,
const std::string & val )

Set a pre-defined string value on the object.

Definition at line 233 of file FileMetaData_v1.cxx.

233 {
234
235 // Get the accessor for this type:
236 const Accessor< std::string >* acc = metaDataTypeStringAccessorV1( type );
237 if( ! acc ) {
238 return false;
239 }
240
241 // Set the value:
242 ( *acc )( *this ) = val;
243
244 // We were successful:
245 return true;
246 }
const SG::AuxElement::Accessor< std::string > * metaDataTypeStringAccessorV1(FileMetaData_v1::MetaDataType type)
Helper function for getting an accessor for a pre-defined property.

◆ setValue() [8/9]

bool xAOD::FileMetaData_v1::setValue ( MetaDataType type,
float val )

Set a pre-defined float value on the object.

Definition at line 364 of file FileMetaData_v1.cxx.

364 {
365
366 // Get the accessor for this type:
367 const Accessor< float >* acc = metaDataTypeFloatAccessorV1( type );
368 if( ! acc ) {
369 return false;
370 }
371
372 // Set the value:
373 ( *acc )( *this ) = val;
374
375 // We were successful:
376 return true;
377 }
const SG::AuxElement::Accessor< float > * metaDataTypeFloatAccessorV1(FileMetaData_v1::MetaDataType type)
Helper function for getting an accessor for a pre-defined property.

◆ setValue() [9/9]

bool xAOD::FileMetaData_v1::setValue ( MetaDataType type,
uint32_t val )

Set a pre-defined uint32_t value on the object.

Definition at line 299 of file FileMetaData_v1.cxx.

299 {
300
301 // Get the accessor for this type:
302 const Accessor< uint32_t >* acc = metaDataTypeUIntAccessorV1( type );
303 if( ! acc ) {
304 return false;
305 }
306
307 // Set the value:
308 ( *acc )( *this ) = val;
309
310 // We were successful:
311 return true;
312 }
const SG::AuxElement::Accessor< uint32_t > * metaDataTypeUIntAccessorV1(FileMetaData_v1::MetaDataType type)
Helper function for getting an accessor for a pre-defined property.

◆ value() [1/9]

bool xAOD::FileMetaData_v1::value ( const std::string & type,
bool & val ) const

Get a generic bool value out of the object.

Definition at line 411 of file FileMetaData_v1.cxx.

412 {
413
414 // Create an accessor object:
415 const Accessor< char > acc( type );
416
417 // Check if this variable is available:
418 if( ! acc.isAvailable( *this ) ) {
419 return false;
420 }
421
422 // Read the value:
423 val = acc( *this );
424
425 // We were successful:
426 return true;
427 }

◆ value() [2/9]

bool xAOD::FileMetaData_v1::value ( const std::string & type,
float & val ) const

Get a generic float value out of the object.

Definition at line 346 of file FileMetaData_v1.cxx.

347 {
348
349 // Create an accessor object:
350 const Accessor< float > acc( type );
351
352 // Check if this variable is available:
353 if( ! acc.isAvailable( *this ) ) {
354 return false;
355 }
356
357 // Read the value:
358 val = acc( *this );
359
360 // We were successful:
361 return true;
362 }

◆ value() [3/9]

bool xAOD::FileMetaData_v1::value ( const std::string & type,
std::string & val ) const

Get a generic string value out of the object.

Definition at line 215 of file FileMetaData_v1.cxx.

216 {
217
218 // Create an accessor object:
219 const Accessor< std::string > acc( type );
220
221 // Check if this variable is available:
222 if( ! acc.isAvailable( *this ) ) {
223 return false;
224 }
225
226 // Read the value:
227 val = acc( *this );
228
229 // We were successful:
230 return true;
231 }

◆ value() [4/9]

bool xAOD::FileMetaData_v1::value ( const std::string & type,
std::vector< uint32_t > & val ) const

Get a generic list value out of the object.

Definition at line 456 of file FileMetaData_v1.cxx.

457 {
458 // Create an accessor object:
459 const Accessor<std::vector<uint32_t> > acc(type);
460
461 // Check if this variable is available:
462 if (!acc.isAvailable(*this)) {
463 return false;
464 }
465
466 // Read the value:
467 val = acc(*this);
468
469 // We were successful:
470 return true;
471 }

◆ value() [5/9]

bool xAOD::FileMetaData_v1::value ( const std::string & type,
uint32_t & val ) const

Get a generic uint32_t value out of the object.

Definition at line 281 of file FileMetaData_v1.cxx.

282 {
283
284 // Create an accessor object:
285 const Accessor< uint32_t > acc( type );
286
287 // Check if this variable is available:
288 if( ! acc.isAvailable( *this ) ) {
289 return false;
290 }
291
292 // Read the value:
293 val = acc( *this );
294
295 // We were successful:
296 return true;
297 }

◆ value() [6/9]

bool xAOD::FileMetaData_v1::value ( MetaDataType type,
bool & val ) const

Get a pre-defined bool value out of the object.

Definition at line 391 of file FileMetaData_v1.cxx.

391 {
392
393 // Get the accessor for this type:
394 const Accessor< char >* acc = metaDataTypeCharAccessorV1( type );
395 if( ! acc ) {
396 return false;
397 }
398
399 // Check if the variable is available:
400 if( ! acc->isAvailable( *this ) ) {
401 return false;
402 }
403
404 // Read the value:
405 val = ( *acc )( *this );
406
407 // We were successful:
408 return true;
409 }

◆ value() [7/9]

bool xAOD::FileMetaData_v1::value ( MetaDataType type,
float & val ) const

Get a pre-defined float value out of the object.

Definition at line 326 of file FileMetaData_v1.cxx.

326 {
327
328 // Get the accessor for this type:
329 const Accessor< float >* acc = metaDataTypeFloatAccessorV1( type );
330 if( ! acc ) {
331 return false;
332 }
333
334 // Check if the variable is available:
335 if( ! acc->isAvailable( *this ) ) {
336 return false;
337 }
338
339 // Read the value:
340 val = ( *acc )( *this );
341
342 // We were successful:
343 return true;
344 }

◆ value() [8/9]

bool xAOD::FileMetaData_v1::value ( MetaDataType type,
std::string & val ) const

Get a pre-defined string value out of the object.

Definition at line 195 of file FileMetaData_v1.cxx.

195 {
196
197 // Get the accessor for this type:
198 const Accessor< std::string >* acc = metaDataTypeStringAccessorV1( type );
199 if( ! acc ) {
200 return false;
201 }
202
203 // Check if the variable is available:
204 if( ! acc->isAvailable( *this ) ) {
205 return false;
206 }
207
208 // Read the value:
209 val = ( *acc )( *this );
210
211 // We were successful:
212 return true;
213 }

◆ value() [9/9]

bool xAOD::FileMetaData_v1::value ( MetaDataType type,
uint32_t & val ) const

Get a pre-defined uint32_t value out of the object.

Definition at line 261 of file FileMetaData_v1.cxx.

261 {
262
263 // Get the accessor for this type:
264 const Accessor< uint32_t >* acc = metaDataTypeUIntAccessorV1( type );
265 if( ! acc ) {
266 return false;
267 }
268
269 // Check if the variable is available:
270 if( ! acc->isAvailable( *this ) ) {
271 return false;
272 }
273
274 // Read the value:
275 val = ( *acc )( *this );
276
277 // We were successful:
278 return true;
279 }

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