ATLAS Offline Software
Loading...
Searching...
No Matches
CalibrationTargetFolderConfig.py
Go to the documentation of this file.
1# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
2
3
4import sys
5import CoolConvUtilities.AtlCoolLib as AtlCoolLib
6from MuonCalibDbOperations.MuonCalibResolveTag import ResolveTag
7
8
9MuonCalib__gCalibrationTargetConfigs = []
10
12
13 def __init__(self, FolderType="T0"):
14 if FolderType not in ["T0", "RT", "T0BLOB", "RTBLOB"]:
15 print ("FATAL Folder type must be 'T0[BLOB]' or 'RT[BLOB]'")
16 sys.exit(1)
17
18#set defaults
19
20 # Default None for all FolderTypes
21 self.Tag=None
22
23 if FolderType=="T0":
24 self.__is_t0=True
25 self.Compress=False
26 self.Folder = "/MDT/T0"
27 elif FolderType == "T0BLOB":
28 self.__is_t0=True
29 self.Compress=True
30 self.Folder = "/MDT/T0BLOB"
31 if FolderType=="RT":
32 self.__is_t0=False
33 self.Compress=False
34 self.Folder = "/MDT/RT"
35 elif FolderType == "RTBLOB":
36 self.__is_t0=False
37 self.Compress=True
38 self.Folder = "/MDT/RTBLOB"
39
40 MuonCalib__gCalibrationTargetConfigs.append(self)
41
42 def ResolveGlobalTag(self, tag, dbstring="COOLOFL_MDT/CONDBR2"):
43 if self.Tag:
44 print ("INFO Tag for", self.Folder, "already set to", self.Tag)
45 print ("INFO Not resolving global tag")
46 return
47 try:
48 db=AtlCoolLib.indirectOpen(dbstring, readOnly=True, debug=True)
49 except Exception as e:
50 print ('Problem opening database',e)
51 sys.exit(-1)
52 cool_folder=db.getFolder(self.Folder)
53 self.Tag=ResolveTag(cool_folder, tag)
54 print ("INFO tag '" + tag + "' resolves to '" + self.Tag + "' for folder '" + self.Folder + "'")
55
56
57
58 def AddToCoolInserter(self, coolInserter):
59
60 if self.__is_t0:
61 coolInserter.T0Folder.append(self.Folder)
62 coolInserter.T0Tag.append(self.Tag)
63 coolInserter.T0FolderCompress.append(self.Compress)
64 else:
65 coolInserter.RtFolder.append(self.Folder)
66 coolInserter.RtTag.append(self.Tag)
67 coolInserter.RtFolderCompress.append(self.Compress)
68