Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-01 22:51:57

0001 #!/bin/bash
0002 set -e
0003 set -x
0004 
0005 if [[ -z ${LOCAL_TEST_DIR} ]]; then
0006   LOCAL_TEST_DIR=.
0007 fi
0008 
0009 # This is mainly to make sure nothing crashes. Checking the output for sanity is attempted but not really complete.
0010 
0011 # 1. Run a very simple configuration with all module types.
0012 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=alltypes.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100
0013 # actually we'd expect 99, but the MEs by legacy modules are booked with JOB scope and cannot be saved to DQMIO.
0014 [ 78 = $(dqmiolistmes.py alltypes.root -r 1 | wc -l) ]
0015 [ 78 = $(dqmiolistmes.py alltypes.root -r 1 -l 1 | wc -l) ]
0016 # this is deeply related to what the analyzers actually do.
0017 # again, the legacy modules output is not saved.
0018 # most run histos (4 modules * 9 types) fill on every event and should have 100 entries.
0019 # the scalar MEs should have the last lumi number (5) (5 float + 5 int)
0020 # testonefilllumi also should have 5 entries in the histograms (9 more)
0021 # the "fillrun" module should have one entry in the histograms (9 total) and 0 in the scalars (2 total)
0022 
0023 [ "0: 1, 0.0: 1, 1: 11, 100: 33, 200: 11, 5: 16, 5.0: 5" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 --summary)" ]
0024 # per lumi we see 20 in most histograms (4*9), and the current lumi number in the scalars (6 modules * 2).
0025 # the two fillumi modules should have one entry in each of the lumi histograms, (2*9 total)
0026  
0027 [ "1: 28, 1.0: 6, 20: 44" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 1 --summary)" ]
0028 [ "1: 22, 2: 6, 2.0: 6, 20: 44" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 2 --summary)" ]
0029 [ "1: 22, 20: 44, 3: 6, 3.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 3 --summary)" ]
0030 [ "1: 22, 20: 44, 4: 6, 4.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 4 --summary)" ]
0031 [ "1: 22, 20: 44, 5: 6, 5.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 5 --summary)" ]
0032 # just make sure we are not off by one
0033 [ "" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py alltypes.root -r 1 -l 6 --summary)" ]
0034 
0035 
0036 # 2. Run multi-threaded. First we make a baseline file without legacy modules, since they might not work.
0037 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=nolegacy.root    numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True
0038 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=nolegacy-mt.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True nThreads=10
0039 
0040 
0041 # 3. Try enabling concurrent lumis.
0042 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=nolegacy-cl.root numberEventsInRun=1000 numberEventsInLuminosityBlock=200 nEvents=1000 nolegacy=True nThreads=10 nConcurrent=10
0043 
0044 # same math as above, just a few less modules, and more events.
0045 for f in nolegacy.root nolegacy-mt.root nolegacy-cl.root
0046 do
0047   [ "0: 1, 0.0: 1, 1: 11, 1000: 22, 2000: 11, 5: 3, 5.0: 3" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 --summary)" ]
0048   [ "1: 2, 1.0: 2, 200: 22" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 1 --summary)" ]
0049   [ "2: 2, 2.0: 2, 200: 22" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 2 --summary)" ]
0050   [ "200: 22, 3: 2, 3.0: 2" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 3 --summary)" ]
0051   [ "200: 22, 4: 2, 4.0: 2" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 4 --summary)" ]
0052   [ "200: 22, 5: 2, 5.0: 2" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 5 --summary)" ]
0053   [ "" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py $f -r 1 -l 6 --summary)" ]
0054 done
0055 
0056 
0057 # 4. Try crossing a run boundary.
0058 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=multirun.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200
0059 dqmiodumpmetadata.py multirun.root | grep -q '4 runs, 12 lumisections'
0060 
0061 
0062 # 5. Now, make some chopped up files to try harvesting.
0063 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part1.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50               # 1st half of 1st lumi
0064 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part2.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 firstEvent=50 # 2nd half of 1st lumi
0065 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part3.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3
0066 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part4.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2   # 3 more runs
0067 
0068 cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part2.root inputFiles=part3.root inputFiles=part4.root outfile=merged.root nomodules=True
0069 dqmiodumpmetadata.py merged.root | grep -q '4 runs, 12 lumisections'
0070 
0071 #dumproot() { root2sqlite.py -o $1.sqlite $1 ; echo '.dump' | sqlite3 $1.sqlite > $1.sqldump ; rm $1.sqlite ; }
0072 #dumproot multirun.root
0073 #dumproot merged.root
0074 rootlist ()
0075 {  python3 -c '
0076 import uproot
0077 for k in uproot.open("'"$1"'").keys(): print(k)'
0078 }
0079 
0080 # we need to exclude MEs filled on run and lumi boundaries, since the split job *does* see a different number of begin/end run/lumi transitions.
0081 cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 1 | grep -vE 'fillrun|filllumi') <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 1 | grep -vE 'fillrun|filllumi')
0082 cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 3) <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 3)
0083 cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 1 -l 1 | grep -v filllumi) <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 1 -l 1 | grep -v filllumi)
0084 cmp <($LOCAL_TEST_DIR/dqmiodumpentries.py multirun.root -r 1 -l 2) <($LOCAL_TEST_DIR/dqmiodumpentries.py merged.root -r 1 -l 2)
0085 
0086 # 6. A load test. 
0087 #( if [[ `uname -m` != aarch64 ]] ; then ulimit -v 4000000 ; fi # limit available virtual memory
0088   cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=huge.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=600 nThreads=10 nConcurrent=2 howmany=1000 nolegacy=True
0089 #)
0090 
0091 
0092 # 7. Try writing a TDirectory file.
0093 cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=alltypes.root nomodules=True legacyoutput=True reScope=JOB
0094 # this number is rather messy: we have 66 per-lumi objecs (harvested), 66 per-run objects (no legacy output), one folder for each set of 11, 
0095 # plus some higher-level folders and the ProvInfo hierarchy create by the FileSaver.
0096 [ 185 = $(rootlist DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root | wc -l) ]
0097 
0098 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 legacyoutput=True
0099 # we expect only the (per-job) legacy histograms here: 3*11 objects in 3 folders, plus 9 more for ProvInfo and higher-level folders.
0100 [ 51 = $(rootlist DQM_V0001_R000000001__EmptySource__DQMTests__DQMIO.root | wc -l) ]
0101 
0102 # 8. Try writing ProtoBuf files.
0103 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 protobufoutput=True
0104 
0105 cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=./run000001 outfile=pbdata.root nomodules=True protobufinput=True
0106 [ 117 = $(dqmiolistmes.py pbdata.root -r 1 | wc -l) ]
0107 [ 78 = $(dqmiolistmes.py pbdata.root -r 1 -l 1 | wc -l) ]
0108 
0109 # this will potentially mess up statistics (we should only fastHadd *within* a lumisection, not *across*), but should technically work.
0110 fastHadd add -o streamDQMHistograms.pb run000001/run000001_ls*_streamDQMHistograms.pb
0111 # the output format is different from the harvesting above, this is a not-DQM-formatted TDirectory file.
0112 fastHadd convert -o streamDQMHistograms.root streamDQMHistograms.pb
0113 # here we expect all (incl. legacy) MEs (99+66), plus folders (14 + 4 higher-level)
0114 [ 214 = $(rootlist streamDQMHistograms.root | wc -l) ]
0115 
0116 
0117 # 9. Try writing online files. This is really TDirectory files, but written via a different module.
0118 # Note that this does not really need to support multiple runs, but it appears it does.
0119 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=1200 onlineoutput=True
0120 # here we expect full per-run output (99 objects), no per-lumi MEs, plus folders (9 + 10 higher-level).
0121 [ 136 = $(rootlist DQM_V0001_UNKNOWN_R000000001.root | wc -l) ]
0122 [ 136 = $(rootlist DQM_V0001_UNKNOWN_R000000002.root | wc -l) ]
0123 [ 136 = $(rootlist DQM_V0001_UNKNOWN_R000000003.root | wc -l) ]
0124 [ 136 = $(rootlist DQM_V0001_UNKNOWN_R000000004.root | wc -l) ]
0125 
0126 
0127 # 10. Try running some harvesting modules and check if their output makes it out.
0128 # Note that we pass the files out-of order here; the DQMIO input should sort them.
0129 cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part3.root inputFiles=part2.root legacyoutput=True
0130 [ 1 = $(rootlist DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root | grep  -c '<harvestingsummary>s=beginRun(1) endLumi(1,1) endLumi(1,2) endLumi(1,3) endRun(1) endJob() </harvestingsummary>') ]
0131 # The legacy harvester can only do per-run harvesting.
0132 [ 2 = $(rootlist DQM_V0001_R000000001__Harvesting__DQMTests__DQMIO.root | grep  -c '<runsummary>s=beginRun(1) endLumi(1,1) endLumi(1,2) endLumi(1,3) endRun(1) </runsummary>') ]
0133 
0134 # 11. Try MEtoEDM and EDMtoME.
0135 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=metoedm.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100 metoedmoutput=True
0136 cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py outfile=edmtome.root inputFiles=metoedm.root nomodules=True metoedminput=True
0137 [ 72 = $(dqmiolistmes.py edmtome.root -r 1 | wc -l) ]
0138 [ 72 = $(dqmiolistmes.py edmtome.root -r 1 -l 1 | wc -l) ]
0139 # again, no legacy module (run) output here due to JOB scope for legacy modules
0140 [ "0: 1, 0.0: 1, 1: 10, 100: 30, 200: 10, 5: 15, 5.0: 5" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 --summary)" ]
0141 [ "1: 26, 1.0: 6, 20: 40" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 1 --summary)" ]
0142 [ "1: 20, 2: 6, 2.0: 6, 20: 40" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 2 --summary)" ]
0143 [ "1: 20, 20: 40, 3: 6, 3.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 3 --summary)" ]
0144 [ "1: 20, 20: 40, 4: 6, 4.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 4 --summary)" ]
0145 [ "1: 20, 20: 40, 5: 6, 5.0: 6" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 5 --summary)" ]
0146 [ "" = "$($LOCAL_TEST_DIR/dqmiodumpentries.py edmtome.root -r 1 -l 6 --summary)" ]
0147 
0148 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part1_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50               # 1st half of 1st lumi
0149 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part2_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=50 firstEvent=50 # 2nd half of 1st lumi
0150 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part3_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3
0151 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=part4_metoedm.root metoedmoutput=True numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2   # 3 more runs
0152 
0153 cmsRun $LOCAL_TEST_DIR/run_harvesters_cfg.py inputFiles=part1_metoedm.root inputFiles=part2_metoedm.root inputFiles=part3_metoedm.root inputFiles=part4_metoedm.root outfile=metoedm_merged.root nomodules=True metoedminput=True
0154 dqmiodumpmetadata.py metoedm_merged.root | grep -q '4 runs, 12 lumisections'
0155 
0156 # 12. Sanity checks.
0157 # this will mess up some of the files created earlier, disable for debugging.
0158 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root nEvents=0
0159 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root howmany=0
0160 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root howmany=0 legacyoutput=True
0161 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=empty.root howmany=0 protobufoutput=True
0162 # nLumisections might be a bit buggy (off by one) in EDM, but is fine here.
0163 cmsRun $LOCAL_TEST_DIR/run_analyzers_cfg.py outfile=noevents.root processingMode='RunsAndLumis' nLumisections=20
0164 [ 78 = $(dqmiolistmes.py noevents.root -r 1 | wc -l) ]
0165 [ 78 = $(dqmiolistmes.py noevents.root -r 1 -l 1 | wc -l) ]
0166 [ 78 = $(dqmiolistmes.py noevents.root -r 2 | wc -l) ]
0167 [ 78 = $(dqmiolistmes.py noevents.root -r 2 -l 2 | wc -l) ]
0168 
0169