Definition at line 5 of file generateStandaloneCode.py.
References join().
7 path_formats =
join(os.environ[
'CMSSW_BASE'],
8 'src/CondFormats/BTauObjects')
9 path_tools =
join(os.environ[
'CMSSW_BASE'],
10 'src/RecoBTag/PerformanceDB/test')
13 file_h =
join(path_tools,
'BTagCalibrationStandalone.h')
14 print 'Creating', file_h
15 with open(file_h,
'w')
as fout:
16 for fname
in [
'BTagEntry.h',
18 'BTagCalibrationReader.h']:
19 with open(
join(path_formats,
'interface', fname))
as fin:
21 if (line.startswith(
'#include "CondFormats')
or
22 'COND_SERIALIZABLE' in line):
28 file_cc =
join(path_tools,
'BTagCalibrationStandalone.cc')
29 print 'Creating', file_cc
30 with open(file_cc,
'w')
as fout:
31 fout.write(
'#include "BTagCalibrationStandalone.h"\n')
32 fout.write(
'#include <iostream>\n')
33 fout.write(
'#include <exception>\n')
34 for fname
in [
'BTagEntry.cc',
36 'BTagCalibrationReader.cc']:
37 with open(
join(path_formats,
'src', fname))
as fin:
39 for line_no, line
in enumerate(fin):
40 if (line.startswith(
'#include "CondFormats')
or
41 line.startswith(
'#include "FWCore')):
43 elif 'throw cms::Exception' in line:
44 line =
'std::cerr << "ERROR in BTagCalibration: "\n'
46 elif line_no == err_on_line + 2:
47 line +=
'throw std::exception();\n'
static std::string join(char **cmd)