CMS 3D CMS Logo

edm::ToprexProducer Class Reference

#include <GeneratorInterface/TopRexInterface/interface/ToprexProducer.h>

Inheritance diagram for edm::ToprexProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ToprexProducer (const ParameterSet &)
 Constructor.
virtual ~ToprexProducer ()
 Destructor.

Private Member Functions

bool call_pygive (const std::string &iParm)
 Interface to the PYGIVE/TXGIVE pythia routine, with add'l protections.
bool call_txgive (const std::string &iParm)
bool call_txgive_init ()
void clear ()
virtual void produce (Event &e, const EventSetup &es)

Private Attributes

int eventNumber_
HepMC::GenEvent * evt
CLHEP::HepRandomEngine * fRandomEngine
CLHEP::RandFlat * fRandomGenerator
unsigned int maxEventsToPrint_
 Events to print if verbosity.
bool pythiaHepMCVerbosity_
 HepMC verbosity flag.
unsigned int pythiaPylistVerbosity_
 Pythia PYLIST Verbosity flag.


Detailed Description

Definition at line 34 of file ToprexProducer.h.


Constructor & Destructor Documentation

ToprexProducer::ToprexProducer ( const ParameterSet pset  ) 

Constructor.

Definition at line 51 of file ToprexProducer.cc.

References call_pygive(), call_toprex(), call_txgive(), call_txgive_init(), edm::errors::Configuration, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), fRandomEngine, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, maxEventsToPrint_, pars, pythiaHepMCVerbosity_, pythiaPylistVerbosity_, and randomEngine.

00051                                                          :
00052   EDProducer(), evt(0), 
00053   pythiaPylistVerbosity_ (pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0)),
00054   pythiaHepMCVerbosity_ (pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false)),
00055   maxEventsToPrint_ (pset.getUntrackedParameter<int>("maxEventsToPrint",1)),
00056   eventNumber_(0)
00057 {
00058   
00059   cout << "ToprexProducer: initializing TopReX " << endl;
00060   
00061   // PYLIST Verbosity Level
00062   // Valid PYLIST arguments are: 1, 2, 3, 5, 7, 11, 12, 13
00063   pythiaPylistVerbosity_ = pset.getUntrackedParameter<int>("pythiaPylistVerbosity",0);
00064   cout << "Pythia PYLIST verbosity level = " << pythiaPylistVerbosity_ << endl;
00065   
00066   // HepMC event verbosity Level
00067   pythiaHepMCVerbosity_ = pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity",false);
00068   cout << "Pythia HepMC verbosity = " << pythiaHepMCVerbosity_ << endl; 
00069 
00070   //Max number of events printed on verbosity level 
00071   maxEventsToPrint_ = pset.getUntrackedParameter<int>("maxEventsToPrint",0);
00072   cout << "Number of events to be printed = " << maxEventsToPrint_ << endl;
00073 
00075   // Set PYTHIA parameters in a single ParameterSet
00076   {
00077   ParameterSet pythia_params = 
00078     pset.getParameter<ParameterSet>("PythiaParameters") ;
00079   
00080   // The parameter sets to be read (default, min bias, user ...) in the
00081   // proper order.
00082   vector<string> setNames = 
00083     pythia_params.getParameter<vector<string> >("parameterSets");
00084   
00085   // Loop over the sets
00086   for ( unsigned i=0; i<setNames.size(); ++i ) {
00087     
00088     string mySet = setNames[i];
00089     
00090     // Read the PYTHIA parameters for each set of parameters
00091     vector<string> pars = 
00092       pythia_params.getParameter<vector<string> >(mySet);
00093     
00094     if (mySet != "CSAParameters"){
00095     cout << "----------------------------------------------" << endl;
00096     cout << "Read PYTHIA parameter set " << mySet << endl;
00097     cout << "----------------------------------------------" << endl;
00098     
00099     // Loop over all parameters and stop in case of mistake
00100     for( vector<string>::const_iterator  
00101            itPar = pars.begin(); itPar != pars.end(); ++itPar ) {
00102       static string sRandomValueSetting("MRPY(1)");
00103       if( 0 == itPar->compare(0,sRandomValueSetting.size(),sRandomValueSetting) ) {
00104         throw edm::Exception(edm::errors::Configuration,"PythiaError")
00105           <<" 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.";
00106       }
00107       if( ! call_pygive(*itPar) ) {
00108         throw edm::Exception(edm::errors::Configuration,"PythiaError") 
00109           <<" pythia did not accept the following \""<<*itPar<<"\"";
00110       }
00111     }
00112     }else if(mySet == "CSAParameters"){   
00113 
00114    // Read CSA parameter
00115   
00116    pars = pythia_params.getParameter<vector<string> >("CSAParameters");
00117 
00118    cout << "----------------------------------------------" << endl; 
00119    cout << "Reading CSA parameter settings. " << endl;
00120    cout << "----------------------------------------------" << endl;                                                                           
00121 
00122     call_txgive_init();
00123   
00124   
00125    // Loop over all parameters and stop in case of a mistake
00126     for (vector<string>::const_iterator 
00127             itPar = pars.begin(); itPar != pars.end(); ++itPar) {
00128       call_txgive(*itPar); 
00129      
00130          } 
00131   
00132   }
00133   }
00134 
00135 }
00136 
00137 
00138 // Read the TopReX parameters
00139 #include "GeneratorInterface/CommonInterface/interface/ExternalGenRead.inc"
00140 
00141 
00142   //In the future, we will get the random number seed on each event and tell 
00143   // pythia to use that new seed
00144     cout << "----------------------------------------------" << endl;
00145     cout << "Setting Pythia random number seed " << endl;
00146     cout << "----------------------------------------------" << endl;
00147   edm::Service<RandomNumberGenerator> rng;
00148   randomEngine = fRandomEngine = &(rng->getEngine());
00149   uint32_t seed = rng->mySeed();
00150   ostringstream sRandomSet;
00151   sRandomSet <<"MRPY(1)="<<seed;
00152   call_pygive(sRandomSet.str());
00153 
00154  // srs insertion
00155   //  cout << "TopReX start called OK" << endl;
00156   call_toprex( "USER", "p", "p", 14000. );
00157   // cout << "TopReX was called OK" << endl;
00158   call_pyinit( "USER", "p", "p", 14000. );
00159   //
00160   //     call_pretauola(-1);     // TAUOLA initialization
00161   cout << endl; // Stetically add for the output
00162 
00163   produces<HepMCProduct>();
00164   cout << "ToprexProducer: starting event generation ... " << endl;
00165 }

ToprexProducer::~ToprexProducer (  )  [virtual]

Destructor.

Definition at line 168 of file ToprexProducer.cc.

References clear(), GenMuonPlsPt100GeV_cfg::cout, and lat::endl().

00168                                {
00169   cout << "ToprexProducer: event generation done. " << endl;
00170   call_pystat(1);
00171   //    call_pretauola(1);  // output from TAUOLA 
00172   clear(); 
00173 }


Member Function Documentation

bool ToprexProducer::call_pygive ( const std::string &  iParm  )  [private]

Interface to the PYGIVE/TXGIVE pythia routine, with add'l protections.

Definition at line 231 of file ToprexProducer.cc.

References pydat1, and PYGIVE.

Referenced by ToprexProducer().

00232 {
00233    int numWarn = pydat1.mstu[26]; //# warnings
00234    int numErr = pydat1.mstu[22];// # errors
00235 //call the fortran routine pygive with a fortran string
00236   PYGIVE( iParm.c_str(), iParm.length() );  
00237 //if an error or warning happens it is problem
00238    return pydat1.mstu[26] == numWarn && pydat1.mstu[22] == numErr;   
00239 }

bool ToprexProducer::call_txgive ( const std::string &  iParm  )  [private]

Definition at line 243 of file ToprexProducer.cc.

References TXGIVE.

Referenced by ToprexProducer().

00244    {
00245    TXGIVE( iParm.c_str(), iParm.length() );  
00246         return 1;  
00247    }

bool ToprexProducer::call_txgive_init (  )  [private]

Definition at line 250 of file ToprexProducer.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and TXGIVE_INIT.

Referenced by ToprexProducer().

00251 {
00252    TXGIVE_INIT();
00253    cout << "  Setting CSA defaults.   "   << endl;
00254    return 1;
00255 }

void ToprexProducer::clear ( void   )  [private]

Definition at line 175 of file ToprexProducer.cc.

Referenced by ~ToprexProducer().

00175 { }

void ToprexProducer::produce ( Event e,
const EventSetup es 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 178 of file ToprexProducer.cc.

References call_findjets(), call_pylist(), conv2, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::EventID::event(), eventNumber_, evt, edm::Event::id(), maxEventsToPrint_, edm::Event::put(), pypars, pythiaHepMCVerbosity_, and pythiaPylistVerbosity_.

00178                                                             {
00179 
00180     auto_ptr<HepMCProduct> bare_product(new HepMCProduct());  
00181      //
00182 
00183     call_pyevnt();      // generate one event with Pythia
00184 
00185     //        call_pretauola(0);       // tau-lepton decays with TAUOLA 
00186 
00187     call_findjets();      // find jets 
00188     call_pyhepc( 1 );
00189     
00190     HepMC::GenEvent* evt = conv2.read_next_event();
00191     evt->set_signal_process_id(pypars.msti[0]);
00192     evt->set_event_scale(pypars.pari[16]);
00193     ++eventNumber_;
00194     evt->set_event_number(eventNumber_);
00195 
00196     //    Nest (*evt);
00197 
00198 
00199 
00200 
00201     //******** Verbosity ********
00202     
00203     if(e.id().event() <= maxEventsToPrint_ &&
00204        (pythiaPylistVerbosity_ || pythiaHepMCVerbosity_)) {
00205 
00206       // Prints PYLIST info
00207       if(pythiaPylistVerbosity_) {
00208         call_pylist(pythiaPylistVerbosity_);
00209       }
00210       
00211       // Prints HepMC event
00212       if(pythiaHepMCVerbosity_) {
00213         cout << "Event process = " << pypars.msti[0] << endl 
00214         << "----------------------" << endl;
00215         //      evt->print();
00216       }
00217     }
00218     
00219     
00220     //evt = reader_->fillCurrentEventData(); 
00221     //********                                      
00222 
00223     if(evt)  bare_product->addHepMCData(evt );
00224 
00225     e.put(bare_product);
00226 
00227     return;
00228 }


Member Data Documentation

int edm::ToprexProducer::eventNumber_ [private]

Definition at line 78 of file ToprexProducer.h.

Referenced by produce().

HepMC::GenEvent* edm::ToprexProducer::evt [private]

Definition at line 56 of file ToprexProducer.h.

Referenced by produce().

CLHEP::HepRandomEngine* edm::ToprexProducer::fRandomEngine [private]

Definition at line 75 of file ToprexProducer.h.

Referenced by ToprexProducer().

CLHEP::RandFlat* edm::ToprexProducer::fRandomGenerator [private]

Definition at line 76 of file ToprexProducer.h.

unsigned int edm::ToprexProducer::maxEventsToPrint_ [private]

Events to print if verbosity.

Definition at line 65 of file ToprexProducer.h.

Referenced by produce(), and ToprexProducer().

bool edm::ToprexProducer::pythiaHepMCVerbosity_ [private]

HepMC verbosity flag.

Definition at line 63 of file ToprexProducer.h.

Referenced by produce(), and ToprexProducer().

unsigned int edm::ToprexProducer::pythiaPylistVerbosity_ [private]

Pythia PYLIST Verbosity flag.

Definition at line 61 of file ToprexProducer.h.

Referenced by produce(), and ToprexProducer().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:44:25 2009 for CMSSW by  doxygen 1.5.4