CMS 3D CMS Logo

Classes | Public Member Functions | Private Member Functions | Private Attributes

lhef::Pythia8Hadronisation Class Reference

Inheritance diagram for lhef::Pythia8Hadronisation:
lhef::Hadronisation

List of all members.

Classes

class  LHAupLesHouches

Public Member Functions

 Pythia8Hadronisation (const edm::ParameterSet &params)
 ~Pythia8Hadronisation ()

Private Member Functions

std::auto_ptr< HepMC::GenEvent > doHadronisation ()
void doInit ()
void newRunInfo (const boost::shared_ptr< LHERunInfo > &runInfo)

Private Attributes

std::auto_ptr< HepMC::I_Pythia8 > conv
std::auto_ptr< LHAupLesHoucheslhaUP
int maxEventsToPrint
std::vector< std::string > paramLines
std::auto_ptr< Pythia > pythia
const int pythiaPylistVerbosity

Detailed Description

Definition at line 32 of file Pythia8Hadronisation.cc.


Constructor & Destructor Documentation

lhef::Pythia8Hadronisation::Pythia8Hadronisation ( const edm::ParameterSet params)

Definition at line 127 of file Pythia8Hadronisation.cc.

References filterCSVwithJSON::copy, edm::ParameterSet::getParameter(), geometryCSVtoXML::line, groupFilesInBlocks::lines, and paramLines.

                                                                        :
        Hadronisation(params),
        pythiaPylistVerbosity(params.getUntrackedParameter<int>("pythiaPylistVerbosity", 0)),
        maxEventsToPrint(params.getUntrackedParameter<int>("maxEventsToPrint", 0))
{
        std::vector<std::string> setNames =
                params.getParameter<std::vector<std::string> >("parameterSets");

        for(std::vector<std::string>::const_iterator iter = setNames.begin();
            iter != setNames.end(); ++iter) {
                std::vector<std::string> lines =
                        params.getParameter< std::vector<std::string> >(*iter);

                for(std::vector<std::string>::const_iterator line = lines.begin();
                    line != lines.end(); ++line )
                        if (line->substr(0, 14) == "Random:setSeed" ||
                            line->substr(0, 11) == "Random:seed")
                                throw cms::Exception("PythiaError")
                                        << "Attempted to set random number"
                                           " using Pythia command 'MRPY(1)'."
                                           " Please use the"
                                           " RandomNumberGeneratorService."
                                        << std::endl;

                std::copy(lines.begin(), lines.end(),
                          std::back_inserter(paramLines));
        }
}
lhef::Pythia8Hadronisation::~Pythia8Hadronisation ( )

Definition at line 156 of file Pythia8Hadronisation.cc.

{
}

Member Function Documentation

std::auto_ptr< HepMC::GenEvent > lhef::Pythia8Hadronisation::doHadronisation ( ) [private, virtual]

Implements lhef::Hadronisation.

Definition at line 192 of file Pythia8Hadronisation.cc.

References conv, gather_cfg::cout, event(), lhef::Hadronisation::getRawEvent(), lhef::getStatus(), lhaUP, maxEventsToPrint, pythia, and pythiaPylistVerbosity.

{
        lhaUP->loadEvent(getRawEvent());
        if (!pythia->next())
                throw cms::Exception("PythiaError")
                        << "Pythia did not want to process event."
                        << std::endl;

        std::auto_ptr<HepMC::GenEvent> event(new HepMC::GenEvent);
        conv->fill_next_event(pythia->event, event.get());

        for(HepMC::GenEvent::particle_iterator iter = event->particles_begin();
            iter != event->particles_end(); iter++)
                (*iter)->set_status(getStatus(*iter));

        event->set_signal_process_id(pythia->info.code());
        event->set_event_scale(pythia->info.pTHat());

        if (maxEventsToPrint > 0) {
                maxEventsToPrint--;
                if (pythiaPylistVerbosity)
                        pythia->event.list(std::cout);
        }

        return event;
}
void lhef::Pythia8Hadronisation::doInit ( ) [private, virtual]

Implements lhef::Hadronisation.

Definition at line 160 of file Pythia8Hadronisation.cc.

References conv, lhaUP, paramLines, and pythia.

{
        pythia.reset(new Pythia);
        lhaUP.reset(new LHAupLesHouches(this));
        conv.reset(new HepMC::I_Pythia8);

        for(std::vector<std::string>::const_iterator iter = paramLines.begin();
            iter != paramLines.end(); ++iter)
                if (!pythia->readString(*iter))
                        throw cms::Exception("PythiaError")
                                << "Pythia did not accept \""
                                << *iter << "\"." << std::endl;

        edm::Service<edm::RandomNumberGenerator> rng;
        std::ostringstream ss;
        ss << "Random:seed = " << rng->mySeed();
        pythia->readString(ss.str());
        pythia->readString("Random:setSeed = on");
}
void lhef::Pythia8Hadronisation::newRunInfo ( const boost::shared_ptr< LHERunInfo > &  runInfo) [private, virtual]

Reimplemented from lhef::Hadronisation.

Definition at line 219 of file Pythia8Hadronisation.cc.

References lhaUP, and pythia.

{
        lhaUP->loadRunInfo(runInfo);
        pythia->init(lhaUP.get());
}

Member Data Documentation

std::auto_ptr<HepMC::I_Pythia8> lhef::Pythia8Hadronisation::conv [private]

Definition at line 50 of file Pythia8Hadronisation.cc.

Referenced by doHadronisation(), and doInit().

Definition at line 49 of file Pythia8Hadronisation.cc.

Referenced by doHadronisation(), doInit(), and newRunInfo().

Definition at line 43 of file Pythia8Hadronisation.cc.

Referenced by doHadronisation().

std::vector<std::string> lhef::Pythia8Hadronisation::paramLines [private]

Definition at line 44 of file Pythia8Hadronisation.cc.

Referenced by doInit(), and Pythia8Hadronisation().

std::auto_ptr<Pythia> lhef::Pythia8Hadronisation::pythia [private]

Definition at line 46 of file Pythia8Hadronisation.cc.

Referenced by doHadronisation(), doInit(), and newRunInfo().

Definition at line 42 of file Pythia8Hadronisation.cc.

Referenced by doHadronisation().