Definition at line 8 of file generateStandaloneCode.py.
9 path_cms =
join(os.environ[
'CMSSW_BASE'],
'src')
10 path_tools =
join(path_cms,
'CondTools/BTau/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 [
'CondFormats/BTauObjects/interface/BTagEntry.h',
17 'CondFormats/BTauObjects/interface/BTagCalibration.h',
18 'CondTools/BTau/interface/BTagCalibrationReader.h']:
19 with open(
join(path_cms, fname))
as fin:
21 if (line.startswith(
'#include "Cond')
or
22 'COND_SERIALIZABLE' in line):
28 file_cc =
join(path_tools,
'BTagCalibrationStandalone.cpp')
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 [
'CondFormats/BTauObjects/src/BTagEntry.cc',
35 'CondFormats/BTauObjects/src/BTagCalibration.cc',
36 'CondTools/BTau/src/BTagCalibrationReader.cc']:
37 with open(
join(path_cms, fname))
as fin:
39 for line_no, line
in enumerate(fin):
40 if (line.startswith(
'#include "Cond')
or
41 line.startswith(
'#include "FWCore')):
47 elif 'throw cms::Exception' in line:
48 line =
'std::cerr << "ERROR in BTagCalibration: "\n'
50 elif line_no == err_on_line + 2:
51 line +=
'throw std::exception();\n'
References join(), and edm.print().