test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

Enumerator
mc 
mb 
mt 
mw 
mz 
mh 
MASS_MAX 

Definition at line 58 of file AlpgenHeader.h.

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

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

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

Definition at line 181 of file AlpgenHeader.cc.

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

Referenced by AlpgenSource::getParameter().

182 {
183  static const unsigned int size = sizeof alpgenParameterNames /
184  sizeof alpgenParameterNames[0];
185 
186  const AlpgenParameterName *pos =
187  std::find(alpgenParameterNames,
188  alpgenParameterNames + size, index);
189 
190  if (pos != alpgenParameterNames + size)
191  return pos->name;
192 
193  std::ostringstream ss;
194  ss << "unknown " << (int)index;
195  return ss.str();
196 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
tuple size
Write out results.
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 67 of file AlpgenHeader.cc.

References begin, filterCSVwithJSON::copy, spr::find(), ihrd, lumi, masses, nEvents, params, xsec, and xsecErr.

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

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

Member Data Documentation

unsigned int AlpgenHeader::ihrd
double AlpgenHeader::lumi

Definition at line 72 of file AlpgenHeader.h.

Referenced by parse().

double AlpgenHeader::masses[MASS_MAX]
double AlpgenHeader::nEvents

Definition at line 71 of file AlpgenHeader.h.

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

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

Definition at line 69 of file AlpgenHeader.h.

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

double AlpgenHeader::xsecErr

Definition at line 70 of file AlpgenHeader.h.

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