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