10 #include <boost/bind.hpp>
11 #include <boost/algorithm/string/classification.hpp>
12 #include <boost/algorithm/string/split.hpp>
14 #include <CLHEP/Random/RandomEngine.h>
32 void pyslha_(
int*,
int*,
int* );
36 pyslha_(&mupda, &kforig, &iretrn);
49 Pythia6Service* service = FortranInstance::getInstance<Pythia6Service>();
69 "Two Pythia6Service instances claiming Pythia6 ownership." <<
94 std::vector<std::string> setNames =
95 pythia_params.
getParameter<std::vector<std::string> >(
"parameterSets");
104 for(std::vector<std::string>::const_iterator iter = setNames.begin();
105 iter != setNames.end(); ++iter)
107 std::vector<std::string>
lines =
108 pythia_params.
getParameter< std::vector<std::string> >(*iter);
110 for(std::vector<std::string>::const_iterator
line = lines.begin();
113 if (
line->substr(0, 7) ==
"MRPY(1)")
115 "Attempted to set random number"
116 " using Pythia command 'MRPY(1)'."
118 " RandomNumberGeneratorService." <<
121 if ( *iter ==
"CSAParameters" )
125 else if ( *iter ==
"SLHAParameters" )
129 else if ( *iter ==
"PYUPDAParameters" )
158 "gen::Pythia6Service is going to initialise Pythia, as no other "
159 "instace has done so yet, and Pythia service routines have been "
160 "requested by a dummy instance." << std::endl;
163 call_pyinit(
"NONE",
"",
"", 0.0);
173 for(std::vector<std::string>::const_iterator iter =
fParamGeneral.begin();
178 <<
"Pythia did not accept \""
179 << *iter <<
"\"." << std::endl;
190 for(std::vector<std::string>::const_iterator iter =
fParamCSA.begin();
193 txgive_( iter->c_str(), iter->length() );
202 std::ostringstream pyCard1 ;
205 std::ostringstream pyCard2 ;
209 fioopn_( &fUnitSLHA, file, strlen(file) );
219 std::cout<<
"=== WRITING PYUPDA FILE "<<file<<
" ==="<<std::endl;
224 std::cout<<
"=== READING PYUPDA FILE "<<file<<
" ==="<<std::endl;
253 for (std::vector<std::string>::const_iterator iter =
fParamSLHA.begin();
257 if( iter->find(
"SLHAFILE", 0 ) == std::string::npos )
continue;
261 if( temp != std::string::npos ) {
263 end = iter->find_last_of(
"'" ) - 1;
265 start = iter->find_first_not_of(
" ", start );
266 end = iter->find_last_not_of(
" ", end );
268 std::string shortfile = iter->substr( start, end - start + 1 );
294 std::string shortfile;
295 bool write_file =
false;
296 bool usePostPyinit =
false;
302 for (std::vector<std::string>::const_iterator iter =
fParamPYUPDA.begin();
306 if( iter->find(
"PYUPDAFILE", 0 ) != std::string::npos ) {
310 if( temp != std::string::npos ) {
312 end = iter->find_last_of(
"'" ) - 1;
314 start = iter->find_first_not_of(
" ", start );
315 end = iter->find_last_not_of(
" ", end );
317 shortfile = iter->substr( start, end - start + 1 );
318 }
else if ( iter->find(
"PYUPDAWRITE", 0 ) != std::string::npos ) {
320 }
else if ( iter->find(
"PYUPDApostPYINIT", 0 ) != std::string::npos ) {
321 usePostPyinit =
true;
325 if (!shortfile.empty()) {
335 if (afterPyinit == usePostPyinit || (write_file && afterPyinit)) {
346 std::set<std::string>
blocks;
347 unsigned int model = 0, subModel = 0;
352 for(std::vector<std::string>::const_iterator iter = lines.begin();
353 iter != lines.end(); ++iter) {
356 std::string
line = *iter;
357 std::transform(line.begin(), line.end(),
358 line.begin(), (int(*)(int))std::toupper);
360 if (pos != std::string::npos)
366 if (!boost::algorithm::is_space()(line[0])) {
367 std::vector<std::string>
tokens;
369 boost::algorithm::is_space(),
370 boost::token_compress_on);
374 if (tokens.size() < 2)
376 if (tokens[0] ==
"BLOCK") {
378 blocks.insert(block);
382 if (tokens[0] ==
"DECAY") {
384 blocks.insert(block);
386 }
else if (block ==
"MODSEL") {
387 std::istringstream ss(line);
388 ss >> model >> subModel;
389 }
else if (block ==
"SMINPUTS") {
390 std::istringstream ss(line);
393 ss >> index >>
value;
402 pydat2_.pmas[0][23 - 1] =
value;
405 pydat2_.pmas[0][6 - 1] =
value;
408 pydat2_.pmas[0][15 - 1] =
value;
415 if (blocks.count(
"SMINPUTS"))
419 (pydat2_.pmas[0][23 - 1] * pydat2_.pmas[0][23 - 1]));
434 blocks.count(
"HIGMIX") ||
435 blocks.count(
"SBOTMIX") ||
436 blocks.count(
"STOPMIX") ||
437 blocks.count(
"STAUMIX") ||
438 blocks.count(
"AMIX") ||
439 blocks.count(
"NMIX") ||
440 blocks.count(
"UMIX") ||
441 blocks.count(
"VMIX"))
444 blocks.count(
"QNUMBERS") ||
445 blocks.count(
"PARTICLE") ||
446 blocks.count(
"MINPAR") ||
447 blocks.count(
"EXTPAR") ||
448 blocks.count(
"SMINPUTS") ||
449 blocks.count(
"SMINPUTS"))
451 if (blocks.count(
"MASS"))
453 if (blocks.count(
"DECAY"))
T getParameter(std::string const &) const
static void call_pyupda(int opt, int iunit)
void pyupda_(int *, int *)
void fioopn_(int *unit, const char *line, int length)
bool call_pygive(const std::string &line)
void fioopnw_(int *unit, const char *line, int length)
CLHEP::HepRandomEngine & getEngineReference()
void pyslha_(int *, int *, int *)
void setSLHAFromHeader(const std::vector< std::string > &lines)
std::vector< std::string > fParamPYUPDA
static int call_pyslha(int mupda, int kforig=0)
void setPYUPDAParams(bool afterPyinit)
std::vector< std::string > fParamGeneral
block
Formating index page's pieces.
static Pythia6Service * fPythia6Owner
CLHEP::HepRandomEngine * fRandomEngine
std::vector< std::string > fParamCSA
void openSLHA(const char *)
void openPYUPDA(const char *, bool write_file)
std::vector< std::string > fParamSLHA
std::string fullPath() const
void txgive_(const char *, int)