CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes
AlpgenHeader Struct Reference

#include <AlpgenHeader.h>

Public Types

enum  Masses {
  mc = 0, mb, mt, mw,
  mz, mh, MASS_MAX
}
 
enum  Parameter {
  ih2 = 2, ebeam = 3, ndns = 4, iqopt = 5,
  qfac = 6, ickkw = 7, ktfac = 8, njets = 10,
  ihvy = 11, ihvy2 = 12, nw = 13, nz = 14,
  nh = 15, nph = 16, ptjmin = 30, ptbmin = 31,
  ptcmin = 32, ptlmin = 33, metmin = 34, ptphmin = 35,
  etajmax = 40, etabmax = 41, etacmax = 42, etalmax = 43,
  etaphmax = 44, drjmin = 50, drbmin = 51, drcmin = 52,
  drlmin = 55, drphjmin = 56, drphlmin = 57, drphmin = 58,
  mllmin = 61, mllmax = 62, iseed1 = 90, iseed2 = 91,
  itopprc = 102, cluopt = 160, iseed3 = 190, iseed4 = 191
}
 

Public Member Functions

bool parse (const std::vector< std::string >::const_iterator &begin, const std::vector< std::string >::const_iterator &end)
 

Static Public Member Functions

static std::string parameterName (Parameter index)
 

Public Attributes

unsigned int ihrd
 
double lumi
 
double masses [MASS_MAX]
 
double nEvents
 
std::map< Parameter, double > params
 
double xsec
 
double xsecErr
 

Detailed Description

A structure that can parse and represent the contents of an ALPGEN _unw.par run information file.

Definition at line 10 of file AlpgenHeader.h.

Member Enumeration Documentation

◆ Masses

Enumerator
mc 
mb 
mt 
mw 
mz 
mh 
MASS_MAX 

Definition at line 58 of file AlpgenHeader.h.

◆ Parameter

Enumerator
ih2 
ebeam 
ndns 
iqopt 
qfac 
ickkw 
ktfac 
njets 
ihvy 
ihvy2 
nw 
nz 
nh 
nph 
ptjmin 
ptbmin 
ptcmin 
ptlmin 
metmin 
ptphmin 
etajmax 
etabmax 
etacmax 
etalmax 
etaphmax 
drjmin 
drbmin 
drcmin 
drlmin 
drphjmin 
drphlmin 
drphmin 
mllmin 
mllmax 
iseed1 
iseed2 
itopprc 
cluopt 
iseed3 
iseed4 

Definition at line 11 of file AlpgenHeader.h.

11  {
12  ih2 = 2,
13  ebeam = 3,
14  ndns = 4,
15  iqopt = 5,
16  qfac = 6,
17  ickkw = 7,
18  ktfac = 8,
19  njets = 10,
20  ihvy = 11,
21  ihvy2 = 12,
22  nw = 13,
23  nz = 14,
24  nh = 15,
25  nph = 16,
26  ptjmin = 30,
27  ptbmin = 31,
28  ptcmin = 32,
29  ptlmin = 33,
30  metmin = 34,
31  ptphmin = 35,
32  etajmax = 40,
33  etabmax = 41,
34  etacmax = 42,
35  etalmax = 43,
36  etaphmax = 44,
37  drjmin = 50,
38  drbmin = 51,
39  drcmin = 52,
40  drlmin = 55,
41  drphjmin = 56,
42  drphlmin = 57,
43  drphmin = 58,
44  mllmin = 61,
45  mllmax = 62,
46  iseed1 = 90,
47  iseed2 = 91,
48  itopprc = 102,
49  cluopt = 160,
50  iseed3 = 190,
51  iseed4 = 191
52  };

Member Function Documentation

◆ parameterName()

std::string AlpgenHeader::parameterName ( Parameter  index)
static

Function to return the human-readable names of ALPGEN parameters.

Definition at line 142 of file AlpgenHeader.cc.

References spr::find(), createfilelist::int, findQualityFiles::size, and contentValuesCheck::ss.

Referenced by AlpgenSource::getParameter().

142  {
143  static const unsigned int size = sizeof alpgenParameterNames / sizeof alpgenParameterNames[0];
144 
145  const AlpgenParameterName *pos = std::find(alpgenParameterNames, alpgenParameterNames + size, index);
146 
147  if (pos != alpgenParameterNames + size)
148  return pos->name;
149 
150  std::ostringstream ss;
151  ss << "unknown " << (int)index;
152  return ss.str();
153 }
size
Write out results.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ parse()

bool AlpgenHeader::parse ( const std::vector< std::string >::const_iterator &  begin,
const std::vector< std::string >::const_iterator &  end 
)

A function to parse a std::<vector<std::string> containing a _unw.par ALPGEN file, and store it in the internal structure.

Definition at line 62 of file AlpgenHeader.cc.

References SplitLinear::begin, filterCSVwithJSON::copy, mps_fire::end, spr::find(), ihrd, mps_splice::line, masses, nEvents, params, xsec, and xsecErr.

Referenced by AlpgenSource::AlpgenSource(), and gen::JetMatchingAlpgen::init().

63  {
64  std::vector<std::string>::const_iterator line = begin;
65 
66  // Mimicking Alpgen - read the _unw.par file until you find the "****".
67  while (line != end)
68  if ((line++)->find("****") != std::string::npos)
69  break;
70 
71  AlpgenParTokens tokens;
72 
73  // hard process code
74  if (line == end || !tokens.parse(*line++, true) || !tokens.values.empty())
75  return false;
76  ihrd = tokens.index;
77 
78  // mc,mb,mt,mw,mz,mh
79  if (line == end || !tokens.parse(*line++, false) || tokens.values.size() < 6)
80  return false;
81 
82  std::copy(tokens.values.begin(), tokens.values.begin() + 6, masses);
83 
84  // key - value pairs
85  params.clear();
86  while (line != end && line->find("****") == std::string::npos) {
87  if (!tokens.parse(*line++, true) || tokens.values.size() != 1)
88  return false;
89  params[(Parameter)tokens.index] = tokens.values[0];
90  }
91  if (line == end)
92  return false;
93  else
94  line++;
95 
96  // cross-section
97  if (line == end || !tokens.parse(*line++, false) || tokens.values.size() != 2)
98  return false;
99 
100  xsec = tokens.values[0];
101  xsecErr = tokens.values[1];
102 
103  // unweighted events, luminosity
104  if (line == end || !tokens.parse(*line++, true) || tokens.values.size() != 1)
105  return false;
106 
107  nEvents = tokens.index;
108  lumi = tokens.values[0];
109 
110  return true;
111 }
std::map< Parameter, double > params
Definition: AlpgenHeader.h:65
double nEvents
Definition: AlpgenHeader.h:69
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
unsigned int ihrd
Definition: AlpgenHeader.h:66
double xsecErr
Definition: AlpgenHeader.h:68
double masses[MASS_MAX]
Definition: AlpgenHeader.h:71

Member Data Documentation

◆ ihrd

unsigned int AlpgenHeader::ihrd

◆ lumi

double AlpgenHeader::lumi

Definition at line 70 of file AlpgenHeader.h.

◆ masses

double AlpgenHeader::masses[MASS_MAX]

◆ nEvents

double AlpgenHeader::nEvents

Definition at line 69 of file AlpgenHeader.h.

Referenced by looper.Looper::loop(), and parse().

◆ params

std::map<Parameter, double> AlpgenHeader::params

◆ xsec

double AlpgenHeader::xsec

Definition at line 67 of file AlpgenHeader.h.

Referenced by AlpgenSource::beginRun(), and parse().

◆ xsecErr

double AlpgenHeader::xsecErr

Definition at line 68 of file AlpgenHeader.h.

Referenced by AlpgenSource::beginRun(), and parse().