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.

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  }

References convertToPDG_, and muonDTDigis_cfi::pset.

◆ ~ExhumeHadronizer()

gen::ExhumeHadronizer::~ExhumeHadronizer ( )
override

Definition at line 94 of file ExhumeHadronizer.cc.

94  {
95  //delete pythia6Hadronizer_;
96  delete pythia6Service_;
97  delete exhumeEvent_;
98  delete exhumeProcess_;
99  }

References exhumeEvent_, exhumeProcess_, and pythia6Service_.

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.

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  }

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

◆ doSetRandomEngine()

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

◆ doSharedResources()

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

Reimplemented from gen::BaseHadronizer.

Definition at line 60 of file ExhumeHadronizer.h.

60 { return theSharedResources; }

References theSharedResources.

◆ finalizeEvent()

void gen::ExhumeHadronizer::finalizeEvent ( )

Definition at line 109 of file ExhumeHadronizer.cc.

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  }

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

◆ generatePartonsAndHadronize()

bool gen::ExhumeHadronizer::generatePartonsAndHadronize ( )

Definition at line 151 of file ExhumeHadronizer.cc.

151  {
152  Pythia6Service::InstanceWrapper guard(pythia6Service_);
153 
155 
156  // generate event
157 
160 
161  event().reset(conv.read_next_event());
162 
163  return true;
164  }

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

◆ 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.

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  }

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.

◆ readSettings()

bool gen::ExhumeHadronizer::readSettings ( int  )

Definition at line 174 of file ExhumeHadronizer.cc.

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

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

◆ 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.

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  }

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

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
Exhume::CrossSection::Hadronise
void Hadronise()
gen::ExhumeHadronizer::exhumeEvent_
Exhume::Event * exhumeEvent_
Definition: ExhumeHadronizer.h:81
mps_fire.i
i
Definition: mps_fire.py:355
fwrapper::cs
unique_ptr< ClusterSequence > cs
Definition: fastjetfortran_madfks.cc:45
conv
HepMC::IO_HEPEVT conv
Definition: ExhumeHadronizer.cc:27
pyint1
#define pyint1
Definition: ExhumeHadronizer.cc:51
Exhume::Higgs
Definition: Higgs.h:13
gather_cfg.cout
cout
Definition: gather_cfg.py:144
Exhume::Event::Generate
void Generate()
edm::LogInfo
Definition: MessageLogger.h:254
pypars
#define pypars
Definition: ExhumeHadronizer.cc:45
gen::FortranInstance::kFortranInstance
static const std::string kFortranInstance
Definition: FortranInstance.h:88
Exhume::Event::GetEfficiency
double GetEfficiency()
Definition: Event.h:66
GenRunInfoProduct::setInternalXSec
void setInternalXSec(const XSec &xsec)
Definition: GenRunInfoProduct.h:26
gen::Pythia6Service::setRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *v)
Definition: Pythia6Service.h:46
gen::ExhumeHadronizer::theSharedResources
static const std::vector< std::string > theSharedResources
Definition: ExhumeHadronizer.h:62
gen::ExhumeHadronizer::convertToPDG_
bool convertToPDG_
Definition: ExhumeHadronizer.h:78
gen::Pythia6Service::setGeneralParams
void setGeneralParams()
Definition: Pythia6Service.cc:157
gen::FortranCallback::getInstance
static FortranCallback * getInstance()
Definition: FortranCallback.h:52
Exhume::Event
Definition: Event.h:17
Exhume::Event::SetMassRange
void SetMassRange(const double &Min_, const double &Max_)
Definition: Event.h:52
part
part
Definition: HCALResponse.h:20
gen::ExhumeHadronizer::maxEventsToPrint_
unsigned int maxEventsToPrint_
Definition: ExhumeHadronizer.h:75
hltExoticaValidator_cfi.DiPhoton
DiPhoton
Definition: hltExoticaValidator_cfi.py:216
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Exhume::QQ
Definition: QQ.h:11
muonRecoAnalyzer_cfi.thetaMin
thetaMin
Definition: muonRecoAnalyzer_cfi.py:22
gen::FortranCallback::resetIterationsPerEvent
void resetIterationsPerEvent()
Definition: FortranCallback.h:23
pycomp
#define pycomp
Definition: ExhumeHadronizer.cc:60
gen::ExhumeHadronizer::pythia6Service_
Pythia6Service * pythia6Service_
Definition: ExhumeHadronizer.h:64
Exhume::GG
Definition: GG.h:11
edm::ParameterSet
Definition: ParameterSet.h:36
Exhume::Event::SetParameterSpace
void SetParameterSpace()
gen::ExhumeHadronizer::pythiaListVerbosity_
unsigned int pythiaListVerbosity_
Definition: ExhumeHadronizer.h:76
gen::v
double v[5][pyjets_maxn]
Definition: Cascade2Hadronizer.cc:74
gen::call_pylist
void call_pylist(int mode)
Definition: ExhumeHadronizer.cc:63
Exhume::Event::CrossSectionCalculation
double CrossSectionCalculation()
Exhume::CrossSection::GetName
std::string GetName()
Definition: CrossSection.h:105
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Exhume::Event::SetRandomEngine
void SetRandomEngine(CLHEP::HepRandomEngine *engine)
Definition: Event.h:22
gen::ExhumeHadronizer::exhumeProcess_
Exhume::CrossSection * exhumeProcess_
Definition: ExhumeHadronizer.h:82
gen::ExhumeHadronizer::comEnergy_
double comEnergy_
Definition: ExhumeHadronizer.h:68
gen::ExhumeHadronizer::myPSet_
edm::ParameterSet myPSet_
Definition: ExhumeHadronizer.h:72
gen::BaseHadronizer::event
std::unique_ptr< HepMC::GenEvent > & event()
Definition: BaseHadronizer.h:86
gen::BaseHadronizer::BaseHadronizer
BaseHadronizer(edm::ParameterSet const &ps)
Definition: BaseHadronizer.cc:12
edm::SharedResourceNames::kPythia6
static const std::string kPythia6
Definition: SharedResourceNames.h:26
Exception
Definition: hltDiff.cc:246
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
pdg
Definition: pdg_functions.h:28
gen::ExhumeHadronizer::randomEngine_
CLHEP::HepRandomEngine * randomEngine_
Definition: ExhumeHadronizer.h:66
gen::BaseHadronizer::runInfo
GenRunInfoProduct & runInfo()
Definition: BaseHadronizer.h:85
gen::call_pygive
bool call_pygive(const std::string &line)
Definition: ExhumeHadronizer.cc:64
edm::errors::Configuration
Definition: EDMException.h:36
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
gen::ExhumeHadronizer::hepMCVerbosity_
bool hepMCVerbosity_
Definition: ExhumeHadronizer.h:74