00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #include "GeneratorInterface/Pythia6Interface/interface/PythiaSource.h"
00018 #include "GeneratorInterface/Pythia6Interface/interface/PYR.h"
00019 #include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
00020 #include "SimDataFormats/HepMCProduct/interface/GenInfoProduct.h"
00021 #include "FWCore/Framework/interface/Event.h"
00022 #include "FWCore/Framework/interface/Run.h"
00023 #include "FWCore/ServiceRegistry/interface/Service.h"
00024 #include "FWCore/Utilities/interface/RandomNumberGenerator.h"
00025 #include "CLHEP/Random/RandFlat.h"
00026
00027
00028 #include <iostream>
00029 #include "time.h"
00030
00031 using namespace edm;
00032 using namespace std;
00033
00034
00035 #include "HepMC/PythiaWrapper6_2.h"
00036 #include "HepMC/IO_HEPEVT.h"
00037
00038
00039
00040 #define N pyjets.n
00041 #define NPAD pyjets.npad
00042 #define K(a,b) pyjets.k[b-1][a-1]
00043 #define P(a,b) pyjets.p[b-1][a-1]
00044 #define V(a,b) pyjets.v[b-1][a-1]
00045
00046 #define PYGIVE pygive_
00047 extern "C" {
00048 void PYGIVE(const char*,int length);
00049 }
00050
00051 #define PY1ENT py1ent_
00052 extern "C" {
00053 void PY1ENT(int& ip, int& kf, double& pe, double& the, double& phi);
00054 }
00055
00056 #define PYROBO pyrobo_
00057 extern "C" {
00058 void PYROBO(int& first, int& last, double& the, double& phi, double& bx, double& by, double& bz);
00059 }
00060
00061 #define PYMASS pymass_
00062 extern "C" {
00063 double PYMASS(int& kf);
00064 }
00065
00066 #define PYEXEC pyexec_
00067 extern "C" {
00068 void PYEXEC();
00069 }
00070
00071 #define PYCOMP pycomp_
00072 extern "C" {
00073 int PYCOMP(int& ip);
00074 }
00075
00076 #define TXGIVE txgive_
00077 extern "C" {
00078 void TXGIVE(const char*,int length);
00079 }
00080
00081 #define TXGIVE_INIT txgive_init_
00082 extern "C" {
00083 void TXGIVE_INIT();
00084 }
00085
00086 #define SLHAGIVE slhagive_
00087 extern "C" {
00088 void SLHAGIVE(const char*,int length);
00089 }
00090
00091 #define SLHA_INIT slha_init_
00092 extern "C" {
00093 void SLHA_INIT();
00094 }
00095
00096 #define PYGLFR pyglfr_
00097 extern "C" {
00098 void PYGLFR();
00099 }
00100
00101 #define PYGLRHAD pyglrhad_
00102 extern "C" {
00103 void PYGLRHAD();
00104 }
00105
00106 #define PYSTFR pyglfr_
00107 extern "C" {
00108 void PYSTLFR();
00109 }
00110
00111 #define PYSTRHAD pystrhad_
00112 extern "C" {
00113 void PYSTRHAD();
00114 }
00115
00116 namespace {
00117 HepRandomEngine& getEngineReference()
00118 {
00119
00120 Service<RandomNumberGenerator> rng;
00121 if(!rng.isAvailable()) {
00122 throw cms::Exception("Configuration")
00123 << "The RandomNumberProducer module requires the RandomNumberGeneratorService\n"
00124 "which appears to be absent. Please add that service to your configuration\n"
00125 "or remove the modules that require it.";
00126 }
00127
00128
00129 return (rng->getEngine());
00130 }
00131 }
00132
00133
00134 HepMC::IO_HEPEVT conv;
00135
00136
00137 static const unsigned long kNanoSecPerSec = 1000000000;
00138 static const unsigned long kAveEventPerSec = 200;
00139
00140 PythiaSource::PythiaSource( const ParameterSet & pset,
00141 InputSourceDescription const& desc ) :
00142 GeneratedInputSource(pset, desc), evt(0),
00143 pythiaPylistVerbosity_ (pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0)),
00144 pythiaHepMCVerbosity_ (pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false)),
00145 imposeProperTimes_ (pset.getUntrackedParameter<bool>("imposeProperTimes",false)),
00146 maxEventsToPrint_ (pset.getUntrackedParameter<int>("maxEventsToPrint",1)),
00147 extCrossSect(pset.getUntrackedParameter<double>("crossSection", -1.)),
00148 extFilterEff(pset.getUntrackedParameter<double>("filterEfficiency", -1.)),
00149 comenergy(pset.getUntrackedParameter<double>("comEnergy",14000.)),
00150 useExternalGenerators_(false),
00151 useTauola_(false),
00152 useTauolaPolarization_(false),
00153 stopHadronsEnabled(false), gluinoHadronsEnabled(false),
00154 fRandomEngine(getEngineReference())
00155 {
00156
00157
00158
00159 pythiaPylistVerbosity_ = pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0);
00160
00161
00162 pythiaHepMCVerbosity_ = pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false);
00163
00164
00165 maxEventsToPrint_ = pset.getUntrackedParameter<int>("maxEventsToPrint",0);
00166
00167 particleID = pset.getUntrackedParameter<int>("ParticleID", 0);
00168
00169 particleIDs =
00170 pset.getUntrackedParameter<std::vector<int> >("ParticleIDs",
00171 std::vector<int>(0));
00172
00173
00174 randomEngine = &fRandomEngine;
00175 fRandomGenerator = new CLHEP::RandFlat(fRandomEngine) ;
00176
00177 if(particleID) {
00178
00179 cout <<" Particle ID = " << particleID << endl;
00180
00181 doubleParticle = pset.getUntrackedParameter<bool>("DoubleParticle",true);
00182 cout <<" double back-to-back " << doubleParticle << endl;
00183
00184 kinedata = pset.getUntrackedParameter<string>("kinematicsFile","");
00185
00186 ptmin = pset.getUntrackedParameter<double>("Ptmin",20.);
00187 ptmax = pset.getUntrackedParameter<double>("Ptmax",420.);
00188 cout <<" ptmin = " << ptmin <<" ptmax = " << ptmax << endl;
00189
00190 emin = pset.getUntrackedParameter<double>("Emin",-1);
00191 emax = pset.getUntrackedParameter<double>("Emax",-1);
00192 if ( emin > 0 && emax > 0 ) {
00193 cout <<" emin = " << emin <<" emax = " << emax << endl;
00194 }
00195
00196 if(kinedata.size() < 1){
00197 etamin = pset.getUntrackedParameter<double>("Etamin",0.);
00198 etamax = pset.getUntrackedParameter<double>("Etamax",2.2);
00199 cout <<" etamin = " << etamin <<" etamax = " << etamax << endl;
00200 }else{
00201 ymin = pset.getUntrackedParameter<double>("ymin",0.);
00202 ymax = pset.getUntrackedParameter<double>("ymax",10.);
00203 cout <<" ymin = " << ymin <<" ymax = " << ymax << endl;
00204 }
00205
00206
00207 phimin = pset.getUntrackedParameter<double>("Phimin",0.);
00208 phimax = pset.getUntrackedParameter<double>("Phimax",360.);
00209 cout <<" phimin = " << phimin <<" phimax = " << phimax << endl;
00210
00211 if(kinedata.size() > 0)
00212 {
00213 int ptbins = pset.getUntrackedParameter<int>("ptBinning",1000);
00214 int ybins = pset.getUntrackedParameter<int>("yBinning",50);
00215 fPtYGenerator = new PtYDistributor(kinedata, fRandomEngine,
00216 ptmax, ptmin, ymax, ymin, ptbins, ybins);
00217 }
00218 } else if ( particleIDs.size() > 1 ) {
00219
00220
00221
00222
00223
00224
00225
00226
00227 emin = pset.getUntrackedParameter<double>("Emin",0.5);
00228 emax = pset.getUntrackedParameter<double>("Emax",2.0);
00229
00230
00231 ptmin = pset.getUntrackedParameter<double>("Pmin",20.);
00232 ptmax = pset.getUntrackedParameter<double>("Pmax",20.);
00233
00234
00235 etamin = pset.getUntrackedParameter<double>("Etamin",0.);
00236 etamax = pset.getUntrackedParameter<double>("Etamax",2.2);
00237
00238
00239 phimin = pset.getUntrackedParameter<double>("Phimin",-3.1415926536);
00240 phimax = pset.getUntrackedParameter<double>("Phimax",+3.1415926536);
00241
00242 }
00243
00244
00245 ParameterSet pythia_params =
00246 pset.getParameter<ParameterSet>("PythiaParameters") ;
00247
00248
00249
00250 vector<string> setNames =
00251 pythia_params.getParameter<vector<string> >("parameterSets");
00252
00253
00254 for ( unsigned i=0; i<setNames.size(); ++i ) {
00255
00256 string mySet = setNames[i];
00257
00258
00259 vector<string> pars =
00260 pythia_params.getParameter<vector<string> >(mySet);
00261
00262 if (mySet != "SLHAParameters" && mySet != "CSAParameters"){
00263
00264
00265 for( vector<string>::const_iterator
00266 itPar = pars.begin(); itPar != pars.end(); ++itPar ) {
00267 static string sRandomValueSetting("MRPY(1)");
00268 if( 0 == itPar->compare(0,sRandomValueSetting.size(),sRandomValueSetting) ) {
00269 throw edm::Exception(edm::errors::Configuration,"PythiaError")
00270 <<" attempted to set random number using pythia command 'MRPY(1)' this is not allowed.\n Please use the RandomNumberGeneratorService to set the random number seed.";
00271 }
00272 if( ! call_pygive(*itPar) ) {
00273 throw edm::Exception(edm::errors::Configuration,"PythiaError")
00274 <<" pythia did not accept the following \""<<*itPar<<"\"";
00275 }
00276 }
00277 } else if(mySet == "CSAParameters"){
00278
00279
00280
00281 pars = pythia_params.getParameter<vector<string> >("CSAParameters");
00282
00283 call_txgive_init();
00284
00285
00286
00287 for (vector<string>::const_iterator
00288 itPar = pars.begin(); itPar != pars.end(); ++itPar) {
00289 call_txgive(*itPar);
00290
00291 }
00292
00293 } else if(mySet == "SLHAParameters"){
00294
00295
00296
00297 pars = pythia_params.getParameter<vector<string> >("SLHAParameters");
00298
00299
00300 for (vector<string>::const_iterator
00301 itPar = pars.begin(); itPar != pars.end(); ++itPar) {
00302 call_slhagive(*itPar);
00303
00304 }
00305
00306 call_slha_init();
00307
00308 }
00309 }
00310
00311 stopHadronsEnabled = pset.getUntrackedParameter<bool>("stopHadrons",false);
00312 gluinoHadronsEnabled = pset.getUntrackedParameter<bool>("gluinoHadrons",false);
00313
00314
00315 if(stopHadronsEnabled) PYSTRHAD();
00316 if(gluinoHadronsEnabled) PYGLRHAD();
00317
00318
00319
00320
00321 #ifdef NOTYET
00322 edm::Service<RandomNumberGenerator> rng;
00323 uint32_t seed = rng->mySeed();
00324 ostringstream sRandomSet;
00325 sRandomSet <<"MRPY(1)="<<seed;
00326 call_pygive(sRandomSet.str());
00327 #endif
00328
00329 if(particleID || particleIDs.size() > 1 )
00330 {
00331 call_pyinit( "NONE", "p", "p", comenergy );
00332 } else {
00333 call_pyinit( "CMS", "p", "p", comenergy );
00334 }
00335
00336
00337
00338 useExternalGenerators_ = pset.getUntrackedParameter<bool>("UseExternalGenerators",false);
00339
00340
00341
00342 if ( useExternalGenerators_ ) {
00343
00344 ParameterSet ext_gen_params =
00345 pset.getParameter<ParameterSet>("ExternalGenerators") ;
00346 vector<string> extGenNames =
00347 ext_gen_params.getParameter< vector<string> >("parameterSets");
00348 for (unsigned int ip=0; ip<extGenNames.size(); ++ip )
00349 {
00350 string curSet = extGenNames[ip];
00351 ParameterSet gen_par_set =
00352 ext_gen_params.getUntrackedParameter< ParameterSet >(curSet);
00353
00354
00355
00356
00357
00358 if ( curSet == "Tauola" )
00359 {
00360 useTauola_ = true;
00361 if ( useTauola_ ) {
00362 cout << "--> use TAUOLA" << endl;
00363 }
00364 useTauolaPolarization_ = gen_par_set.getParameter<bool>("UseTauolaPolarization");
00365 if ( useTauolaPolarization_ )
00366 {
00367 cout << "(Polarization effects enabled)" << endl;
00368 tauola_.enablePolarizationEffects();
00369 }
00370 else
00371 {
00372 cout << "(Polarization effects disabled)" << endl;
00373 tauola_.disablePolarizationEffects();
00374 }
00375 vector<string> cards = gen_par_set.getParameter< vector<string> >("InputCards");
00376 cout << "----------------------------------------------" << endl;
00377 cout << "Initializing Tauola" << endl;
00378 for( vector<string>::const_iterator
00379 itPar = cards.begin(); itPar != cards.end(); ++itPar )
00380 {
00381 call_txgive(*itPar);
00382 }
00383 tauola_.initialize();
00384
00385 }
00386 }
00387
00388 }
00389
00390
00391 cout << endl;
00392
00393
00394 produces<HepMCProduct>();
00395 produces<GenInfoProduct, edm::InRun>();
00396 }
00397
00398
00399 PythiaSource::~PythiaSource(){
00400 clear();
00401 }
00402
00403 void PythiaSource::clear() {
00404
00405 }
00406
00407 void PythiaSource::endRun(Run & r) {
00408
00409 double cs = pypars.pari[0];
00410 auto_ptr<GenInfoProduct> giprod (new GenInfoProduct());
00411 giprod->set_cross_section(cs);
00412 giprod->set_external_cross_section(extCrossSect);
00413 giprod->set_filter_efficiency(extFilterEff);
00414 r.put(giprod);
00415
00416 call_pystat(1);
00417 if ( useTauola_ ) {
00418 tauola_.print();
00419
00420 }
00421
00422 }
00423
00424 bool PythiaSource::produce(Event & e) {
00425
00426 auto_ptr<HepMCProduct> bare_product(new HepMCProduct());
00427
00428
00429
00430 if(particleID)
00431 {
00432 double pi = 3.1415927;
00433 int ip = 1;
00434 int dum;
00435 double ee=0,the=0,eta=0;
00436 double pmass = PYMASS(particleID);
00437 double phi = (phimax-phimin)*pyr_(&dum)+phimin;
00438
00439 if(kinedata.size() < 1){
00440 double pt = (ptmax-ptmin)*pyr_(&dum)+ptmin;
00441 double e = (emax-emin)*pyr_(&dum)+emin;
00442 eta = (etamax-etamin)*pyr_(&dum)+etamin;
00443 the = 2.*atan(exp(-eta));
00444 if ( emin > pmass && emax > pmass ) {
00445 ee = e;
00446 } else {
00447 double pe = pt/sin(the);
00448 ee = sqrt(pe*pe+pmass*pmass);
00449 }
00450 }else{
00451 double pt = fPtYGenerator->firePt();
00452 double y = fPtYGenerator->fireY();
00453 double u = exp(y);
00454 ee = 0.5*sqrt(pmass*pmass+pt*pt)*(u*u+1)/u;
00455 double pz = sqrt(ee*ee-pt*pt-pmass*pmass);
00456 if(y<0) pz = -pz;
00457 the = atan(pt/pz);
00458 if(pz < 0) the = pi + the;
00459 eta = -log(tan(the/2));
00460 }
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471 phi = phi * (3.1415927/180.);
00472
00473 PY1ENT(ip, particleID, ee, the, phi);
00474
00475 if(doubleParticle)
00476 {
00477 ip = ip + 1;
00478
00479
00480 int pythiaCode = PYCOMP(particleID);
00481 int has_antipart = pydat2.kchg[3-1][pythiaCode-1];
00482 int particleID2 = has_antipart ? -1 * particleID : particleID;
00483 the = 2.*atan(exp(eta));
00484 phi = phi + 3.1415927;
00485 if (phi > 2.* 3.1415927) {phi = phi - 2.* 3.1415927;}
00486 PY1ENT(ip, particleID2, ee, the, phi);
00487 }
00488 PYEXEC();
00489
00490 } else if ( particleIDs.size() > 1 ) {
00491
00492
00493 int dum;
00494 int ip = 0;
00495 double px = 0;
00496 double py = 0;
00497 double pz = 0;
00498 double pe = 0;
00499
00500 for ( unsigned id=0; id<particleIDs.size(); ++id ) {
00501 ++ip;
00502 int pythiaCode = particleIDs[id];
00503
00504 double e = emin + (emax-emin) * pyr_(&pythiaCode);
00505
00506 double phi = 2. * 3.1415927 * pyr_(&pythiaCode);
00507 double ctt = -1. + 2.*pyr_(&pythiaCode);
00508 double the = std::acos(ctt);
00509
00510 PY1ENT(ip,pythiaCode,e,the,phi);
00511
00512 px += P(ip,1);
00513 py += P(ip,2);
00514 pz += P(ip,3);
00515 pe += P(ip,4);
00516 }
00517
00518
00519
00520 double mm = std::sqrt(pe*pe-px*px-py*py-pz*pz);
00521
00522 double pp = ptmin + (ptmax-ptmin)*pyr_(&dum);
00523 double ee = sqrt(pp*pp+mm*mm);
00524
00525 double fhi = phimin + (phimax-phimin)*pyr_(&dum);
00526 double eta = etamin + (etamax-etamin)*pyr_(&dum);
00527 double tet = 2.*atan(exp(-eta));
00528
00529 double betax = pp/ee * std::sin(tet) * std::cos(fhi);
00530 double betay = pp/ee * std::sin(tet) * std::sin(fhi);
00531 double betaz = pp/ee * std::cos(tet);
00532
00533 double rothe = 0.;
00534 double rophi = 0.;
00535
00536 int first = -1;
00537 int last = -1;
00538 PYROBO(first, last, rothe, rophi, betax, betay, betaz);
00539
00540 PYEXEC();
00541
00542 } else {
00543 if(!gluinoHadronsEnabled && !stopHadronsEnabled)
00544 {
00545 call_pyevnt();
00546 }
00547 else
00548 {
00549 call_pygive("MSTJ(14)=-1");
00550 call_pyevnt();
00551 call_pygive("MSTJ(14)=1");
00552 if(gluinoHadronsEnabled) PYGLFR();
00553 if(stopHadronsEnabled) PYSTFR();
00554 }
00555
00556 }
00557
00558 if ( useTauola_ ) {
00559 tauola_.processEvent();
00560
00561 }
00562
00563
00564
00565 call_pyhepc( 1 );
00566
00567
00568
00569
00570 HepMC::GenEvent* evt = conv.read_next_event();
00571
00572
00573 if ( particleID ) evt->set_beam_particles(0,0);
00574
00575 evt->set_signal_process_id(pypars.msti[0]);
00576 evt->set_event_scale(pypars.pari[16]);
00577 evt->set_event_number(numberEventsInRun() - remainingEvents() - 1);
00578
00579
00580
00581 int id1 = pyint1.mint[14];
00582 int id2 = pyint1.mint[15];
00583 if ( id1 == 21 ) id1 = 0;
00584 if ( id2 == 21 ) id2 = 0;
00585 double x1 = pyint1.vint[40];
00586 double x2 = pyint1.vint[41];
00587 double Q = pyint1.vint[50];
00588 double pdf1 = pyint1.vint[38];
00589 pdf1 /= x1 ;
00590 double pdf2 = pyint1.vint[39];
00591 pdf2 /= x2 ;
00592 evt->set_pdf_info( HepMC::PdfInfo(id1,id2,x1,x2,Q,pdf1,pdf2) ) ;
00593
00594 evt->weights().push_back( pyint1.vint[96] );
00595
00596 if (imposeProperTimes_ || pydat1.mstj[21]==3 || pydat1.mstj[21]==4 ) {
00597 int dumm;
00598 HepMC::GenEvent::vertex_const_iterator vbegin = evt->vertices_begin();
00599 HepMC::GenEvent::vertex_const_iterator vend = evt->vertices_end();
00600 HepMC::GenEvent::vertex_const_iterator vitr = vbegin;
00601 for (; vitr != vend; ++vitr ) {
00602 HepMC::GenVertex::particle_iterator pbegin = (*vitr)->particles_begin(HepMC::children);
00603 HepMC::GenVertex::particle_iterator pend = (*vitr)->particles_end(HepMC::children);
00604 HepMC::GenVertex::particle_iterator pitr = pbegin;
00605 for (; pitr != pend; ++pitr) {
00606 if ((*pitr)->end_vertex()) continue;
00607 if ((*pitr)->status()!=1) continue;
00608 int pdgcode= abs((*pitr)->pdg_id());
00609
00610 if (pydat3.mdcy[0][PYCOMP(pdgcode)-1]!=1) continue;
00611
00612 double ctau = pydat2.pmas[3][PYCOMP(pdgcode)-1];
00613 HepMC::FourVector mom = (*pitr)->momentum();
00614 HepMC::FourVector vin = (*vitr)->position();
00615 double x = 0.;
00616 double y = 0.;
00617 double z = 0.;
00618 double t = 0.;
00619 bool decayInRange = false;
00620 while (!decayInRange) {
00621 double unif_rand = pyr_(&dumm);
00622
00623 double proper_length = - ctau * log(unif_rand);
00624 double factor = proper_length/mom.m();
00625 x = vin.x() + factor * mom.px();
00626 y = vin.y() + factor * mom.py();
00627 z = vin.z() + factor * mom.pz();
00628 t = vin.t() + factor * mom.e();
00629
00630 if (pydat1.mstj[21]==4) {
00631 if (sqrt(x*x+y*y)>pydat1.parj[72] || abs(z)>pydat1.parj[73]) decayInRange = true;
00632
00633 } else if (pydat1.mstj[21]==3) {
00634 if (sqrt(x*x+y*y+z*z)>pydat1.parj[71]) decayInRange = true;
00635
00636 } else {
00637 decayInRange = true;
00638 }
00639 }
00640
00641 HepMC::GenVertex* vdec = new HepMC::GenVertex(HepMC::FourVector(x,y,z,t));
00642 evt->add_vertex(vdec);
00643 vdec->add_particle_in((*pitr));
00644 }
00645 }
00646 }
00647
00648
00649
00650 if(event() <= maxEventsToPrint_ &&
00651 (pythiaPylistVerbosity_ || pythiaHepMCVerbosity_)) {
00652
00653
00654 if(pythiaPylistVerbosity_) {
00655 call_pylist(pythiaPylistVerbosity_);
00656 }
00657
00658
00659 if(pythiaHepMCVerbosity_) {
00660 cout << "Event process = " << pypars.msti[0] << endl
00661 << "----------------------" << endl;
00662 evt->print();
00663 }
00664 }
00665
00666
00667
00668
00669
00670 if(evt) bare_product->addHepMCData(evt );
00671
00672 e.put(bare_product);
00673
00674 return true;
00675 }
00676
00677 bool
00678 PythiaSource::call_pygive(const std::string& iParm ) {
00679
00680 int numWarn = pydat1.mstu[26];
00681 int numErr = pydat1.mstu[22];
00682
00683
00684 PYGIVE( iParm.c_str(), iParm.length() );
00685
00686
00687 return pydat1.mstu[26] == numWarn && pydat1.mstu[22] == numErr;
00688
00689 }
00690
00691 bool
00692 PythiaSource::call_txgive(const std::string& iParm ) {
00693
00694 TXGIVE( iParm.c_str(), iParm.length() );
00695 cout << " " << iParm.c_str() << endl;
00696 return 1;
00697 }
00698
00699 bool
00700 PythiaSource::call_txgive_init() {
00701
00702 TXGIVE_INIT();
00703 return 1;
00704 }
00705
00706 bool
00707 PythiaSource::call_slhagive(const std::string& iParm ) {
00708 if( iParm.find( "SLHAFILE", 0 ) != string::npos ) {
00709 string::size_type start = iParm.find_first_of( "=" ) + 1;
00710 string::size_type end = iParm.length() - 1;
00711 string::size_type temp = iParm.find_first_of( "'", start );
00712 if( temp != string::npos ) {
00713 start = temp + 1;
00714 end = iParm.find_last_of( "'" ) - 1;
00715 }
00716 start = iParm.find_first_not_of( " ", start );
00717 end = iParm.find_last_not_of( " ", end );
00718 string shortfile = iParm.substr( start, end - start + 1 );
00719 string file;
00720 if( shortfile[0] == '/' ) {
00721 cout << "SLHA file given with absolut path." << endl;
00722 file = shortfile;
00723 } else {
00724
00725 FileInPath f1( shortfile );
00726 file = f1.fullPath();
00727
00728
00729
00730
00731 }
00732 file = "SLHAFILE = '" + file + "'";
00733 SLHAGIVE( file.c_str(), file.length() );
00734 cout << " " << file.c_str() << endl;
00735
00736 } else {
00737 SLHAGIVE( iParm.c_str(), iParm.length() );
00738 cout << " " << iParm.c_str() << endl;
00739 }
00740 return 1;
00741 }
00742
00743
00744 bool
00745 PythiaSource::call_slha_init() {
00746
00747 SLHA_INIT();
00748 return 1;
00749 }