CMS 3D CMS Logo

edm::ComphepSource Class Reference

#include <GeneratorInterface/ComphepInterface/interface/ComphepSource.h>

Inheritance diagram for edm::ComphepSource:

edm::GeneratedInputSource edm::ConfigurableInputSource edm::InputSource edm::ProductRegistryHelper

List of all members.

Public Member Functions

 ComphepSource (const ParameterSet &, const InputSourceDescription &)
 Constructor.
virtual ~ComphepSource ()
 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 bool produce (Event &e)

Private Attributes

std::string CHFile_
 MCDB input file.
bool doubleParticle
double etamax
double etamin
HepMC::GenEvent * evt
CLHEP::HepRandomEngine * fRandomEngine
CLHEP::RandFlat * fRandomGenerator
bool getInputFromMCDB_
 Get input file from LCG MCDB.
unsigned int maxEventsToPrint_
 Events to print if verbosity.
int MCDBArticleID_
 Sets the MCDB Article ID (0 if none).
int particleID
double phimax
double phimin
double ptmax
double ptmin
bool pythiaHepMCVerbosity_
 HepMC verbosity flag.
unsigned int pythiaPylistVerbosity_
 Pythia PYLIST Verbosity flag.


Detailed Description

Definition at line 34 of file ComphepSource.h.


Constructor & Destructor Documentation

ComphepSource::ComphepSource ( const ParameterSet pset,
const InputSourceDescription desc 
)

Constructor.

Definition at line 50 of file ComphepSource.cc.

References call_pevmain(), call_pygive(), call_txgive(), call_txgive_init(), CHFile_, edm::errors::Configuration, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), getInputFromMCDB_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, maxEventsToPrint_, MCDBArticleID_, mcdbGetInputFile(), pars, pythiaHepMCVerbosity_, and pythiaPylistVerbosity_.

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

ComphepSource::~ComphepSource (  )  [virtual]

Destructor.

Definition at line 163 of file ComphepSource.cc.

References clear().

00163                              {
00164   call_pystat(1);
00165   //  call_pretauola(1);  // output from TAUOLA 
00166   clear(); 
00167 }


Member Function Documentation

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

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

Definition at line 222 of file ComphepSource.cc.

References pydat1, and PYGIVE.

Referenced by ComphepSource().

00223  {
00224   int numWarn = pydat1.mstu[26]; //# warnings
00225   int numErr = pydat1.mstu[22];// # errors
00226 //call the fortran routine pygive with a fortran string
00227   PYGIVE( iParm.c_str(), iParm.length() );  
00228 //if an error or warning happens it is problem
00229   return pydat1.mstu[26] == numWarn && pydat1.mstu[22] == numErr;   
00230 }

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

Definition at line 233 of file ComphepSource.cc.

References TXGIVE.

Referenced by ComphepSource().

00234    {
00235     //call the fortran routine txgive with a fortran string
00236      TXGIVE( iParm.c_str(), iParm.length() );  
00237      return 1;  
00238    }

bool ComphepSource::call_txgive_init (  )  [private]

Definition at line 241 of file ComphepSource.cc.

References TXGIVE_INIT.

Referenced by ComphepSource().

00242 {
00243    TXGIVE_INIT();
00244    return 1;
00245 }

void ComphepSource::clear ( void   )  [private]

Definition at line 169 of file ComphepSource.cc.

Referenced by ~ComphepSource().

00169                           {
00170  
00171 }

bool ComphepSource::produce ( Event e  )  [private, virtual]

Implements edm::ConfigurableInputSource.

Definition at line 174 of file ComphepSource.cc.

References call_pylist(), conv, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), edm::ConfigurableInputSource::event(), evt, maxEventsToPrint_, edm::ConfigurableInputSource::numberEventsInRun(), edm::Event::put(), pypars, pythiaHepMCVerbosity_, pythiaPylistVerbosity_, and edm::InputSource::remainingEvents().

00174                                      {
00175 
00176     auto_ptr<HepMCProduct> bare_product(new HepMCProduct());  
00177 
00178     //********                                         
00179     //
00180 
00181     call_pyevnt();      // generate one event with Pythia
00182     //    call_pretauola(0);  // tau-lepton decays with TAUOLA 
00183 
00184     call_pyhepc( 1 );
00185     
00186     //    HepMC::GenEvent* evt = conv.getGenEventfromHEPEVT();
00187     HepMC::GenEvent* evt = conv.read_next_event();
00188     evt->set_signal_process_id(pypars.msti[0]);
00189     evt->set_event_number(numberEventsInRun() - remainingEvents() - 1);
00190     
00191 
00192     //******** Verbosity ********
00193     
00194     if(event() <= maxEventsToPrint_ &&
00195        (pythiaPylistVerbosity_ || pythiaHepMCVerbosity_)) {
00196 
00197       // Prints PYLIST info
00198       if(pythiaPylistVerbosity_) {
00199         call_pylist(pythiaPylistVerbosity_);
00200       }
00201       
00202       // Prints HepMC event
00203       if(pythiaHepMCVerbosity_) {
00204         cout << "Event process = " << pypars.msti[0] << endl 
00205         << "----------------------" << endl;
00206         evt->print();
00207       }
00208     }
00209     
00210     
00211     //evt = reader_->fillCurrentEventData(); 
00212     //********                                      
00213 
00214     if(evt)  bare_product->addHepMCData(evt );
00215 
00216     e.put(bare_product);
00217 
00218     return true;
00219 }


Member Data Documentation

std::string edm::ComphepSource::CHFile_ [private]

MCDB input file.

Definition at line 64 of file ComphepSource.h.

Referenced by ComphepSource().

bool edm::ComphepSource::doubleParticle [private]

Definition at line 74 of file ComphepSource.h.

double edm::ComphepSource::etamax [private]

Definition at line 76 of file ComphepSource.h.

double edm::ComphepSource::etamin [private]

Definition at line 76 of file ComphepSource.h.

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

Definition at line 55 of file ComphepSource.h.

Referenced by produce().

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

Definition at line 79 of file ComphepSource.h.

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

Definition at line 80 of file ComphepSource.h.

bool edm::ComphepSource::getInputFromMCDB_ [private]

Get input file from LCG MCDB.

Definition at line 66 of file ComphepSource.h.

Referenced by ComphepSource().

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

Events to print if verbosity.

Definition at line 62 of file ComphepSource.h.

Referenced by ComphepSource(), and produce().

int edm::ComphepSource::MCDBArticleID_ [private]

Sets the MCDB Article ID (0 if none).

Definition at line 68 of file ComphepSource.h.

Referenced by ComphepSource().

int edm::ComphepSource::particleID [private]

Definition at line 73 of file ComphepSource.h.

double edm::ComphepSource::phimax [private]

Definition at line 77 of file ComphepSource.h.

double edm::ComphepSource::phimin [private]

Definition at line 77 of file ComphepSource.h.

double edm::ComphepSource::ptmax [private]

Definition at line 75 of file ComphepSource.h.

double edm::ComphepSource::ptmin [private]

Definition at line 75 of file ComphepSource.h.

bool edm::ComphepSource::pythiaHepMCVerbosity_ [private]

HepMC verbosity flag.

Definition at line 60 of file ComphepSource.h.

Referenced by ComphepSource(), and produce().

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

Pythia PYLIST Verbosity flag.

Definition at line 58 of file ComphepSource.h.

Referenced by ComphepSource(), and produce().


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