ATLAS Offline Software
Loading...
Searching...
No Matches
HanConfigGroup.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// **********************************************************************
6// **********************************************************************
7
9
10#include "dqm_core/Parameter.h"
11#include "dqm_core/Region.h"
12
13
14//Get rid of Root macros that confuse Doxygen
18
19
20namespace dqi {
21
22// *********************************************************************
23// Public Methods
24// *********************************************************************
25
30
31
33HanConfigGroup( const HanConfigGroup& other )
34 : HanConfigAssessor(other)
35 , m_pathName(other.m_pathName)
36{
37 TIter nextAssess( &other.m_assessors );
38 HanConfigAssessor* otherAssess;
39 while( (otherAssess = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 ) {
40 HanConfigAssessor* acpy = new HanConfigAssessor( *otherAssess );
41 m_assessors.Add( acpy );
42 }
43
44 TIter nextGroup( &other.m_groups );
45 HanConfigGroup* otherGroup;
46 while( (otherGroup = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 ) {
47 HanConfigGroup* gcpy = new HanConfigGroup( *otherGroup );
48 m_groups.Add( gcpy );
49 }
50}
51
52
55operator=( const HanConfigGroup& other )
56{
57 if (this != &other) {
59 m_pathName = other.m_pathName;
60
61 TIter nextAssess( &other.m_assessors );
62 HanConfigAssessor* otherAssess;
63 while( (otherAssess = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 ) {
64 HanConfigAssessor* acpy = new HanConfigAssessor( *otherAssess );
65 m_assessors.Add( acpy );
66 }
67
68 TIter nextGroup( &other.m_groups );
69 HanConfigGroup* otherGroup;
70 while( (otherGroup = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 ) {
71 HanConfigGroup* gcpy = new HanConfigGroup( *otherGroup );
72 m_groups.Add( gcpy );
73 }
74 }
75
76 return *this;
77}
78
79
82{
83 // Assume that the same object has not been added to both lists
84 m_assessors.Delete();
85 m_groups.Delete();
86}
87
88
89std::string
91GetUniqueName() const
92{
93 return std::string( GetPathName() );
94}
95
96
97void
99SetPathName( const std::string& name_ )
100{
101 m_pathName.SetString( name_.c_str() );
102}
103
104
105const char*
107GetPathName() const
108{
109 return m_pathName.GetName();
110}
111
112
113void
115AddAssessor( const HanConfigAssessor& hcass_ )
116{
117 HanConfigAssessor* acpy = new HanConfigAssessor( hcass_ );
118 m_assessors.Add( acpy );
119}
120
121
124GetAssessor( const std::string& name_ ) const
125{
126 HanConfigAssessor* hca = dynamic_cast<HanConfigAssessor*>( m_assessors.FindObject(name_.c_str()) );
127 if( hca == 0 ) {
128 return HanConfigAssessor();
129 }
130
131 return *hca;
132}
133
134
135TIter
137GetAllAssessors() const
138{
139 return TIter( &m_assessors );
140}
141
142
143void
145AddGroup( const HanConfigGroup& hcg_ )
146{
147 HanConfigGroup* gcpy = new HanConfigGroup( hcg_ );
148 m_groups.Add( gcpy );
149}
150
151
154GetGroup( const std::string& name_ ) const
155{
156 HanConfigGroup* hcg = dynamic_cast<HanConfigGroup*>( m_groups.FindObject(name_.c_str()) );
157 if( hcg == 0 ) {
158 return HanConfigGroup();
159 }
160
161 return *hcg;
162}
163
164
165TIter
167GetAllGroups() const
168{
169 return TIter( &m_groups );
170}
171
172
175GetNode( const std::string& name_ ) const
176{
177 if( m_groups.IsEmpty() ) {
178 return 0;
179 }
180
181 std::string::size_type k = name_.find_first_of('/');
182 if( k != std::string::npos ) {
183 std::string dName( name_, 0, k );
184 std::string pName( name_, k+1, std::string::npos );
185 if( dName != "" ) {
186 if( dName == std::string( GetName() ) ) {
187 return GetNode( pName );
188 }
189 HanConfigGroup* subreg = dynamic_cast<HanConfigGroup*>( m_groups.FindObject(dName.c_str()) );
190 if( subreg == 0 ) {
191 return 0;
192 }
193 return subreg->GetNode( pName );
194 }
195 return GetNode( pName );
196 }
197
198 HanConfigGroup* subreg = dynamic_cast<HanConfigGroup*>( m_groups.FindObject(name_.c_str()) );
199 return subreg;
200}
201
202
203TSeqCollection *
205GetList( TDirectory* basedir, std::map<std::string,TSeqCollection*>& mp )
206{
207 // Let the original method do all the work
208 TSeqCollection *ret = HanConfigAssessor::GetList( basedir, mp );
209 ret->SetName( this->m_name.GetName() );
210
211 // Iterate through containing m_groups and m_assessors and add them to the childrenList
212 TIter nextAssess( &m_assessors );
214 while( (hca = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 )
215 ret->Add( hca->GetList(basedir,mp) );
216
217 TIter nextGroup( &m_groups );
218 HanConfigGroup* hcg;
219 while( (hcg = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 )
220 ret->Add( hcg->GetList(basedir,mp) );
221
222 return ret;
223}
224
225
226void
228Accept( Visitor& visitor, boost::shared_ptr<dqm_core::Region> dqParent ) const
229{
230 std::string nodeName( GetName() );
231 boost::shared_ptr<dqm_core::Region> dqr;
232 if( nodeName != "top_level" ) {
233 boost::shared_ptr<dqm_core::Node> dqp(visitor.Visit( this, std::move(dqParent) ));
234 dqr = boost::dynamic_pointer_cast<dqm_core::Region>( dqp );
235 }
236 else {
237 dqr = std::move(dqParent);
238 }
239 // Accept the same visitor on all containing m_groups and m_assessors
240
241 try {
242 TIter nextAssess(&m_assessors);
244 while ((hca = dynamic_cast<HanConfigAssessor*>(nextAssess())) != 0) {
245 hca->Accept(visitor, dqr);
246 }
247 } catch (std::exception& s) {
248 std::cout << "Assess: Caught exception " << s.what() << std::endl;
249 throw;
250 }
251
252 try {
253 TIter nextGroup(&m_groups);
254 HanConfigGroup* hcg;
255 while ((hcg = dynamic_cast<HanConfigGroup*>(nextGroup())) != 0) {
256 hcg->Accept(visitor, dqr);
257 }
258 } catch (std::exception& s) {
259 std::cout << "Group: Caught exception " << s.what() << std::endl;
260 throw;
261 }
262}
263
264void
266PrintIOStream( std::ostream& o ) const
267{
268 o << "\nHanConfigGroup: " << GetName() << "\n"
269 << " Algorithm Name = \"" << GetAlgName() << "\"\n"
270 << " Algorithm Library = \"" << GetAlgLibName() << "\"\n"
271 << " Algorithm Reference = \"" << GetAlgRefName() << "\"\n"
272 << " Weight = " << GetWeight() << "\n";
273
274 if( !m_algPars->IsEmpty() ) {
275 o << " Algorithm Parameters = {\n";
276 TIter nextPar( m_algPars );
277 HanConfigAlgPar* par;
278 while( (par = dynamic_cast<HanConfigAlgPar*>( nextPar() )) != 0 ) {
279 o << " " << par;
280 }
281 TIter nextStrPar( m_algStrPars );
282 HanConfigParMap* strPar;
283 while( (strPar = dynamic_cast<HanConfigParMap*>( nextStrPar() )) != 0 ) {
284 o << " " << strPar;
285 }
286 o << " }\n";
287 }
288
289 if( !m_algLimits->IsEmpty() ) {
290 o << " Algorithm Limits = {\n";
291 TIter nextLim( m_algLimits );
293 while( (lim = dynamic_cast<HanConfigAlgLimit*>( nextLim() )) != 0 ) {
294 o << " " << lim;
295 }
296 o << " }\n";
297 }
298
299 if( !m_groups.IsEmpty() ) {
300 o << "\n>> BEGIN SUB REGIONS of \"" << GetName() << "\"\n";
301 TIter nextGroup( &m_groups );
302 HanConfigGroup* hcg;
303 while( (hcg = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 ) {
304 o << hcg;
305 }
306 o << "\n<< END SUB REGIONS of \"" << GetName() << "\"\n";
307 }
308
309 if( !m_assessors.IsEmpty() ) {
310 o << "\n>> BEGIN ASSESSMENTS of \"" << GetName() << "\"\n";
311 TIter nextAssess( &m_assessors );
313 while( (hca = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 ) {
314 o << hca;
315 }
316 o << "\n<< END ASSESSMENTS of \"" << GetName() << "\"\n";
317 }
318
319}
320
321} // namespace dqi
322
323
324std::ostream& operator<< ATLAS_NOT_THREAD_SAFE ( std::ostream& o, const dqi::HanConfigGroup& g )
325{
326 g.PrintIOStream(o);
327 return o;
328}
329
330
331std::ostream& operator<< ATLAS_NOT_THREAD_SAFE ( std::ostream& o, const dqi::HanConfigGroup* g )
332{
333 g->PrintIOStream(o);
334 return o;
335}
336
ClassImp(xAOD::Experimental::RFileChecker) namespace xAOD
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
virtual boost::shared_ptr< dqm_core::Node > Visit(const HanConfigAssessor *node, boost::shared_ptr< dqm_core::Region > dqParent)=0
TSeqCollection * m_algLimits
virtual float GetWeight() const
virtual const char * GetAlgName() const
virtual const char * GetAlgLibName() const
virtual TSeqCollection * GetList(TDirectory *basedir, std::map< std::string, TSeqCollection * > &mp)
HanConfigAssessor & operator=(const HanConfigAssessor &other)
TSeqCollection * m_algStrPars
virtual std::string GetAlgRefName() const
virtual void Accept(Visitor &visitor, boost::shared_ptr< dqm_core::Region > dqParent) const
virtual const char * GetName() const
virtual void SetPathName(const std::string &name_)
virtual TIter GetAllGroups() const
virtual HanConfigGroup * GetNode(const std::string &name_) const
virtual const char * GetPathName() const
virtual TSeqCollection * GetList(TDirectory *basedir, std::map< std::string, TSeqCollection * > &mp)
virtual void AddGroup(const HanConfigGroup &hcg_)
virtual HanConfigGroup GetGroup(const std::string &name_) const
virtual const HanConfigAssessor GetAssessor(const std::string &name_) const
virtual TIter GetAllAssessors() const
virtual void AddAssessor(const HanConfigAssessor &hcass_)
virtual std::string GetUniqueName() const
virtual void PrintIOStream(std::ostream &o) const
HanConfigGroup & operator=(const HanConfigGroup &other)
virtual void Accept(Visitor &visitor, boost::shared_ptr< dqm_core::Region > dqParent) const