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
gen::JetMatchingAlpgen Class Reference

#include <JetMatchingAlpgen.h>

Inheritance diagram for gen::JetMatchingAlpgen:
gen::JetMatching

Public Member Functions

 JetMatchingAlpgen (const edm::ParameterSet &params)
 
 ~JetMatchingAlpgen ()
 
- Public Member Functions inherited from gen::JetMatching
virtual void beforeHadronisationExec ()
 
const std::vector
< JetPartonMatch > & 
getMatchSummary () const
 
bool isMatchingDone ()
 
 JetMatching (const edm::ParameterSet &params)
 
void resetMatchingStatus ()
 
virtual ~JetMatching ()
 

Private Member Functions

void beforeHadronisation (const lhef::LHEEvent *event)
 
std::set< std::string > capabilities () const
 
void init (const lhef::LHERunInfo *runInfo)
 
int match (const HepMC::GenEvent *partonLevel, const HepMC::GenEvent *finalState, bool showeredFinalState)
 

Private Attributes

bool applyMatching
 
bool eventInitialized
 
AlpgenHeader header
 
bool runInitialized
 

Additional Inherited Members

- Static Public Member Functions inherited from gen::JetMatching
static std::auto_ptr< JetMatchingcreate (const edm::ParameterSet &params)
 
- Protected Attributes inherited from gen::JetMatching
bool fMatchingStatus
 
std::vector< JetPartonMatchmatchSummary
 

Detailed Description

Definition at line 12 of file JetMatchingAlpgen.h.

Constructor & Destructor Documentation

gen::JetMatchingAlpgen::JetMatchingAlpgen ( const edm::ParameterSet params)

Definition at line 34 of file JetMatchingAlpgen.cc.

References ahopts_, AHOPTS::etclus, edm::ParameterSet::getParameter(), AHOPTS::iexc, and AHOPTS::rclus.

34  :
35  JetMatching(params),
36  applyMatching(params.getParameter<bool>("applyMatching")),
37  runInitialized(false)
38 {
39  ahopts_.etclus = params.getParameter<double>("etMin");
40  ahopts_.rclus = params.getParameter<double>("drMin");
41  ahopts_.iexc = params.getParameter<bool>("exclusive");
42 }
T getParameter(std::string const &) const
struct AHOPTS ahopts_
double rclus
JetMatching(const edm::ParameterSet &params)
Definition: JetMatching.cc:18
double etclus
gen::JetMatchingAlpgen::~JetMatchingAlpgen ( )

Definition at line 45 of file JetMatchingAlpgen.cc.

46 {
47 }

Member Function Documentation

void gen::JetMatchingAlpgen::beforeHadronisation ( const lhef::LHEEvent event)
privatevirtual

Reimplemented from gen::JetMatching.

Definition at line 120 of file JetMatchingAlpgen.cc.

References eventInitialized, edm::hlt::Exception, and runInitialized.

121 {
122  // We can't continue if the run has not been initialized.
123  if (!runInitialized)
124  throw cms::Exception("Generator|PartonShowerVeto")
125  << "Run not initialized in JetMatchingAlpgen"
126  << std::endl;
127 
128  // We are called just after LHEInterface has filled in
129  // the Fortran common block (and Pythia6 called UPEVNT).
130 
131  // Possibly not interesting for us.
132  // (except perhaps for debugging?)
133  // pyupre_();
134  // dbpart_();
135  eventInitialized = true;
136 }
std::set< std::string > gen::JetMatchingAlpgen::capabilities ( ) const
privatevirtual

Reimplemented from gen::JetMatching.

Definition at line 49 of file JetMatchingAlpgen.cc.

References query::result.

50 {
51  std::set<std::string> result;
52  result.insert("psFinalState");
53  result.insert("hepevt");
54  result.insert("pythia6");
55  return result;
56 }
tuple result
Definition: query.py:137
void gen::JetMatchingAlpgen::init ( const lhef::LHERunInfo runInfo)
privatevirtual

Reimplemented from gen::JetMatching.

Definition at line 60 of file JetMatchingAlpgen.cc.

References ahpars_, ahppara_, gen::alsetp_(), filterCSVwithJSON::copy, AlpgenHeader::ebeam, AHPPARA::ebeam, lhef::LHERunInfo::findHeader(), header, AHPPARA::ihrd, AlpgenHeader::ihrd, AlpgenHeader::MASS_MAX, AHPPARA::masses, AlpgenHeader::masses, AHPARS::nparam, AlpgenHeader::params, AlpgenHeader::parse(), AHPARS::parval, and runInitialized.

61 {
62 
63  // Read Alpgen run card stored in the LHERunInfo object.
64  std::vector<std::string> headerLines = runInfo->findHeader("AlpgenUnwParFile");
65  if (headerLines.empty())
66  throw cms::Exception("Generator|PartonShowerVeto")
67  << "In order to use Alpgen jet matching, "
68  "the input file has to contain the corresponding "
69  "Alpgen headers." << std::endl;
70 
71  // Parse the header using its bultin function.
72  header.parse(headerLines.begin(), headerLines.end());
73 
74  // I don't want to print this right now.
75 // std::cout << "Alpgen header" << std::endl;
76 // std::cout << "========================" << std::endl;
77 // std::cout << "\tihrd = " << header.ihrd << std::endl;
78 // std::cout << "\tmc = " << header.masses[AlpgenHeader::mc]
79 // << ", mb = " << header.masses[AlpgenHeader::mb]
80 // << ", mt = " << header.masses[AlpgenHeader::mt]
81 // << ", mw = " << header.masses[AlpgenHeader::mw]
82 // << ", mz = " << header.masses[AlpgenHeader::mz]
83 // << ", mh = " << header.masses[AlpgenHeader::mh]
84 // << std::endl;
85 // for(std::map<AlpgenHeader::Parameter, double>::const_iterator iter =
86 // header.params.begin(); iter != header.params.end(); ++iter)
87 // std::cout << "\t" << AlpgenHeader::parameterName(iter->first)
88 // << " = " << iter->second << std::endl;
89 // std::cout << "\txsec = " << header.xsec
90 // << " +-" << header.xsecErr << std::endl;
91 // std::cout << "========================" << std::endl;
92 
93  // Here we pass a few header variables to common block and
94  // call Alpgen init routine to do the rest.
95  // The variables passed first are the ones directly that
96  // need to be set up "manually": IHRD and the masses.
97  // (ebeam is set just to mimic the original code)
98  // Afterwards, we pass the full spectrum of Alpgen
99  // parameters directly into the AHPARS structure, to be
100  // treated by AHSPAR which is called inside alsetp_().
101 
105 
106  for(std::map<AlpgenHeader::Parameter, double>::const_iterator iter =
107  header.params.begin(); iter != header.params.end(); ++iter) {
108  if (iter->first <= 0 || iter->first >= (int)AHPARS::nparam - 1)
109  continue;
110  ahpars_.parval[(int)iter->first - 1] = iter->second;
111  }
112 
113  // Run the rest of the setup.
114  alsetp_();
115 
116  // When we reach this point, the run is fully initialized.
117  runInitialized = true;
118 }
struct AHPPARA ahppara_
void alsetp_()
std::map< Parameter, double > params
Definition: AlpgenHeader.h:67
bool parse(const std::vector< std::string >::const_iterator &begin, const std::vector< std::string >::const_iterator &end)
Definition: AlpgenHeader.cc:67
double masses[6]
double parval[nparam]
static const unsigned int nparam
unsigned int ihrd
Definition: AlpgenHeader.h:68
struct AHPARS ahpars_
std::vector< std::string > findHeader(const std::string &tag) const
Definition: LHERunInfo.cc:529
double masses[MASS_MAX]
Definition: AlpgenHeader.h:73
int gen::JetMatchingAlpgen::match ( const HepMC::GenEvent *  partonLevel,
const HepMC::GenEvent *  finalState,
bool  showeredFinalState 
)
privatevirtual

Implements gen::JetMatching.

Definition at line 138 of file JetMatchingAlpgen.cc.

References gen::alveto_(), applyMatching, eventInitialized, edm::hlt::Exception, and runInitialized.

141 {
142  if (!showeredFinalState)
143  throw cms::Exception("Generator|PartonShowerVeto")
144  << "Alpgen matching expected parton shower "
145  "final state." << std::endl;
146 
147  if (!runInitialized)
148  throw cms::Exception("Generator|PartonShowerVeto")
149  << "Run not initialized in JetMatchingAlpgen"
150  << std::endl;
151 
152  if (!eventInitialized)
153  throw cms::Exception("Generator|PartonShowerVeto")
154  << "Event not initialized in JetMatchingAlpgen"
155  << std::endl;
156 
157  // If matching not required (e.g., icckw = 0), don't run the
158  // FORTRAN veto code.
159  if(!applyMatching) return 0;
160 
161  // Call the Fortran veto code.
162  int veto = 0;
163  alveto_(&veto);
164 
165  eventInitialized = false;
166 
167  // If event was vetoed, the variable veto will contain the number 1.
168  // In this case, we must return 1 - that will be used as the return value from UPVETO.
169  // If event was accepted, the variable veto will contain the number 0.
170  // In this case, we must return 0 - that will be used as the return value from UPVETO.
171  return veto ? 1 : 0;
172 }
void alveto_(int *ipveto)

Member Data Documentation

bool gen::JetMatchingAlpgen::applyMatching
private

Definition at line 27 of file JetMatchingAlpgen.h.

Referenced by match().

bool gen::JetMatchingAlpgen::eventInitialized
private

Definition at line 29 of file JetMatchingAlpgen.h.

Referenced by beforeHadronisation(), and match().

AlpgenHeader gen::JetMatchingAlpgen::header
private

Definition at line 31 of file JetMatchingAlpgen.h.

Referenced by init().

bool gen::JetMatchingAlpgen::runInitialized
private

Definition at line 28 of file JetMatchingAlpgen.h.

Referenced by beforeHadronisation(), init(), and match().