CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

AlpgenHeader Struct Reference

#include <AlpgenHeader.h>

List of all members.

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.

              {
    mc = 0, mb, mt, mw, mz, mh, MASS_MAX
  };
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.

                 {
    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
  };

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(), and findQualityFiles::size.

Referenced by AlpgenSource::getParameter().

{
  static const unsigned int size = sizeof alpgenParameterNames /
    sizeof alpgenParameterNames[0];

  const AlpgenParameterName *pos =
    std::find(alpgenParameterNames,
              alpgenParameterNames + size, index);

  if (pos != alpgenParameterNames + size)
    return pos->name;

  std::ostringstream ss;
  ss << "unknown " << (int)index;
  return ss.str();
}
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, EcalElecEmulTccFlatFileProducerFromTPG_cfg::tokens, xsec, and xsecErr.

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

{
  std::vector<std::string>::const_iterator line = begin;
  
  // Mimicking Alpgen - read the _unw.par file until you find the "****".
  while(line != end)
    if ((line++)->find("****") != std::string::npos)
      break;
  
  AlpgenParTokens tokens;
  
  // hard process code
  if (line == end || !tokens.parse(*line++, true) ||
      !tokens.values.empty())
    return false;
  ihrd = tokens.index;

  // mc,mb,mt,mw,mz,mh
  if (line == end || !tokens.parse(*line++, false) ||
      tokens.values.size() < 6)
    return false;

  std::copy(tokens.values.begin(), tokens.values.begin() + 6, masses);

  // key - value pairs
  params.clear();
  while(line != end && line->find("****") == std::string::npos) {
    if (!tokens.parse(*line++, true) ||
        tokens.values.size() != 1)
      return false;
    params[(Parameter)tokens.index] = tokens.values[0];
  }
  if (line == end)
    return false;
  else
    line++;

  // cross-section
  if (line == end || !tokens.parse(*line++, false) ||
      tokens.values.size() != 2)
    return false;

  xsec = tokens.values[0];
  xsecErr = tokens.values[1];

  // unweighted events, luminosity
  if (line == end || !tokens.parse(*line++, true) ||
      tokens.values.size() != 1)
    return false;

  nEvents = tokens.index;
  lumi = tokens.values[0];

  return true;
}

Member Data Documentation

unsigned int AlpgenHeader::ihrd

Definition at line 72 of file AlpgenHeader.h.

Referenced by parse().

double AlpgenHeader::masses[MASS_MAX]

Definition at line 71 of file AlpgenHeader.h.

Referenced by parse().

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

Definition at line 69 of file AlpgenHeader.h.

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

Definition at line 70 of file AlpgenHeader.h.

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