Fork me on GitHub

Changeset 01f9722 in git for classes/DelphesLHEFReader.cc


Ignore:
Timestamp:
Aug 13, 2018, 3:01:20 PM (6 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
1d9c62a, 9047a02
Parents:
cdbca0d
Message:

read xsec from LHE files produced with Wizard

File:
1 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesLHEFReader.cc

    rcdbca0d r01f9722  
    3131#include <iostream>
    3232#include <sstream>
     33#include <string>
    3334
    3435#include <stdio.h>
     
    5455DelphesLHEFReader::DelphesLHEFReader() :
    5556  fInputFile(0), fBuffer(0), fPDG(0),
    56   fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1)
     57  fEventReady(kFALSE), fEventCounter(-1), fParticleCounter(-1),   fCrossSection(1)
     58
    5759{
    5860  fBuffer = new char[kBufferSize];
     
    105107  if(!fgets(fBuffer, kBufferSize, fInputFile)) return kFALSE;
    106108
     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 
    107127  if(strstr(fBuffer, "<event>"))
    108128  {
     
    110130    fEventCounter = 1;
    111131  }
     132 
    112133  else if(fEventCounter > 0)
    113134  {
     
    206227  element->ProcessID = fProcessID;
    207228  element->Weight = fWeight;
     229  element->CrossSection = fCrossSection;
     230
    208231  element->ScalePDF = fScalePDF;
    209232  element->AlphaQED = fAlphaQED;
Note: See TracChangeset for help on using the changeset viewer.