Fork me on GitHub

Changeset 1d9c62a in git for classes


Ignore:
Timestamp:
Aug 24, 2018, 4:19:20 PM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
538edc4, 6bc0fd3
Parents:
01f9722
Message:

fix DelphesLHEFReader.cc compilation under Ubuntu 14.04

File:
1 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesLHEFReader.cc

    r01f9722 r1d9c62a  
    3131#include <iostream>
    3232#include <sstream>
    33 #include <string>
    3433
    3534#include <stdio.h>
     
    103102  int rc, id;
    104103  char *pch;
    105   double weight;
     104  double weight, xsec;
    106105
    107106  if(!fgets(fBuffer, kBufferSize, fInputFile)) return kFALSE;
    108107
    109   // read cross section string from LHE file header (meant to work on Wizard output only)
    110   if(strstr(fBuffer, "<xsecinfo ") && fEventCounter < 0)
    111   {
    112     DelphesStream bufferStream(fBuffer);
    113 
    114     string buf = fBuffer;   
    115     string xsecstr="totxsec";
    116    
    117     if (buf.find(xsecstr) != string::npos)
    118     {
    119         buf = buf.substr(buf.find(xsecstr) + xsecstr.length()+1);
    120         unsigned first = buf.find_first_of("\"")+1;
    121         unsigned last = buf.find_last_of("\"");
    122         xsecstr = buf.substr(first,last-first);
    123         fCrossSection = stod(xsecstr);
    124     } 
    125   }
    126  
    127108  if(strstr(fBuffer, "<event>"))
    128109  {
     
    130111    fEventCounter = 1;
    131112  }
    132  
    133113  else if(fEventCounter > 0)
    134114  {
     
    207187    fWeightList.push_back(make_pair(id, weight));
    208188  }
     189  else if(strstr(fBuffer, "<xsecinfo"))
     190  {
     191    pch = strstr(fBuffer, "totxsec");
     192    if(!pch)
     193    {
     194      cerr << "** ERROR: " << "invalid cross section format" << endl;
     195      return kFALSE;
     196    }
     197
     198    pch = strpbrk(pch + 1, "\"'");
     199    if(!pch)
     200    {
     201      cerr << "** ERROR: " << "invalid cross section format" << endl;
     202      return kFALSE;
     203    }
     204
     205    DelphesStream xsecStream(pch + 1);
     206    rc = xsecStream.ReadDbl(xsec);
     207
     208    if(!rc)
     209    {
     210      cerr << "** ERROR: " << "invalid cross section format" << endl;
     211      return kFALSE;
     212    }
     213
     214    fCrossSection = xsec;
     215  }
    209216  else if(strstr(fBuffer, "</event>"))
    210217  {
Note: See TracChangeset for help on using the changeset viewer.