File indexing completed on 2024-04-06 12:20:33
0001
0002 use File::Basename;
0003
0004
0005
0006 my @src = ();
0007 my @rep = ();
0008
0009 open FILELIST, "L1Trigger/L1TGlobal/scripts/files.txt";
0010 while($fullfile = <FILELIST>){
0011 next if ($fullfile =~ /^\s*\
0012 chomp $fullfile;
0013
0014 $file = basename($fullfile);
0015
0016 if ($file =~ /^es(\S+)\.hh/) {
0017 $utmclass = "es$1";
0018 $cmsclass = "L1TUtm$1";
0019 print "INFO: \"$utmclass\" --> cms: \"$cmsclass\"\n";
0020 push @src, "$utmclass\.hh";
0021 push @rep, "$cmsclass.h";
0022 push @src, $utmclass;
0023 push @rep, $cmsclass;
0024
0025 open OUTFILE, ">CondFormats/L1TObjects/src/$cmsclass.cc";
0026 print OUTFILE "// auto-generated file by import_utm.pl \n";
0027 print OUTFILE "#include \"CondFormats/L1TObjects/interface/$cmsclass.h\"\n";
0028 close OUTFILE;
0029
0030 open OUTFILE, ">CondFormats/L1TObjects/src/T_EventSetup_$cmsclass.cc";
0031 print OUTFILE "// auto-generated file by import_utm.pl \n";
0032 print OUTFILE "#include \"CondFormats/L1TObjects/interface/$cmsclass.h\"\n";
0033 print OUTFILE "#include \"FWCore/Utilities/interface/typelookup.h\"\n\n";
0034 print OUTFILE "TYPELOOKUP_DATA_REG($cmsclass);\n";
0035 close OUTFILE;
0036
0037 open OUTFILE, ">CondFormats/DataRecord/interface/${cmsclass}Rcd.h";
0038 print OUTFILE "// auto-generated file by import_utm.pl \n";
0039 print OUTFILE "\#ifndef CondFormatsDataRecord_${cmsclass}Rcd_h\n";
0040 print OUTFILE "\#define CondFormatsDataRecord_${cmsclass}Rcd_h\n";
0041 print OUTFILE "#include \"FWCore/Framework/interface/EventSetupRecordImplementation.h\"\n";
0042 print OUTFILE "class ${cmsclass}Rcd : public edm::eventsetup::EventSetupRecordImplementation<${cmsclass}Rcd> {};\n";
0043 print OUTFILE "\#endif\n";
0044 close OUTFILE;
0045
0046 open OUTFILE, ">CondFormats/DataRecord/src/${cmsclass}Rcd.cc";
0047 print OUTFILE "// auto-generated file by import_utm.pl \n";
0048 print OUTFILE "\#include \"FWCore/Framework/interface/eventsetuprecord_registration_macro.h\"\n";
0049 print OUTFILE "\#include \"CondFormats/DataRecord/interface/${cmsclass}Rcd.h\"\n";
0050 print OUTFILE "EVENTSETUP_RECORD_REG(${cmsclass}Rcd);\n";
0051 close OUTFILE;
0052 } else {
0053 print "ERROR: unable to guess CMSSW from $fullfile\n";
0054 exit(0);
0055 }
0056 }
0057 close FILELIST;
0058
0059 open REPLACELIST, "L1Trigger/L1TGlobal/scripts/replace.txt";
0060 while(<REPLACELIST>){
0061 next if (/^\s*\
0062
0063 if(/\"(.+)\"\s*\,\s*\"(.+)\"/){
0064 $a = $1;
0065 $b = $2;
0066 print "INFO: \"$a\" -> \"$b\"\n";
0067 push @src, $a;
0068 push @rep, $b;
0069 }
0070 }
0071 close REPLACELIST;
0072
0073 print "@src\n";
0074 print "@rep\n";
0075
0076 open FILELIST, "L1Trigger/L1TGlobal/scripts/files.txt";
0077 while($fullfile = <FILELIST>){
0078 next if ($fullfile =~ /^\s*\
0079 chomp $fullfile;
0080 print "INFO: processing file: $fullfile\n";
0081 $file = basename($fullfile);
0082
0083 if ($file =~ /^es(\S+)\.hh/) {
0084 $cmsswfile = "CondFormats/L1TObjects/interface/L1TUtm$1.h";
0085 } else {
0086 print "ERROR: unable to guess CMSSW from $fullfile\n";
0087 exit(0);
0088 }
0089 print "INFO: CMSSW filename is: $cmsswfile\n";
0090
0091 open FILENAME, $fullfile;
0092 open OUTFILE, ">$cmsswfile";
0093
0094
0095 print OUTFILE "//\n";
0096 print OUTFILE "// NOTE: This file was automatically generated from UTM library via import_utm.pl\n";
0097 print OUTFILE "// DIRECT EDITS MIGHT BE LOST.\n";
0098 print OUTFILE "//\n";
0099
0100 while (<FILENAME>){
0101 if (/esTypes/){
0102 print "INFO: dropping unneeded include: $_\n";
0103 } elsif (/namespace tmeventsetup/){
0104 if (! /\}/){
0105 $_ = <FILENAME>;
0106 }
0107 print "INFO: dropping namespace.\n";
0108
0109 } elsif (/^\s*\}\;/){
0110 print "INFO: found end of class definition.\n";
0111 print OUTFILE " COND_SERIALIZABLE;\n";
0112 print OUTFILE "$_";
0113 } elsif (/\* headers/){
0114 print "INFO: found start of header files\n";
0115 print OUTFILE $_;
0116 $_ = <FILENAME>;
0117 print OUTFILE $_;
0118 $_ = <FILENAME>;
0119 while(/\
0120 print OUTFILE $_;
0121 $_ = <FILENAME>;
0122 }
0123 print OUTFILE "#include \"CondFormats/Serialization/interface/Serializable.h\"\n";
0124 print OUTFILE $_;
0125
0126 } elsif (/\
0127 print "INFO: dropping SWIG blog.\n";
0128 until(/endif/){
0129
0130 $_ = <FILENAME>;
0131 }
0132 } else {
0133
0134 s/tmeventsetup\:\://g;
0135
0136 for ($i=0; $i<=$#src; $i++){
0137 $a = $src[$i];
0138 $b = $rep[$i];
0139
0140 s/\b$a\b/$b/g;
0141 s/\_$a\_/\_$b\_/g;
0142 }
0143 print OUTFILE $_;
0144 }
0145 }
0146 close FILENAME;
0147 close OUTFILE;
0148 }