Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:52:14

0001 #!/bin/sh
0002 # -*- Tcl -*- the next line restarts using tclsh \
0003 exec tclsh "$0" ${1+"$@"}
0004 
0005 global env
0006 if {![info exists env(CMSSW_BASE)]} {
0007     puts stderr "Please set up CMSSW environment first"
0008     exit 1
0009 }
0010 
0011 set current_dir [pwd]
0012 set cmssw_base $env(CMSSW_BASE)
0013 set testdir $cmssw_base/src/CondTools/Hcal/test
0014 set pkgdir HFPhase1PMTParams
0015 
0016 set pkg_files {
0017     DataFormats/HcalDetId {
0018         HcalDetId.h
0019         HcalDetId.cc
0020         HcalSubdetector.h
0021     }
0022     DataFormats/DetId {
0023         DetId.h
0024     }
0025     CondTools/Hcal {
0026         CmdLine.h
0027         make_HFPhase1PMTParams.h
0028         parseHcalDetId.h
0029         parseHcalDetId.cc
0030         visualizeHFPhase1PMTParams.h
0031     }
0032     CondFormats/HcalObjects {
0033         AbsHcalAlgoData.h
0034         AbsHcalFunctor.h
0035         HcalChebyshevFunctor.h
0036         HcalChebyshevFunctor.cc
0037         HcalConstFunctor.h
0038         HcalConstFunctor.cc
0039         HcalCubicInterpolator.h
0040         HcalCubicInterpolator.cc
0041         HcalDetIdTransform.h
0042         HcalDetIdTransform.cc
0043         HcalIndexLookup.h
0044         HcalIndexLookup.cc
0045         HcalInterpolatedTableFunctor.h
0046         HcalInterpolatedTableFunctor.cc
0047         HcalItemArrayCollById.h
0048         HcalItemArrayColl.h
0049         HcalItemCollById.h
0050         HcalItemColl.h
0051         HcalLinearCompositionFunctor.h
0052         HcalLinearCompositionFunctor.cc
0053         HcalPiecewiseLinearFunctor.h
0054         HcalPiecewiseLinearFunctor.cc
0055         HcalPolynomialFunctor.h
0056         HcalPolynomialFunctor.cc
0057         HFPhase1PMTData.h
0058         HFPhase1PMTParams.h
0059     }
0060 }
0061 
0062 set test_files {
0063     visualizeHFPhase1PMTParams.cc
0064     write_HFPhase1PMTParams.cc
0065     makeHFPhase1PMTParamsPlots.cc
0066     make_HFPhase1PMTParams_data.cc
0067     make_HFPhase1PMTParams_dummy.cc
0068     make_HFPhase1PMTParams_mc.cc
0069     make_HFPhase1PMTParams_test.cc
0070     pmtlist_example.txt
0071 }
0072 
0073 set copy_files {
0074     Makefile.1 Makefile.common
0075     Makefile.2 Makefile
0076     Makefile.3 Makefile.plots
0077 }
0078 
0079 # Fetch all packages
0080 #
0081 # Porting consists in replacing the header file locations
0082 # and changing all cms::Exception into standard exceptions
0083 #
0084 cd [file join $cmssw_base src]
0085 set filelist [list]
0086 set includemap [list "\#include \"FWCore/Utilities/interface/Exception.h\"" \
0087                     "\#include <stdexcept>"]
0088 lappend includemap cms::Exception std::runtime_error
0089 
0090 foreach {pkg files} $pkg_files {
0091     if {![file isdirectory $pkg]} {
0092         exec git cms-addpkg $pkg
0093     }
0094     foreach f $files {
0095         if {[string equal [file extension $f] ".h"]} {
0096             set header "$pkg/interface/$f"
0097             lappend includemap "\#include \"$header\"" "\#include \"$f\""
0098             lappend filelist $header
0099         } else {
0100             lappend filelist "$pkg/src/$f"
0101         }
0102     }
0103 }
0104 
0105 if {![file isdirectory CondFormats/Serialization]} {
0106     exec git cms-addpkg CondFormats/Serialization
0107 }
0108 
0109 proc file_contents {filename} {
0110     set chan [open $filename "r"]
0111     set contents [read $chan [file size $filename]]
0112     close $chan
0113     set contents
0114 }
0115 
0116 proc filemap {infile outfile map} {
0117     set fix [list "(\"Invalid DetId\") <<" "(\"Invalid DetId\"); // <<"]
0118     set in_data [file_contents $infile]
0119     set chan [open $outfile "w"]
0120     puts -nonewline $chan [string map $fix [string map $map $in_data]]
0121     close $chan
0122 }
0123 
0124 set todir "$testdir/$pkgdir"
0125 file delete -force $todir
0126 exec /bin/mkdir -p $todir
0127 exec /bin/mkdir -p $todir/CondFormats/Serialization/interface
0128 file copy -force CondFormats/Serialization/interface/eos \
0129     $todir/CondFormats/Serialization/interface
0130 file copy -force CondFormats/Serialization/src/templateInstantiations.cc $todir
0131 
0132 foreach f $filelist {
0133     set outfile [file join "$todir" [file tail $f]]
0134     filemap $f $outfile $includemap
0135 }
0136 
0137 foreach f $test_files {
0138     set infile [file join $testdir $f]
0139     set outfile [file join $todir $f]
0140     filemap $infile $outfile $includemap
0141 }
0142 
0143 foreach {f1 f2} $copy_files {
0144     set infile [file join $testdir $f1]
0145     set outfile [file join $todir $f2]
0146     file copy -force $infile $outfile
0147 }
0148 
0149 set tarfile [file join $current_dir $pkgdir.tar.gz]
0150 file delete -force $tarfile
0151 cd $testdir
0152 exec /bin/tar -czvf $tarfile $pkgdir
0153 file delete -force $todir
0154 puts "Wrote file $pkgdir.tar.gz"
0155 
0156 exit 0