CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Attributes
gen::Pythia6PartonPtGun Class Reference

#include <Pythia6PartonPtGun.h>

Inheritance diagram for gen::Pythia6PartonPtGun:
gen::Pythia6PartonGun gen::Pythia6Gun edm::one::EDProducer< edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 Pythia6PartonPtGun (const edm::ParameterSet &)
 
 ~Pythia6PartonPtGun () override
 
- Public Member Functions inherited from gen::Pythia6PartonGun
 Pythia6PartonGun (const edm::ParameterSet &)
 
 ~Pythia6PartonGun () override
 
- Public Member Functions inherited from gen::Pythia6Gun
void beginJob () override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endRun (edm::Run const &, edm::EventSetup const &) override
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 Pythia6Gun (const edm::ParameterSet &)
 
 ~Pythia6Gun () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::WatchLuminosityBlocks, edm::one::WatchRuns, edm::one::SharedResources >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

void generateEvent (CLHEP::HepRandomEngine *) override
 
- Protected Member Functions inherited from gen::Pythia6PartonGun
void joinPartons (double qmax)
 
- Protected Member Functions inherited from gen::Pythia6Gun
HepMC::GenParticle * addAntiParticle (int &, int &, double &, double &, double &)
 
void attachPy6DecaysToGenEvent ()
 
void loadEvent (edm::Event &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Attributes

double fMaxEta
 
double fMaxPt
 
double fMinEta
 
double fMinPt
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Attributes inherited from gen::Pythia6PartonGun
int fPartonID
 
- Protected Attributes inherited from gen::Pythia6Gun
HepMC::GenEventfEvt
 
bool fHepMCVerbosity
 
int fMaxEventsToPrint
 
double fMaxPhi
 
double fMinPhi
 
std::vector< int > fPartIDs
 
Pythia6ServicefPy6Service
 
int fPylistVerbosity
 

Detailed Description

Definition at line 12 of file Pythia6PartonPtGun.h.

Constructor & Destructor Documentation

◆ Pythia6PartonPtGun()

Pythia6PartonPtGun::Pythia6PartonPtGun ( const edm::ParameterSet pset)

Definition at line 17 of file Pythia6PartonPtGun.cc.

References fMaxEta, fMaxPt, fMinEta, fMinPt, edm::ParameterSet::getParameter(), and muonDTDigis_cfi::pset.

18  // ParameterSet defpset ;
19  ParameterSet pgun_params = pset.getParameter<ParameterSet>("PGunParameters"); //, defpset ) ;
20  fMinEta = pgun_params.getParameter<double>("MinEta"); // ,-2.2);
21  fMaxEta = pgun_params.getParameter<double>("MaxEta"); // , 2.2);
22  fMinPt = pgun_params.getParameter<double>("MinPt"); // , 20.);
23  fMaxPt = pgun_params.getParameter<double>("MaxPt"); // , 420.);
24 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Pythia6PartonGun(const edm::ParameterSet &)

◆ ~Pythia6PartonPtGun()

Pythia6PartonPtGun::~Pythia6PartonPtGun ( )
override

Definition at line 26 of file Pythia6PartonPtGun.cc.

26 {}

Member Function Documentation

◆ generateEvent()

void Pythia6PartonPtGun::generateEvent ( CLHEP::HepRandomEngine *  )
overrideprotectedvirtual

Implements gen::Pythia6Gun.

Definition at line 28 of file Pythia6PartonPtGun.cc.

References gen::Pythia6Gun::addAntiParticle(), PVValHelper::eta, JetChargeProducer_cfi::exp, gen::Pythia6Gun::fEvt, fMaxEta, gen::Pythia6Gun::fMaxPhi, fMaxPt, fMinEta, gen::Pythia6Gun::fMinPhi, fMinPt, gen::Pythia6PartonGun::fPartonID, gen::Pythia6Gun::fPy6Service, GenParticle::GenParticle, gen::Pythia6PartonGun::joinPartons(), EgHLTOffHistBins_cfi::mass, gen::p, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, gen::py1ent_(), gen::pyexec_(), gen::pymass_(), gen::pyr_(), funct::sin(), and mathSSE::sqrt().

28  {
29  Pythia6Service::InstanceWrapper guard(fPy6Service); // grab Py6 instance
30 
31  // now actualy, start cooking up the event gun
32  //
33 
34  // 1st, primary vertex
35  //
36  HepMC::GenVertex* Vtx = new HepMC::GenVertex(HepMC::FourVector(0., 0., 0.));
37 
38  // here re-create fEvt (memory)
39  //
40  fEvt = new HepMC::GenEvent();
41 
42  int ip = 1;
43 
44  int py6PID = HepPID::translatePDTtoPythia(fPartonID);
45  int dum = 0;
46  double pt = 0, mom = 0, ee = 0, the = 0, eta = 0;
47  double mass = pymass_(py6PID);
48 
49  // fill p(ip,5) (in PYJETS) with mass value right now,
50  // because the (hardcoded) mstu(10)=1 will make py1ent
51  // pick the mass from there
52  pyjets.p[4][ip - 1] = mass;
53 
54  double phi = (fMaxPhi - fMinPhi) * pyr_(&dum) + fMinPhi;
55 
56  eta = (fMaxEta - fMinEta) * pyr_(&dum) + fMinEta;
57 
58  the = 2. * atan(exp(-eta));
59 
60  pt = (fMaxPt - fMinPt) * pyr_(&dum) + fMinPt;
61 
62  mom = pt / sin(the);
63  ee = sqrt(mom * mom + mass * mass);
64 
65  py1ent_(ip, py6PID, ee, the, phi);
66 
67  double px = pyjets.p[0][ip - 1]; // pt*cos(phi) ;
68  double py = pyjets.p[1][ip - 1]; // pt*sin(phi) ;
69  double pz = pyjets.p[2][ip - 1]; // mom*cos(the) ;
70 
71  HepMC::FourVector p(px, py, pz, ee);
73  Part->suggest_barcode(ip);
74  Vtx->add_particle_out(Part);
75 
76  // now add anti-quark
77  ip = ip + 1;
79  if (APart) {
80  Vtx->add_particle_out(APart);
81  } else {
82  // otherwise it should throw !
83  }
84 
85  // this should probably be configurable...
86  //
87  double qmax = 2. * ee;
88 
89  joinPartons(qmax);
90 
91  fEvt->add_vertex(Vtx);
92 
93  // run pythia
94  pyexec_();
95 
96  return;
97 }
double pyr_(int *idummy)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HepMC::GenParticle * addAntiParticle(int &, int &, double &, double &, double &)
Definition: Pythia6Gun.cc:200
HepMC::GenEvent * fEvt
Definition: Pythia6Gun.h:68
double p[5][pyjets_maxn]
double fMinPhi
Definition: Pythia6Gun.h:63
T sqrt(T t)
Definition: SSEVec.h:19
double pymass_(int &)
double fMaxPhi
Definition: Pythia6Gun.h:64
void joinPartons(double qmax)
void py1ent_(int &ip, int &kf, double &pe, double &the, double &phi)
Pythia6Service * fPy6Service
Definition: Pythia6Gun.h:58
void pyexec_()

Member Data Documentation

◆ fMaxEta

double gen::Pythia6PartonPtGun::fMaxEta
private

Definition at line 22 of file Pythia6PartonPtGun.h.

Referenced by generateEvent(), and Pythia6PartonPtGun().

◆ fMaxPt

double gen::Pythia6PartonPtGun::fMaxPt
private

Definition at line 24 of file Pythia6PartonPtGun.h.

Referenced by generateEvent(), and Pythia6PartonPtGun().

◆ fMinEta

double gen::Pythia6PartonPtGun::fMinEta
private

Definition at line 21 of file Pythia6PartonPtGun.h.

Referenced by generateEvent(), and Pythia6PartonPtGun().

◆ fMinPt

double gen::Pythia6PartonPtGun::fMinPt
private

Definition at line 23 of file Pythia6PartonPtGun.h.

Referenced by generateEvent(), and Pythia6PartonPtGun().