Skip to content

Commit

Permalink
Merge pull request #319 from OSU-CMS/fixTFPXpolarity
Browse files Browse the repository at this point in the history
Fix tfp xpolarity
  • Loading branch information
mlj5j authored Dec 11, 2024
2 parents 3f01953 + 62c5dc7 commit 50a9574
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 44 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Ph2_ACF/test/logs*
Ph2_ACF/test/logs*
data/
8 changes: 4 additions & 4 deletions Gui/CMSIT_RD53Bv1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ DAC_KRUM_CURR_LIN 0x1D 0d70 0d70
DAC_REF_KRUM_LIN 0x1E 0d360 0d360 10
DAC_COMP_LIN 0x1F 0d80 0d80 10
DAC_COMP_TA_LIN 0x20 0d900 0d900 10
DAC_GDAC_L_LIN 0x21 0d900 0d900 10
DAC_GDAC_R_LIN 0x22 0d900 0d900 10
DAC_GDAC_M_LIN 0x23 0d900 0d900 10
DAC_GDAC_L_LIN 0x21 0d450 0d450 10
DAC_GDAC_R_LIN 0x22 0d450 0d450 10
DAC_GDAC_M_LIN 0x23 0d450 0d450 10
DAC_LDAC_LIN 0x24 0d140 0d140 10

*-------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -80,7 +80,7 @@ EN_CORE_COL_RESET_0 0x2E 0b0 0b0
*-------------------------------------------------------------------------------------------------------
* RegName Addr Defval Value BitSize
*-------------------------------------------------------------------------------------------------------
TriggerConfig 0x2F 0b0111110100 0b0111110100 10
TriggerConfig 0x2F 0b0010000100 0b0010000100 10
SelfTriggerConfig_1 0x30 0b010001 0b010001 6
SelfTriggerConfig_0 0x31 0b000110010000001 0b000110010000001 15
HitOrPatternLUT 0x32 0b0 0b0 16
Expand Down
10 changes: 6 additions & 4 deletions Gui/GUIutils/guiUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,9 @@ def GenerateXMLConfig(firmwareList, testName, outputDir, **arg):
HyBridModule0.SetHyBridName(module.getModuleName())

moduleType = module.getModuleType()
RxPolarities = "1" if "CROC" and "Quad" in moduleType else "0" if "CROC" in moduleType else None
revPolarity = not ("CROC" and "1x2" in moduleType)
RxPolarities = "1" if "CROC" in moduleType and "Quad" in moduleType and "TFPX" in moduleType else "0" if "CROC" in moduleType else None
#revPolarity = not ("CROC" and "1x2" in moduleType)
revPolarity = bool(int(RxPolarities))
FESettings_Dict = FESettings_DictB if "CROC" in moduleType else FESettings_DictA
globalSettings_Dict = globalSettings_DictB if "CROC" in moduleType else globalSettings_DictA
HWSettings_Dict = HWSettings_DictB if "CROC" in moduleType else HWSettings_DictA
Expand Down Expand Up @@ -436,8 +437,9 @@ def GenerateXMLConfig(firmwareList, testName, outputDir, **arg):

BeBoardModule0.AddOGModule(OpticalGroupModule0)

if revPolarity:
RegisterSettingsList['user.ctrl_regs.gtx_rx_polarity.fmc_l12'] = 11
if revPolarity == True:
RegisterSettingsList['user.ctrl_regs.gtx_rx_polarity.fmc_l12'] = '0xbbb'
RegisterSettingsList['user.ctrl_regs.gtx_rx_polarity.fmc_l8'] = '0x44'

BeBoardModule0.SetURI(BeBoard.getIPAddress())
BeBoardModule0.SetBeBoard(BeBoard.getBoardID(), "RD53")
Expand Down
2 changes: 1 addition & 1 deletion Gui/GUIutils/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
"TEPX CROC 1x2": {"0": "0", "2": "2"},
"TBPX CROC 1x2": {"0": "0", "2": "2"},
"TFPX CROC Quad": {"2": "12", "1": "13", "0": "14", "3": "15"},
"TEPX CROC Quad": {"0": "0", "1": "1", "2": "2", "3": "3"},
"TEPX CROC Quad": {"0": "15", "1": "14", "2": "13", "3": "12"},
"TBPX CROC Quad": {"0": "0", "1": "1", "2": "2", "3": "3"},
}

Expand Down
17 changes: 16 additions & 1 deletion Gui/python/TestHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
)
from Gui.python.ROOTInterface import executeCommandSequence
from felis.felis import Felis
from InnerTrackerTests.Analysis.IVCurve_CSV_to_ROOT import IVCurve_CSV_to_ROOT

# from Gui.QtGUIutils.QtStartWindow import *
#from Gui.QtGUIutils.QtCustomizeWindow import *
Expand Down Expand Up @@ -1055,8 +1056,15 @@ def IVCurveFinished(self, test: str, measure: dict):
self.outputString.emit(f"Voltages: {measure['voltage']}")
self.outputString.emit(f"Currents: {measure['current']}")

for module in self.modules: #Only one HV and IVCurve works by sweeping HV. Ask about this.

# for module in self.modules: #Only one HV and IVCurve works by sweeping HV. Ask about this.
# moduleName = module.getModuleName()

for module in self.modules:
ogId = module.getOpticalGroup().getOpticalGroupID()
beboardId = module.getOpticalGroup().getBeBoard().getBoardID()
moduleName = module.getModuleName()
hybridId = module.getFMCPort()

self.IVCurveResult = ScanCanvas(
self,
Expand All @@ -1069,7 +1077,13 @@ def IVCurveFinished(self, test: str, measure: dict):

csvfilename = "{0}/IVCurve_Module_{1}_{2}.csv".format(self.output_dir, moduleName, timestamp)
np.savetxt(csvfilename, (measure["voltage"], measure["current"]), delimiter=',')
module_canvas_path = "Detector/Board_{boardID}/OpticalGroup_{ogID}/Hybrid_{hybridID}/".format(
boardID=beboardId,
ogID=ogId,
hybridID=hybridId)

IVCurve_CSV_to_ROOT(moduleName, module_canvas_path, csvfilename, self.output_dir)

filename = "{0}/IVCurve_Module_{1}_{2}.svg".format(self.output_dir, moduleName, timestamp)
filename2 = "IVCurve_Module_{0}_{1}.svg".format(moduleName, timestamp)
self.IVCurveResult.saveToSVG(filename)
Expand Down Expand Up @@ -1181,6 +1195,7 @@ def forceContinue(self):

def upload_to_Panthera(self):
try:
self.runwindow.UploadButton.setDisabled(True)
for module in self.modules:
status, message = self.felis.upload_results(
module.getModuleName(),
Expand Down
90 changes: 62 additions & 28 deletions Gui/python/TestValidator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,82 @@
import os
from Gui.python.logging_config import logger
from InnerTrackerTests.TestSequences import Test_to_Ph2ACF_Map
from InnerTrackerTests.Analysis.IVCurve_CSV_to_ROOT import IVCurve_CSV_to_ROOT

def ResultGrader(felis, outputDir, testName, testIndexInSequence, runNumber, module_data):
try:
module_name = module_data['module'].getModuleName()
module_type = module_data['module'].getModuleType()
module_version = module_data['module'].getModuleVersion()
if 'IVCurve' in testName or 'SLDOScan' in testName or 'CommunicationTest' in testName:
explanation = 'No grading currently available for IVCurve, SLDOScan, or CommunicationTest.'
if 'SLDOScan' in testName or 'CommunicationTest' in testName:
explanation = 'No grading currently available for SLDOScan or CommunicationTest.'
return {module_name:(True, explanation)}

#if 'IVCurve' in testName:
# module_canvas_path = "Detector/Board_{boardID}/OpticalGroup_{ogID}/Hybrid_{hybridID}/".format(
# boardID=module_data['boardID'],
# ogID=module_data['ogID'],
# hybridID=module_data['hybridID'])
# relevant_files = [outputDir+"/"+os.fsdecode(file) for file in os.listdir(outputDir)]



root_file_name = testName.split('_')[0]
if 'SCurveScan' in root_file_name:
root_file_name = 'SCurve'
elif 'GainScan' in root_file_name:
root_file_name = 'Gain'
elif 'Threshold' in root_file_name:
root_file_name = root_file_name.replace('Threshold', 'Thr')
ROOT_file_path = "{0}/Run{1}_{2}.root".format(
outputDir, runNumber, root_file_name
)
chip_canvas_path_template = "Detector/Board_{boardID}/OpticalGroup_{ogID}/Hybrid_{hybridID}/Chip_{chipID:02d}"
active_chips = [chip.getID() for chip in module_data['module'].getChips().values() if chip.getStatus()]
chip_canvases = [
chip_canvas_path_template.format(
boardID=module_data['boardID'],
ogID=module_data['ogID'],
hybridID=module_data['hybridID'],
chipID=int(chipID)
if 'IVCurve' in testName:
root_file_name = testName.split('_')[0]+"_"+module_name
module_canvas_path = "Detector/Board_{boardID}/OpticalGroup_{ogID}/Hybrid_{hybridID}".format(
boardID=module_data['boardID'],
ogID=module_data['ogID'],
hybridID=module_data['hybridID'])
ROOT_file_path = "{0}/Result_{1}.root".format(outputDir, root_file_name)

relevant_files = [outputDir+"/"+os.fsdecode(file) for file in os.listdir(outputDir)]
_1, _2 = felis.set_module(
module_name, module_type.split(" ")[2].replace("Quad","2x2"), module_type.split(" ")[0], module_version.strip('v'), True, "link"
)
module_canvases = [module_canvas_path]
status, message, sanity, explanation = felis.set_result(
ROOT_file_path,
module_canvases,
relevant_files,
module_name,
f"{testIndexInSequence:02d}_{testName}",
Test_to_Ph2ACF_Map[testName],
)
else:
ROOT_file_path = "{0}/Run{1}_{2}.root".format(
outputDir, runNumber, root_file_name
)
chip_canvas_path_template = "Detector/Board_{boardID}/OpticalGroup_{ogID}/Hybrid_{hybridID}/Chip_{chipID:02d}"
active_chips = [chip.getID() for chip in module_data['module'].getChips().values() if chip.getStatus()]
chip_canvases = [
chip_canvas_path_template.format(
boardID=module_data['boardID'],
ogID=module_data['ogID'],
hybridID=module_data['hybridID'],
chipID=int(chipID)
)
for chipID in active_chips
]
relevant_files = [outputDir+"/"+os.fsdecode(file) for file in os.listdir(outputDir)]
_1, _2 = felis.set_module(
module_name, module_type.split(" ")[2].replace("Quad","2x2"), module_type.split(" ")[0], module_version.strip('v'), True, "link"
)

status, message, sanity, explanation = felis.set_result(
ROOT_file_path,
chip_canvases,
relevant_files,
module_name,
f"{testIndexInSequence:02d}_{testName}",
Test_to_Ph2ACF_Map[testName],
)
for chipID in active_chips
]
relevant_files = [outputDir+"/"+os.fsdecode(file) for file in os.listdir(outputDir)]
_1, _2 = felis.set_module(
module_name, module_type.split(" ")[2].replace("Quad","2x2"), module_type.split(" ")[0], module_version.strip('v'), True, "link"
)

status, message, sanity, explanation = felis.set_result(
ROOT_file_path,
chip_canvases,
relevant_files,
module_name,
f"{testIndexInSequence:02d}_{testName}",
Test_to_Ph2ACF_Map[testName],
)
if not status:
raise RuntimeError(message)

Expand Down
2 changes: 1 addition & 1 deletion Gui/siteConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
## Specify whether of not you want to monitor chip temperature during the tests ##
## Set this to "1" if you want the monitoring enabled. Set it to "0" if you want it disabled. ##
Monitor_RD53A = "1"
Monitor_CROC = "1"
Monitor_CROC = "0"
Monitor_SleepTime = "30000" # time in milliseconds between temperature readings

## Establish thresholds for chip temperature readings. A chip reading above the
Expand Down
2 changes: 1 addition & 1 deletion InnerTrackerTests
Submodule InnerTrackerTests updated from 35f5c3 to aac762
4 changes: 4 additions & 0 deletions prepare_Ph2ACF.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ source setup.sh
cd ${GUI_dir}
source symlinks.sh

cd ${GUI_dir}/Gui/python

wget -O rhapi.py https://gitlab.cern.ch/cms-ph2-database/resthub-dev/-/raw/master/clients/python/src/main/python/rhapi.py

cd ${GUI_dir}/Gui

echo "You can now open the GUI by doing 'python3 QtApplication.py'."
Expand Down
24 changes: 21 additions & 3 deletions run_Docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ then
-v ${PWD}/icicle/icicle:/home/cmsTkUser/Ph2_ACF_GUI/icicle/icicle:ro\
-v ${PWD}/Gui/siteConfig.py:/home/cmsTkUser/Ph2_ACF_GUI/Gui/siteSettings.py\
-v ${PWD}/Ph2_ACF/test:/home/cmsTkUser/Ph2_ACF_GUI/Ph2_ACF/test\
-v ${PWD}/Ph2_ACF/settings/RD53Files:/home/cmsTkUser/Ph2_ACF_GUI/Ph2_ACF/settings/RD53Files\
-v ${PWD}/data:/home/cmsTkUser/Ph2_ACF_GUI/data\
-v ${PWD}/Gui/QtGUIutils/:/home/cmsTkUser/Ph2_ACF_GUI/Gui/QtGUIutils/\
-v ${PWD}/Gui/GUIutils/:/home/cmsTkUser/Ph2_ACF_GUI/Gui/GUIutils/\
Expand All @@ -55,13 +56,30 @@ then
-e XAUTHORITY=$XAUTH --net host majoyce2/ph2_acf_gui_dev:latest
else
echo "running as user"
docker run --pull=always --detach-keys='ctrl-e,e' --rm -ti $mydevices -v ${PWD}:${PWD}\
IMAGE_NAME="majoyce2/ph2_acf_gui_user:latest"

LOCAL_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' "$IMAGE_NAME" | cut -d'@' -f2)
REMOTE_DIGEST=$(skopeo inspect docker://$IMAGE_NAME | jq -r '.Digest')

if [[ "$LOCAL_DIGEST" == "$REMOTE_DIGEST" ]]; then
echo "The image is already up to date."
else
echo "A newer image is available. Do you want to pull it? (y/n)"
read -r response
if [[ $response == "y" ]]; then
docker pull $IMAGE_NAME
echo "Image pulled successfully."
else
echo "Image pull canceled."
fi
fi
docker run --detach-keys='ctrl-e,e' --rm -ti $mydevices -v ${PWD}:${PWD}\
-v ${PWD}/Gui/siteConfig.py:/home/cmsTkUser/Ph2_ACF_GUI/Gui/siteSettings.py\
-v ${PWD}/Ph2_ACF/test:/home/cmsTkUser/Ph2_ACF_GUI/Ph2_ACF/test\
-v ${PWD}/data:/home/cmsTkUser/Ph2_ACF_GUI/data\
-v ${PWD}/Gui/jsonFiles:/home/cmsTkUser/Ph2_ACF_GUI/Gui/jsonFiles\
-v ${PWD}/Gui/QtGUIutils/PeltierCoolingApp.py:/home/cmsTkUser/Ph2_ACF_GUI/Gui/QtGUIutils/PeltierCoolingApp.py\
-v ${PWD}/Gui/python/Peltier.py:/home/cmsTkUser/Ph2_ACF_GUI/Gui/python/Peltier.py\
-w $PWD -e DISPLAY=$DISPLAY -v $XSOCK:$XSOCK -v $XAUTH:$XAUTH\
-e XAUTHORITY=$XAUTH --net host majoyce2/ph2_acf_gui_user:latest #local/testimagejuly30user
fi
-e XAUTHORITY=$XAUTH --net host local/testimagedec11user #majoyce2/ph2_acf_gui_user:latest #local/testimagejuly30user
fi

0 comments on commit 50a9574

Please sign in to comment.