ATLAS Offline Software
BPhysMetadataBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //============================================================================
6 // BPhysMetadataBase.h
7 //============================================================================
8 //
9 // Author : Wolfgang Walkowiak <Wolfgang.Walkowiak@cern.ch.>
10 // Changes:
11 // - w.w., 2017-01-22: Added use of BPhysMetaDataTool.
12 // - w.w., 2019-12-05: Added long and vector<long> types
13 //
14 // Store JO metadata in the output file.
15 //
16 // It uses the BPhysMetaDataTool (default) or the IOVDbMetaDataTool to
17 // store job option information as metadata in a specific branch whose
18 // name needs to prefixed by the deriviation format name.
19 // Note: Metadata stored by the IOVDbMetaDataTool is not readable on
20 // 'RootCore' level.
21 //
22 // This is a base class. Inherit from it to add the job options you want
23 // to store. For a usage example, see
24 // Bmumu_metadata.h / Bmumu_metadata.cxx
25 // and
26 // BPHY8.py .
27 //
28 //============================================================================
29 //
30 #ifndef DERIVATIONFRAMEWORK_BPhysMetadataBase_H
31 #define DERIVATIONFRAMEWORK_BPhysMetadataBase_H
32 
33 #include <string>
34 #include <map>
35 #include <vector>
36 
39 #include "GaudiKernel/ToolHandle.h"
40 
41 namespace DerivationFramework {
42 
43  class BPhysMetadataBase : virtual public AthAlgTool,
44  virtual public IAugmentationTool {
45  public:
46  BPhysMetadataBase(const std::string& t, const std::string& n,
47  const IInterface* p);
48 
49  virtual StatusCode initialize();
50  virtual StatusCode finalize();
51 
52  virtual StatusCode addBranches() const;
53 
54  protected:
55  virtual void recordPropertyI(const std::string& name, int val);
56  virtual void recordPropertyL(const std::string& name, long val);
57  virtual void recordPropertyD(const std::string& name, double val);
58  virtual void recordPropertyB(const std::string& name, bool val);
59  virtual void recordPropertyS(const std::string& name, const std::string& val);
60 
61  virtual void recordPropertyVI(const std::string& name, const std::vector<int>& val);
62  virtual void recordPropertyVL(const std::string& name, const std::vector<long>& val);
63  virtual void recordPropertyVD(const std::string& name, const std::vector<double>& val);
64  virtual void recordPropertyVB(const std::string& name, const std::vector<bool>& val);
65  virtual void recordPropertyVS(const std::string& name,
66  const std::vector<std::string>& val);
67 
68  private:
69  virtual StatusCode saveMetaDataBPhys() const;
70  virtual std::string buildFolderName(const std::string& fname="") const;
71  virtual std::string vecToString(const std::vector<int>& v) const;
72  virtual std::string vecToString(const std::vector<long>& v) const;
73  virtual std::string vecToString(const std::vector<double>& v) const;
74  virtual std::string vecToString(const std::vector<bool>& v) const;
75  virtual std::string vecToString(const std::vector<std::string>& v) const;
76 
77  private:
80 
81  // job options
82  std::string m_derivationName;
83  std::string m_mdFolderName;
84  std::string m_prefix;
85 
86  // maps for different types of JOs
87  std::map<std::string, int> m_propInt;
88  std::map<std::string, long> m_propLong;
89  std::map<std::string, double> m_propDouble;
90  std::map<std::string, bool> m_propBool;
91  std::map<std::string, std::string> m_propString;
92  std::map<std::string, std::vector<int> > m_propVInt;
93  std::map<std::string, std::vector<long> > m_propVLong;
94  std::map<std::string, std::vector<double> > m_propVDouble;
95  std::map<std::string, std::vector<bool> > m_propVBool;
96  std::map<std::string, std::vector<std::string> > m_propVString;
97  }; // class
98 } // namespace
99 
100 #endif // DERIVATIONFRAMEWORK_BPhysMetadataBase_H
DerivationFramework::BPhysMetadataBase::recordPropertyD
virtual void recordPropertyD(const std::string &name, double val)
Definition: BPhysMetadataBase.cxx:176
DerivationFramework::BPhysMetadataBase::recordPropertyB
virtual void recordPropertyB(const std::string &name, bool val)
Definition: BPhysMetadataBase.cxx:181
DerivationFramework::BPhysMetadataBase::m_prefix
std::string m_prefix
Definition: BPhysMetadataBase.h:84
DerivationFramework::BPhysMetadataBase::saveMetaDataBPhys
virtual StatusCode saveMetaDataBPhys() const
Definition: BPhysMetadataBase.cxx:104
DerivationFramework::BPhysMetadataBase::recordPropertyVD
virtual void recordPropertyVD(const std::string &name, const std::vector< double > &val)
Definition: BPhysMetadataBase.cxx:203
IAugmentationTool.h
DerivationFramework::BPhysMetadataBase::BPhysMetadataBase
BPhysMetadataBase(const std::string &t, const std::string &n, const IInterface *p)
Definition: BPhysMetadataBase.cxx:45
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::BPhysMetadataBase::addBranches
virtual StatusCode addBranches() const
Pass the thinning service
Definition: BPhysMetadataBase.cxx:92
DerivationFramework::IAugmentationTool
Definition: IAugmentationTool.h:24
DerivationFramework::BPhysMetadataBase::initialize
virtual StatusCode initialize()
Definition: BPhysMetadataBase.cxx:64
DerivationFramework::BPhysMetadataBase::m_propVInt
std::map< std::string, std::vector< int > > m_propVInt
Definition: BPhysMetadataBase.h:92
DerivationFramework::BPhysMetadataBase::m_propBool
std::map< std::string, bool > m_propBool
Definition: BPhysMetadataBase.h:90
DerivationFramework::BPhysMetadataBase::vecToString
virtual std::string vecToString(const std::vector< int > &v) const
Definition: BPhysMetadataBase.cxx:221
DerivationFramework::BPhysMetadataBase::buildFolderName
virtual std::string buildFolderName(const std::string &fname="") const
Definition: BPhysMetadataBase.cxx:150
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::BPhysMetadataBase::recordPropertyL
virtual void recordPropertyL(const std::string &name, long val)
Definition: BPhysMetadataBase.cxx:171
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::BPhysMetadataBase::recordPropertyVL
virtual void recordPropertyVL(const std::string &name, const std::vector< long > &val)
Definition: BPhysMetadataBase.cxx:197
DerivationFramework::BPhysMetadataBase::finalize
virtual StatusCode finalize()
Definition: BPhysMetadataBase.cxx:84
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
DerivationFramework::BPhysMetadataBase::m_outputMetaStore
ServiceHandle< StoreGateSvc > m_outputMetaStore
Object accessing the output metadata store.
Definition: BPhysMetadataBase.h:79
DerivationFramework::BPhysMetadataBase::m_derivationName
std::string m_derivationName
Definition: BPhysMetadataBase.h:82
DerivationFramework::BPhysMetadataBase::m_propInt
std::map< std::string, int > m_propInt
Definition: BPhysMetadataBase.h:87
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
python.PyAthena.v
v
Definition: PyAthena.py:154
DerivationFramework::BPhysMetadataBase::recordPropertyVB
virtual void recordPropertyVB(const std::string &name, const std::vector< bool > &val)
Definition: BPhysMetadataBase.cxx:209
DerivationFramework::BPhysMetadataBase::m_propVBool
std::map< std::string, std::vector< bool > > m_propVBool
Definition: BPhysMetadataBase.h:95
DerivationFramework::BPhysMetadataBase::m_propVLong
std::map< std::string, std::vector< long > > m_propVLong
Definition: BPhysMetadataBase.h:93
DerivationFramework::BPhysMetadataBase::m_propString
std::map< std::string, std::string > m_propString
Definition: BPhysMetadataBase.h:91
DerivationFramework::BPhysMetadataBase::recordPropertyS
virtual void recordPropertyS(const std::string &name, const std::string &val)
Definition: BPhysMetadataBase.cxx:186
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
DerivationFramework::BPhysMetadataBase::recordPropertyVI
virtual void recordPropertyVI(const std::string &name, const std::vector< int > &val)
Definition: BPhysMetadataBase.cxx:191
DerivationFramework::BPhysMetadataBase::m_propVString
std::map< std::string, std::vector< std::string > > m_propVString
Definition: BPhysMetadataBase.h:96
DerivationFramework::BPhysMetadataBase::m_propDouble
std::map< std::string, double > m_propDouble
Definition: BPhysMetadataBase.h:89
AthAlgTool
Definition: AthAlgTool.h:26
DerivationFramework::BPhysMetadataBase::m_mdFolderName
std::string m_mdFolderName
Definition: BPhysMetadataBase.h:83
DerivationFramework::BPhysMetadataBase::recordPropertyVS
virtual void recordPropertyVS(const std::string &name, const std::vector< std::string > &val)
Definition: BPhysMetadataBase.cxx:215
DerivationFramework::BPhysMetadataBase::m_propVDouble
std::map< std::string, std::vector< double > > m_propVDouble
Definition: BPhysMetadataBase.h:94
DerivationFramework::BPhysMetadataBase::recordPropertyI
virtual void recordPropertyI(const std::string &name, int val)
Definition: BPhysMetadataBase.cxx:166
DerivationFramework::BPhysMetadataBase::m_propLong
std::map< std::string, long > m_propLong
Definition: BPhysMetadataBase.h:88
DerivationFramework::BPhysMetadataBase
Definition: BPhysMetadataBase.h:44
ServiceHandle< StoreGateSvc >