CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

gen::Pythia6EGun Class Reference

#include <Pythia6EGun.h>

Inheritance diagram for gen::Pythia6EGun:
gen::Pythia6ParticleGun gen::Pythia6Gun edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 Pythia6EGun (const edm::ParameterSet &)
virtual ~Pythia6EGun ()

Protected Member Functions

void generateEvent ()

Private Attributes

bool fAddAntiParticle
double fMaxE
double fMaxEta
double fMinE
double fMinEta

Detailed Description

Definition at line 8 of file Pythia6EGun.h.


Constructor & Destructor Documentation

Pythia6EGun::Pythia6EGun ( const edm::ParameterSet pset)

Definition at line 18 of file Pythia6EGun.cc.

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

                                                   :
   Pythia6ParticleGun(pset)
{
   
   // ParameterSet defpset ;
   ParameterSet pgun_params = 
      pset.getParameter<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) ;  

}
Pythia6EGun::~Pythia6EGun ( ) [virtual]

Definition at line 33 of file Pythia6EGun.cc.

{
}

Member Function Documentation

void Pythia6EGun::generateEvent ( ) [protected, virtual]

Implements gen::Pythia6Gun.

Definition at line 37 of file Pythia6EGun.cc.

References gen::Pythia6Gun::addAntiParticle(), eta(), funct::exp(), fAddAntiParticle, gen::Pythia6Gun::fEvt, fMaxE, fMaxEta, gen::Pythia6Gun::fMaxPhi, fMinE, fMinEta, gen::Pythia6Gun::fMinPhi, gen::Pythia6ParticleGun::fPartIDs, gen::Pythia6Gun::fPy6Service, configurableAnalysis::GenParticle, i, gen::p, phi, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), and gen::pyr_().

{
   
   Pythia6Service::InstanceWrapper guard(fPy6Service);  // grab Py6 instance

   // now actualy, start cooking up the event gun 
   //

   // 1st, primary vertex
   //
   HepMC::GenVertex* Vtx = new HepMC::GenVertex( HepMC::FourVector(0.,0.,0.));

   // here re-create fEvt (memory)
   //
   fEvt = new HepMC::GenEvent() ;
     
   int ip=1;
   for ( size_t i=0; i<fPartIDs.size(); i++ )
   {
         int particleID = fPartIDs[i]; // this is PDG - need to convert to Py6 !!!
         int py6PID = HepPID::translatePDTtoPythia( particleID );
         int dum = 0;
         double ee=0,the=0,eta=0;
         double mass = pymass_(particleID);
         
         // fill p(ip,5) (in PYJETS) with mass value right now,
         // because the (hardcoded) mstu(10)=1 will make py1ent
         // pick the mass from there
         pyjets.p[4][ip-1]=mass;         
         
         double phi = (fMaxPhi-fMinPhi)*pyr_(&dum)+fMinPhi;
         ee   = (fMaxE-fMinE)*pyr_(&dum)+fMinE;
         eta  = (fMaxEta-fMinEta)*pyr_(&dum)+fMinEta;                                                      
         the  = 2.*atan(exp(-eta));                                                                          
         
         py1ent_(ip, py6PID, ee, the, phi);
         
         double px     = pyjets.p[0][ip-1]; // pt*cos(phi) ;
         double py     = pyjets.p[1][ip-1]; // pt*sin(phi) ;
         double pz     = pyjets.p[2][ip-1]; // mom*cos(the) ;
 
         HepMC::FourVector p(px,py,pz,ee) ;
         HepMC::GenParticle* Part = 
             new HepMC::GenParticle(p,particleID,1);
         Part->suggest_barcode( ip ) ;
         Vtx->add_particle_out(Part);
         
         if(fAddAntiParticle)
         {
            ip = ip + 1;
            HepMC::GenParticle* APart = addAntiParticle( ip, particleID, ee, eta, phi );
            if ( APart ) Vtx->add_particle_out(APart) ;     
         }
         ip++;
   }
   
   fEvt->add_vertex(Vtx);
     
   // run pythia
   pyexec_();
   
   return;
}

Member Data Documentation

Definition at line 26 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

double gen::Pythia6EGun::fMaxE [private]

Definition at line 25 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

double gen::Pythia6EGun::fMaxEta [private]

Definition at line 23 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

double gen::Pythia6EGun::fMinE [private]

Definition at line 24 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().

double gen::Pythia6EGun::fMinEta [private]

Definition at line 22 of file Pythia6EGun.h.

Referenced by generateEvent(), and Pythia6EGun().