CMS 3D CMS Logo

Public Member Functions | Private Attributes

gen::Py8EGun Class Reference

Inheritance diagram for gen::Py8EGun:
gen::Py8GunBase gen::Py8InterfaceBase

List of all members.

Public Member Functions

const char * classname () const
bool generatePartonsAndHadronize ()
 Py8EGun (edm::ParameterSet const &)
 ~Py8EGun ()

Private Attributes

bool fAddAntiParticle
double fMaxE
double fMaxEta
double fMinE
double fMinEta

Detailed Description

Definition at line 10 of file Py8EGun.cc.


Constructor & Destructor Documentation

gen::Py8EGun::Py8EGun ( edm::ParameterSet const &  ps)

Definition at line 33 of file Py8EGun.cc.

References fAddAntiParticle, fMaxE, fMaxEta, fMinE, fMinEta, and edm::ParameterSet::getParameter().

   : Py8GunBase(ps) 
{

   // ParameterSet defpset ;
   edm::ParameterSet pgun_params = 
      ps.getParameter<edm::ParameterSet>("PGunParameters"); // , defpset ) ;
   fMinEta     = pgun_params.getParameter<double>("MinEta"); // ,-2.2);
   fMaxEta     = pgun_params.getParameter<double>("MaxEta"); // , 2.2);
   fMinE       = pgun_params.getParameter<double>("MinE"); // ,  0.);
   fMaxE       = pgun_params.getParameter<double>("MaxE"); // ,  0.);
   fAddAntiParticle = pgun_params.getParameter<bool>("AddAntiParticle"); //, false) ;  

}
gen::Py8EGun::~Py8EGun ( ) [inline]

Definition at line 15 of file Py8EGun.cc.

{}

Member Function Documentation

const char * gen::Py8EGun::classname ( ) const [virtual]

Implements gen::Py8InterfaceBase.

Definition at line 108 of file Py8EGun.cc.

{
   return "Py8EGun"; 
}
bool gen::Py8EGun::generatePartonsAndHadronize ( ) [virtual]

Implements gen::Py8InterfaceBase.

Definition at line 48 of file Py8EGun.cc.

References python::multivaluedict::append(), funct::cos(), eta(), gen::Py8GunBase::event(), create_public_lumi_plots::exp, fAddAntiParticle, gen::Py8InterfaceBase::fMasterGen, fMaxE, fMaxEta, gen::Py8GunBase::fMaxPhi, fMinE, fMinEta, gen::Py8GunBase::fMinPhi, gen::Py8GunBase::fPartIDs, i, phi, createTree::pp, randomEngine, funct::sin(), mathSSE::sqrt(), and gen::Py8InterfaceBase::toHepMC.

{

   fMasterGen->event.reset();
   
   for ( size_t i=0; i<fPartIDs.size(); i++ )
   {

      int particleID = fPartIDs[i]; // this is PDG - need to convert to Py8 ???

      // FIXME !!!
      // Ouch, it's using bare randomEngine pointer - that's NOT safe.
      // Need to hold a pointer somewhere properly !!!
      //
      double phi = (fMaxPhi-fMinPhi) * randomEngine->flat() + fMinPhi;
      double ee   = (fMaxE-fMinE) * randomEngine->flat() + fMinE;
      double eta  = (fMaxEta-fMinEta) * randomEngine->flat() + fMinEta;                                                      
      double the  = 2.*atan(exp(-eta));                                                                          
      
      double mass = (fMasterGen->particleData).mass( particleID );
//      double mass = (pythia->particleData).m0( particleID );

      double pp = sqrt( ee*ee - mass*mass );
      double px = pp * sin(the) * cos(phi);
      double py = pp * sin(the) * sin(phi);
      double pz = pp * cos(the);

      if ( !((fMasterGen->particleData).isParticle( particleID )) )
      {
         particleID = std::fabs(particleID) ;
      }
      (fMasterGen->event).append( particleID, 1, 0, 0, px, py, pz, ee, mass ); 

// Here also need to add anti-particle (if any)
// otherwise just add a 2nd particle of the same type 
// (for example, gamma)
//
      if ( fAddAntiParticle )
      {
         if ( (fMasterGen->particleData).isParticle( -particleID ) )
         {
            (fMasterGen->event).append( -particleID, 1, 0, 0, px, py, pz, ee, mass );
         }
         else
         {
            (fMasterGen->event).append( particleID, 1, 0, 0, px, py, pz, ee, mass );
         }
      }

   }
   
   if ( !fMasterGen->next() ) return false;
   
   event().reset(new HepMC::GenEvent);
   toHepMC.fill_next_event( fMasterGen->event, event().get() );
      
   return true;   
  
}

Member Data Documentation

Definition at line 27 of file Py8EGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8EGun().

double gen::Py8EGun::fMaxE [private]

Definition at line 26 of file Py8EGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8EGun().

double gen::Py8EGun::fMaxEta [private]

Definition at line 24 of file Py8EGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8EGun().

double gen::Py8EGun::fMinE [private]

Definition at line 25 of file Py8EGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8EGun().

double gen::Py8EGun::fMinEta [private]

Definition at line 23 of file Py8EGun.cc.

Referenced by generatePartonsAndHadronize(), and Py8EGun().