GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
InteractionListAssembler.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, 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 
18 
19 using namespace genie;
20 
21 //___________________________________________________________________________
23 Algorithm("genie::InteractionListAssembler")
24 {
26 }
27 //___________________________________________________________________________
29 Algorithm("genie::InteractionListAssembler", config)
30 {
32 }
33 //___________________________________________________________________________
35 {
36 
37 }
38 //___________________________________________________________________________
40 {
41  fEventGeneratorList = evglist;
42 }
43 //___________________________________________________________________________
45  const InitialState & init_state) const
46 {
47  if(!fEventGeneratorList) {
48  LOG("IntLst", pERROR)
49  << "\n*** NULL Generator List! "
50  << "Can not assemble the Interaction List for \n" << init_state;
51  return 0;
52  }
53 
54  InteractionList * total_intlist = new InteractionList;
55 
56  EventGeneratorList::const_iterator evgliter; // event generator list iter
57  InteractionList::iterator intliter; // interaction list iter
58 
59  for(evgliter = fEventGeneratorList->begin();
60  evgliter != fEventGeneratorList->end(); ++evgliter) {
61 
62  const EventGeneratorI * evgen = *evgliter;
63 
64  LOG("IntLst", pINFO)
65  << "\nQuerying EventGenerator: " << evgen->Id().Key()
66  << " for its Interaction List";
67 
68  // ask the event generator to produce a list of all interaction it can
69  // generate for the input initial state
70 
71  const InteractionListGeneratorI * intlistgen = evgen->IntListGenerator();
72 
73  InteractionList * intlist = intlistgen->CreateInteractionList(init_state); // should delete ?
74 
75  LOG("IntLst", pINFO) << "\nGot list:\n" << *intlist;
76 
77  // add them to the combined interaction list
78  for(intliter = intlist->begin();
79  intliter != intlist->end(); ++intliter) {
80  Interaction * interaction = *intliter;
81  total_intlist->push_back(interaction);
82 
83  } // loop over interaction that can be generated
84  } // loop over event generators
85 
86  return total_intlist;
87 }
88 //___________________________________________________________________________
#define pERROR
Definition: Messenger.h:59
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
InteractionList * AssembleInteractionList(const InitialState &init) const
Defines the EventGeneratorI interface.
Algorithm abstract base class.
Definition: Algorithm.h:54
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
void SetGeneratorList(EventGeneratorList *evglist)
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
A vector of Interaction objects.
A vector of EventGeneratorI objects.
virtual const InteractionListGeneratorI * IntListGenerator(void) const =0
string Key(void) const
Definition: AlgId.h:46
Initial State information.
Definition: InitialState.h:48