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