Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[124X] Bugfix to the destructor of two TkDQM scripts #39575

Merged
merged 2 commits into from Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions DQM/SiStripMonitorClient/scripts/PhaseITreeProducer.py
Expand Up @@ -314,8 +314,9 @@ def DumpData(self):
print(len(self.availableNames))

def __del__(self):
if self.inputFile.IsOpen():
self.inputFile.Close()
if self.inputFile:
if self.inputFile.IsOpen():
self.inputFile.Close()

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
for i in range(1, len(sys.argv), 1):
Expand Down
5 changes: 3 additions & 2 deletions DQM/SiStripMonitorClient/scripts/TH2PolyOfflineMaps.py
Expand Up @@ -526,8 +526,9 @@ def PrintTrackerMaps(self):
c1.Print(self.outputDirName + mv + ".png")

def __del__(self):
if self.inputFile.IsOpen():
self.inputFile.Close()
if self.inputFile :
if self.inputFile.IsOpen():
self.inputFile.Close()

#--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--
for i in range(1, len(sys.argv), 1):
Expand Down
5 changes: 5 additions & 0 deletions DQM/SiStripMonitorClient/test/BuildFile.xml
Expand Up @@ -2,3 +2,8 @@
<flags TEST_RUNNER_ARGS="/bin/bash DQM/SiStripMonitorClient/test test_SiStripDQM_OfflineTkMap.sh"/>
<use name="FWCore/Utilities"/>
</bin>

<bin name="test_TreeAndTkMapProducer" file="TestDriver.cpp">
<flags TEST_RUNNER_ARGS="/bin/bash DQM/SiStripMonitorClient/test test_TreeAndTkMapProducer.sh"/>
<use name="FWCore/Utilities"/>
</bin>
14 changes: 14 additions & 0 deletions DQM/SiStripMonitorClient/test/test_TreeAndTkMapProducer.sh
@@ -0,0 +1,14 @@
#!/bin/bash
function die { echo $1: status $2; exit $2; }
DQMFILE="/store/group/comm_dqm/DQMGUI_data/Run2018/ZeroBias/R0003191xx/DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root"
COMMMAND=`xrdfs cms-xrd-global.cern.ch locate $DQMFILE`
STATUS=$?
echo "xrdfs command status = "$STATUS
if [ $STATUS -eq 0 ]; then
echo "Using file ${DQMFILE} Running in ${LOCAL_TEST_DIR}."
xrdcp root://cms-xrd-global.cern.ch//$DQMFILE DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root
(python3 ${LOCAL_TEST_DIR}/../scripts/PhaseITreeProducer.py DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root) || die 'failed running PhaseITreeProducer.py' $?
(python3 ${LOCAL_TEST_DIR}/../scripts/TH2PolyOfflineMaps.py DQM_V0001_R000319176__ZeroBias__Run2018B-PromptReco-v2__DQMIO.root 3000 2000 ) || die 'failed running TH2PolyOfflineMaps.py' $?
else
die "SKIPPING test, file ${DQMFILE} not found" 0
fi