InteractionListAssembler.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
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 //___________________________________________________________________________
intermediate_table::iterator iterator
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
#define pERROR
Definition: Messenger.h:59
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
virtual const InteractionListGeneratorI * IntListGenerator(void) const =0
InteractionList * AssembleInteractionList(const InitialState &init) const
Defines the EventGeneratorI interface.
Algorithm abstract base class.
Definition: Algorithm.h:53
intermediate_table::const_iterator const_iterator
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
static Config * config
Definition: config.cpp:1054
#define pINFO
Definition: Messenger.h:62
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
A vector of Interaction objects.
A vector of EventGeneratorI objects.
Event Generation using GENIE, cosmics or single particles.
string Key(void) const
Definition: AlgId.h:46
Initial State information.
Definition: InitialState.h:48