]>
Commit | Line | Data |
---|---|---|
0ca57c2f | 1 | //-------------------------------------------------------------------------- |
2 | // | |
3 | // Environment: | |
4 | // This software is part of the EvtGen package. If you use all or part | |
5 | // of it, please give an appropriate acknowledgement. | |
6 | // | |
7 | // Copyright Information: See EvtGen/COPYRIGHT | |
8 | // Copyright (C) 2012 University of Warwick, UK | |
9 | // | |
10 | // Module: EvtExternalGenFactory | |
11 | // | |
12 | // Description: A factory type method to create engines for external physics | |
13 | // generators like Pythia. | |
14 | // | |
15 | // Modification history: | |
16 | // | |
17 | // John Back Sept 2012 Module created | |
18 | // | |
19 | //------------------------------------------------------------------------------ | |
20 | // | |
21 | #include <TSystem.h> | |
22 | #include "EvtGenExternal/EvtExternalGenList.hh" | |
23 | ||
24 | #include "EvtGenExternal/EvtExternalGenFactory.hh" | |
25 | #include "EvtGenExternal/EvtPHOTOS.hh" | |
26 | #include "EvtGenExternal/EvtPythia.hh" | |
27 | #include "EvtGenExternal/EvtTauola.hh" | |
28 | ||
29 | EvtExternalGenList::EvtExternalGenList(bool convertPythiaCodes, std::string pythiaXmlDir, | |
30 | std::string photonType, bool useEvtGenRandom) { | |
31 | ||
32 | // Instantiate the external generator factory | |
33 | EvtExternalGenFactory* extFactory = EvtExternalGenFactory::getInstance(); | |
34 | ||
35 | // Define the external generator "engines" here | |
36 | extFactory->definePhotosGenerator(photonType, useEvtGenRandom); | |
37 | ||
38 | if (pythiaXmlDir.size() < 1) { | |
39 | // If we have no string defined, check the value of the | |
40 | // PYTHIA8DATA environment variable which should be set to the | |
41 | // xmldoc Pythia directory | |
3a6cdcc8 | 42 | char* pythiaDataDir = getenv("PYTHIA8DATA"); |
0ca57c2f | 43 | if (pythiaDataDir != 0) {pythiaXmlDir = pythiaDataDir;} |
44 | } | |
45 | ||
46 | extFactory->definePythiaGenerator(pythiaXmlDir, convertPythiaCodes, | |
47 | useEvtGenRandom); | |
48 | ||
49 | extFactory->defineTauolaGenerator(useEvtGenRandom); | |
50 | ||
51 | } | |
52 | ||
53 | EvtExternalGenList::~EvtExternalGenList() { | |
54 | } | |
55 | ||
56 | EvtAbsRadCorr* EvtExternalGenList::getPhotosModel() { | |
57 | ||
58 | // Define the Photos model, which uses the EvtPhotosEngine class. | |
59 | EvtPHOTOS* photosModel = new EvtPHOTOS(); | |
60 | return photosModel; | |
61 | ||
62 | } | |
63 | ||
64 | std::list<EvtDecayBase*> EvtExternalGenList::getListOfModels() { | |
65 | ||
66 | // Create the Pythia and Tauola models, which use their own engine classes. | |
67 | EvtPythia* pythiaModel = new EvtPythia(); | |
68 | EvtTauola* tauolaModel = new EvtTauola(); | |
69 | ||
70 | std::list<EvtDecayBase*> extraModels; | |
71 | extraModels.push_back(pythiaModel); | |
72 | extraModels.push_back(tauolaModel); | |
73 | ||
74 | // Return the list of models | |
75 | return extraModels; | |
76 | ||
77 | } |