20 from Validation.RecoTrack.plotting.validation
import Sample, Validation
21 from Validation.HGCalValidation.html
import _sampleName,_pageNameMap,_summary,_summobj
27 usage = (
'usage: %prog [options]\n'
28 +
'%prog -h for help')
29 parser = optparse.OptionParser(usage)
31 parser.add_option(
'',
'--Obj', dest=
'OBJ', type=
'string', default=
None, help=
'Object to run. Options are: Geometry, SimHits, Digis, RecHits, Calibrations, CaloParticles, hgcalLayerClusters')
32 parser.add_option(
'',
'--html-validation-name', dest=
'HTMLVALNAME', type=
'string', default=
'', help=
'Could be either be hgcalLayerClusters or hgcalMultiClusters')
33 parser.add_option(
'-d',
'--download', action=
'store_true', dest=
'DOWNLOAD', default=
False, help=
'Download DQM files from RelVals')
34 parser.add_option(
'-g',
'--gather', dest=
'GATHER', type=
'string', default=
None, help=
'Objects to gather: hitValidation, hitCalibration, hgcalLayerClusters, hgcalMultiClusters, ticlMultiClustersFromTrackstersEM, ticlMultiClustersFromTrackstersHAD')
35 parser.add_option(
'-w',
'--wwwarea', dest=
'WWWAREA', type=
'string', default=
'/eos/project/h/hgcaldpg/www', help=
'Objects to gather: hitValidation, hitCalibration, hgcalLayerClusters, hgcalMultiClusters, ticlMultiClustersFromTrackstersEM, ticlMultiClustersFromTrackstersHAD')
36 parser.add_option(
'-y',
'--dry-run', action=
'store_true', dest=
'DRYRUN', default=
False, help=
'perform a dry run (nothing is lauched).')
37 parser.add_option(
'-i',
'--inputeosarea', dest=
'INPUT', type=
'string', default=
'/eos/cms/store/group/dpg_hgcal/comm_hgcal/apsallid/RelVals', help=
'Eos area where we will place all DQM files of the new and reference release campaign')
41 (opt, args) = parser.parse_args()
50 status, output = commands.getstatusoutput(cmd)
51 if (status !=0
and not quite):
52 print 'Error in processing command:\n ['+cmd+
']'
53 print 'Output:\n ['+output+
'] \n'
58 if "_pmx" in NewRelease:
59 if "_pmx" in RefRelease:
60 return {
"default":
"pmx"+t}
61 return {
"default": t, NewRelease:
"pmx"+t}
81 thereleases = {
"CMSSW 11_2_X" : [
82 "CMSSW_11_2_0_pre7_vs_CMSSW_11_2_0_pre6",
83 "CMSSW_11_2_0_pre6_ROOT622_vs_CMSSW_11_2_0_pre6",
84 "CMSSW_11_2_0_pre6_vs_CMSSW_11_2_0_pre5",
85 "CMSSW_11_2_0_pre5_GEANT106_vs_CMSSW_11_2_0_pre5",
86 "CMSSW_11_2_0_pre5_vs_CMSSW_11_2_0_pre3",
87 "CMSSW_11_2_0_pre3_vs_CMSSW_11_2_0_pre1",
88 "CMSSW_11_2_0_pre1_vs_CMSSW_11_1_0_pre8"
91 "CMSSW_11_1_0_pre8_raw1100_vs_CMSSW_11_1_0_pre8",
92 "CMSSW_11_1_0_pre8_raw1100_vs_CMSSW_11_1_0_pre7_raw1100",
93 "CMSSW_11_1_0_pre8_vs_CMSSW_11_1_0_pre7",
94 "CMSSW_11_1_0_pre7_raw1100_vs_CMSSW_11_1_0_pre7",
95 "CMSSW_11_1_0_pre7_raw1100_vs_CMSSW_11_1_0_pre6_raw1100",
96 "CMSSW_11_1_0_pre7_vs_CMSSW_11_1_0_pre6",
97 "CMSSW_11_1_0_pre6_raw1100_vs_CMSSW_11_1_0_pre6",
98 "CMSSW_11_1_0_pre6_raw1100_vs_CMSSW_11_1_0_pre5_raw1100",
99 "CMSSW_11_1_0_pre6_vs_CMSSW_11_1_0_pre5",
100 "CMSSW_11_1_0_pre5_vs_CMSSW_11_1_0_pre4",
101 "CMSSW_11_1_0_pre5_raw1100_vs_CMSSW_11_1_0_pre5",
102 "CMSSW_11_1_0_pre5_raw1100_vs_CMSSW_11_1_0_pre4_raw1100",
103 "CMSSW_11_1_0_pre4_raw1100_vs_CMSSW_11_1_0_pre4",
104 "CMSSW_11_1_0_pre4_raw1100_vs_CMSSW_11_1_0_pre3_raw1100",
105 "CMSSW_11_1_0_pre4_GEANT4",
"CMSSW_11_1_0_pre4"
109 RefRelease=
'CMSSW_11_2_0_pre7'
111 NewRelease=
'CMSSW_11_2_0_pre7'
113 NotNormalRelease =
"raw"
114 NotNormalRefRelease =
"normal"
116 if ( os.path.isdir(
'%s/%s' %(opt.WWWAREA, NewRelease))) :
117 print(
"The campaign you are trying to validate has already an existing validation folder in the official www area.")
118 print(
"Make sure you are not overwriting anything and try again.")
121 if "raw" in NotNormalRelease:
124 appendglobaltag =
"_2026D49noPU_gcc900"
126 appendglobaltag =
"_2026D49noPU"
130 phase2samples_noPU_oldnaming = [
131 # Sample("RelValCloseByParticleGun_CE_H_Fine_300um", dqmVersion="0002", scenario="2026D49", appendGlobalTag=appendglobaltag ),
132 Sample("RelValCloseByParticleGun_CE_H_Fine_300um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
133 Sample("RelValCloseByParticleGun_CE_H_Fine_200um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
134 Sample("RelValCloseByParticleGun_CE_H_Fine_120um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
135 Sample("RelValCloseByParticleGun_CE_H_Coarse_Scint", scenario="2026D49", appendGlobalTag=appendglobaltag ),
136 Sample("RelValCloseByParticleGun_CE_H_Coarse_300um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
137 Sample("RelValCloseByParticleGun_CE_E_Front_300um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
138 Sample("RelValCloseByParticleGun_CE_E_Front_200um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
139 Sample("RelValCloseByParticleGun_CE_E_Front_120um", scenario="2026D49", appendGlobalTag=appendglobaltag ),
140 #Sample("RelValCloseByParticleGun_CE_E_Front_120um", scenario="2026D49", appendGlobalTag=appendglobaltag , version="v2"),
141 Sample("RelValTTbar", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
142 Sample("RelValZMM", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ),
143 Sample("RelValSingleGammaFlatPt8To150", scenario="2026D49", appendGlobalTag=appendglobaltag ),
144 Sample("RelValSingleMuPt10", scenario="2026D49", appendGlobalTag=appendglobaltag ),
145 Sample("RelValSingleMuPt100", scenario="2026D49", appendGlobalTag=appendglobaltag ),
146 Sample("RelValSingleMuPt1000", scenario="2026D49", appendGlobalTag=appendglobaltag ),
147 Sample("RelValSingleMuFlatPt2To100", scenario="2026D49", appendGlobalTag=appendglobaltag ),
148 Sample("RelValSingleMuFlatPt0p7To10", scenario="2026D49", appendGlobalTag=appendglobaltag ),
149 Sample("RelValSingleEFlatPt2To100", scenario="2026D49", appendGlobalTag=appendglobaltag ),
150 Sample("RelValSingleTauFlatPt2To150", scenario="2026D49", appendGlobalTag=appendglobaltag ),
151 Sample("RelValSinglePiFlatPt0p7To10", scenario="2026D49", appendGlobalTag=appendglobaltag ),
152 Sample("RelValQCD_Pt20toInfMuEnrichPt15", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
153 Sample("RelValQCD_Pt15To7000_Flat", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
154 Sample("RelValZTT", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
155 Sample("RelValZMM", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ),
156 Sample("RelValZEE", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ),
157 Sample("RelValB0ToKstarMuMu", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
158 Sample("RelValBsToEleEle", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
159 Sample("RelValBsToMuMu", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
160 Sample("RelValBsToJpsiGamma", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
161 Sample("RelValBsToJpsiPhi_mumuKK", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
162 Sample("RelValBsToPhiPhi_KKKK", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
163 Sample("RelValDisplacedMuPt30To100", scenario="2026D49", appendGlobalTag=appendglobaltag ),
164 Sample("RelValDisplacedMuPt2To10", scenario="2026D49", appendGlobalTag=appendglobaltag ),
165 Sample("RelValDisplacedMuPt10To30", scenario="2026D49", appendGlobalTag=appendglobaltag ),
166 Sample("RelValTauToMuMuMu", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
167 #Sample("RelValMinBias", midfix="14TeV", scenario="2026D49", appendGlobalTag=appendglobaltag ),
168 Sample("RelValH125GGgluonfusion", midfix="14", scenario="2026D49", appendGlobalTag=appendglobaltag ),
169 Sample("RelValNuGun", scenario="2026D49", appendGlobalTag=appendglobaltag )
174 phase2samples_noPU = [
192 Sample(
"RelValZpTT_1500", midfix=
"14", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
194 Sample(
"RelValZTT", midfix=
"14TeV", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
195 Sample(
"RelValZMM", midfix=
"14", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
196 Sample(
"RelValZEE", midfix=
"14", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
198 Sample(
"RelValTenTau_15_500", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
199 Sample(
"RelValTTbar", midfix=
"14TeV", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
200 Sample(
"RelValQCD_Pt15To7000_Flat", midfix=
"14", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
202 Sample(
"RelValNuGun", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
204 Sample(
"RelValMinBias", midfix=
"14TeV", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
205 Sample(
"RelValH125GGgluonfusion", midfix=
"14", scenario=
"2026D49", appendGlobalTag=appendglobaltag )
212 phase2samples_noPU_extend = [
220 Sample(
"RelValSingleMuPt10", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
221 Sample(
"RelValSingleMuPt100", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
222 Sample(
"RelValSingleMuPt1000", scenario=
"2026D49", appendGlobalTag=appendglobaltag )
229 phase2samples_noPU_extend_more = [
246 Sample(
"RelValCloseByPGun_CE_H_Fine_300um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
247 Sample(
"RelValCloseByPGun_CE_H_Fine_200um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
248 Sample(
"RelValCloseByPGun_CE_H_Fine_120um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
249 Sample(
"RelValCloseByPGun_CE_H_Coarse_Scint", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
250 Sample(
"RelValCloseByPGun_CE_H_Coarse_300um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
251 Sample(
"RelValCloseByPGun_CE_E_Front_300um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
252 Sample(
"RelValCloseByPGun_CE_E_Front_200um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
253 Sample(
"RelValCloseByPGun_CE_E_Front_120um", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
254 Sample(
"RelValSingleGammaFlatPt8To150", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
255 Sample(
"RelValSingleEFlatPt2To100", scenario=
"2026D49", appendGlobalTag=appendglobaltag ),
256 Sample(
"RelValSinglePiFlatPt0p7To10", scenario=
"2026D49", appendGlobalTag=appendglobaltag )
288 phase2samples_noPU.extend(phase2samples_noPU_extend)
289 phase2samples_noPU.extend(phase2samples_noPU_extend_more)
294 Sample(
"RelValTTbar", midfix=
"14TeV", scenario=
"2026D49", putype=
putype(
"25ns"), punum=200, appendGlobalTag=
"_2026D49PU200", version=
"v2"),
298 RefRepository =
'%s' %(opt.INPUT)
299 NewRepository =
'%s' %(opt.INPUT)
308 fullsimSamples = phase2samples_noPU,
310 refRelease=RefRelease, refRepository=RefRepository,
311 newRelease=NewRelease, newRepository=NewRepository
320 if (
not os.path.isdir(RefRepository+
'/'+NewRelease)) :
321 processCmd(
'mkdir -p '+RefRepository+
'/'+NewRelease)
323 for infi
in phase2samples_noPU:
324 if "_HGCal" in infi.filename(NewRelease):
325 processCmd(
'mv ' + infi.filename(NewRelease) +
' ' + infi.filename(NewRelease).
replace(
"_HGCal",
""))
326 processCmd(
'mv ' + infi.filename(NewRelease).
replace(
"_HGCal",
"") +
' ' + RefRepository+
'/'+NewRelease)
330 processCmd(
'mv ' + infi.filename(NewRelease) +
' ' + RefRepository+
'/'+NewRelease)
337 if (opt.OBJ ==
'hgcalLayerClusters' or opt.OBJ ==
'hitCalibration' or opt.OBJ ==
'ticlMultiClustersFromTrackstersEM' or opt.OBJ ==
'ticlMultiClustersFromTrackstersHAD'):
341 for infi
in phase2samples_noPU:
342 samplename = infi.filename(NewRelease).
replace(
"DQM_V0001_R000000001__",
"").
replace(
"__DQMIO.root",
"")
345 if infi.pileup() ==
"PU":
346 samplename = samplename +
str(infi.pileupNumber())
349 print(_sampleName[infi.name()])
355 if RefRelease !=
None: inputpathRef = RefRepository +
'/' + RefRelease +
'/'
356 inputpathNew = NewRepository +
'/' + NewRelease+
'/'
358 if RefRelease ==
None:
359 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename)+
' --collection %s' %(opt.HTMLVALNAME)
360 elif "raw" in NotNormalRelease
and "normal" in NotNormalRefRelease:
361 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).
replace(
"mcRun4_realistic_v2_2026D49noPU_gcc900-v1",
"mcRun4_realistic_v2_2026D49noPU-v1") +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
363 elif "raw" in NotNormalRelease
and "raw" in NotNormalRefRelease:
365 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).
replace(
"_raw1100",
"_raw1100_rsb") +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
366 elif "normal" in NotNormalRelease
and "normal" in NotNormalRefRelease:
367 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease) +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
372 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).
replace(
"mcRun4_realistic_v2-v1",
"mcRun4_realistic_v2_2026D49noPU-v1") +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
376 print 'Dry-run: ['+cmd+
']'
379 if opt.OBJ ==
'hgcalLayerClusters':
380 processCmd(
'awk \'NR>=6&&NR<=44\' HGCValid_%s_Plots/index.html > HGCValid_%s_Plots/index_%s.html '% (opt.HTMLVALNAME,opt.HTMLVALNAME, samplename))
381 if opt.OBJ ==
'hitCalibration':
382 processCmd(
'awk \'NR>=6&&NR<=15\' HGCValid_%s_Plots/index.html > HGCValid_%s_Plots/index_%s.html '% (opt.HTMLVALNAME,opt.HTMLVALNAME, samplename))
383 if opt.OBJ ==
'ticlMultiClustersFromTrackstersEM' or opt.OBJ ==
'ticlMultiClustersFromTrackstersHAD':
384 processCmd(
'awk \'NR>=6&&NR<=25\' HGCValid_%s_Plots/index.html > HGCValid_%s_Plots/index_%s.html '% (opt.HTMLVALNAME,opt.HTMLVALNAME, samplename))
387 fragments.append(
'HGCValid_%s_Plots/index_%s.html'% (opt.HTMLVALNAME, samplename) )
391 processCmd(
'mv HGCValid_%s_Plots/index.html HGCValid_%s_Plots/test.html' %(opt.HTMLVALNAME,opt.HTMLVALNAME) )
392 index_file = open(
'HGCValid_%s_Plots/index.html'%(opt.HTMLVALNAME),
'w')
394 index_file.write(
'<html>\n')
395 index_file.write(
' <head>\n')
396 index_file.write(
' <title>HGCal validation %s </title>\n' %(opt.HTMLVALNAME) )
397 index_file.write(
' </head>\n')
398 index_file.write(
' <body>\n')
400 for frag
in fragments:
401 with open(frag,
'r')
as f:
402 lines = f.read().splitlines()
405 index_file.write(line +
'\n')
411 index_file.write(
' </body>\n')
412 index_file.write(
'</html>\n')
417 if (opt.OBJ ==
'SimHits'):
419 if (
not os.path.isdir(
"hgcalSimHitStudy")) :
422 processCmd(
'cp %s/../public/index.php hgcalSimHitStudy/.'%(opt.WWWAREA) )
426 cmd =
'root.exe -b -q Validation/HGCalValidation/macros/validationplots.C\(\\"hgcSimHit.root' +
'\\",\\"'+ opt.OBJ +
'\\"\)'
428 print 'Dry-run: ['+cmd+
']'
433 if (opt.OBJ ==
'hitValidation'):
437 for infi
in phase2samples_noPU:
438 samplename = infi.filename(NewRelease).
replace(
"DQM_V0001_R000000001__",
"").
replace(
"__DQMIO.root",
"")
441 if infi.pileup() ==
"PU":
442 samplename = samplename +
str(infi.pileupNumber())
449 if RefRelease !=
None: inputpathRef = RefRepository +
'/' + RefRelease +
'/'
450 inputpathNew = NewRepository +
'/' + NewRelease+
'/'
452 if RefRelease ==
None:
453 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename)+
' --collection %s' %(opt.HTMLVALNAME)
454 elif "raw" in NotNormalRelease
and "normal" in NotNormalRefRelease:
455 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).
replace(
"mcRun4_realistic_v2_2026D49noPU_gcc900-v1",
"mcRun4_realistic_v2_2026D49noPU-v1") +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
457 elif "raw" in NotNormalRelease
and "raw" in NotNormalRefRelease:
459 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).
replace(
"_raw1100",
"_raw1100_rsb") +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
460 elif "normal" in NotNormalRelease
and "normal" in NotNormalRefRelease:
461 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease) +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
464 cmd =
'python Validation/HGCalValidation/scripts/makeHGCalValidationPlots.py ' + inputpathRef + infi.filename(RefRelease).
replace(
"mcRun4_realistic_v2-v1",
"mcRun4_realistic_v2_2026D49noPU-v1") +
' ' + inputpathNew + infi.filename(NewRelease) +
' --outputDir HGCValid_%s_Plots --no-ratio --png --separate --html-sample "%s" ' %(opt.HTMLVALNAME, _sampleName[infi.name()] ) +
' --html-validation-name %s --subdirprefix ' %(opt.HTMLVALNAME) +
' plots_%s' % (samplename) +
' --collection %s' %(opt.HTMLVALNAME)
469 print 'Dry-run: ['+cmd+
']'
472 processCmd(
'awk \'NR>=6&&NR<=28\' HGCValid_%s_Plots/index.html > HGCValid_%s_Plots/index_%s.html '% (opt.HTMLVALNAME,opt.HTMLVALNAME, samplename))
474 fragments.append(
'HGCValid_%s_Plots/index_%s.html'% (opt.HTMLVALNAME, samplename) )
478 processCmd(
'mv HGCValid_%s_Plots/index.html HGCValid_%s_Plots/test.html' %(opt.HTMLVALNAME,opt.HTMLVALNAME) )
479 index_file = open(
'HGCValid_%s_Plots/index.html'%(opt.HTMLVALNAME),
'w')
481 index_file.write(
'<html>\n')
482 index_file.write(
' <head>\n')
483 index_file.write(
' <title>HGCal validation %s </title>\n' %(opt.HTMLVALNAME) )
484 index_file.write(
' </head>\n')
485 index_file.write(
' <body>\n')
487 for frag
in fragments:
488 with open(frag,
'r')
as f:
489 lines = f.read().splitlines()
492 index_file.write(line +
'\n')
498 index_file.write(
' </body>\n')
499 index_file.write(
'</html>\n')
504 if (opt.OBJ ==
'Digis'):
506 if (
not os.path.isdir(
"hgcalDigiStudy")) :
512 processCmd(
'cp %s/../public/index.php hgcalDigiStudy/.'%(opt.WWWAREA) )
513 processCmd(
'cp %s/../public/index.php hgcalDigiStudyEE/.'%(opt.WWWAREA) )
514 processCmd(
'cp %s/../public/index.php hgcalDigiStudyHEF/.'%(opt.WWWAREA) )
515 processCmd(
'cp %s/../public/index.php hgcalDigiStudyHEB/.'%(opt.WWWAREA) )
519 cmd =
'root.exe -b -q Validation/HGCalValidation/macros/validationplots.C\(\\"hgcDigi.root' +
'\\",\\"'+ opt.OBJ +
'\\"\)'
521 print 'Dry-run: ['+cmd+
']'
525 processCmd(
'mv hgcalDigiStudyEE hgcalDigiStudy/.')
526 processCmd(
'mv hgcalDigiStudyHEF hgcalDigiStudy/.')
527 processCmd(
'mv hgcalDigiStudyHEB hgcalDigiStudy/.')
531 if (opt.OBJ ==
'RecHits'):
533 if (
not os.path.isdir(
"hgcalRecHitStudy")) :
539 processCmd(
'cp %s/../public/index.php hgcalRecHitStudy/.'%(opt.WWWAREA) )
540 processCmd(
'cp %s/../public/index.php hgcalRecHitStudyEE/.'%(opt.WWWAREA) )
541 processCmd(
'cp %s/../public/index.php hgcalRecHitStudyHEF/.'%(opt.WWWAREA) )
542 processCmd(
'cp %s/../public/index.php hgcalRecHitStudyHEB/.'%(opt.WWWAREA) )
546 cmd =
'root.exe -b -q Validation/HGCalValidation/macros/validationplots.C\(\\"hgcRecHit.root' +
'\\",\\"'+ opt.OBJ +
'\\"\)'
548 print 'Dry-run: ['+cmd+
']'
552 processCmd(
'mv hgcalRecHitStudyEE hgcalRecHitStudy/.')
553 processCmd(
'mv hgcalRecHitStudyHEF hgcalRecHitStudy/.')
554 processCmd(
'mv hgcalRecHitStudyHEB hgcalRecHitStudy/.')
558 if (opt.OBJ ==
'CaloParticles'):
559 particletypes = [
"-11",
"-13",
"-211",
"-321",
"11",
"111",
"13",
"211",
"22",
"321"]
561 if (
not os.path.isdir(
"CaloParticles")) :
564 processCmd(
'cp %s/../public/index.php CaloParticles/.'%(opt.WWWAREA) )
567 for infi
in phase2samples_noPU:
569 samplename = infi.filename(NewRelease).
replace(
"DQM_V0001_R000000001__",
"").
split(
"__"+NewRelease,1)[0]
570 samplename = samplename + infi.pileup()
571 if infi.pileup() ==
"PU":
572 samplename = samplename +
str(infi.pileupNumber())
577 if (
not os.path.isdir(samplename)) :
579 processCmd(
'cp %s/RelVals/index.php '%(opt.WWWAREA) + samplename +
'/.')
580 for part
in particletypes:
581 processCmd(
'mkdir -p ' + samplename +
'/' +part )
583 processCmd(
'cp %s/RelVals/index.php '%(opt.WWWAREA) + samplename +
'/' +part +
'/.')
586 if RefRelease !=
None: inputpathRef = RefRepository +
'/' + RefRelease +
'/'
587 inputpathNew = NewRepository +
'/' + NewRelease+
'/'
588 cmd =
'root.exe -b -q Validation/HGCalValidation/macros/validationplots.C\(\\"'+ inputpathNew + infi.filename(NewRelease) +
'\\",\\"'+ opt.OBJ +
'\\",\\"'+ samplename +
'\\"\\)'
590 print 'Dry-run: ['+cmd+
']'
593 processCmd(
'mv ' +samplename+
' CaloParticles/.' )
600 if (opt.GATHER !=
None) :
603 index_file = open(
'index.html',
'w')
605 index_file.write(
'<html>\n')
606 index_file.write(
' <head>\n')
607 index_file.write(
' <title>HGCAL validation results </title>\n' )
608 index_file.write(
' </head>\n')
609 index_file.write(
' <body>\n')
610 index_file.write(
' <h1>\n')
611 index_file.write(
' HGCAL Validation Results \n' )
612 index_file.write(
' </h1>\n')
613 index_file.write(
' <ul>\n' )
615 for trel
in thereleases.keys():
616 index_file.write(
' <li>\n' )
617 index_file.write(
' %s\n' %(trel) )
618 for rel
in thereleases[trel]:
619 index_file.write(
' <ul>\n' )
620 index_file.write(
' <li><a href="%s/index.html">%s</a></li>\n' %(rel, rel ) )
621 index_file.write(
' </ul>\n' )
622 index_file.write(
' </li>\n' )
623 index_file.write(
' <br>\n' )
624 index_file.write(
' <br>\n' )
625 index_file.write(
' <br>\n' )
628 index_file.write(
' </ul>\n' )
629 index_file.write(
' </body>\n')
630 index_file.write(
'</html>\n')
633 processCmd(
'cp index.html %s/.' %(opt.WWWAREA) )
636 if (
not os.path.isdir(
"HGCValid_summary_Plots")):
640 df = pd.DataFrame.from_dict(_summary, orient =
'index').
transpose()
644 index_file = open(
'HGCValid_summary_Plots/index.html',
'w')
646 index_file.write(
'<html>\n')
647 index_file.write(
' <body>\n')
650 for infi
in phase2samples_noPU:
651 samplename = infi.filename(NewRelease).
replace(
"DQM_V0001_R000000001__",
"").
replace(
"__DQMIO.root",
"")
652 index_file.write(
'<h2> %s </h2> \n' %(_sampleName[infi.name()]) )
654 index_file.write(
'<table> \n')
655 index_file.write(
' <tr>\n')
658 index_file.write(
' <th>%s</th>\n' %(_pageNameMap[obj]) )
659 index_file.write(
' </tr>\n')
661 for i, row
in df.iterrows():
662 index_file.write(
' <tr>\n')
663 for j, column
in row.iteritems():
665 index_file.write(
' <td>\n')
666 index_file.write(
' <ul>\n')
670 index_file.write(
' </ul>\n')
671 index_file.write(
' </td>\n')
678 index_file.write(
' <li><a href="../HGCValid_%s_Plots/plots_%s_%s">%s</a></li> \n' %(j, samplename, column, column.partition(
"/")[2] ))
680 index_file.write(
' </ul>\n')
681 index_file.write(
' </td>\n')
683 index_file.write(
' </tr>\n')
685 index_file.write(
' </table>\n')
686 index_file.write(
' <br/>\n' )
687 index_file.write(
' <br/>\n' )
688 index_file.write(
' <br/>\n' )
691 index_file.write(
' </body>\n')
692 index_file.write(
'</html>\n')
695 objects = opt.GATHER.split(
",")
698 if "raw" in NotNormalRelease
and "raw" in NotNormalRefRelease:
699 localoutputdir = NewRelease +
"_raw1100" +
"_vs_" + RefRelease +
"_raw1100"
700 elif "raw" in NotNormalRelease
and "normal" in NotNormalRefRelease:
701 localoutputdir = NewRelease +
"_raw1100" +
"_vs_" + RefRelease
702 elif "normal" in NotNormalRelease
and "normal" in NotNormalRefRelease:
703 localoutputdir = NewRelease +
"_vs_" + RefRelease
705 localoutputdir = NewRelease
710 if (
not os.path.isdir(
'%s/standalone' %(localoutputdir))) :
711 processCmd(
'mkdir -p %s/standalone' %(localoutputdir))
712 if (obj!=
"standalone"):
processCmd(
'mv HGCValid_%s_Plots %s'%(obj, localoutputdir) )
714 processCmd(
'mv hgcalSimHitStudy %s/standalone/.'%(localoutputdir) )
715 processCmd(
'mv hgcalDigiStudy %s/standalone/.'%(localoutputdir) )
716 processCmd(
'mv hgcalRecHitStudy %s/standalone/.'%(localoutputdir) )
717 processCmd(
'cp %s/../public/index.php %s/standalone/.'%(opt.WWWAREA, localoutputdir) )
720 #Let's also copy to the summary folder what we need.
721 for infi in phase2samples_noPU:
722 samplename = infi.filename(NewRelease).replace("DQM_V0001_R000000001__","").replace("__DQMIO.root","")
725 #if obj == "hitValidation" : samplename = samplename + infi.pileup()
726 #else : samplename = infi.filename(NewRelease).replace("DQM_V0001_R000000001__","").replace("__DQMIO.root","")
728 if df[obj][ind] == None: continue
729 else: processCmd('cp -r %s/HGCValid_%s_Plots/plots_%s_%s %s/HGCValid_summary_Plots ' %(NewRelease, obj, samplename, df[obj][ind].partition("/")[0], NewRelease ) )
732 index_file = open(
'%s/index.html'%(localoutputdir),
'w')
734 index_file.write(
'<html>\n')
735 index_file.write(
' <head>\n')
736 index_file.write(
' <title> <h2> HGCal validation results for %s </h2> </title>\n' %(localoutputdir) )
737 index_file.write(
' </head>\n')
738 index_file.write(
' <body>\n')
739 index_file.write(
' HGCal validation results for %s \n' %(localoutputdir) )
743 if (obj!=
"standalone"):
744 index_file.write(
' <br/>\n' )
745 index_file.write(
' <ul>\n' )
746 index_file.write(
' <li><a href="HGCValid_%s_Plots/index.html">%s</a></li>\n' %(obj, _pageNameMap[obj] ) )
747 index_file.write(
' </ul>\n' )
748 index_file.write(
' <br/>\n' )
750 index_file.write(
' <br/>\n' )
751 index_file.write(
' <ul>\n' )
752 index_file.write(
' <li><a href="%s/index.php">%s</a></li>\n' %(obj, _pageNameMap[obj] ) )
753 index_file.write(
' </ul>\n' )
754 index_file.write(
' <br/>\n' )
758 index_file.write(
' </body>\n')
759 index_file.write(
'</html>\n')
771 processCmd(
'zip -0 -r %s.zip %s' %(localoutputdir,localoutputdir) )
772 processCmd(
'cp %s.zip %s/.' %(localoutputdir,opt.WWWAREA) )
775 processCmd(
'mv %s.zip %s/.' %(localoutputdir,localoutputdir) )