1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
#!/bin/sh
# -*- Tcl -*- the next line restarts using tclsh \
exec tclsh "$0" ${1+"$@"}
global env
if {![info exists env(CMSSW_BASE)]} {
puts stderr "Please set up CMSSW environment first"
exit 1
}
set current_dir [pwd]
set cmssw_base $env(CMSSW_BASE)
set testdir $cmssw_base/src/CondTools/Hcal/test
set pkgdir HFPhase1PMTParams
set pkg_files {
DataFormats/HcalDetId {
HcalDetId.h
HcalDetId.cc
HcalSubdetector.h
}
DataFormats/DetId {
DetId.h
}
CondTools/Hcal {
CmdLine.h
make_HFPhase1PMTParams.h
parseHcalDetId.h
parseHcalDetId.cc
visualizeHFPhase1PMTParams.h
}
CondFormats/HcalObjects {
AbsHcalAlgoData.h
AbsHcalFunctor.h
HcalChebyshevFunctor.h
HcalChebyshevFunctor.cc
HcalConstFunctor.h
HcalConstFunctor.cc
HcalCubicInterpolator.h
HcalCubicInterpolator.cc
HcalDetIdTransform.h
HcalDetIdTransform.cc
HcalIndexLookup.h
HcalIndexLookup.cc
HcalInterpolatedTableFunctor.h
HcalInterpolatedTableFunctor.cc
HcalItemArrayCollById.h
HcalItemArrayColl.h
HcalItemCollById.h
HcalItemColl.h
HcalLinearCompositionFunctor.h
HcalLinearCompositionFunctor.cc
HcalPiecewiseLinearFunctor.h
HcalPiecewiseLinearFunctor.cc
HcalPolynomialFunctor.h
HcalPolynomialFunctor.cc
HFPhase1PMTData.h
HFPhase1PMTParams.h
}
}
set test_files {
visualizeHFPhase1PMTParams.cc
write_HFPhase1PMTParams.cc
makeHFPhase1PMTParamsPlots.cc
make_HFPhase1PMTParams_data.cc
make_HFPhase1PMTParams_dummy.cc
make_HFPhase1PMTParams_mc.cc
make_HFPhase1PMTParams_test.cc
pmtlist_example.txt
}
set copy_files {
Makefile.1 Makefile.common
Makefile.2 Makefile
Makefile.3 Makefile.plots
}
# Fetch all packages
#
# Porting consists in replacing the header file locations
# and changing all cms::Exception into standard exceptions
#
cd [file join $cmssw_base src]
set filelist [list]
set includemap [list "\#include \"FWCore/Utilities/interface/Exception.h\"" \
"\#include <stdexcept>"]
lappend includemap cms::Exception std::runtime_error
foreach {pkg files} $pkg_files {
if {![file isdirectory $pkg]} {
exec git cms-addpkg $pkg
}
foreach f $files {
if {[string equal [file extension $f] ".h"]} {
set header "$pkg/interface/$f"
lappend includemap "\#include \"$header\"" "\#include \"$f\""
lappend filelist $header
} else {
lappend filelist "$pkg/src/$f"
}
}
}
if {![file isdirectory CondFormats/Serialization]} {
exec git cms-addpkg CondFormats/Serialization
}
proc file_contents {filename} {
set chan [open $filename "r"]
set contents [read $chan [file size $filename]]
close $chan
set contents
}
proc filemap {infile outfile map} {
set fix [list "(\"Invalid DetId\") <<" "(\"Invalid DetId\"); // <<"]
set in_data [file_contents $infile]
set chan [open $outfile "w"]
puts -nonewline $chan [string map $fix [string map $map $in_data]]
close $chan
}
set todir "$testdir/$pkgdir"
file delete -force $todir
exec /bin/mkdir -p $todir
exec /bin/mkdir -p $todir/CondFormats/Serialization/interface
file copy -force CondFormats/Serialization/interface/eos \
$todir/CondFormats/Serialization/interface
file copy -force CondFormats/Serialization/src/templateInstantiations.cc $todir
foreach f $filelist {
set outfile [file join "$todir" [file tail $f]]
filemap $f $outfile $includemap
}
foreach f $test_files {
set infile [file join $testdir $f]
set outfile [file join $todir $f]
filemap $infile $outfile $includemap
}
foreach {f1 f2} $copy_files {
set infile [file join $testdir $f1]
set outfile [file join $todir $f2]
file copy -force $infile $outfile
}
set tarfile [file join $current_dir $pkgdir.tar.gz]
file delete -force $tarfile
cd $testdir
exec /bin/tar -czvf $tarfile $pkgdir
file delete -force $todir
puts "Wrote file $pkgdir.tar.gz"
exit 0
|