ATLAS Offline Software
Loading...
Searching...
No Matches
ITkPixelCablingFromDB.py
Go to the documentation of this file.
2# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3#
4
5import json
6import requests
7
8def ITkPixelCablingFromCREST(url : str = 'https://atlas-crest-dev.cern.ch/api-v6.4', tag : str = 'ITkPixModIDMap-RUN4-00-01-TEST', output_file : str = 'cabling.json'):
9
10 payload_hash = requests.get(
11 f"{url}/iovs",
12 params={"tagname": tag, "sort": "id.since:DESC", "page": 0, "size": 1},
13 ).json()["resources"][0]["payloadHash"]
14
15 doc = requests.get(
16 f"{url}/payloads/data",
17 params={"hash": payload_hash},
18 ).json()
19
20 doc["side-A"] = doc.pop("0")
21 doc["side-C"] = doc.pop("1")
22
23 for side in ("side-A", "side-C"):
24 doc[side][0] = json.loads(doc[side][0][2:-1])
25
26 with open(output_file, "w") as f:
27 json.dump(doc, f, indent=2)
ITkPixelCablingFromCREST(str url='https://atlas-crest-dev.cern.ch/api-v6.4', str tag='ITkPixModIDMap-RUN4-00-01-TEST', str output_file='cabling.json')