Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:10:10

0001 #! /usr/bin/env python
0002 import os
0003 os.system("make clean; make; \\rm *.log log.list")
0004 
0005 
0006 ############################################
0007 
0008 #dir1='TriggerValidation_223_HLT'
0009 #dir2='TriggerValidation_224_HLT'
0010 #out='223_vs_224'
0011 
0012 #samples=['LM1']
0013 #prefix1 = "histo_"
0014 #prefix2 = "histo_"
0015 #sufix1 = "_IDEALV11"
0016 #sufix2 = "_IDEALV11_v1"
0017 #label1 = "LM1_223"
0018 #label2 = "LM1_224"
0019 
0020 ############################################
0021 
0022 #dir1='TriggerValidation_224_HLT'
0023 #dir2='TriggerValidation_300pre2_HLT'
0024 #out='224_vs_300pre2'
0025 
0026 #samples=['LM1']
0027 #prefix1 = "histo_"
0028 #prefix2 = "histo_"
0029 #sufix1 = "_IDEALV11_v1"
0030 #sufix2 = "_IDEALV9"
0031 #label1 = "LM1_223"
0032 #label2 = "LM1_300pre2"
0033 
0034 ############################################
0035 
0036 #dir1='TriggerValidation_224_HLT'
0037 #dir2='TriggerValidation_300pre6_HLT'
0038 #out='224_vs_300pre6'
0039 
0040 #samples=['LM1']
0041 #prefix1 = "histo_"
0042 #prefix2 = "histo_"
0043 #sufix1 = "_IDEALV11_v1"
0044 #sufix2 = "_IDEAL_30x_v1"
0045 #label1 = "LM1_223"
0046 #label2 = "LM1_300pre6"
0047 
0048 ############################################
0049 
0050 dir1='/afs/cern.ch/user/c/chiorbo/scratch0/SUSY_2007/TriggerValidation/TriggerValidation_DQM_312_commit_V00-06-00/src/HLTriggerOffline/SUSYBSM/test'
0051 dir2='/afs/cern.ch/user/c/chiorbo/scratch0/SUSY_2007/TriggerValidation/TriggerValidation_DQM_312_commit_V00-06-00/src/HLTriggerOffline/SUSYBSM/test'
0052 out='mc1_vs_mc2'
0053 
0054 samples=['_HLT']
0055 prefix1 = "DQM_V0001"
0056 prefix2 = "DQM_V0001"
0057 sufix1 = "_R000000001"
0058 sufix2 = "_R000000001_2"
0059 label1 = "HLT"
0060 label2 = "HLT"
0061 
0062 ############################################
0063 
0064 os.system('mkdir html/'+out)
0065 #create html index page
0066 os.system('cp html/template/index.html html/'+out+'/index.html')
0067 
0068 
0069 #create the cover page
0070 inputhtml  = open('html/template/beginning.html')
0071 outputhtml = open('html/'+out+'/cover.html','w')
0072 for line in inputhtml:
0073     # remove .root
0074     if line.find('<!-- Here python will write the name of first release -->') != -1: outputhtml.write(dir1) 
0075     # remove .root
0076     elif line.find('<!-- Here python will write the name of second release -->') != -1: outputhtml.write(dir2)
0077     else: outputhtml.write(line)
0078     continue
0079 inputhtml.close()
0080 outputhtml.close()
0081 
0082 #create the menu page
0083 os.system('cp html/template/menu_beginning.html html/'+out+'/menu.html')
0084 for sample in samples:
0085     tmp1 = open('tmp.html','w')
0086     tmp2 = open('html/template/menu_body.html')
0087     for line in tmp2:
0088         if line.find('thissample') != -1:
0089             newline = line.replace('thissample',sample)
0090             tmp1.write(newline)
0091         else: tmp1.write(line)
0092         continue
0093     tmp1.close()
0094     tmp2.close()
0095     os.system('more tmp.html >> html/'+out+'/menu.html')
0096     os.system('rm tmp.html')
0097     continue
0098 os.system('more html/template/menu_end.html >> html/'+out+'/menu.html')
0099 
0100 #run the code for each sample
0101 for sample in samples:
0102     file1   = dir1+'/'+prefix1+sample+sufix1+'.root'
0103     file2   = dir2+'/'+prefix2+sample+sufix2+'.root'
0104     outputfile =  'outputfile.root'
0105 
0106     #create html page for this sample
0107     inputhtml  = open('html/template/comp_beginning.html')
0108     os.system('mkdir html/'+out+'/'+sample)
0109     outputhtml = open('html/'+out+'/'+sample+'/comparison.html','w')
0110 
0111     # add right version names in the html
0112     for line in inputhtml:
0113         if line.find('<!-- Here python will write the name of first release -->') != -1: outputhtml.write(dir1) 
0114         elif line.find('<!-- Here python will write the name of second release -->') != -1: outputhtml.write(dir2) 
0115         elif line.find('<!-- Here python will write the name of the model -->') != -1: outputhtml.write(sample)
0116 
0117         elif line.find('thissample') != -1:
0118             newline = line.replace('thissample',sample)
0119             outputhtml.write(newline)
0120         else: outputhtml.write(line)
0121         continue
0122     inputhtml.close()
0123     outputhtml.close()
0124     
0125     # run the comparison 
0126     os.system('./triggerComparison.x  -File1='+file1+' -File2='+file2+' -OutputFile='+outputfile+' -label1='+label1+' -label2='+label2)
0127     # for old names
0128     #    os.system('./triggerComparison.x  --oldL1names -File1='+file1+' -File2='+file2+' -OutputFile='+outputfile+' -label1='+label1+' -label2='+label2)
0129     os.system('mv HLTcomparison.log html/'+out+'/'+sample)
0130     os.system('mv L1comparison.log html/'+out+'/'+sample)
0131     
0132     # mv root file to the html directory
0133     os.system('mv '+outputfile+' html/'+out+'/'+sample)
0134 
0135     # add eff and residual pulls to the html
0136     os.system('more html/template/comp.html >> html/'+out+'/'+sample+'/comparison.html')
0137 
0138     # link the compatibility maps
0139     os.system('more compatibility.html >> html/'+out+'/'+sample+'/comparison.html')
0140 
0141     # create jpg files
0142     os.system("ls *eps > listeps.log")
0143     listeps = open("listeps.log")
0144     for epsfile in listeps: os.system("convert \""+epsfile[:-1]+"\" \""+epsfile[:-4]+"jpg\"")
0145     thefile = open('html/'+out+'/'+sample+'/comparison.html',"r+")
0146     # link HLT files    
0147 
0148     #thefile.seek(0,2)
0149     #thefile.write('<tr><td><center><table>\n')
0150     #listeps.seek(0)
0151     #for epsfile in listeps:
0152     #    if(epsfile.find('HLT') != -1):   #this is a plot of a trigger path
0153     #        tmp1 = open('html/template/addplot.html')
0154     #        for line in tmp1:
0155     #            newline = line.replace('triggerpath',epsfile[:-5])
0156     #            thefile.write(newline+'\n')
0157     #            continue
0158     #        continue
0159     #    continue
0160     #thefile.write('</table></center></td>\n')
0161 
0162     # link L1 files 
0163     #thefile.write('<td><center><table>\n')
0164     #listeps.seek(0)
0165     #for epsfile in listeps:
0166     #  if(epsfile.find('L1') != -1):   #this is a plot of a trigger path
0167     #    if(epsfile.find('A_') != -1):   #this is a plot of a trigger path
0168     #        tmp1 = open('html/template/addplot.html')
0169     #        for line in tmp1:
0170     #            newline = line.replace('triggerpath',epsfile[:-5])
0171     #            thefile.write(newline+'\n')
0172     #            continue
0173     #        continue
0174     #    continue
0175     #thefile.write('</table></center></td></tr>\n')
0176     #thefile.close()
0177 
0178     # write end of the comparison web page 
0179     os.system('more html/template/end.html >> html/'+out+'/'+sample+'/comparison.html')
0180     #  move all eps and jpg files in the proper directory
0181     os.system('mv *jpg html/'+out+'/'+sample+'/')
0182     os.system('mv *eps html/'+out+'/'+sample+'/')
0183     continue
0184 os.system('\\rm listeps.log')