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

An Interaction -> XSecAlgorithmI associative container. The container is being built for the loaded EventGeneratorList and for the input InitialState object. More...

#include <XSecAlgorithmMap.h>

Inheritance diagram for genie::XSecAlgorithmMap:

Public Member Functions

 XSecAlgorithmMap ()
 
 XSecAlgorithmMap (const XSecAlgorithmMap &xsmap)
 
 ~XSecAlgorithmMap ()
 
void UseGeneratorList (const EventGeneratorList *list)
 
void BuildMap (const InitialState &init_state)
 
const XSecAlgorithmIFindXSecAlgorithm (const Interaction *in) const
 
const InteractionListGetInteractionList (void) const
 
void Reset (void)
 
void Copy (const XSecAlgorithmMap &xsmap)
 
void Print (ostream &stream) const
 
XSecAlgorithmMapoperator= (const XSecAlgorithmMap &xsmap)
 

Private Member Functions

void Init (void)
 
void CleanUp (void)
 

Private Attributes

const EventGeneratorListfEventGeneratorList
 
InitialStatefInitState
 
InteractionListfInteractionList
 

Friends

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

Detailed Description

An Interaction -> XSecAlgorithmI associative container. The container is being built for the loaded EventGeneratorList and for the input InitialState object.

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 42 of file XSecAlgorithmMap.h.

Constructor & Destructor Documentation

XSecAlgorithmMap::XSecAlgorithmMap ( )

Definition at line 32 of file XSecAlgorithmMap.cxx.

32  :
33 map<string, const XSecAlgorithmI *> ()
34 {
35  this->Init();
36 }
XSecAlgorithmMap::XSecAlgorithmMap ( const XSecAlgorithmMap xsmap)

Definition at line 38 of file XSecAlgorithmMap.cxx.

38  :
39 map<string, const XSecAlgorithmI *> ()
40 {
41  this->Copy(xsmap);
42 }
void Copy(const XSecAlgorithmMap &xsmap)
XSecAlgorithmMap::~XSecAlgorithmMap ( )

Definition at line 44 of file XSecAlgorithmMap.cxx.

45 {
46  this->CleanUp();
47 }

Member Function Documentation

void XSecAlgorithmMap::BuildMap ( const InitialState init_state)

Definition at line 95 of file XSecAlgorithmMap.cxx.

96 {
97  LOG("XSecAlgMap", pNOTICE)
98  << "Building 'interaction' -> 'xsec algorithm' associations";
99  LOG("XSecAlgMap", pNOTICE)
100  << "Using all simulated interactions for init-state: "
101  << init_state.AsString();
102  if(!fEventGeneratorList) {
103  LOG("XSecAlgMap", pWARN)
104  << "No EventGeneratorList was loaded. Will not build XSecAlgorithmMap";
105  return;
106  }
107 
108  fInitState->Copy(init_state);
109 
110  EventGeneratorList::const_iterator evgliter; // event generator list iter
111  InteractionList::iterator intliter; // interaction list iter
112 
113  // loop over all EventGenerator objects used in the current job
114  for(evgliter = fEventGeneratorList->begin();
115  evgliter != fEventGeneratorList->end(); ++evgliter) {
116  // current EventGenerator
117  const EventGeneratorI * evgen = *evgliter;
118  assert(evgen);
119 
120  // ask the event generator to produce a list of all interaction it can
121  // generate for the input initial state
122  LOG("XSecAlgMap", pNOTICE)
123  << "Querying [" << evgen->Id().Key() << "] for its InteractionList";
124 
125  const InteractionListGeneratorI * ilstgen = evgen->IntListGenerator();
126  InteractionList * ilst = ilstgen->CreateInteractionList(init_state);
127 
128  // no point to go on if the list is NULL - continue to next iteration
129  if(!ilst) continue;
130 
131  // append the new InteractionList to the local copy
132  fInteractionList->Append(*ilst);
133 
134  // cross section algorithm used by this EventGenerator
135  const XSecAlgorithmI * xsec_alg = evgen->CrossSectionAlg();
136 
137  // loop over all interaction that can be genererated by the current
138  // EventGenerator and link all of them to the current XSecAlgorithmI
139  for(intliter = ilst->begin(); intliter != ilst->end(); ++intliter)
140  {
141  // current interaction
142  Interaction * interaction = *intliter;
143  string code = interaction->AsString();
144 
145  // link with the xsec algorithm
146  SLOG("XSecAlgMap", pINFO)
147  << "\nLinking: " << code
148  << "\n --> with xsec algorithm: " << xsec_alg->Id().Key();
149  this->insert(
150  map<string, const XSecAlgorithmI *>::value_type(code,xsec_alg));
151 
152  } // loop over interactions
153  delete ilst;
154  ilst = 0;
155  } // loop over event generators
156 }
Cross Section Calculation Interface.
intermediate_table::iterator iterator
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
virtual const InteractionListGeneratorI * IntListGenerator(void) const =0
const EventGeneratorList * fEventGeneratorList
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
#define pINFO
Definition: Messenger.h:62
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
#define pWARN
Definition: Messenger.h:60
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
void Append(const InteractionList &intl)
InteractionList * fInteractionList
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
void XSecAlgorithmMap::CleanUp ( void  )
private

Definition at line 63 of file XSecAlgorithmMap.cxx.

64 {
65  delete fInitState;
66  delete fInteractionList;
67 
68  this->clear();
69 }
InteractionList * fInteractionList
vector< vector< double > > clear
void XSecAlgorithmMap::Copy ( const XSecAlgorithmMap xsmap)

Definition at line 71 of file XSecAlgorithmMap.cxx.

72 {
74 
75  fInitState -> Copy (*xsmap.fInitState);
77 
78  this->clear();
79 
81 
82  for(iter = xsmap.begin(); iter != xsmap.end(); ++iter) {
83  string code = iter->first;
84  const XSecAlgorithmI * alg = iter->second;
85 
86  this->insert(map<string, const XSecAlgorithmI *>::value_type(code,alg));
87  }
88 }
Cross Section Calculation Interface.
const EventGeneratorList * fEventGeneratorList
intermediate_table::const_iterator const_iterator
void Copy(const XSecAlgorithmMap &xsmap)
CodeOutputInterface * code
InteractionList * fInteractionList
vector< vector< double > > clear
const XSecAlgorithmI * XSecAlgorithmMap::FindXSecAlgorithm ( const Interaction in) const

Definition at line 158 of file XSecAlgorithmMap.cxx.

160 {
161  if(!interaction) {
162  LOG("XSecAlgMap", pWARN) << "Null interaction!!";
163  return 0;
164  }
165 
166  string code = interaction->AsString();
167 
168  XSecAlgorithmMap::const_iterator xsec_alg_iter = this->find(code);
169  if(xsec_alg_iter == this->end()) {
170  LOG("XSecAlgMap", pWARN)
171  << "No XSecAlgorithmI was found for interaction: \n" << code;
172  return 0;
173  }
174 
175  const XSecAlgorithmI * xsec_alg = xsec_alg_iter->second;
176  return xsec_alg;
177 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Cross Section Calculation 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 & XSecAlgorithmMap::GetInteractionList ( void  ) const

Definition at line 179 of file XSecAlgorithmMap.cxx.

180 {
181  return *fInteractionList;
182 }
InteractionList * fInteractionList
void XSecAlgorithmMap::Init ( void  )
private

Definition at line 55 of file XSecAlgorithmMap.cxx.

56 {
58 
61 }
const EventGeneratorList * fEventGeneratorList
InteractionList * fInteractionList
A vector of Interaction objects.
Initial State information.
Definition: InitialState.h:48
XSecAlgorithmMap & XSecAlgorithmMap::operator= ( const XSecAlgorithmMap xsmap)

Definition at line 201 of file XSecAlgorithmMap.cxx.

202 {
203  this->Copy(xs);
204  return (*this);
205 }
void Copy(const XSecAlgorithmMap &xsmap)
void XSecAlgorithmMap::Print ( ostream &  stream) const

Definition at line 184 of file XSecAlgorithmMap.cxx.

185 {
187 
188  stream<< "Printing 'interaction' -> 'xsec algorithm' associations" << endl;
189 
190  for(iter = this->begin(); iter != this->end(); ++iter) {
191  string code = iter->first;
192  const XSecAlgorithmI * alg = iter->second;
193  if(alg) {
194  stream << code << " -> " << alg->Id().Key() << endl;
195  } else {
196  stream << code << " -> **** NULL XSEC ALGORITHM ****" << endl;
197  }
198  }
199 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Cross Section Calculation Interface.
intermediate_table::const_iterator const_iterator
CodeOutputInterface * code
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
string Key(void) const
Definition: AlgId.h:46
QTextStream & endl(QTextStream &s)
void XSecAlgorithmMap::Reset ( void  )

Definition at line 49 of file XSecAlgorithmMap.cxx.

50 {
51  this->CleanUp();
52  this->Init();
53 }
void XSecAlgorithmMap::UseGeneratorList ( const EventGeneratorList list)

Definition at line 90 of file XSecAlgorithmMap.cxx.

91 {
92  fEventGeneratorList = list;
93 }
const EventGeneratorList * fEventGeneratorList

Friends And Related Function Documentation

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

Definition at line 25 of file XSecAlgorithmMap.cxx.

26  {
27  intl.Print(stream);
28  return stream;
29  }

Member Data Documentation

const EventGeneratorList* genie::XSecAlgorithmMap::fEventGeneratorList
private

Definition at line 68 of file XSecAlgorithmMap.h.

InitialState* genie::XSecAlgorithmMap::fInitState
private

Definition at line 70 of file XSecAlgorithmMap.h.

InteractionList* genie::XSecAlgorithmMap::fInteractionList
private

Definition at line 71 of file XSecAlgorithmMap.h.


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