ATLAS Offline Software
HanConfig.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef dqiHanConfig_h
6 #define dqiHanConfig_h
7 
8 
9 #include <TList.h>
10 #include <TMap.h>
11 
12 #include <TObject.h>
13 
17 
18 #ifndef __CINT__
19 #include <boost/shared_ptr.hpp>
20 #endif
21 
22 #include <string>
23 #include <set>
24 #include <map>
25 #include <memory>
26 
28 ATLAS_NO_CHECK_FILE_THREAD_SAFETY; // standalone application
29 
30 class TDirectory;
31 class TFile;
32 class TKey;
33 
34 namespace dqm_core {
35  class Input;
36  class Output;
37  class Region;
38 }
39 
40 
41 namespace dqi {
42 
43 class MiniConfig;
44 class HanConfigGroup;
45 class HanOutput;
46 class HanInputRootFile;
47 
48 class HanConfig : public TObject {
49 public:
50 
52  virtual ~HanConfig();
53 
54 
55  virtual void AssembleAndSave( std::string infileName, std::string outfileName,
56  std::string connectionString="sqlite://;schema=/afs/cern.ch/user/a/atlasdqm/dqmdisk1/cherrypy-devel/RefDB.db;dbname=REFDB",
57  long runNumber=2147483646, bool bulk=false);
58 
59  virtual void BuildMonitors( std::string configName, HanInputRootFile& input, HanOutput& output );
60 #ifndef __CINT__
61  virtual boost::shared_ptr<dqm_core::Region> BuildMonitorsNewRoot( std::string configName, HanInputRootFile& input, dqm_core::Output& output );
62 #endif
63  virtual void BuildConfigOutput( std::string configName, TFile* inputFile, std::string path,
64  std::map<std::string,TSeqCollection*>* outputMap, TSeqCollection *outputList );
65 
66  virtual TObject* GetReference( std::string& groupName, std::string& name );
67  virtual const HanConfigAssessor* GetAssessor( std::string& groupName, std::string& name ) const;
68 
69  virtual void GetRegexList( std::set<std::string>& regexlist );
70 
71 protected:
72 
73  typedef std::map<std::string,TDirectory*> DirMap_t;
74 
75 
77  public:
78  RefVisitor( TFile* outfile_, HanConfig::DirMap_t& directories_, TMap* refsourcedata );
79  virtual void Visit( const MiniConfigTreeNode* node );
80  protected:
81  TFile* m_outfile;
84  };
85 
87  public:
88  RefWriter( DatabaseConfig& databaseConfig_, const bool bulk);
89  virtual void Write( MiniConfigTreeNode* node);
90  protected:
92  const bool m_bulk;
93  };
94 
96  public:
97  AssessmentVisitorBase( HanConfigGroup* root_, const MiniConfig& algConfig_,
98  const MiniConfig& thrConfig_, const MiniConfig& refConfig_,
99  TFile* outfile_, HanConfig::DirMap_t& directories_,
100  TMap* refsourcedata_ );
101 
102  protected:
103 
104  void GetAlgorithmConfiguration( HanConfigAssessor* dqpar, const std::string& algID,
105  const std::string& assessorName = "" );
106 
111  TFile* m_outfile;
114  // File cache
115  std::map<std::string, std::shared_ptr<TFile> > m_filecache;
116  // following is so we can skip repeated attempts to open nonexistent files
117  std::unordered_set<std::string> m_badPaths;
118  // following is a cache of the set of keys in each TFile
119  // vector since we are going to iterate through them
120  std::map<std::string, std::vector<std::string>> m_keycache;
121  std::shared_ptr<TFile> GetROOTFile(std::string& fname);
122  void PopulateKeyCache(const std::string& fname, std::shared_ptr<TFile> file);
123  void EnsureKeyCache(std::string& fname);
124  };
125 
126 
128  public:
129  RegionVisitor( HanConfigGroup* root_, const MiniConfig& algConfig_,
130  const MiniConfig& thrConfig_, const MiniConfig& refConfig_,
131  HanConfig::DirMap_t& directories_ );
132  virtual void Visit( const MiniConfigTreeNode* node );
133  };
134 
135 
137  public:
138  AssessmentVisitor( HanConfigGroup* root_, const MiniConfig& algConfig_,
139  const MiniConfig& thrConfig_, const MiniConfig& refConfig_,
140  TFile* outfile_, HanConfig::DirMap_t& directories_,
141  TMap* refsourcedata_ );
142  virtual void Visit( const MiniConfigTreeNode* node );
143  };
144 
145 #ifndef __CINT__
147  public:
148  RegexVisitor( std::set<std::string>& regexes_ );
149  virtual boost::shared_ptr<dqm_core::Node>
150  Visit( const HanConfigAssessor* node, boost::shared_ptr<dqm_core::Region> );
151  protected:
152  std::set<std::string>& m_regexes;
153  };
154 
156  public:
157  ConfigVisitor( TFile* file_, dqm_core::Output* output_ );
158  virtual boost::shared_ptr<dqm_core::Node>
159  Visit( const HanConfigAssessor* node, boost::shared_ptr<dqm_core::Region> dqParent );
160  protected:
161  TFile* m_file;
163  };
164 #endif
165 
167  public:
168  CompAlgVisitor( TFile* outfile_ , const MiniConfig& compAlgConfig_);
169  virtual void Visit( const MiniConfigTreeNode* node );
170  protected:
171  TFile* m_outfile;
173  };
174 
176  public:
177  MetadataVisitor( TFile* outfile_ , const MiniConfig& metadataConfig_);
178  virtual void Visit( const MiniConfigTreeNode* node );
179  protected:
180  TFile* m_outfile;
182  };
183 
184 
185  bool Initialize( const std::string& configName );
186 
187 
188  TFile* m_config;
189 #ifndef __CINT__
190  boost::shared_ptr<dqm_core::Region> m_dqRoot;
191 #endif
193  TSeqCollection* m_metadata;
194 
195 //Get rid of Root macros that confuse Doxygen
197  ClassDef( HanConfig, 0 ) // Creates a Han configuration from a MiniConfig
199 
200 private:
201 
202  static TKey* GetObjKey( TDirectory* dir, std::string path );
203  static TDirectory* ChangeInputDir( TDirectory* dir, const std::string& path );
204  static TDirectory* ChangeOutputDir( TFile* file, const std::string& path, DirMap_t& directories );
205 
206 };
207 
208 } // namespace dqi
209 
210 #endif
dqi::HanConfig::AssessmentVisitorBase
Definition: HanConfig.h:95
dqi::HanConfig::AssessmentVisitorBase::m_thrConfig
const MiniConfig & m_thrConfig
Definition: HanConfig.h:109
dqi::MiniConfigTreeNode
A node of a tree structure holding a configuration, where each node may be given attributes,...
Definition: MiniConfigTreeNode.h:25
dqi::HanConfig::AssembleAndSave
virtual void AssembleAndSave(std::string infileName, std::string outfileName, std::string connectionString="sqlite://;schema=/afs/cern.ch/user/a/atlasdqm/dqmdisk1/cherrypy-devel/RefDB.db;dbname=REFDB", long runNumber=2147483646, bool bulk=false)
dqi::HanConfig::RefWriter
Definition: HanConfig.h:86
dqi::HanConfig::RegexVisitor::m_regexes
std::set< std::string > & m_regexes
Definition: HanConfig.h:152
dqi::HanConfig::RefVisitor::Visit
virtual void Visit(const MiniConfigTreeNode *node)
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
directories
std::vector< std::string > directories
Definition: listroot.cxx:185
dqi::HanConfig::AssessmentVisitorBase::GetAlgorithmConfiguration
void GetAlgorithmConfiguration(HanConfigAssessor *dqpar, const std::string &algID, const std::string &assessorName="")
dqi::HanConfig::ConfigVisitor::Visit
virtual boost::shared_ptr< dqm_core::Node > Visit(const HanConfigAssessor *node, boost::shared_ptr< dqm_core::Region > dqParent)
MiniConfigTreeNode.h
RunTileMonitoring.groupName
groupName
Definition: RunTileMonitoring.py:158
dqi::HanConfig::MetadataVisitor
Definition: HanConfig.h:175
dqi::HanConfig::RegionVisitor::Visit
virtual void Visit(const MiniConfigTreeNode *node)
dqi::HanConfig::RegexVisitor::Visit
virtual boost::shared_ptr< dqm_core::Node > Visit(const HanConfigAssessor *node, boost::shared_ptr< dqm_core::Region >)
dqi::HanConfig::AssessmentVisitor::Visit
virtual void Visit(const MiniConfigTreeNode *node)
dqi::HanConfig::GetAssessor
virtual const HanConfigAssessor * GetAssessor(std::string &groupName, std::string &name) const
dqi::HanConfig::AssessmentVisitorBase::AssessmentVisitorBase
AssessmentVisitorBase(HanConfigGroup *root_, const MiniConfig &algConfig_, const MiniConfig &thrConfig_, const MiniConfig &refConfig_, TFile *outfile_, HanConfig::DirMap_t &directories_, TMap *refsourcedata_)
dqi::HanConfig::~HanConfig
virtual ~HanConfig()
dqi::HanOutput
Definition: HanOutput.h:39
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
dqi::HanConfig::MetadataVisitor::Visit
virtual void Visit(const MiniConfigTreeNode *node)
dqi::HanConfig::AssessmentVisitorBase::m_directories
HanConfig::DirMap_t & m_directories
Definition: HanConfig.h:112
dqi::HanConfig::RefWriter::m_bulk
const bool m_bulk
Definition: HanConfig.h:92
dqm_core
Definition: HanConfig.h:34
dqi::HanConfig::m_dqRoot
boost::shared_ptr< dqm_core::Region > m_dqRoot
Definition: HanConfig.h:190
dqi::HanConfig::MetadataVisitor::m_metadataConfig
const MiniConfig & m_metadataConfig
Definition: HanConfig.h:181
dqi::HanConfig::RefWriter::m_databaseConfig
DatabaseConfig & m_databaseConfig
Definition: HanConfig.h:91
dqi::HanConfig::Initialize
bool Initialize(const std::string &configName)
dqi::HanConfig::RefVisitor::m_directories
HanConfig::DirMap_t & m_directories
Definition: HanConfig.h:82
dqi::HanConfig::GetRegexList
virtual void GetRegexList(std::set< std::string > &regexlist)
dqi::HanConfigGroup
Definition: HanConfigGroup.h:23
dqi::HanConfig::AssessmentVisitorBase::m_badPaths
std::unordered_set< std::string > m_badPaths
Definition: HanConfig.h:117
dqi::HanConfig::DirMap_t
std::map< std::string, TDirectory * > DirMap_t
Definition: HanConfig.h:73
dqi::HanConfig::AssessmentVisitorBase::GetROOTFile
std::shared_ptr< TFile > GetROOTFile(std::string &fname)
dqi::HanConfig::AssessmentVisitorBase::m_algConfig
const MiniConfig & m_algConfig
Definition: HanConfig.h:108
dqi::HanConfig::BuildMonitors
virtual void BuildMonitors(std::string configName, HanInputRootFile &input, HanOutput &output)
dqi::HanConfig::RefVisitor::RefVisitor
RefVisitor(TFile *outfile_, HanConfig::DirMap_t &directories_, TMap *refsourcedata)
dqi::HanConfig::RegexVisitor::RegexVisitor
RegexVisitor(std::set< std::string > &regexes_)
CaloCondBlobAlgs_fillNoiseFromASCII.inputFile
string inputFile
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:17
dq_make_web_display.dqpar
dqpar
Definition: dq_make_web_display.py:45
dqi::HanConfig::CompAlgVisitor
Definition: HanConfig.h:166
dqi::DatabaseConfig
Definition: DatabaseConfig.h:15
dqi::HanConfig::ChangeInputDir
static TDirectory * ChangeInputDir(TDirectory *dir, const std::string &path)
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
file
TFile * file
Definition: tile_monitor.h:29
HanConfigAssessor.h
dqi::HanConfig::AssessmentVisitorBase::m_filecache
std::map< std::string, std::shared_ptr< TFile > > m_filecache
Definition: HanConfig.h:115
dqi::MiniConfigTreeNode::Visitor
Definition: MiniConfigTreeNode.h:28
dqi::HanConfig::m_config
TFile * m_config
Definition: HanConfig.h:188
Region
Region
Definition: TrigL2HitResidual.h:14
dqi::MiniConfigTreeNode::Writer
Definition: MiniConfigTreeNode.h:34
dqi::HanConfig::CompAlgVisitor::Visit
virtual void Visit(const MiniConfigTreeNode *node)
dqi::HanConfig::CompAlgVisitor::m_compAlgConfig
const MiniConfig & m_compAlgConfig
Definition: HanConfig.h:172
dqi::HanConfig::CompAlgVisitor::m_outfile
TFile * m_outfile
Definition: HanConfig.h:171
dqi::HanConfigAssessor
Definition: HanConfigAssessor.h:37
dqi::HanConfig::AssessmentVisitorBase::m_root
HanConfigGroup * m_root
Definition: HanConfig.h:107
dqi::HanConfig::ConfigVisitor::ConfigVisitor
ConfigVisitor(TFile *file_, dqm_core::Output *output_)
dqi::HanConfig::AssessmentVisitorBase::EnsureKeyCache
void EnsureKeyCache(std::string &fname)
dqi::MiniConfig
description
Definition: MiniConfig.h:25
dqi::HanConfig::AssessmentVisitor::AssessmentVisitor
AssessmentVisitor(HanConfigGroup *root_, const MiniConfig &algConfig_, const MiniConfig &thrConfig_, const MiniConfig &refConfig_, TFile *outfile_, HanConfig::DirMap_t &directories_, TMap *refsourcedata_)
dqi::HanConfig::RegionVisitor::RegionVisitor
RegionVisitor(HanConfigGroup *root_, const MiniConfig &algConfig_, const MiniConfig &thrConfig_, const MiniConfig &refConfig_, HanConfig::DirMap_t &directories_)
dqi::HanConfig::GetObjKey
static TKey * GetObjKey(TDirectory *dir, std::string path)
dqi::HanConfig::ConfigVisitor::m_file
TFile * m_file
Definition: HanConfig.h:161
beamspotman.dir
string dir
Definition: beamspotman.py:623
merge.output
output
Definition: merge.py:17
dqi::HanInputRootFile
Definition: HanInputRootFile.h:19
private
#define private
Definition: DetDescrConditionsDict_dict_fixes.cxx:13
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
dqi::HanConfig::BuildMonitorsNewRoot
virtual boost::shared_ptr< dqm_core::Region > BuildMonitorsNewRoot(std::string configName, HanInputRootFile &input, dqm_core::Output &output)
test_pyhistsvc_write.Output
Output
Definition: test_pyhistsvc_write.py:15
dqi::HanConfig::RefWriter::Write
virtual void Write(MiniConfigTreeNode *node)
dqi::HanConfig::AssessmentVisitorBase::m_outfile
TFile * m_outfile
Definition: HanConfig.h:111
dqi::HanConfigAssessor::Visitor
Definition: HanConfigAssessor.h:41
dqi::HanConfig::MetadataVisitor::m_outfile
TFile * m_outfile
Definition: HanConfig.h:180
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
dqi::HanConfig::GetReference
virtual TObject * GetReference(std::string &groupName, std::string &name)
dqi::HanConfig::RefWriter::RefWriter
RefWriter(DatabaseConfig &databaseConfig_, const bool bulk)
dqi::HanConfig::RefVisitor
Definition: HanConfig.h:76
dqi::HanConfig::AssessmentVisitorBase::PopulateKeyCache
void PopulateKeyCache(const std::string &fname, std::shared_ptr< TFile > file)
dqi::HanConfig::ChangeOutputDir
static TDirectory * ChangeOutputDir(TFile *file, const std::string &path, DirMap_t &directories)
dqi::HanConfig
Definition: HanConfig.h:48
dqi::HanConfig::m_metadata
TSeqCollection * m_metadata
Definition: HanConfig.h:193
dqi::HanConfig::RefVisitor::m_outfile
TFile * m_outfile
Definition: HanConfig.h:81
dqi::HanConfig::m_top_level
HanConfigGroup * m_top_level
Definition: HanConfig.h:192
dqi::HanConfig::HanConfig
HanConfig()
dqi::HanConfig::ConfigVisitor::m_output
dqm_core::Output * m_output
Definition: HanConfig.h:162
dqi::HanConfig::AssessmentVisitor
Definition: HanConfig.h:136
dqi::HanConfig::AssessmentVisitorBase::m_refConfig
const MiniConfig & m_refConfig
Definition: HanConfig.h:110
dqi::HanConfig::AssessmentVisitorBase::m_keycache
std::map< std::string, std::vector< std::string > > m_keycache
Definition: HanConfig.h:120
NswErrorCalibData::Input
Helper struct to be parsed to the object to derive the specific error of the cluster.
Definition: NswErrorCalibData.h:25
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: HanConfig.h:28
dqi::HanConfig::MetadataVisitor::MetadataVisitor
MetadataVisitor(TFile *outfile_, const MiniConfig &metadataConfig_)
dqi::HanConfig::CompAlgVisitor::CompAlgVisitor
CompAlgVisitor(TFile *outfile_, const MiniConfig &compAlgConfig_)
checker_macros.h
Define macros for attributes used to control the static checker.
dqi
Definition: CompositeAlgorithm.h:16
dqi::HanConfig::BuildConfigOutput
virtual void BuildConfigOutput(std::string configName, TFile *inputFile, std::string path, std::map< std::string, TSeqCollection * > *outputMap, TSeqCollection *outputList)
dqi::HanConfig::AssessmentVisitorBase::m_refsourcedata
TMap * m_refsourcedata
Definition: HanConfig.h:113
DatabaseConfig.h
node
Definition: memory_hooks-stdcmalloc.h:74
dqi::HanConfig::RegionVisitor
Definition: HanConfig.h:127
dqi::HanConfig::RegexVisitor
Definition: HanConfig.h:146
dqi::HanConfig::ConfigVisitor
Definition: HanConfig.h:155
dqi::HanConfig::RefVisitor::m_refsourcedata
TMap * m_refsourcedata
Definition: HanConfig.h:83