Changeset 1d9c62a in git for classes/DelphesLHEFReader.cc
- Timestamp:
- Aug 24, 2018, 4:19:20 PM (6 years ago)
- Branches:
- ImprovedOutputFile, Timing, dual_readout, llp, master
- Children:
- 538edc4, 6bc0fd3
- Parents:
- 01f9722
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
classes/DelphesLHEFReader.cc
r01f9722 r1d9c62a 31 31 #include <iostream> 32 32 #include <sstream> 33 #include <string>34 33 35 34 #include <stdio.h> … … 103 102 int rc, id; 104 103 char *pch; 105 double weight ;104 double weight, xsec; 106 105 107 106 if(!fgets(fBuffer, kBufferSize, fInputFile)) return kFALSE; 108 107 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 127 108 if(strstr(fBuffer, "<event>")) 128 109 { … … 130 111 fEventCounter = 1; 131 112 } 132 133 113 else if(fEventCounter > 0) 134 114 { … … 207 187 fWeightList.push_back(make_pair(id, weight)); 208 188 } 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 } 209 216 else if(strstr(fBuffer, "</event>")) 210 217 {
Note:
See TracChangeset
for help on using the changeset viewer.