CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
gen::ExhumeHadronizer Class Reference

#include <ExhumeHadronizer.h>

Inheritance diagram for gen::ExhumeHadronizer:
gen::BaseHadronizer

Public Member Functions

const char * classname () const
 
bool decay ()
 
bool declareSpecialSettings (const std::vector< std::string > &)
 
bool declareStableParticles (const std::vector< int > &)
 
 ExhumeHadronizer (edm::ParameterSet const &ps)
 
void finalizeEvent ()
 
bool generatePartonsAndHadronize ()
 
bool hadronize ()
 
bool initializeForExternalPartons ()
 
bool initializeForInternalPartons ()
 
bool readSettings (int)
 
bool residualDecay ()
 
void statistics ()
 
 ~ExhumeHadronizer () override
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
void cleanLHE ()
 
void generateLHE (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine, unsigned int ncpu)
 
edm::EventgetEDMEvent () const
 
std::unique_ptr< HepMC::GenEventgetGenEvent ()
 
std::unique_ptr< GenEventInfoProductgetGenEventInfo ()
 
virtual std::unique_ptr< GenLumiInfoHeadergetGenLumiInfoHeader () const
 
GenRunInfoProductgetGenRunInfo ()
 
std::unique_ptr< lhef::LHEEventgetLHEEvent ()
 
const std::shared_ptr< lhef::LHERunInfo > & getLHERunInfo () const
 
const std::string & gridpackPath () const
 
int randomIndex () const
 
const std::string & randomInitConfigDescription () const
 
void randomizeIndex (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
 
void resetEvent (std::unique_ptr< HepMC::GenEvent > event)
 
void resetEventInfo (std::unique_ptr< GenEventInfoProduct > eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (std::unique_ptr< lhef::LHEEvent > event)
 
void setLHERunInfo (std::unique_ptr< lhef::LHERunInfo > runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
virtual ~BaseHadronizer () noexcept(false)
 

Private Member Functions

void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
std::vector< std::string > const & doSharedResources () const override
 

Private Attributes

double comEnergy_
 
bool convertToPDG_
 
Exhume::EventexhumeEvent_
 
Exhume::CrossSectionexhumeProcess_
 
bool hepMCVerbosity_
 
unsigned int maxEventsToPrint_
 
edm::ParameterSet myPSet_
 
Pythia6Servicepythia6Service_
 
unsigned int pythiaListVerbosity_
 
CLHEP::HepRandomEngine * randomEngine_
 

Static Private Attributes

static const std::vector< std::string > theSharedResources
 

Additional Inherited Members

- Protected Member Functions inherited from gen::BaseHadronizer
std::unique_ptr< HepMC::GenEvent > & event ()
 
std::unique_ptr< GenEventInfoProduct > & eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::BaseHadronizer
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 36 of file ExhumeHadronizer.h.

Constructor & Destructor Documentation

◆ ExhumeHadronizer()

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

Definition at line 76 of file ExhumeHadronizer.cc.

References convertToPDG_, and muonDTDigis_cfi::pset.

78  pythia6Service_(new Pythia6Service(pset)),
79  randomEngine_(nullptr),
80  comEnergy_(pset.getParameter<double>("comEnergy")),
81  myPSet_(pset),
82  hepMCVerbosity_(pset.getUntrackedParameter<bool>("pythiaHepMCVerbosity", false)),
83  maxEventsToPrint_(pset.getUntrackedParameter<int>("maxEventsToPrint", 0)),
84  pythiaListVerbosity_(pset.getUntrackedParameter<int>("pythiaPylistVerbosity", 0)),
85  exhumeEvent_(nullptr) {
86  convertToPDG_ = false;
87  if (pset.exists("doPDGConvert")) {
88  convertToPDG_ = pset.getParameter<bool>("doPDGConvert");
89  }
90 
91  //pythia6Hadronizer_ = new Pythia6Hadronizer(pset);
92  }
Exhume::Event * exhumeEvent_
BaseHadronizer(edm::ParameterSet const &ps)
unsigned int maxEventsToPrint_
unsigned int pythiaListVerbosity_
Pythia6Service * pythia6Service_
edm::ParameterSet myPSet_
CLHEP::HepRandomEngine * randomEngine_

◆ ~ExhumeHadronizer()

gen::ExhumeHadronizer::~ExhumeHadronizer ( )
override

Definition at line 94 of file ExhumeHadronizer.cc.

References exhumeEvent_, exhumeProcess_, and pythia6Service_.

94  {
95  //delete pythia6Hadronizer_;
96  delete pythia6Service_;
97  delete exhumeEvent_;
98  delete exhumeProcess_;
99  }
Exhume::Event * exhumeEvent_
Pythia6Service * pythia6Service_
Exhume::CrossSection * exhumeProcess_

Member Function Documentation

◆ classname()

const char * gen::ExhumeHadronizer::classname ( ) const

Definition at line 273 of file ExhumeHadronizer.cc.

273 { return "gen::ExhumeHadronizer"; }

◆ decay()

bool gen::ExhumeHadronizer::decay ( )

Definition at line 168 of file ExhumeHadronizer.cc.

168 { return true; }

◆ declareSpecialSettings()

bool gen::ExhumeHadronizer::declareSpecialSettings ( const std::vector< std::string > &  )

Definition at line 244 of file ExhumeHadronizer.cc.

244 { return true; }

◆ declareStableParticles()

bool gen::ExhumeHadronizer::declareStableParticles ( const std::vector< int > &  _pdg)

Definition at line 229 of file ExhumeHadronizer.cc.

References gen::call_pygive(), gather_cfg::cout, mps_fire::i, and pycomp.

229  {
230  std::vector<int> pdg = _pdg;
231  //return pythia6Hadronizer_->declareStableParticles(pdg);
232 
233  for (size_t i = 0; i < pdg.size(); i++) {
234  int pyCode = pycomp(pdg[i]);
235  std::ostringstream pyCard;
236  pyCard << "MDCY(" << pyCode << ",1)=0";
237  std::cout << pyCard.str() << std::endl;
238  call_pygive(pyCard.str());
239  }
240 
241  return true;
242  }
bool call_pygive(const std::string &line)
#define pycomp

◆ doSetRandomEngine()

void gen::ExhumeHadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
overrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 101 of file ExhumeHadronizer.cc.

References exhumeEvent_, pythia6Service_, randomEngine_, Exhume::Event::SetRandomEngine(), gen::Pythia6Service::setRandomEngine(), and gen::v.

101  {
103  randomEngine_ = v;
104  if (exhumeEvent_) {
106  }
107  }
Exhume::Event * exhumeEvent_
double v[5][pyjets_maxn]
void SetRandomEngine(CLHEP::HepRandomEngine *engine)
Definition: Event.h:22
Pythia6Service * pythia6Service_
void setRandomEngine(CLHEP::HepRandomEngine *v)
CLHEP::HepRandomEngine * randomEngine_

◆ doSharedResources()

std::vector<std::string> const& gen::ExhumeHadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 60 of file ExhumeHadronizer.h.

References theSharedResources.

60 { return theSharedResources; }
static const std::vector< std::string > theSharedResources

◆ finalizeEvent()

void gen::ExhumeHadronizer::finalizeEvent ( )

Definition at line 109 of file ExhumeHadronizer.cc.

References gen::call_pylist(), convertToPDG_, gather_cfg::cout, gen::BaseHadronizer::event(), hepMCVerbosity_, maxEventsToPrint_, pyint1, pypars, and pythiaListVerbosity_.

109  {
110  //pythia6Hadronizer_->finalizeEvent();
111 
112  event()->set_signal_process_id(pypars.msti[0]);
113  event()->set_event_scale(pypars.pari[16]);
114 
115  HepMC::PdfInfo pdf;
116  pdf.set_id1(pyint1.mint[14] == 21 ? 0 : pyint1.mint[14]);
117  pdf.set_id2(pyint1.mint[15] == 21 ? 0 : pyint1.mint[15]);
118  pdf.set_x1(pyint1.vint[40]);
119  pdf.set_x2(pyint1.vint[41]);
120  pdf.set_pdf1(pyint1.vint[38] / pyint1.vint[40]);
121  pdf.set_pdf2(pyint1.vint[39] / pyint1.vint[41]);
122  pdf.set_scalePDF(pyint1.vint[50]);
123 
124  event()->set_pdf_info(pdf);
125 
126  event()->weights().push_back(pyint1.vint[96]);
127 
128  // convert particle IDs Py6->PDG, if requested
129  if (convertToPDG_) {
130  for (HepMC::GenEvent::particle_iterator part = event()->particles_begin(); part != event()->particles_end();
131  ++part) {
132  (*part)->set_pdg_id(HepPID::translatePythiatoPDT((*part)->pdg_id()));
133  }
134  }
135 
136  // service printouts, if requested
137  //
138  if (maxEventsToPrint_ > 0) {
142  if (hepMCVerbosity_) {
143  std::cout << "Event process = " << pypars.msti[0] << std::endl << "----------------------" << std::endl;
144  event()->print();
145  }
146  }
147 
148  return;
149  }
unsigned int maxEventsToPrint_
void call_pylist(int mode)
#define pyint1
unsigned int pythiaListVerbosity_
std::unique_ptr< HepMC::GenEvent > & event()
#define pypars
part
Definition: HCALResponse.h:20

◆ generatePartonsAndHadronize()

bool gen::ExhumeHadronizer::generatePartonsAndHadronize ( )

Definition at line 151 of file ExhumeHadronizer.cc.

References gen::BaseHadronizer::event(), exhume_conv, exhumeEvent_, exhumeProcess_, Exhume::Event::Generate(), gen::FortranCallback::getInstance(), Exhume::CrossSection::Hadronise(), pythia6Service_, and gen::FortranCallback::resetIterationsPerEvent().

151  {
152  Pythia6Service::InstanceWrapper guard(pythia6Service_);
153 
155 
156  // generate event
157 
160 
161  event().reset(exhume_conv.read_next_event());
162 
163  return true;
164  }
HepMC::IO_HEPEVT exhume_conv
Exhume::Event * exhumeEvent_
std::unique_ptr< HepMC::GenEvent > & event()
Pythia6Service * pythia6Service_
static FortranCallback * getInstance()
Exhume::CrossSection * exhumeProcess_

◆ hadronize()

bool gen::ExhumeHadronizer::hadronize ( )

Definition at line 166 of file ExhumeHadronizer.cc.

166 { return false; }

◆ initializeForExternalPartons()

bool gen::ExhumeHadronizer::initializeForExternalPartons ( )

Definition at line 172 of file ExhumeHadronizer.cc.

172 { return false; }

◆ initializeForInternalPartons()

bool gen::ExhumeHadronizer::initializeForInternalPartons ( )

Definition at line 182 of file ExhumeHadronizer.cc.

References edm::errors::Configuration, hltExoticaValidator_cfi::DiPhoton, Exception, exhumeEvent_, exhumeProcess_, edm::ParameterSet::getParameter(), myPSet_, pypars, pythia6Service_, randomEngine_, Exhume::Event::SetMassRange(), Exhume::Event::SetParameterSpace(), AlCaHLTBitMon_QueryRunRegistry::string, and muonRecoAnalyzer_cfi::thetaMin.

182  {
183  Pythia6Service::InstanceWrapper guard(pythia6Service_);
184 
185  // pythia6Service_->setGeneralParams();
186 
187  //Exhume Initialization
188  edm::ParameterSet processPSet = myPSet_.getParameter<edm::ParameterSet>("ExhumeProcess");
189  std::string processType = processPSet.getParameter<std::string>("ProcessType");
190  int sigID = -1;
191  if (processType == "Higgs") {
193  int higgsDecay = processPSet.getParameter<int>("HiggsDecay");
194  (static_cast<Exhume::Higgs*>(exhumeProcess_))->SetHiggsDecay(higgsDecay);
195  sigID = 100 + higgsDecay;
196  } else if (processType == "QQ") {
198  int quarkType = processPSet.getParameter<int>("QuarkType");
199  double thetaMin = processPSet.getParameter<double>("ThetaMin");
200  ((Exhume::QQ*)exhumeProcess_)->SetQuarkType(quarkType);
201  (static_cast<Exhume::QQ*>(exhumeProcess_))->SetThetaMin(thetaMin);
202  sigID = 200 + quarkType;
203  } else if (processType == "GG") {
205  double thetaMin = processPSet.getParameter<double>("ThetaMin");
206  (static_cast<Exhume::GG*>(exhumeProcess_))->SetThetaMin(thetaMin);
207  sigID = 300;
208  } else if (processType == "DiPhoton") {
210  double thetaMin = processPSet.getParameter<double>("ThetaMin");
211  (static_cast<Exhume::DiPhoton*>(exhumeProcess_))->SetThetaMin(thetaMin);
212  sigID = 400;
213  } else {
214  sigID = -1;
215  throw edm::Exception(edm::errors::Configuration, "ExhumeError") << " No valid Exhume Process";
216  }
217 
218  pypars.msti[0] = sigID;
220 
221  double massRangeLow = processPSet.getParameter<double>("MassRangeLow");
222  double massRangeHigh = processPSet.getParameter<double>("MassRangeHigh");
223  exhumeEvent_->SetMassRange(massRangeLow, massRangeHigh);
225 
226  return true;
227  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exhume::Event * exhumeEvent_
Definition: QQ.h:11
void SetMassRange(const double &Min_, const double &Max_)
Definition: Event.h:52
Pythia6Service * pythia6Service_
void SetParameterSpace()
#define pypars
Definition: GG.h:11
edm::ParameterSet myPSet_
Exhume::CrossSection * exhumeProcess_
CLHEP::HepRandomEngine * randomEngine_

◆ readSettings()

bool gen::ExhumeHadronizer::readSettings ( int  )

Definition at line 174 of file ExhumeHadronizer.cc.

References pythia6Service_, and gen::Pythia6Service::setGeneralParams().

174  {
175  Pythia6Service::InstanceWrapper guard(pythia6Service_);
176 
178 
179  return true;
180  }
Pythia6Service * pythia6Service_

◆ residualDecay()

bool gen::ExhumeHadronizer::residualDecay ( )

Definition at line 170 of file ExhumeHadronizer.cc.

170 { return true; }

◆ statistics()

void gen::ExhumeHadronizer::statistics ( )

Definition at line 246 of file ExhumeHadronizer.cc.

References Exhume::Event::CrossSectionCalculation(), callgraph::cs, exhumeEvent_, exhumeProcess_, Exhume::Event::GetEfficiency(), Exhume::CrossSection::GetName(), Skims_PA_cff::name, gen::BaseHadronizer::runInfo(), GenRunInfoProduct::setInternalXSec(), and AlCaHLTBitMon_QueryRunRegistry::string.

246  {
247  std::ostringstream footer_str;
248 
250  double eff = exhumeEvent_->GetEfficiency();
252 
253  footer_str << "\n"
254  << " You have just been ExHuMEd."
255  << "\n"
256  << "\n";
257  footer_str << " The cross section for process " << name << " is " << cs << " fb"
258  << "\n"
259  << "\n";
260  footer_str << " The efficiency of event generation was " << eff << "%"
261  << "\n"
262  << "\n";
263 
264  edm::LogInfo("") << footer_str.str();
265 
266  if (!runInfo().internalXSec()) {
268  }
269 
270  return;
271  }
Exhume::Event * exhumeEvent_
double CrossSectionCalculation()
std::string GetName()
Definition: CrossSection.h:105
void setInternalXSec(const XSec &xsec)
double GetEfficiency()
Definition: Event.h:66
GenRunInfoProduct & runInfo()
Log< level::Info, false > LogInfo
Exhume::CrossSection * exhumeProcess_

Member Data Documentation

◆ comEnergy_

double gen::ExhumeHadronizer::comEnergy_
private

Definition at line 68 of file ExhumeHadronizer.h.

◆ convertToPDG_

bool gen::ExhumeHadronizer::convertToPDG_
private

Definition at line 78 of file ExhumeHadronizer.h.

Referenced by ExhumeHadronizer(), and finalizeEvent().

◆ exhumeEvent_

Exhume::Event* gen::ExhumeHadronizer::exhumeEvent_
private

◆ exhumeProcess_

Exhume::CrossSection* gen::ExhumeHadronizer::exhumeProcess_
private

◆ hepMCVerbosity_

bool gen::ExhumeHadronizer::hepMCVerbosity_
private

Definition at line 74 of file ExhumeHadronizer.h.

Referenced by finalizeEvent().

◆ maxEventsToPrint_

unsigned int gen::ExhumeHadronizer::maxEventsToPrint_
private

Definition at line 75 of file ExhumeHadronizer.h.

Referenced by finalizeEvent().

◆ myPSet_

edm::ParameterSet gen::ExhumeHadronizer::myPSet_
private

Definition at line 72 of file ExhumeHadronizer.h.

Referenced by initializeForInternalPartons().

◆ pythia6Service_

Pythia6Service* gen::ExhumeHadronizer::pythia6Service_
private

◆ pythiaListVerbosity_

unsigned int gen::ExhumeHadronizer::pythiaListVerbosity_
private

Definition at line 76 of file ExhumeHadronizer.h.

Referenced by finalizeEvent().

◆ randomEngine_

CLHEP::HepRandomEngine* gen::ExhumeHadronizer::randomEngine_
private

Definition at line 66 of file ExhumeHadronizer.h.

Referenced by doSetRandomEngine(), and initializeForInternalPartons().

◆ theSharedResources

const std::vector< std::string > gen::ExhumeHadronizer::theSharedResources
staticprivate