InteractionListAssembler.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 - May 16, 2005
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13 
14 */
15 //____________________________________________________________________________
16 
24 
25 using namespace genie;
26 
27 //___________________________________________________________________________
29 Algorithm("genie::InteractionListAssembler")
30 {
32 }
33 //___________________________________________________________________________
35 Algorithm("genie::InteractionListAssembler", config)
36 {
38 }
39 //___________________________________________________________________________
41 {
42 
43 }
44 //___________________________________________________________________________
46 {
47  fEventGeneratorList = evglist;
48 }
49 //___________________________________________________________________________
51  const InitialState & init_state) const
52 {
53  if(!fEventGeneratorList) {
54  LOG("IntLst", pERROR)
55  << "\n*** NULL Generator List! "
56  << "Can not assemble the Interaction List for \n" << init_state;
57  return 0;
58  }
59 
60  InteractionList * total_intlist = new InteractionList;
61 
62  EventGeneratorList::const_iterator evgliter; // event generator list iter
63  InteractionList::iterator intliter; // interaction list iter
64 
65  for(evgliter = fEventGeneratorList->begin();
66  evgliter != fEventGeneratorList->end(); ++evgliter) {
67 
68  const EventGeneratorI * evgen = *evgliter;
69 
70  LOG("IntLst", pINFO)
71  << "\nQuerying EventGenerator: " << evgen->Id().Key()
72  << " for its Interaction List";
73 
74  // ask the event generator to produce a list of all interaction it can
75  // generate for the input initial state
76 
77  const InteractionListGeneratorI * intlistgen = evgen->IntListGenerator();
78 
79  InteractionList * intlist = intlistgen->CreateInteractionList(init_state); // should delete ?
80 
81  LOG("IntLst", pINFO) << "\nGot list:\n" << *intlist;
82 
83  // add them to the combined interaction list
84  for(intliter = intlist->begin();
85  intliter != intlist->end(); ++intliter) {
86  Interaction * interaction = *intliter;
87  total_intlist->push_back(interaction);
88 
89  } // loop over interaction that can be generated
90  } // loop over event generators
91 
92  return total_intlist;
93 }
94 //___________________________________________________________________________
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
#define pERROR
Definition: Messenger.h:60
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:54
Definition: config.py:1
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:97
#define pINFO
Definition: Messenger.h:63
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
A vector of Interaction objects.
A vector of EventGeneratorI objects.
Module to generate only pions from cosmic rays.
string Key(void) const
Definition: AlgId.h:47
Initial State information.
Definition: InitialState.h:49