Skip to content

Commit

Permalink
Update DQMServices/Demo/test; Exist run-time error associated with TH…
Browse files Browse the repository at this point in the history
…2Poly::GetNumberOfBins() and Add().
  • Loading branch information
ywkao committed Aug 23, 2024
1 parent fddc8e2 commit 87c28ba
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
2 changes: 2 additions & 0 deletions DQMServices/Demo/test/TestDQMEDAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class BookerFiller {
mes_2D.push_back(ibooker.book2D("th2f" + num, "2D Float Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(ibooker.book2S("th2s" + num, "2D Short Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(ibooker.book2DD("th2d" + num, "2D Double Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(ibooker.book2DPoly("th2poly" + num, "2D Polygonal Double Histogram " + num, -0.5, 100.5, -0.5, 10.5));
mes_2D.push_back(ibooker.book2I("th2i" + num, "2D Integer Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(
ibooker.bookProfile("tprofile" + num, "1D Profile Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
Expand All @@ -57,6 +58,7 @@ class BookerFiller {
mes_2D.push_back(ibooker.book2D("th2f" + num, "2D Float Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(ibooker.book2S("th2s" + num, "2D Short Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(ibooker.book2DD("th2d" + num, "2D Double Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(ibooker.book2DPoly("th2poly" + num, "2D Polygonal Double Histogram " + num, -0.5, 100.5, -0.5, 10.5));
mes_2D.push_back(ibooker.book2I("th2i" + num, "2D Integer Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
mes_2D.push_back(
ibooker.bookProfile("tprofile" + num, "1D Profile Histogram " + num, 101, -0.5, 100.5, 11, -0.5, 10.5));
Expand Down
15 changes: 8 additions & 7 deletions DQMServices/Demo/test/dqmiodumpentries.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
6: "TH2Fs",
7: "TH2Ss",
8: "TH2Ds",
9: "TH3Fs",
10: "TProfiles",
11: "TProfile2Ds",
12: "TH1Is",
13: "TH2Is"
9: "TH2Polys",
10: "TH3Fs",
11: "TProfiles",
12: "TProfile2Ds",
13: "TH1Is",
14: "TH2Is"
}

f = ROOT.TFile.Open(args.inputfile)
idxtree = getattr(f, "Indices")
idxtree = f["Indices"]

summary = defaultdict(lambda: 0)

Expand All @@ -41,7 +42,7 @@

# inclusive range -- for 0 entries, row is left out
firstidx, lastidx = idxtree.FirstIndex, idxtree.LastIndex
metree = getattr(f, treenames[metype])
metree = f[treenames[metype]]
# this GetEntry is only to make sure the TTree is initialized correctly
metree.GetEntry(0)
metree.SetBranchStatus("*",0)
Expand Down
32 changes: 17 additions & 15 deletions DQMServices/Demo/test/runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ set -x

# This is mainly to make sure nothing crashes. Checking the output for sanity is attempted but not really complete.

SCRAM_TEST_PATH=/afs/cern.ch/work/y/ykao/pull_request_cmssw_th2poly/CMSSW_14_1_ROOT632_X_2024-08-18-2300/src/DQMServices/Demo/test

# 1. Run a very simple configuration with all module types.
cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=alltypes.root numberEventsInRun=100 numberEventsInLuminosityBlock=20 nEvents=100
# actually we'd expect 99, but the MEs by legacy modules are booked with JOB scope and cannot be saved to DQMIO.
[ 78 = $(dqmiolistmes.py alltypes.root -r 1 | wc -l) ]
[ 78 = $(dqmiolistmes.py alltypes.root -r 1 -l 1 | wc -l) ]
[ 84 = $(dqmiolistmes.py alltypes.root -r 1 | wc -l) ]
[ 84 = $(dqmiolistmes.py alltypes.root -r 1 -l 1 | wc -l) ]
# this is deeply related to what the analyzers actually do.
# again, the legacy modules output is not saved.
# most run histos (4 modules * 9 types) fill on every event and should have 100 entries.
# the scalar MEs should have the last lumi number (5) (5 float + 5 int)
# testonefilllumi also should have 5 entries in the histograms (9 more)
# the "fillrun" module should have one entry in the histograms (9 total) and 0 in the scalars (2 total)

[ "0: 1, 0.0: 1, 1: 11, 100: 33, 200: 11, 5: 16, 5.0: 5" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 --summary)" ]
[ "0: 7, 0.0: 1, 1: 11, 100: 33, 200: 11, 5: 16, 5.0: 5" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 --summary)" ]
# per lumi we see 20 in most histograms (4*9), and the current lumi number in the scalars (6 modules * 2).
# the two fillumi modules should have one entry in each of the lumi histograms, (2*9 total)

[ "1: 28, 1.0: 6, 20: 44" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 1 --summary)" ]
[ "1: 22, 2: 6, 2.0: 6, 20: 44" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 2 --summary)" ]
[ "1: 22, 20: 44, 3: 6, 3.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 3 --summary)" ]
[ "1: 22, 20: 44, 4: 6, 4.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 4 --summary)" ]
[ "1: 22, 20: 44, 5: 6, 5.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 5 --summary)" ]
[ "0: 6, 1: 28, 1.0: 6, 20: 44" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 1 --summary)" ]
[ "0: 6, 1: 22, 2: 6, 2.0: 6, 20: 44" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 2 --summary)" ]
[ "0: 6, 1: 22, 20: 44, 3: 6, 3.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 3 --summary)" ]
[ "0: 6, 1: 22, 20: 44, 4: 6, 4.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 4 --summary)" ]
[ "0: 6, 1: 22, 20: 44, 5: 6, 5.0: 6" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 5 --summary)" ]
# just make sure we are not off by one
[ "" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py alltypes.root -r 1 -l 6 --summary)" ]

Expand All @@ -40,12 +41,12 @@ cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=nolegacy-cl.root numberEv
# same math as above, just a few less modules, and more events.
for f in nolegacy.root nolegacy-mt.root nolegacy-cl.root
do
[ "0: 1, 0.0: 1, 1: 11, 1000: 22, 2000: 11, 5: 3, 5.0: 3" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 --summary)" ]
[ "1: 2, 1.0: 2, 200: 22" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 1 --summary)" ]
[ "2: 2, 2.0: 2, 200: 22" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 2 --summary)" ]
[ "200: 22, 3: 2, 3.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 3 --summary)" ]
[ "200: 22, 4: 2, 4.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 4 --summary)" ]
[ "200: 22, 5: 2, 5.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 5 --summary)" ]
[ "0: 5, 0.0: 1, 1: 11, 1000: 22, 2000: 11, 5: 3, 5.0: 3" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 --summary)" ]
[ "0: 2, 1: 2, 1.0: 2, 200: 22" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 1 --summary)" ]
[ "0: 2, 2: 2, 2.0: 2, 200: 22" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 2 --summary)" ]
[ "0: 2, 200: 22, 3: 2, 3.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 3 --summary)" ]
[ "0: 2, 200: 22, 4: 2, 4.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 4 --summary)" ]
[ "0: 2, 200: 22, 5: 2, 5.0: 2" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 5 --summary)" ]
[ "" = "$(${SCRAM_TEST_PATH}/dqmiodumpentries.py $f -r 1 -l 6 --summary)" ]
done

Expand All @@ -61,6 +62,7 @@ cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part2.root numberEventsIn
cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part3.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=200 firstEvent=100 firstLuminosityBlock=2 # lumi 2 and 3
cmsRun ${SCRAM_TEST_PATH}/run_analyzers_cfg.py outfile=part4.root numberEventsInRun=300 numberEventsInLuminosityBlock=100 nEvents=900 firstRun=2 # 3 more runs

echo ">>> Need to fix segamentation fault in running ${SCRAM_TEST_PATH}/run_harvesters_cfg.py"
cmsRun ${SCRAM_TEST_PATH}/run_harvesters_cfg.py inputFiles=part1.root inputFiles=part2.root inputFiles=part3.root inputFiles=part4.root outfile=merged.root nomodules=True
dqmiodumpmetadata.py merged.root | grep -q '4 runs, 12 lumisections'

Expand Down

0 comments on commit 87c28ba

Please sign in to comment.