GENIEGenerator
Loading...
Searching...
No Matches
Algorithm.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
11#include <vector>
12#include <string>
13#include <sstream>
14
20
21using std::vector;
22using std::string;
23using std::endl;
24
25using namespace genie;
26using namespace genie::utils;
27
28//____________________________________________________________________________
29namespace genie
30{
31 ostream & operator << (ostream & stream, const Algorithm & alg)
32 {
33 alg.Print(stream);
34 return stream;
35 }
36}
37//____________________________________________________________________________
39{
40 this->Initialize();
41}
42//____________________________________________________________________________
44{
45 this->Initialize();
46 fID.SetId(name);
47}
48//____________________________________________________________________________
49Algorithm::Algorithm(string name, string config)
50{
51 this->Initialize();
52 fID.SetId(name,config);
53 this->FindConfig();
54}
55//____________________________________________________________________________
57{
58 this->DeleteConfig();
59 this->DeleteSubstructure();
60}
61//____________________________________________________________________________
63{
64// Configure the Algorithm using the input configuration Registry
65
66 LOG("Algorithm", pNOTICE) << "Input configuration: " << config;
67
68 if ( config.NEntries() <= 0 ) {
69
70 LOG("Algorithm", pNOTICE) "Registry " << config.Name() << " is empty. Not added to " << fID.Name();
71 return;
72 }
73
75 if ( rp ) {
76
77 MergeTopRegistry( *rp ) ;
78 LOG("Algorithm", pNOTICE) << fID.Name() << " merged with external configuration: " << *rp;
79
80 // The memory handled by this pointer has been copied and needs to be cleared
81 delete rp ;
82 }
83
84 if(!fOwnsSubstruc) return; // doesn't own substructure
85 if(fOwnedSubAlgMp->size()==0) return; // no sub-algorithms
86
87 LOG("Algorithm", pNOTICE) << "Configuring algorithms stored at local pool";
88
89 // loop over local pool algorithms
90
91 for( AlgMapIter alg_iter = fOwnedSubAlgMp->begin();
92 alg_iter != fOwnedSubAlgMp->end(); ++alg_iter) {
93
94 string alg_key = alg_iter->first;
95 Algorithm * alg = alg_iter->second;
96
97 if(!alg) {
98 LOG("Algorithm", pERROR)
99 << "Key: " << alg_key << " points to a null algorithm at local pool";
100 continue;
101 }
102
103 LOG("Algorithm", pNOTICE) << "Configuring sub-alg: " << alg->Id().Key();
104
105 rp = ExtractLowerConfig( config, alg_key ) ;
106 if ( rp ) {
107
108 alg -> Configure( *rp ) ;
109
110 delete rp ;
111
112 }
113
114 }
115
116}
117//____________________________________________________________________________
119{
120// Configure the Algorithm looking up at the ConfigPool singleton for a
121// configuration Registry corresponding to the input named parameter set.
122
123 fID.SetConfig(config);
124 this->FindConfig();
125}
126//____________________________________________________________________________
128{
129// Finds its configration Registry from the ConfigPool and gets a pointer to
130// it. If the Registry comes from the ConfigPool then the Algorithm does not
131// own its configuration (the ConfigPool singleton keeps the ownership and the
132// responsibility to -eventually- delete all the Registries it instantiates
133// by parsing the XML config files).
134
135 DeleteConfig() ;
136
138
139 Registry * config = 0 ;
140
141 // load the Default config if config is not the default
142 if ( fID.Config() != "Default" ) {
143 config = pool -> FindRegistry( fID.Name(), "Default" );
144 if ( config ) {
145 if ( config -> NEntries() > 0 ) {
146 AddTopRegistry( config, false ) ;
147 LOG("Algorithm", pDEBUG) << "\n" << *config;
148 }
149 }
150 }
151
152 // Load the right config
153 config = pool->FindRegistry(this);
154
155 if(!config)
156 // notify & keep whatever config Registry was used before.
157 LOG("Algorithm", pWARN)
158 << "No Configuration available for "
159 << this->Id().Key() << " at the ConfigPool";
160 else {
161 if ( config -> NEntries() > 0 ) {
162 AddTopRegistry( config, false ) ;
163 LOG("Algorithm", pDEBUG) << "\n" << config;
164 }
165 }
166
167 const string common_key_root = "Common" ;
168 std::map<string, string> common_lists;
169
170 // Load Common Parameters if key that start with "Common" is found
171 for ( unsigned int i = 0 ; i < fConfVect.size() ; ++i ) {
172 const Registry & temp = * fConfVect[i] ;
173 for ( RgIMapConstIter it = temp.GetItemMap().begin() ; it != temp.GetItemMap().end() ; ++it ) {
174
175 // check if it is a "Common" entry
176 if ( it -> first.find( common_key_root ) == 0 ) {
177 // retrieve the type of the common entry
178 std::string type = it -> first.substr(common_key_root.size() ) ;
179
180 if ( temp.ItemIsLocal( it -> first ) ) {
181
182 string temp_list = temp.GetString( it -> first ) ;
183 if ( temp_list.length() > 0 ) {
184 common_lists[type] = temp_list ;
185 }
186 }
187 }
188
189 }
190
191 } // loop over the local registries
192
193
194 for ( std::map<string, string>::const_iterator it = common_lists.begin() ;
195 it != common_lists.end() ; ++it ) {
196
197 vector<string> list = str::Split( it -> second , "," ) ;
198
199 for ( unsigned int i = 0; i < list.size(); ++i ) {
200
201 config = pool -> CommonList( it -> first, list[i] ) ;
202
203 if ( ! config ) {
204 LOG("Algorithm", pFATAL)
205 << "No Common parameters available for " << it -> first << " list "
206 << list[i] << " at the ConfigPool";
207
208 exit( 78 ) ;
209 }
210 else {
211 AddLowRegistry( config, false ) ;
212 LOG("Algorithm", pDEBUG) << "Loading "
213 << it -> first << " registry "
214 << list[i] << " \n" << config;
215 }
216
217 }
218
219 }
220
221
222 // Load Tunable from CommonParameters
223 // only if the option is specified in RunOpt
224 config = pool -> CommonList( "Param", "Tunable" ) ;
225 if ( config ) {
226 if ( config -> NEntries() > 0 ) {
227 AddTopRegistry( config, false ) ;
228 LOG("Algorithm", pDEBUG) << "Loading Tunable registry \n" << config;
229 }
230 }
231 else {
232 // notify & keep whatever config Registry was used before.
233 LOG("Algorithm", pWARN)
234 << "No Tunable parameter set available at the ConfigPool";
235 }
236
237 if ( fConfig ) {
238 delete fConfig ;
239 fConfig = 0 ;
240 }
241
242}
243
244//____________________________________________________________________________
245
246const Registry & Algorithm::GetConfig(void) const {
247
248 if ( fConfig ) return * fConfig ;
249
250 const_cast<Algorithm*>( this ) -> fConfig = new Registry( fID.Key() + "_summary", false ) ;
251
252 // loop and append
253 // understand the append mechanism
254 for ( unsigned int i = 0 ; i < fConfVect.size(); ++i ) {
255 fConfig -> Append( * fConfVect[i] ) ;
256 }
257
258 if ( fOwnsSubstruc ) {
259
260 for ( AlgMapConstIter iter = fOwnedSubAlgMp -> begin() ;
261 iter != fOwnedSubAlgMp -> end() ; ++iter ) {
262
263 Algorithm * subalg = iter -> second ;
264
265 LOG("Algorithm", pDEBUG) << "Appending config from " << iter -> first << " -> " << subalg -> Id() ;
266 const Registry & r = subalg->GetConfig();
267 RgKey prefix = iter -> first + "/";
268 fConfig -> Append(r,prefix);
269
270 }
271
272 } //if owned substructure
273
274 return * fConfig ;
275}
276
277
278//____________________________________________________________________________
280{
281
282 GetConfig() ;
283 return fConfig;
284}
285//____________________________________________________________________________
287{
288// Compares itself with the input algorithm
289
290 string alg1 = this->Id().Name();
291 string config1 = this->Id().Config();
292 string alg2 = algo->Id().Name();
293 string config2 = algo->Id().Config();
294
295 if(alg1 == alg2)
296 {
297 if(config1 == config2) return kAlgCmpIdentical;
298 else return kAlgCmpDiffConfig;
299 }
300 else return kAlgCmpDiffAlg;
301
302 return kAlgCmpUnknown;
303}
304//____________________________________________________________________________
305void Algorithm::SetId(const AlgId & id)
306{
307 fID.Copy(id);
308}
309//____________________________________________________________________________
310void Algorithm::SetId(string name, string config)
311{
312 fID.SetId(name, config);
313}
314//____________________________________________________________________________
315void Algorithm::Print(ostream & stream) const
316{
317 // print algorithm name & parameter-set
318 stream << "\nAlgorithm Key: " << this->fID.Key();
319 stream << " - Owns Substruc: " << ((fOwnsSubstruc) ? "[true]" : "[false]");
320
321 // print algorithm configuration
322 const Registry & r = this->GetConfig();
323 stream << r;
324
325 if(fOwnsSubstruc) {
326 AlgMapConstIter iter = fOwnedSubAlgMp->begin();
327 for(; iter!=fOwnedSubAlgMp->end(); ++iter) {
328 Algorithm * alg = iter->second;
329 stream << "<Next algorithm is owned by : " << this->fID.Key() << ">";
330 stream << *alg;
331 }
332 }
333}
334//____________________________________________________________________________
336{
337// Algorithm initialization
338//
339 fAllowReconfig = true;
340 fOwnsSubstruc = false;
341 fConfig = 0;
342 fOwnedSubAlgMp = 0;
343}
344//____________________________________________________________________________
345const Algorithm * Algorithm::SubAlg(const RgKey & registry_key) const
346{
347// Returns the sub-algorithm pointed to this algorithm's XML config file using
348// the the values of the key.
349// This method asserts the existence of these keys in the XML config.
350// Note: Since only 1 parameter is used, the key value should contain both the
351// algorithm name and its configuration set according to the usual scheme:
352// namespace::algorithm_name/configuration_set
353//
354 LOG("Algorithm", pINFO)
355 << "Fetching sub-alg within alg: " << this->Id().Key()
356 << " pointed to by key: " << registry_key;
357
358 //-- if the algorithm owns its substructure:
359 // return the sub-algorithm from the local pool
360 //
361 if(fOwnsSubstruc) {
362 AlgMapConstIter iter = fOwnedSubAlgMp->find(registry_key);
363 if(iter!=fOwnedSubAlgMp->end()) return iter->second;
364 LOG("Algorithm", pERROR)
365 << "Owned sub-alg pointed to by key: " << registry_key
366 << " was not found within alg: " << this->Id().Key();
367 return 0;
368 }
369
370 //-- if the algorithm does not own its substructure:
371 // return the sub-algorithm from the AlgFactory's pool
372 RgAlg alg ;
373 GetParam( registry_key, alg ) ;
374
375 LOG("Algorithm", pINFO)
376 << "Registry key: " << registry_key << " points to algorithm: " << alg;
377
378 // retrieve the Algorithm object from the the Algorithm factory
380 const Algorithm * algbase = algf->GetAlgorithm(alg.name, alg.config);
381 assert(algbase);
382
383 return algbase;
384}
385//____________________________________________________________________________
387
388 LOG("Algorithm", pNOTICE)
389 << this->Id().Key() << " is taking ownership of its configuration";
390
391 // if(fOwnsConfig) {
392 // LOG("Algorithm", pWARN)
393 // << this->Id().Key() << " already owns its configuration!";
394 // return;
395 // }
396
397 this->Configure( GetConfig() );
398}
399//____________________________________________________________________________
401{
402// Take ownership of the algorithms subtructure (sub-algorithms,..) by copying
403// them from the AlgFactory pool to the local pool. Also bring all the
404// configuration variables to the top level. See the header for more details.
405// A secial naming convention is required for configuration parameter keys
406// for parameters belonging to sub-algorithms (or sub-algorithms of these
407// sub-algorithms and so on...).
408// The convention is: "sub-alg-key/sub-sub-alg-key/.../original name"
409// This is a recursive method: The AdoptSubtructure()of all sub-algorithms is
410// invoked.
411//
412 LOG("Algorithm", pNOTICE)
413 << "Algorithm: " << this->Id().Key() << " is adopting its substructure";
414
415// Registry deep_config;
416// deep_config.UnLock();
417// deep_config.SetName(this->Id().Key());
418
419 // deep_config.SetName(this->Id().Config() + ";D");
420 // fID.SetConfig(this->Id().Config() + ";D");
421
423
425 fOwnsSubstruc = true;
426
428
429 const RgIMap & rgmap = GetConfig().GetItemMap();
430
431 RgIMapConstIter iter = rgmap.begin();
432 for( ; iter != rgmap.end(); ++iter) {
433
434 RgKey reg_key = iter->first;
435 RegistryItemI * ri = iter->second;
436
437 if(ri->TypeInfo() == kRgAlg) {
438 LOG("Algorithm", pDEBUG)
439 << "Found sub-algorithm pointed to by " << reg_key;
440 RgAlg reg_alg = fConfig->GetAlg(reg_key);
441 AlgId id(reg_alg);
442
443 LOG("Algorithm", pDEBUG) << "Adopting sub-algorithm = " << id.Key();
444 Algorithm * subalg = algf->AdoptAlgorithm(id.Name(),id.Config());
445 subalg->AdoptSubstructure();
446
447 LOG("Algorithm", pDEBUG) << "Adding sub-algorithm to local pool";
448 AlgMapPair key_alg_pair(reg_key, subalg);
449 fOwnedSubAlgMp->insert(key_alg_pair);
450
451 }
452
453 }
454
455
456 if ( fConfig ) {
457 delete fConfig ;
458 fConfig = 0 ;
459 }
460
461}
462//____________________________________________________________________________
464{
465 // there is nothing to delete if the configuration is not owned but is
466 // rather looked up from the configuration pool
467 //
468
469 for ( unsigned int i = 0 ; i < fConfVect.size() ; ++i ) {
470 if ( fOwnerships[i] ) {
471 delete fConfVect[i] ;
472 }
473 }
474
475 fConfVect.clear() ;
476 fOwnerships.clear() ;
477
478 // delete owned configuration registry
479
480 if(fConfig) {
481 delete fConfig;
482 fConfig=0;
483 }
484
485}
486
487//____________________________________________________________________________
489{
490 // there is nothing to delete if the sub-algorithms are not owned but rather
491 // taken from the AlgFactory's pool
492 //
493 if(!fOwnsSubstruc) return;
494
495 // delete local algorithm pool
496 //
497 AlgMapIter iter = fOwnedSubAlgMp->begin();
498 for( ; iter != fOwnedSubAlgMp->end(); ++iter) {
499 Algorithm * alg = iter->second;
500 if(alg) {
501 delete alg;
502 alg=0;
503 }
504 }
505 delete fOwnedSubAlgMp;
506 fOwnedSubAlgMp = 0;
507}
508//____________________________________________________________________________
509
510string Algorithm::BuildParamVectKey( const std::string & comm_name, unsigned int i ) {
511
512 std::stringstream name;
513 name << comm_name << '-' << i ;
514 return name.str() ;
515
516}
517
518//____________________________________________________________________________
519
520string Algorithm::BuildParamVectSizeKey( const std::string & comm_name ) {
521
522 return 'N' + comm_name + 's' ;
523
524}
525//____________________________________________________________________________
526
527string Algorithm::BuildParamMatKey( const std::string & comm_name, unsigned int i, unsigned int j ) {
528
529 std::stringstream name;
530 name << comm_name << '-' << i << "-" << j ;
531 return name.str() ;
532
533}
534
535//____________________________________________________________________________
536
537string Algorithm::BuildParamMatRowSizeKey( const std::string & comm_name ) {
538
539 return "Nrow" + comm_name + 's' ;
540
541}
542
543//____________________________________________________________________________
544
545string Algorithm::BuildParamMatColSizeKey( const std::string & comm_name ) {
546
547 return "Ncol" + comm_name + 's' ;
548
549}
550
551
552
553//____________________________________________________________________________
554
555int Algorithm::GetParamVectKeys( const std::string & comm_name, std::vector<RgKey> & k,
556 bool is_top_call ) const {
557
558 k.clear() ;
559
560 int n ;
561 std::string n_name = Algorithm::BuildParamVectSizeKey( comm_name ) ;
562
563 bool found = GetParam( n_name, n, is_top_call ) ;
564
565 if ( ! found ) {
566 return 0 ;
567 }
568
569 for ( int i = 0; i < n; ++i ) {
570
571 RgKey temp_key = Algorithm::BuildParamVectKey( comm_name, i ) ;
572
573 // potentially, if it is a top call,
574 // we might want to check if the key actually exist in the global Registry
575 // Not a priority irght now
576
577 k.push_back( temp_key ) ;
578 }
579
580 return k.size() ;
581}
582
583//____________________________________________________________________________
584
585int Algorithm::GetParamMatKeys( const std::string & comm_name, std::vector<RgKey> & k,
586 bool is_top_call ) const {
587
588 k.clear() ;
589
590 int n_row = 0, n_col = 0 ;
591 std::string row_name = Algorithm::BuildParamMatRowSizeKey( comm_name ) ;
592 std::string col_name = Algorithm::BuildParamMatColSizeKey( comm_name ) ;
593
594 bool found = GetParam( row_name, n_row, is_top_call ) && GetParam( col_name, n_col, is_top_call ) ;
595
596 if ( ! found ) {
597 return 0 ;
598 }
599
600 for ( int i = 0; i < n_row; ++i ) {
601 for ( int j = 0; j < n_col; ++j ) {
602
603 RgKey temp_key = Algorithm::BuildParamMatKey( comm_name, i, j ) ;
604
605 // potentially, if it is a top call,
606 // we might want to check if the key actually exist in the global Registry
607 // Not a priority irght now
608
609 k.push_back( temp_key ) ;
610 }
611 }
612
613 return k.size() ;
614}
615
616
617
618//____________________________________________________________________________
620
621 const RgIMap & rgmap = in.GetItemMap();
622 Registry * out = new Registry( in.Name(), false );
623
624 for( RgIMapConstIter reg_iter = rgmap.begin();
625 reg_iter != rgmap.end(); ++reg_iter ) {
626
627 RgKey reg_key = reg_iter->first;
628 if( reg_key.find( '/' ) != string::npos) continue;
629
630 // at this point
631 // this key is referred to the local algorithm
632 // it has to be copied in out;
633
634 RegistryItemI * ri = reg_iter->second;
635 RgIMapPair key_item_pair( reg_key, ri->Clone() );
636 out -> Set(key_item_pair);
637
638 }
639
640 if ( out -> NEntries() <= 0 ) {
641 delete out ;
642 out = 0 ;
643 }
644
645 return out ;
646}
647
648//____________________________________________________________________________
649
650Registry * Algorithm::ExtractLowerConfig( const Registry & in, const string & alg_key ) const {
651
652 const RgIMap & rgmap = in.GetItemMap();
653 Registry * out = new Registry( in.Name(), false );
654
655 for( RgIMapConstIter reg_iter = rgmap.begin();
656 reg_iter != rgmap.end(); ++reg_iter ) {
657
658 RgKey reg_key = reg_iter->first;
659 if( reg_key.find(alg_key+"/") == string::npos) continue;
660
661 // at this point
662 // this key is referred to the sub-algorithm
663 // indicated by alg_key: it has to be copied in out;
664
665 int new_key_start = reg_key.find_first_of('/')+1;
666 RgKey new_reg_key = reg_key.substr( new_key_start, reg_key.length() );
667
668 RegistryItemI * ri = reg_iter->second;
669 RgIMapPair key_item_pair(new_reg_key, ri->Clone());
670 out -> Set(key_item_pair);
671
672 }
673
674 if ( out -> NEntries() <= 0 ) {
675 delete out ;
676 out = 0 ;
677 }
678
679 return out ;
680
681}
682
683
684//____________________________________________________________________________
685
686int Algorithm::AddTopRegistry( Registry * rp, bool own ) {
687
688 fConfVect.insert( fConfVect.begin(), rp ) ;
689 fOwnerships.insert( fOwnerships.begin(), own ) ;
690
691 if ( fConfig ) {
692 delete fConfig ;
693 fConfig = 0 ;
694 }
695
696 return fConfVect.size() ;
697
698}
699
700//____________________________________________________________________________
701
702int Algorithm::AddLowRegistry( Registry * rp, bool own ) {
703
704 fConfVect.push_back( rp ) ;
705 fOwnerships.push_back( own ) ;
706
707 if ( fConfig ) {
708 delete fConfig ;
709 fConfig = 0 ;
710 }
711
712 return fConfVect.size() ;
713
714}
715
716//____________________________________________________________________________
717
718
720
721 if ( fOwnerships.empty() ) {
722
723 // this algorithm is not configured right now, the incoming registry is the only configuration
724 Registry * p = new Registry( r ) ;
725 AddTopRegistry( p ) ;
726
727 return 1 ;
728 }
729
730 if ( fOwnerships[0] ) {
731 //the top registry is owned: it can be changed with no consequences for other algorithms
732 fConfVect[0] -> Merge( r ) ;
733 }
734 else {
735 // The top registry is not owned so it cannot be changed
736 // The registry will be added with top priority
737
738 Registry * p = new Registry( r ) ;
739 AddTopRegistry( p ) ;
740 }
741
742 // The configuration has changed so the summary is not updated anymore and must be deleted
743 if ( fConfig ) {
744 delete fConfig ;
745 fConfig = 0 ;
746 }
747
748 return fConfVect.size() ;
749}
750
751//____________________________________________________________________________
752
753
754int Algorithm::AddTopRegisties( const vector<Registry*> & rs, bool own ) {
755
756 fConfVect.insert( fConfVect.begin(), rs.begin(), rs.end() ) ;
757
758 fOwnerships.insert( fOwnerships.begin(), rs.size(), own ) ;
759
760 if ( fConfig ) {
761 delete fConfig ;
762 fConfig = 0 ;
763 }
764
765 return fConfVect.size() ;
766
767}
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define pERROR
Definition Messenger.h:59
#define pFATAL
Definition Messenger.h:56
#define pDEBUG
Definition Messenger.h:63
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
#define pWARN
Definition Messenger.h:60
string RgKey
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
Registry * FindRegistry(string key) const
static AlgConfigPool * Instance()
The GENIE Algorithm Factory.
Definition AlgFactory.h:39
const Algorithm * GetAlgorithm(const AlgId &algid)
static AlgFactory * Instance()
Algorithm * AdoptAlgorithm(const AlgId &algid) const
Algorithm ID (algorithm name + configuration set name)
Definition AlgId.h:34
string Config(void) const
Definition AlgId.h:45
string Key(void) const
Definition AlgId.h:46
string Name(void) const
Definition AlgId.h:44
Registry * GetOwnedConfig(void)
static string BuildParamMatKey(const std::string &comm_name, unsigned int i, unsigned int j)
int GetParamMatKeys(const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
void AdoptSubstructure(void)
void Initialize(void)
Registry * ExtractLowerConfig(const Registry &in, const string &alg_key) const
Split an incoming configuration Registry into a block valid for the sub-algo identified by alg_key.
static string BuildParamMatColSizeKey(const std::string &comm_name)
bool fOwnsSubstruc
true if it owns its substructure (sub-algs,...)
Definition Algorithm.h:164
Registry * ExtractLocalConfig(const Registry &in) const
int AddLowRegistry(Registry *rp, bool owns=true)
add registry with lowest priority, also update ownership
virtual AlgCmp_t Compare(const Algorithm *alg) const
Compare with input algorithm.
virtual const Registry & GetConfig(void) const
static string BuildParamVectSizeKey(const std::string &comm_name)
static string BuildParamMatRowSizeKey(const std::string &comm_name)
Registry * fConfig
Summary configuration derived from fConvVect, not necessarily allocated.
Definition Algorithm.h:217
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
vector< bool > fOwnerships
ownership for every registry in fConfVect
Definition Algorithm.h:173
virtual void FindConfig(void)
int GetParamVectKeys(const std::string &comm_name, std::vector< RgKey > &k, bool is_top_call=true) const
void AdoptConfig(void)
virtual void SetId(const AlgId &id)
Set algorithm ID.
void DeleteSubstructure(void)
int MergeTopRegistry(const Registry &r)
vector< Registry * > fConfVect
Definition Algorithm.h:170
AlgId fID
algorithm name and configuration set
Definition Algorithm.h:165
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
void DeleteConfig(void)
const Algorithm * SubAlg(const RgKey &registry_key) const
virtual void Print(ostream &stream) const
Print algorithm info.
virtual ~Algorithm()
Definition Algorithm.cxx:56
int AddTopRegisties(const vector< Registry * > &rs, bool owns=false)
Add registries with top priority, also udated Ownerships.
AlgMap * fOwnedSubAlgMp
local pool for owned sub-algs (taken out of the factory pool)
Definition Algorithm.h:176
int AddTopRegistry(Registry *rp, bool owns=true)
add registry with top priority, also update ownership
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition Algorithm.h:98
static string BuildParamVectKey(const std::string &comm_name, unsigned int i)
Registry item pABC.
virtual RegistryItemI * Clone(void) const =0
virtual RgType_t TypeInfo(void) const =0
A registry. Provides the container for algorithm configuration parameters.
Definition Registry.h:65
const RgIMap & GetItemMap(void) const
Definition Registry.h:161
string Name(void) const
get the registry name
Definition Registry.cxx:597
RgStr GetString(RgKey key) const
Definition Registry.cxx:481
bool ItemIsLocal(RgKey key) const
local or global?
Definition Registry.cxx:178
Simple functions for loading and reading nucleus dependent keys from config files.
vector< string > Split(string input, string delim)
Root of GENIE utility namespaces.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
map< string, Algorithm * >::iterator AlgMapIter
Definition Algorithm.h:50
map< RgKey, RegistryItemI * > RgIMap
Definition Registry.h:45
pair< RgKey, RegistryItemI * > RgIMapPair
Definition Registry.h:46
@ kAlgCmpDiffConfig
Definition AlgCmp.h:31
@ kAlgCmpIdentical
Definition AlgCmp.h:30
@ kAlgCmpUnknown
Definition AlgCmp.h:29
@ kAlgCmpDiffAlg
Definition AlgCmp.h:32
map< RgKey, RegistryItemI * >::const_iterator RgIMapConstIter
Definition Registry.h:49
pair< string, Algorithm * > AlgMapPair
Definition Algorithm.h:52
map< string, Algorithm * >::const_iterator AlgMapConstIter
Definition Algorithm.h:51
enum genie::EAlgCmp AlgCmp_t
map< string, Algorithm * > AlgMap
Definition Algorithm.h:49
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)