3# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4#
5# CopyBlobFromCrest.py
6"""
7@author Laura.Sargsyan@cern.ch 2025-04-16
8CopyBlobFromCrest.py - Tool for retrieving TileCal calibration data from CREST
9
10Description:
11------------
12This script connects to the CREST service to fetch calibration data (blobs) for TileCal. Users can specify which calibration tag, run number, luminosity
13block, and channels to retrieve for fine-grained control of the data. The fetched calibration data is then saved into a JSON file whose name typically
14includes metadata such as the tag, run, and luminosity block.
15
16Command-line Parameters:
17-----------------------
18-s, --server
19 CREST server URL. Default: http://crest-j23.cern.ch:8080/api-v5.0
20
21-t, --tag
22 Calibration tag to fetch from CREST (e.g., TileOfl02CalibCes-RUN2-UPD4-29). Default: TileOfl02CalibCes-RUN2-UPD4-29)
23
24-r, --run
25 The run number. Default: 2147483647 (retrieves the latest IOV).
26
27-l, --lumi
28 Luminosity block number. Default: 0
29
30-c, --channel
31 Space or comma-separated list of COOL channel IDs to retrieve (e.g., 0,1,2). Default: [0..275] plus channel 1000.
32
33-o, --output
34 Output filename (JSON). If omitted, a default is generated, typically
35 structured as: <tag>.<run>.<lumi>.json. For example: UPD4.2147483647.0.json