Functions
gtestConfigPool.cxx File Reference
#include "Framework/Algorithm/Algorithm.h"
#include "Framework/Algorithm/AlgFactory.h"
#include "Framework/Algorithm/AlgConfigPool.h"
#include "Physics/QuasiElastic/XSection/QELFormFactorsModelI.h"
#include "Physics/QuasiElastic/XSection/ELFormFactorsModelI.h"
#include "Framework/Messenger/Messenger.h"

Go to the source code of this file.

Functions

int main (int, char **)
 

Function Documentation

int main ( int  ,
char **   
)

Definition at line 28 of file gtestConfigPool.cxx.

29 {
30  // Get an instance of the ConfigPool
31  LOG("test", pINFO) << "Get config pool instance";
32  AlgConfigPool * pool = AlgConfigPool::Instance();
33 
34  // Print the ConfigPool ( => print all its configuration registries )
35  LOG("test", pINFO) << "Printing the config pool\n" << *pool;
36 
37  // Get the algorithm factory
38  AlgFactory * algf = AlgFactory::Instance();
39 
40  // Instantiate an algorithm
41  LOG("test", pINFO) << "Instantiate a concrete algorithm";
42  const Algorithm * alg0 =
43  algf->GetAlgorithm("genie::LwlynSmithFFCC","Default");
44  const QELFormFactorsModelI * llewellyn_smith =
45  dynamic_cast<const QELFormFactorsModelI *> (alg0);
46  LOG("test", pINFO) << *alg0;
47 
48  LOG("test", pINFO) << "Instantiate another concrete algorithm";
49  const Algorithm * alg1 =
50  algf->GetAlgorithm("genie::DipoleELFormFactorsModel","Default");
51  const ELFormFactorsModelI * dipole_elff =
52  dynamic_cast<const ELFormFactorsModelI *> (alg1);
53  LOG("test", pINFO) << *alg1;
54 
55  // Ask the ConfigPool for this algorithm's config registry and print it
56 
57  LOG("test", pINFO) << "Find the configuration for both algorithms";
58 
59  Registry * config1 = pool->FindRegistry( llewellyn_smith );
60  Registry * config2 = pool->FindRegistry( dipole_elff );
61 
62  if(config1) LOG("test", pINFO) << "1st algorithm config: \n" << *config1;
63  if(config2) LOG("test", pINFO) << "2nd algorithm config: \n" << *config2;
64 
65  return 0;
66 }
A singleton class holding all configuration registries built while parsing all loaded XML configurati...
Definition: AlgConfigPool.h:40
Algorithm abstract base class.
Definition: Algorithm.h:53
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
Pure abstract base class. Defines the QELFormFactorsModelI interface to be implemented by any algorit...
Pure abstract base class. Defines the ELFormFactorsModelI interface to be implemented by any algorith...
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:75
#define pINFO
Definition: Messenger.h:62
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
Registry * FindRegistry(string key) const
The GENIE Algorithm Factory.
Definition: AlgFactory.h:39