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"
38 py1ent_(dummy, dummy, dummy2, dummy2, dummy2);
51 void pyslha_(
int*,
int*,
int* );
55 pyslha_(&mupda, &kforig, &iretrn);
79 : fRandomEngine(
nullptr), fUnitSLHA(24), fUnitPYUPDA(25)
84 : fRandomEngine(
nullptr), fUnitSLHA(24), fUnitPYUPDA(25)
88 "Two Pythia6Service instances claiming Pythia6 ownership." <<
113 std::vector<std::string> setNames =
114 pythia_params.
getParameter<std::vector<std::string> >(
"parameterSets");
123 for(std::vector<std::string>::const_iterator
iter = setNames.begin();
126 std::vector<std::string>
lines =
127 pythia_params.
getParameter< std::vector<std::string> >(*iter);
129 for(std::vector<std::string>::const_iterator
line = lines.begin();
132 if (
line->substr(0, 7) ==
"MRPY(1)")
134 "Attempted to set random number"
135 " using Pythia command 'MRPY(1)'."
137 " RandomNumberGeneratorService." <<
140 if ( *iter ==
"CSAParameters" )
144 else if ( *iter ==
"SLHAParameters" )
148 else if ( *iter ==
"PYUPDAParameters" )
177 "gen::Pythia6Service is going to initialise Pythia, as no other "
178 "instace has done so yet, and Pythia service routines have been "
179 "requested by a dummy instance." << std::endl;
182 call_pyinit(
"NONE",
"",
"", 0.0);
197 <<
"Pythia did not accept \""
198 << *
iter <<
"\"." << std::endl;
206 #define SETCSAPARBUFSIZE 514
210 for(std::vector<std::string>::const_iterator
iter =
fParamCSA.begin();
218 if (
iter->length() <= 0)
221 size_t maxSize =
iter->length() > (SETCSAPARBUFSIZE-2) ? (SETCSAPARBUFSIZE-2) :
iter->length();
224 if (buf[maxSize-1] !=
'\n')
229 buf[maxSize + 1] = 0;
235 #undef SETCSAPARBUFSIZE
241 std::ostringstream pyCard1 ;
244 std::ostringstream pyCard2 ;
248 fioopn_( &fUnitSLHA, file, strlen(file) );
258 std::cout<<
"=== WRITING PYUPDA FILE "<<file<<
" ==="<<std::endl;
263 std::cout<<
"=== READING PYUPDA FILE "<<file<<
" ==="<<std::endl;
292 for (std::vector<std::string>::const_iterator
iter =
fParamSLHA.begin();
296 if(
iter->find(
"SLHAFILE", 0 ) == std::string::npos )
continue;
300 if( temp != std::string::npos ) {
302 end =
iter->find_last_of(
"'" ) - 1;
304 start =
iter->find_first_not_of(
" ", start );
305 end =
iter->find_last_not_of(
" ", end );
334 bool write_file =
false;
335 bool usePostPyinit =
false;
345 if(
iter->find(
"PYUPDAFILE", 0 ) != std::string::npos ) {
349 if( temp != std::string::npos ) {
351 end =
iter->find_last_of(
"'" ) - 1;
353 start =
iter->find_first_not_of(
" ", start );
354 end =
iter->find_last_not_of(
" ", end );
356 shortfile =
iter->substr( start, end - start + 1 );
357 }
else if (
iter->find(
"PYUPDAWRITE", 0 ) != std::string::npos ) {
359 }
else if (
iter->find(
"PYUPDApostPYINIT", 0 ) != std::string::npos ) {
360 usePostPyinit =
true;
364 if (!shortfile.empty()) {
374 if (afterPyinit == usePostPyinit || (write_file && afterPyinit)) {
385 std::set<std::string>
blocks;
386 unsigned int model = 0, subModel = 0;
391 for(std::vector<std::string>::const_iterator
iter = lines.begin();
397 line.begin(), (int(*)(int))std::toupper);
399 if (pos != std::string::npos)
405 if (!boost::algorithm::is_space()(line[0])) {
406 std::vector<std::string> tokens;
408 boost::algorithm::is_space(),
409 boost::token_compress_on);
413 if (tokens.size() < 2)
415 if (tokens[0] ==
"BLOCK") {
417 blocks.insert(block);
421 if (tokens[0] ==
"DECAY") {
423 blocks.insert(block);
425 }
else if (block ==
"MODSEL") {
426 std::istringstream
ss(line);
427 ss >> model >> subModel;
428 }
else if (block ==
"SMINPUTS") {
429 std::istringstream
ss(line);
432 ss >> index >>
value;
441 pydat2_.pmas[0][23 - 1] =
value;
444 pydat2_.pmas[0][6 - 1] =
value;
447 pydat2_.pmas[0][15 - 1] =
value;
454 if (blocks.count(
"SMINPUTS"))
458 (pydat2_.pmas[0][23 - 1] * pydat2_.pmas[0][23 - 1]));
473 blocks.count(
"HIGMIX") ||
474 blocks.count(
"SBOTMIX") ||
475 blocks.count(
"STOPMIX") ||
476 blocks.count(
"STAUMIX") ||
477 blocks.count(
"AMIX") ||
478 blocks.count(
"NMIX") ||
479 blocks.count(
"UMIX") ||
480 blocks.count(
"VMIX"))
483 blocks.count(
"QNUMBERS") ||
484 blocks.count(
"PARTICLE") ||
485 blocks.count(
"MINPAR") ||
486 blocks.count(
"EXTPAR") ||
487 blocks.count(
"SMINPUTS") ||
488 blocks.count(
"SMINPUTS"))
490 if (blocks.count(
"MASS"))
492 if (blocks.count(
"DECAY"))
T getParameter(std::string const &) const
static void call_pyupda(int opt, int iunit)
tuple start
Check for commandline option errors.
void pyupda_(int *, int *)
void fioopn_(int *unit, const char *line, int length)
bool call_pygive(const std::string &line)
void pyjoin_(int &njoin, int ijoin[])
void pygive_(const char *, int)
void fioopnw_(int *unit, const char *line, int length)
void pyslha_(int *, int *, int *)
tuple maxSize
'/store/data/Commissioning08/BeamHalo/RECO/StuffAlmostToP5_v1/000/061/642/10A0FE34-A67D-DD11-AD05-000...
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
static Pythia6Service * fPythia6Owner
CLHEP::HepRandomEngine * fRandomEngine
float __attribute__((vector_size(8))) float32x2_t
std::vector< std::string > fParamCSA
void openSLHA(const char *)
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
void openPYUPDA(const char *, bool write_file)
std::vector< std::string > fParamSLHA
std::string fullPath() const
void txgive_(const char *, int)