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