ATLAS Offline Software
HanConfigGroup.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 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 
20 namespace dqi {
21 
22 // *********************************************************************
23 // Public Methods
24 // *********************************************************************
25 
28 {
29 }
30 
31 
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 
56 {
58  m_pathName = other.m_pathName;
59 
60  TIter nextAssess( &other.m_assessors );
61  HanConfigAssessor* otherAssess;
62  while( (otherAssess = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 ) {
63  HanConfigAssessor* acpy = new HanConfigAssessor( *otherAssess );
64  m_assessors.Add( acpy );
65  }
66 
67  TIter nextGroup( &other.m_groups );
68  HanConfigGroup* otherGroup;
69  while( (otherGroup = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 ) {
70  HanConfigGroup* gcpy = new HanConfigGroup( *otherGroup );
71  m_groups.Add( gcpy );
72  }
73 
74  return *this;
75 }
76 
77 
80 {
81  // Assume that the same object has not been added to both lists
82  m_assessors.Delete();
83  m_groups.Delete();
84 }
85 
86 
87 std::string
89 GetUniqueName() const
90 {
91  return std::string( GetPathName() );
92 }
93 
94 
95 void
97 SetPathName( const std::string& name_ )
98 {
99  m_pathName.SetString( name_.c_str() );
100 }
101 
102 
103 const char*
105 GetPathName() const
106 {
107  return m_pathName.GetName();
108 }
109 
110 
111 void
113 AddAssessor( const HanConfigAssessor& hcass_ )
114 {
115  HanConfigAssessor* acpy = new HanConfigAssessor( hcass_ );
116  m_assessors.Add( acpy );
117 }
118 
119 
120 const HanConfigAssessor
122 GetAssessor( const std::string& name_ ) const
123 {
124  HanConfigAssessor* hca = dynamic_cast<HanConfigAssessor*>( m_assessors.FindObject(name_.c_str()) );
125  if( hca == 0 ) {
126  return HanConfigAssessor();
127  }
128 
129  return *hca;
130 }
131 
132 
133 TIter
135 GetAllAssessors() const
136 {
137  return TIter( &m_assessors );
138 }
139 
140 
141 void
143 AddGroup( const HanConfigGroup& hcg_ )
144 {
145  HanConfigGroup* gcpy = new HanConfigGroup( hcg_ );
146  m_groups.Add( gcpy );
147 }
148 
149 
152 GetGroup( const std::string& name_ ) const
153 {
154  HanConfigGroup* hcg = dynamic_cast<HanConfigGroup*>( m_groups.FindObject(name_.c_str()) );
155  if( hcg == 0 ) {
156  return HanConfigGroup();
157  }
158 
159  return *hcg;
160 }
161 
162 
163 TIter
165 GetAllGroups() const
166 {
167  return TIter( &m_groups );
168 }
169 
170 
173 GetNode( const std::string& name_ ) const
174 {
175  if( m_groups.IsEmpty() ) {
176  return 0;
177  }
178 
179  std::string::size_type k = name_.find_first_of('/');
180  if( k != std::string::npos ) {
181  std::string dName( name_, 0, k );
182  std::string pName( name_, k+1, std::string::npos );
183  if( dName != "" ) {
184  if( dName == std::string( GetName() ) ) {
185  return GetNode( pName );
186  }
187  HanConfigGroup* subreg = dynamic_cast<HanConfigGroup*>( m_groups.FindObject(dName.c_str()) );
188  if( subreg == 0 ) {
189  return 0;
190  }
191  return subreg->GetNode( pName );
192  }
193  return GetNode( pName );
194  }
195 
196  HanConfigGroup* subreg = dynamic_cast<HanConfigGroup*>( m_groups.FindObject(name_.c_str()) );
197  return subreg;
198 }
199 
200 
201 TSeqCollection *
203 GetList( TDirectory* basedir, std::map<std::string,TSeqCollection*>& mp )
204 {
205  // Let the original method do all the work
206  TSeqCollection *ret = HanConfigAssessor::GetList( basedir, mp );
207  ret->SetName( this->m_name.GetName() );
208 
209  // Iterate through containing m_groups and m_assessors and add them to the childrenList
210  TIter nextAssess( &m_assessors );
211  HanConfigAssessor* hca;
212  while( (hca = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 )
213  ret->Add( hca->GetList(basedir,mp) );
214 
215  TIter nextGroup( &m_groups );
216  HanConfigGroup* hcg;
217  while( (hcg = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 )
218  ret->Add( hcg->GetList(basedir,mp) );
219 
220  return ret;
221 }
222 
223 
224 void
226 Accept( Visitor& visitor, boost::shared_ptr<dqm_core::Region> dqParent ) const
227 {
228  std::string nodeName( GetName() );
229  boost::shared_ptr<dqm_core::Region> dqr;
230  if( nodeName != "top_level" ) {
231  boost::shared_ptr<dqm_core::Node> dqp(visitor.Visit( this, dqParent ));
232  dqr = boost::dynamic_pointer_cast<dqm_core::Region>( dqp );
233  }
234  else {
235  dqr = dqParent;
236  }
237 
238  // Accept the same visitor on all containing m_groups and m_assessors
239 
240  TIter nextAssess( &m_assessors );
241  HanConfigAssessor* hca;
242  while( (hca = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 ) {
243  hca->Accept( visitor, dqr );
244  }
245 
246  TIter nextGroup( &m_groups );
247  HanConfigGroup* hcg;
248  while( (hcg = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 ) {
249  hcg->Accept( visitor, dqr );
250  }
251 }
252 
253 
254 void
256 PrintIOStream( std::ostream& o ) const
257 {
258  o << "\nHanConfigGroup: " << GetName() << "\n"
259  << " Algorithm Name = \"" << GetAlgName() << "\"\n"
260  << " Algorithm Library = \"" << GetAlgLibName() << "\"\n"
261  << " Algorithm Reference = \"" << GetAlgRefName() << "\"\n"
262  << " Weight = " << GetWeight() << "\n";
263 
264  if( !m_algPars->IsEmpty() ) {
265  o << " Algorithm Parameters = {\n";
266  TIter nextPar( m_algPars );
268  while( (par = dynamic_cast<HanConfigAlgPar*>( nextPar() )) != 0 ) {
269  o << " " << par;
270  }
271  TIter nextStrPar( m_algStrPars );
272  HanConfigParMap* strPar;
273  while( (strPar = dynamic_cast<HanConfigParMap*>( nextStrPar() )) != 0 ) {
274  o << " " << strPar;
275  }
276  o << " }\n";
277  }
278 
279  if( !m_algLimits->IsEmpty() ) {
280  o << " Algorithm Limits = {\n";
281  TIter nextLim( m_algLimits );
282  HanConfigAlgLimit* lim;
283  while( (lim = dynamic_cast<HanConfigAlgLimit*>( nextLim() )) != 0 ) {
284  o << " " << lim;
285  }
286  o << " }\n";
287  }
288 
289  if( !m_groups.IsEmpty() ) {
290  o << "\n>> BEGIN SUB REGIONS of \"" << GetName() << "\"\n";
291  TIter nextGroup( &m_groups );
292  HanConfigGroup* hcg;
293  while( (hcg = dynamic_cast<HanConfigGroup*>( nextGroup() )) != 0 ) {
294  o << hcg;
295  }
296  o << "\n<< END SUB REGIONS of \"" << GetName() << "\"\n";
297  }
298 
299  if( !m_assessors.IsEmpty() ) {
300  o << "\n>> BEGIN ASSESSMENTS of \"" << GetName() << "\"\n";
301  TIter nextAssess( &m_assessors );
302  HanConfigAssessor* hca;
303  while( (hca = dynamic_cast<HanConfigAssessor*>( nextAssess() )) != 0 ) {
304  o << hca;
305  }
306  o << "\n<< END ASSESSMENTS of \"" << GetName() << "\"\n";
307  }
308 
309 }
310 
311 } // namespace dqi
312 
313 
314 std::ostream& operator<< ATLAS_NOT_THREAD_SAFE ( std::ostream& o, const dqi::HanConfigGroup& g )
315 {
316  g.PrintIOStream(o);
317  return o;
318 }
319 
320 
321 std::ostream& operator<< ATLAS_NOT_THREAD_SAFE ( std::ostream& o, const dqi::HanConfigGroup* g )
322 {
323  g->PrintIOStream(o);
324  return o;
325 }
326 
dqi::HanConfigGroup::PrintIOStream
virtual void PrintIOStream(std::ostream &o) const
Definition: HanConfigGroup.cxx:256
dqi::HanConfigAssessor::GetAlgLibName
virtual const char * GetAlgLibName() const
Definition: HanConfigAssessor.cxx:213
HanConfigGroup.h
dqi::HanConfigGroup::m_pathName
TObjString m_pathName
Definition: HanConfigGroup.h:62
dqi::HanConfigAlgLimit
Definition: HanConfigAlgLimit.h:18
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
dqi::HanConfigGroup::HanConfigGroup
HanConfigGroup()
Definition: HanConfigGroup.cxx:27
dqi::HanConfigGroup::GetGroup
virtual HanConfigGroup GetGroup(const std::string &name_) const
Definition: HanConfigGroup.cxx:152
dqi::HanConfigGroup::AddGroup
virtual void AddGroup(const HanConfigGroup &hcg_)
Definition: HanConfigGroup.cxx:143
dqi::HanConfigGroup::GetList
virtual TSeqCollection * GetList(TDirectory *basedir, std::map< std::string, TSeqCollection * > &mp)
Definition: HanConfigGroup.cxx:203
dqi::HanConfigAssessor::Accept
virtual void Accept(Visitor &visitor, boost::shared_ptr< dqm_core::Region > dqParent) const
Definition: HanConfigAssessor.cxx:523
dqi::HanConfigAssessor::GetAlgRefName
virtual std::string GetAlgRefName() const
Definition: HanConfigAssessor.cxx:229
dqi::HanConfigGroup::operator=
HanConfigGroup & operator=(const HanConfigGroup &other)
Definition: HanConfigGroup.cxx:55
dqi::HanConfigGroup::m_assessors
TList m_assessors
Definition: HanConfigGroup.h:64
dqi::HanConfigAssessor::GetList
virtual TSeqCollection * GetList(TDirectory *basedir, std::map< std::string, TSeqCollection * > &mp)
Definition: HanConfigAssessor.cxx:392
dqi::HanConfigAssessor::Visitor::Visit
virtual boost::shared_ptr< dqm_core::Node > Visit(const HanConfigAssessor *node, boost::shared_ptr< dqm_core::Region > dqParent)=0
dqi::HanConfigAssessor::operator=
HanConfigAssessor & operator=(const HanConfigAssessor &other)
Definition: HanConfigAssessor.cxx:91
dqi::HanConfigGroup::GetNode
virtual HanConfigGroup * GetNode(const std::string &name_) const
Definition: HanConfigGroup.cxx:173
dqi::HanConfigParMap
Definition: HanConfigParMap.h:18
dqi::HanConfigAssessor::GetName
virtual const char * GetName() const
Definition: HanConfigAssessor.cxx:170
ClassImp
ClassImp(xAOD::TFileChecker) namespace xAOD
Definition: TFileChecker.cxx:28
dqi::HanConfigGroup
Definition: HanConfigGroup.h:23
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
dqi::HanConfigAssessor::m_name
TObjString m_name
Definition: HanConfigAssessor.h:106
dqi::HanConfigAssessor::m_algLimits
TSeqCollection * m_algLimits
Definition: HanConfigAssessor.h:114
dqi::HanConfigGroup::GetAllAssessors
virtual TIter GetAllAssessors() const
Definition: HanConfigGroup.cxx:135
dqi::HanConfigGroup::GetAssessor
virtual const HanConfigAssessor GetAssessor(const std::string &name_) const
Definition: HanConfigGroup.cxx:122
dqi::HanConfigAssessor
Definition: HanConfigAssessor.h:37
dqi::HanConfigGroup::GetAllGroups
virtual TIter GetAllGroups() const
Definition: HanConfigGroup.cxx:165
dqi::HanConfigGroup::~HanConfigGroup
virtual ~HanConfigGroup()
Definition: HanConfigGroup.cxx:79
dqi::HanConfigGroup::Accept
virtual void Accept(Visitor &visitor, boost::shared_ptr< dqm_core::Region > dqParent) const
Definition: HanConfigGroup.cxx:226
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
dqi::HanConfigAssessor::Visitor
Definition: HanConfigAssessor.h:41
dqi::HanConfigAlgPar
Definition: HanConfigAlgPar.h:18
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
dqi::HanConfigGroup::AddAssessor
virtual void AddAssessor(const HanConfigAssessor &hcass_)
Definition: HanConfigGroup.cxx:113
dqi::HanConfigGroup::GetUniqueName
virtual std::string GetUniqueName() const
Definition: HanConfigGroup.cxx:89
dqi::HanConfigGroup::m_groups
TList m_groups
Definition: HanConfigGroup.h:65
dqi::HanConfigAssessor::m_algPars
TSeqCollection * m_algPars
Definition: HanConfigAssessor.h:112
dqi::HanConfigAssessor::HanConfigAssessor
HanConfigAssessor()
Definition: HanConfigAssessor.cxx:35
dqi::HanConfigAssessor::GetWeight
virtual float GetWeight() const
Definition: HanConfigAssessor.cxx:371
dqi::HanConfigAssessor::m_algStrPars
TSeqCollection * m_algStrPars
Definition: HanConfigAssessor.h:113
dqi::HanConfigGroup::SetPathName
virtual void SetPathName(const std::string &name_)
Definition: HanConfigGroup.cxx:97
dqi::HanConfigAssessor::GetAlgName
virtual const char * GetAlgName() const
Definition: HanConfigAssessor.cxx:197
dqi
Definition: CompositeAlgorithm.h:16
fitman.k
k
Definition: fitman.py:528
dqi::HanConfigGroup::GetPathName
virtual const char * GetPathName() const
Definition: HanConfigGroup.cxx:105