Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
genie::InteractionGeneratorMap Class Reference

An Interaction -> EventGeneratorI associative container. The container is being built for the loaded EventGeneratorList and for the input InitialState object and is being used to locate the generator that can generate aany given interaction. More...

#include <InteractionGeneratorMap.h>

Inheritance diagram for genie::InteractionGeneratorMap:

Public Member Functions

 InteractionGeneratorMap ()
 
 InteractionGeneratorMap (const InteractionGeneratorMap &igmap)
 
 ~InteractionGeneratorMap ()
 
void UseGeneratorList (const EventGeneratorList *list)
 
void BuildMap (const InitialState &init_state)
 
const EventGeneratorIFindGenerator (const Interaction *in) const
 
const InteractionListGetInteractionList (void) const
 
void Reset (void)
 
void Copy (const InteractionGeneratorMap &xsmap)
 
void Print (ostream &stream) const
 
InteractionGeneratorMapoperator= (const InteractionGeneratorMap &xsmap)
 

Private Member Functions

void Init (void)
 
void CleanUp (void)
 

Private Attributes

const EventGeneratorListfEventGeneratorList
 
InitialStatefInitState
 
InteractionListfInteractionList
 

Friends

ostream & operator<< (ostream &stream, const InteractionGeneratorMap &xsmap)
 

Detailed Description

An Interaction -> EventGeneratorI associative container. The container is being built for the loaded EventGeneratorList and for the input InitialState object and is being used to locate the generator that can generate aany given interaction.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

January 23, 2006

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 44 of file InteractionGeneratorMap.h.

Constructor & Destructor Documentation

InteractionGeneratorMap::InteractionGeneratorMap ( )

Definition at line 37 of file InteractionGeneratorMap.cxx.

37  :
38 map<string, const EventGeneratorI *> ()
39 {
40  this->Init();
41 }
InteractionGeneratorMap::InteractionGeneratorMap ( const InteractionGeneratorMap igmap)

Definition at line 43 of file InteractionGeneratorMap.cxx.

44  :
45 map<string, const EventGeneratorI *> ()
46 {
47  this->Copy(igmap);
48 }
void Copy(const InteractionGeneratorMap &xsmap)
InteractionGeneratorMap::~InteractionGeneratorMap ( )

Definition at line 50 of file InteractionGeneratorMap.cxx.

51 {
52  this->CleanUp();
53 }

Member Function Documentation

void InteractionGeneratorMap::BuildMap ( const InitialState init_state)

Definition at line 101 of file InteractionGeneratorMap.cxx.

102 {
103  SLOG("IntGenMap", pDEBUG)
104  << "Building 'interaction' -> 'generator' associations";
105  SLOG("IntGenMap", pNOTICE)
106  << "Using all simulated interactions for init-state: "
107  << init_state.AsString();
108  if(!fEventGeneratorList) {
109  LOG("IntGenMap", pWARN) << "No EventGeneratorList was loaded!!";
110  return;
111  }
112 
113  fInitState->Copy(init_state);
114 
115  EventGeneratorList::const_iterator evgliter; // event generator list iter
116  InteractionList::iterator intliter; // interaction list iter
117 
118  // loop over all EventGenerator objects used in the current job
119  for(evgliter = fEventGeneratorList->begin();
120  evgliter != fEventGeneratorList->end(); ++evgliter) {
121  // current EventGenerator
122  const EventGeneratorI * evgen = *evgliter;
123  assert(evgen);
124 
125  // ask the event generator to produce a list of all interaction it can
126  // generate for the input initial state
127  SLOG("IntGenMap", pNOTICE)
128  << "Querying [" << evgen->Id().Key() << "] for its InteractionList";
129 
130  const InteractionListGeneratorI * ilstgen = evgen->IntListGenerator();
131  InteractionList * ilst = ilstgen->CreateInteractionList(init_state);
132 
133  // no point to go on if the list is NULL - continue to next iteration
134  if(!ilst) continue;
135 
136  // append the new InteractionList to the local copy
137  fInteractionList->Append(*ilst);
138 
139  // loop over all interaction that can be genererated by the current
140  // EventGenerator and link all of them to iy
141  for(intliter = ilst->begin(); intliter != ilst->end(); ++intliter)
142  {
143  // current interaction
144  Interaction * interaction = *intliter;
145  string code = interaction->AsString();
146 
147  SLOG("IntGenMap", pDEBUG)
148  << "\nLinking: " << code << " --> to: " << evgen->Id().Key();
149  this->insert(
150  map<string, const EventGeneratorI *>::value_type(code,evgen));
151  } // loop over interactions
152  delete ilst;
153  ilst = 0;
154  } // loop over event generators
155 }
intermediate_table::iterator iterator
const EventGeneratorList * fEventGeneratorList
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
virtual const InteractionListGeneratorI * IntListGenerator(void) const =0
Defines the EventGeneratorI interface.
intermediate_table::const_iterator const_iterator
string AsString(void) const
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
void Copy(const InitialState &init_state)
string AsString(void) const
CodeOutputInterface * code
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
#define pWARN
Definition: Messenger.h:60
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
void Append(const InteractionList &intl)
A vector of Interaction objects.
#define pNOTICE
Definition: Messenger.h:61
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:84
Event Generation using GENIE, cosmics or single particles.
string Key(void) const
Definition: AlgId.h:46
#define pDEBUG
Definition: Messenger.h:63
void InteractionGeneratorMap::CleanUp ( void  )
private

Definition at line 69 of file InteractionGeneratorMap.cxx.

70 {
71  delete fInitState;
72  delete fInteractionList;
73 
74  this->clear();
75 }
vector< vector< double > > clear
void InteractionGeneratorMap::Copy ( const InteractionGeneratorMap xsmap)

Definition at line 77 of file InteractionGeneratorMap.cxx.

78 {
80 
81  fInitState -> Copy (*xsmap.fInitState);
83 
84  this->clear();
85 
87 
88  for(iter = xsmap.begin(); iter != xsmap.end(); ++iter) {
89  string code = iter->first;
90  const EventGeneratorI * evg = iter->second;
91 
92  this->insert(map<string, const EventGeneratorI *>::value_type(code,evg));
93  }
94 }
const EventGeneratorList * fEventGeneratorList
Defines the EventGeneratorI interface.
void Copy(const InteractionGeneratorMap &xsmap)
intermediate_table::const_iterator const_iterator
CodeOutputInterface * code
vector< vector< double > > clear
const EventGeneratorI * InteractionGeneratorMap::FindGenerator ( const Interaction in) const

Definition at line 157 of file InteractionGeneratorMap.cxx.

159 {
160  if(!interaction) {
161  LOG("IntGenMap", pWARN) << "Null interaction!!";
162  return 0;
163  }
164  string code = interaction->AsString();
165  InteractionGeneratorMap::const_iterator evgiter = this->find(code);
166  if(evgiter == this->end()) {
167  LOG("IntGenMap", pWARN)
168  << "No EventGeneratorI was found for interaction: \n" << code;
169  return 0;
170  }
171  const EventGeneratorI * evg = evgiter->second;
172  return evg;
173 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Defines the EventGeneratorI interface.
intermediate_table::const_iterator const_iterator
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
CodeOutputInterface * code
#define pWARN
Definition: Messenger.h:60
const InteractionList & InteractionGeneratorMap::GetInteractionList ( void  ) const

Definition at line 175 of file InteractionGeneratorMap.cxx.

176 {
177  return *fInteractionList;
178 }
void InteractionGeneratorMap::Init ( void  )
private

Definition at line 61 of file InteractionGeneratorMap.cxx.

62 {
64 
67 }
const EventGeneratorList * fEventGeneratorList
A vector of Interaction objects.
Initial State information.
Definition: InitialState.h:48
InteractionGeneratorMap & InteractionGeneratorMap::operator= ( const InteractionGeneratorMap xsmap)

Definition at line 203 of file InteractionGeneratorMap.cxx.

205 {
206  this->Copy(igmap);
207  return (*this);
208 }
void Copy(const InteractionGeneratorMap &xsmap)
void InteractionGeneratorMap::Print ( ostream &  stream) const

Definition at line 180 of file InteractionGeneratorMap.cxx.

181 {
182  stream << endl;
183 
185 
186  unsigned int maxlen = 0;
187  for(iter = this->begin(); iter != this->end(); ++iter) {
188  string icode = iter->first;
189  unsigned int isz = (unsigned int) icode.size();
190  maxlen=TMath::Max(maxlen,isz);
191  }
192 
193  for(iter = this->begin(); iter != this->end(); ++iter) {
194  const EventGeneratorI * evg = iter->second;
195  string intstr = iter->first;
196  string evgstr = (evg) ? evg->Id().Key() : "** NULL EVENT GENERATOR **";
197 
198  stream << setfill(' ') << setw(maxlen)
199  << intstr << " --> " << evgstr << endl;
200  }
201 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
static const int maxlen
Definition: qregexp.cpp:904
Defines the EventGeneratorI interface.
intermediate_table::const_iterator const_iterator
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
string Key(void) const
Definition: AlgId.h:46
QTextStream & endl(QTextStream &s)
void InteractionGeneratorMap::Reset ( void  )

Definition at line 55 of file InteractionGeneratorMap.cxx.

56 {
57  this->CleanUp();
58  this->Init();
59 }
void InteractionGeneratorMap::UseGeneratorList ( const EventGeneratorList list)

Definition at line 96 of file InteractionGeneratorMap.cxx.

97 {
99 }
const EventGeneratorList * fEventGeneratorList
static QStrList * l
Definition: config.cpp:1044

Friends And Related Function Documentation

ostream& operator<< ( ostream &  stream,
const InteractionGeneratorMap xsmap 
)
friend

Definition at line 30 of file InteractionGeneratorMap.cxx.

31  {
32  intl.Print(stream);
33  return stream;
34  }

Member Data Documentation

const EventGeneratorList* genie::InteractionGeneratorMap::fEventGeneratorList
private

Definition at line 69 of file InteractionGeneratorMap.h.

InitialState* genie::InteractionGeneratorMap::fInitState
private

Definition at line 71 of file InteractionGeneratorMap.h.

InteractionList* genie::InteractionGeneratorMap::fInteractionList
private

Definition at line 72 of file InteractionGeneratorMap.h.


The documentation for this class was generated from the following files: