GENIEGenerator
Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for genie::XSecAlgorithmMap:
[legend]

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 <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n January 23, 2006
License:\n Copyright (c) 2003-2025, 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() [1/2]

XSecAlgorithmMap::XSecAlgorithmMap ( )

Definition at line 32 of file XSecAlgorithmMap.cxx.

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

References Init().

Referenced by Copy(), operator<<, operator=(), and XSecAlgorithmMap().

◆ XSecAlgorithmMap() [2/2]

XSecAlgorithmMap::XSecAlgorithmMap ( const XSecAlgorithmMap & xsmap)

Definition at line 38 of file XSecAlgorithmMap.cxx.

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

References Copy(), and XSecAlgorithmMap().

◆ ~XSecAlgorithmMap()

XSecAlgorithmMap::~XSecAlgorithmMap ( )

Definition at line 44 of file XSecAlgorithmMap.cxx.

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

References CleanUp().

Member Function Documentation

◆ BuildMap()

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();
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}
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
#define pWARN
Definition Messenger.h:60
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition Messenger.h:84
string Key(void) const
Definition AlgId.h:46
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition Algorithm.h:98
virtual const InteractionListGeneratorI * IntListGenerator(void) const =0
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
string AsString(void) const
virtual InteractionList * CreateInteractionList(const InitialState &init) const =0
string AsString(void) const
InteractionList * fInteractionList
const EventGeneratorList * fEventGeneratorList

References genie::InitialState::AsString(), genie::Interaction::AsString(), genie::InteractionListGeneratorI::CreateInteractionList(), genie::EventGeneratorI::CrossSectionAlg(), fEventGeneratorList, fInitState, fInteractionList, genie::Algorithm::Id(), genie::EventGeneratorI::IntListGenerator(), genie::AlgId::Key(), LOG, pINFO, pNOTICE, pWARN, and SLOG.

◆ CleanUp()

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}
vector< vector< double > > clear

References clear, fInitState, and fInteractionList.

Referenced by Reset(), and ~XSecAlgorithmMap().

◆ Copy()

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
80 XSecAlgorithmMap::const_iterator iter;
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}

References clear, Copy(), fEventGeneratorList, fInitState, fInteractionList, and XSecAlgorithmMap().

Referenced by Copy(), operator=(), and XSecAlgorithmMap().

◆ FindXSecAlgorithm()

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}

References genie::Interaction::AsString(), LOG, and pWARN.

◆ GetInteractionList()

const InteractionList & XSecAlgorithmMap::GetInteractionList ( void ) const

Definition at line 179 of file XSecAlgorithmMap.cxx.

180{
181 return *fInteractionList;
182}

References fInteractionList.

◆ Init()

void XSecAlgorithmMap::Init ( void )
private

Definition at line 55 of file XSecAlgorithmMap.cxx.

56{
58
59 fInitState = new InitialState;
60 fInteractionList = new InteractionList;
61}

References fEventGeneratorList, fInitState, and fInteractionList.

Referenced by Reset(), and XSecAlgorithmMap().

◆ operator=()

XSecAlgorithmMap & XSecAlgorithmMap::operator= ( const XSecAlgorithmMap & xsmap)

Definition at line 201 of file XSecAlgorithmMap.cxx.

202{
203 this->Copy(xs);
204 return (*this);
205}

References Copy(), and XSecAlgorithmMap().

◆ Print()

void XSecAlgorithmMap::Print ( ostream & stream) const

Definition at line 184 of file XSecAlgorithmMap.cxx.

185{
186 XSecAlgorithmMap::const_iterator iter;
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}

References genie::Algorithm::Id(), and genie::AlgId::Key().

Referenced by operator<<.

◆ Reset()

void XSecAlgorithmMap::Reset ( void )

Definition at line 49 of file XSecAlgorithmMap.cxx.

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

References CleanUp(), and Init().

◆ UseGeneratorList()

void XSecAlgorithmMap::UseGeneratorList ( const EventGeneratorList * list)

Definition at line 90 of file XSecAlgorithmMap.cxx.

91{
93}

References fEventGeneratorList.

◆ operator<<

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 }

References Print(), and XSecAlgorithmMap().

Member Data Documentation

◆ fEventGeneratorList

const EventGeneratorList* genie::XSecAlgorithmMap::fEventGeneratorList
private

Definition at line 68 of file XSecAlgorithmMap.h.

Referenced by BuildMap(), Copy(), Init(), and UseGeneratorList().

◆ fInitState

InitialState* genie::XSecAlgorithmMap::fInitState
private

Definition at line 70 of file XSecAlgorithmMap.h.

Referenced by BuildMap(), CleanUp(), Copy(), and Init().

◆ fInteractionList

InteractionList* genie::XSecAlgorithmMap::fInteractionList
private

Definition at line 71 of file XSecAlgorithmMap.h.

Referenced by BuildMap(), CleanUp(), Copy(), GetInteractionList(), and Init().


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