ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_RegisterPool.py
Go to the documentation of this file.
1# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
2import subprocess
3import sys
4
5def run_command(command):
6 """Run a shell command and handle errors."""
7 print(f"\n>>> Running: {command}\n")
8 try:
9 subprocess.run(command, shell=True)
10 except subprocess.CalledProcessError as e:
11 print(f"Error: Command failed: {e}")
12 sys.exit(1)
13
14def run_command_test(command):
15 """Run a shell command and handle errors."""
16 print(f"\n>>> Running: {command}\n")
17
18
19if __name__ == "__main__":
20
21 import argparse
22 parser = argparse.ArgumentParser(prog='python -m TRT_ConditionsAlgs.TRT_RegisterPool', formatter_class=argparse.RawTextHelpFormatter,
23 description='''Update TRT conditions:
24 python -m TRT_ConditionsAlgs.TRT_RegisterPool -> for testing
25 python -m TRT_ConditionsAlgs.TRT_RegisterPool --prod -> for data production
26 python -m TRT_ConditionsAlgs.TRT_RegisterPool --prod --isMC -> for MC production''')
27
28 parser.add_argument('--prod',action='store_true', help="Meant for production only")
29 parser.add_argument('--isMC',action='store_true', help="Set for MC")
30 parser.add_argument('--email', required=True, help="Email to be notify")
31 parser.add_argument('--poolfile', default="pooloutputfile.root", help="POOL file to be registered")
32 args = parser.parse_args()
33
34 # Registering the constants
35 genCOND = "cond09_mc.gen.COND" if args.isMC else "condR2_data.gen.COND" if args.prod else "cond09_test.gen.COND"
36 run_command_test(f"/afs/cern.ch/user/a/atlcond/utils22/registerFiles2 --wait --email={args.email} {genCOND} {args.poolfile}")
37
38 print("Environment setup complete.")
void print(char *figname, TCanvas *c1)