CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from gen::BaseHadronizer
 BaseHadronizer (edm::ParameterSet const &ps)
 
void cleanLHE ()
 
void generateLHE (edm::LuminosityBlock const &lumi, CLHEP::HepRandomEngine *rengine)
 
edm::EventgetEDMEvent () const
 
HepMC::GenEventgetGenEvent ()
 
GenEventInfoProductgetGenEventInfo ()
 
virtual GenLumiInfoHeadergetGenLumiInfoHeader () const
 
GenRunInfoProductgetGenRunInfo ()
 
const boost::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 (HepMC::GenEvent *event)
 
void resetEventInfo (GenEventInfoProduct *eventInfo)
 
virtual bool select (HepMC::GenEvent *) const
 
void setEDMEvent (edm::Event &event)
 
void setLHEEvent (lhef::LHEEvent *event)
 
void setLHERunInfo (lhef::LHERunInfo *runInfo)
 
void setRandomEngine (CLHEP::HepRandomEngine *v)
 
std::vector< std::string > const & sharedResources () const
 
 ~BaseHadronizer ()
 

Private Member Functions

virtual void doSetRandomEngine (CLHEP::HepRandomEngine *v) override
 
virtual 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::auto_ptr< HepMC::GenEvent > & event ()
 
std::auto_ptr
< GenEventInfoProduct > & 
eventInfo ()
 
lhef::LHEEventlheEvent ()
 
lhef::LHERunInfolheRunInfo ()
 
GenRunInfoProductrunInfo ()
 
- Protected Attributes inherited from gen::BaseHadronizer
std::string lheFile_
 
int randomIndex_
 

Detailed Description

Definition at line 41 of file ExhumeHadronizer.h.

Constructor & Destructor Documentation

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

Definition at line 78 of file ExhumeHadronizer.cc.

References convertToPDG_, edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().

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

Definition at line 99 of file ExhumeHadronizer.cc.

References exhumeEvent_, exhumeProcess_, and pythia6Service_.

99  {
100  //delete pythia6Hadronizer_;
101  delete pythia6Service_;
102  delete exhumeEvent_;
103  delete exhumeProcess_;
104 }
Exhume::Event * exhumeEvent_
Pythia6Service * pythia6Service_
Exhume::CrossSection * exhumeProcess_

Member Function Documentation

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

Definition at line 301 of file ExhumeHadronizer.cc.

302 {
303  return "gen::ExhumeHadronizer";
304 }
bool gen::ExhumeHadronizer::decay ( )

Definition at line 181 of file ExhumeHadronizer.cc.

182 {
183  return true;
184 }
bool gen::ExhumeHadronizer::declareSpecialSettings ( const std::vector< std::string > &  )

Definition at line 273 of file ExhumeHadronizer.cc.

274 {
275  return true;
276 }
bool gen::ExhumeHadronizer::declareStableParticles ( const std::vector< int > &  _pdg)

Definition at line 255 of file ExhumeHadronizer.cc.

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

256 {
257  std::vector<int> pdg = _pdg;
258  //return pythia6Hadronizer_->declareStableParticles(pdg);
259 
260  for ( size_t i=0; i < pdg.size(); i++ )
261  {
262  int pyCode = pycomp( pdg[i] );
263  std::ostringstream pyCard ;
264  pyCard << "MDCY(" << pyCode << ",1)=0";
265  std::cout << pyCard.str() << std::endl;
266  call_pygive( pyCard.str() );
267  }
268 
269  return true;
270 
271 }
int i
Definition: DBlmapReader.cc:9
bool call_pygive(const std::string &line)
#define pycomp
tuple cout
Definition: gather_cfg.py:145
void gen::ExhumeHadronizer::doSetRandomEngine ( CLHEP::HepRandomEngine *  v)
overrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 106 of file ExhumeHadronizer.cc.

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

107 {
109  randomEngine_ = v;
110  if(exhumeEvent_) {
112  }
113 }
Exhume::Event * exhumeEvent_
double v[5][pyjets_maxn]
void SetRandomEngine(CLHEP::HepRandomEngine *engine)
Definition: Event.h:24
Pythia6Service * pythia6Service_
void setRandomEngine(CLHEP::HepRandomEngine *v)
CLHEP::HepRandomEngine * randomEngine_
virtual std::vector<std::string> const& gen::ExhumeHadronizer::doSharedResources ( ) const
inlineoverrideprivatevirtual

Reimplemented from gen::BaseHadronizer.

Definition at line 68 of file ExhumeHadronizer.h.

References theSharedResources.

68 { return theSharedResources; }
static const std::vector< std::string > theSharedResources
void gen::ExhumeHadronizer::finalizeEvent ( )

Definition at line 115 of file ExhumeHadronizer.cc.

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

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

Definition at line 160 of file ExhumeHadronizer.cc.

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

161 {
162  Pythia6Service::InstanceWrapper guard(pythia6Service_);
163 
165 
166  // generate event
167 
170 
171  event().reset( conv.read_next_event() );
172 
173  return true;
174 }
Exhume::Event * exhumeEvent_
static HepMC::IO_HEPEVT conv
std::auto_ptr< HepMC::GenEvent > & event()
Pythia6Service * pythia6Service_
static FortranCallback * getInstance()
Exhume::CrossSection * exhumeProcess_
bool gen::ExhumeHadronizer::hadronize ( )

Definition at line 176 of file ExhumeHadronizer.cc.

177 {
178  return false;
179 }
bool gen::ExhumeHadronizer::initializeForExternalPartons ( )

Definition at line 191 of file ExhumeHadronizer.cc.

192 {
193  return false;
194 }
bool gen::ExhumeHadronizer::initializeForInternalPartons ( )

Definition at line 207 of file ExhumeHadronizer.cc.

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

208 {
209  Pythia6Service::InstanceWrapper guard(pythia6Service_);
210 
211  // pythia6Service_->setGeneralParams();
212 
213  //Exhume Initialization
214  edm::ParameterSet processPSet = myPSet_.getParameter<edm::ParameterSet>("ExhumeProcess");
215  std::string processType = processPSet.getParameter<std::string>("ProcessType");
216  int sigID = -1;
217  if(processType == "Higgs"){
219  int higgsDecay = processPSet.getParameter<int>("HiggsDecay");
220  (static_cast<Exhume::Higgs*>(exhumeProcess_))->SetHiggsDecay(higgsDecay);
221  sigID = 100 + higgsDecay;
222  } else if(processType == "QQ"){
224  int quarkType = processPSet.getParameter<int>("QuarkType");
225  double thetaMin = processPSet.getParameter<double>("ThetaMin");
226  ((Exhume::QQ*)exhumeProcess_)->SetQuarkType(quarkType);
227  (static_cast<Exhume::QQ*>(exhumeProcess_))->SetThetaMin(thetaMin);
228  sigID = 200 + quarkType;
229  } else if(processType == "GG"){
231  double thetaMin = processPSet.getParameter<double>("ThetaMin");
232  (static_cast<Exhume::GG*>(exhumeProcess_))->SetThetaMin(thetaMin);
233  sigID = 300;
234  } else if(processType == "DiPhoton"){
236  double thetaMin = processPSet.getParameter<double>("ThetaMin");
237  (static_cast<Exhume::DiPhoton*>(exhumeProcess_))->SetThetaMin(thetaMin);
238  sigID = 400;
239  } else{
240  sigID = -1;
241  throw edm::Exception(edm::errors::Configuration,"ExhumeError") <<" No valid Exhume Process";
242  }
243 
244  pypars.msti[0] = sigID;
246 
247  double massRangeLow = processPSet.getParameter<double>("MassRangeLow");
248  double massRangeHigh = processPSet.getParameter<double>("MassRangeHigh");
249  exhumeEvent_->SetMassRange(massRangeLow,massRangeHigh);
251 
252  return true;
253 }
T getParameter(std::string const &) const
Exhume::Event * exhumeEvent_
Definition: QQ.h:11
void SetMassRange(const double &Min_, const double &Max_)
Definition: Event.h:54
Pythia6Service * pythia6Service_
void SetParameterSpace()
#define pypars
Definition: GG.h:11
edm::ParameterSet myPSet_
Exhume::CrossSection * exhumeProcess_
CLHEP::HepRandomEngine * randomEngine_
bool gen::ExhumeHadronizer::readSettings ( int  )

Definition at line 196 of file ExhumeHadronizer.cc.

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

197 {
198 
199  Pythia6Service::InstanceWrapper guard(pythia6Service_);
200 
202 
203  return true;
204 
205 }
Pythia6Service * pythia6Service_
bool gen::ExhumeHadronizer::residualDecay ( )

Definition at line 186 of file ExhumeHadronizer.cc.

187 {
188  return true;
189 }
void gen::ExhumeHadronizer::statistics ( )

Definition at line 278 of file ExhumeHadronizer.cc.

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

279 {
280  std::ostringstream footer_str;
281 
283  double eff = exhumeEvent_->GetEfficiency();
285 
286  footer_str << "\n" <<" You have just been ExHuMEd." << "\n" << "\n";
287  footer_str << " The cross section for process " << name
288  << " is " << cs << " fb" << "\n" << "\n";
289  footer_str << " The efficiency of event generation was " << eff << "%" << "\n" << "\n";
290 
291  edm::LogInfo("") << footer_str.str();
292 
293  if ( !runInfo().internalXSec() )
294  {
295  runInfo().setInternalXSec( cs );
296  }
297 
298  return;
299 }
auto_ptr< ClusterSequence > cs
Exhume::Event * exhumeEvent_
double CrossSectionCalculation()
std::string GetName()
Definition: CrossSection.h:144
void setInternalXSec(const XSec &xsec)
double GetEfficiency()
Definition: Event.h:72
GenRunInfoProduct & runInfo()
Exhume::CrossSection * exhumeProcess_

Member Data Documentation

double gen::ExhumeHadronizer::comEnergy_
private

Definition at line 76 of file ExhumeHadronizer.h.

bool gen::ExhumeHadronizer::convertToPDG_
private

Definition at line 86 of file ExhumeHadronizer.h.

Referenced by ExhumeHadronizer(), and finalizeEvent().

Exhume::Event* gen::ExhumeHadronizer::exhumeEvent_
private
Exhume::CrossSection* gen::ExhumeHadronizer::exhumeProcess_
private
bool gen::ExhumeHadronizer::hepMCVerbosity_
private

Definition at line 82 of file ExhumeHadronizer.h.

Referenced by finalizeEvent().

unsigned int gen::ExhumeHadronizer::maxEventsToPrint_
private

Definition at line 83 of file ExhumeHadronizer.h.

Referenced by finalizeEvent().

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

Definition at line 80 of file ExhumeHadronizer.h.

Referenced by initializeForInternalPartons().

Pythia6Service* gen::ExhumeHadronizer::pythia6Service_
private
unsigned int gen::ExhumeHadronizer::pythiaListVerbosity_
private

Definition at line 84 of file ExhumeHadronizer.h.

Referenced by finalizeEvent().

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

Definition at line 74 of file ExhumeHadronizer.h.

Referenced by doSetRandomEngine(), and initializeForInternalPartons().

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