ATLAS Offline Software
CalibrationSourceConfig.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 from MuonCalibDbOperations.MuonCalibDbOperationsConf import MuonCalib__MuonCalibDbCalibrationSource
7 
8 MuonCalib__gCalibrationSourceConfigs = []
9 
11 
12  __working_schemata={'MP': "ATLAS_MUONCALIBR_MPI", 'RM': "ATLAS_MUONCALIBR_RM", 'UM': "ATLAS_MUONCALIBR_UM"}
13 
14  def __init__(self, site_name, head_id, region="", store_rt=True, store_t0=True):
15 
16  if site_name not in self.__working_schemata:
17  print ("FATAL: unknown site name ", site_name)
18  print ("FATAL: must be one of", self.__working_schemata.keys())
19  sys.exit(1)
20 
21  self.UserName="ATLAS_MUONCALIBR_READER"
22  self.SiteName=site_name
23  self.HeadID=head_id
24  self.Region=region
25  self.StoreRt=store_rt
26  self.StoreT0=store_t0
27  self.T0Offset=0.0
29  self.__name = "MuonCalibDbCalibrationSource_" + str(len(MuonCalib__gCalibrationSourceConfigs))
30  MuonCalib__gCalibrationSourceConfigs.append(self)
33 
34  def GenCalibrationSource(self, reader_passwd):
35  source=MuonCalib__MuonCalibDbCalibrationSource(self.__name)
36  source.WorkingSchema = self.__working_schemata[self.SiteName]
37  source.UserName = self.UserName
38  if hasattr(self, "ReaderPassword"):
39  source.Password = self.ReaderPassword
40  else:
41  source.Password = reader_passwd
42  source.SiteName = self.SiteName
43  source.HeadId = self.HeadID
44  source.Region = self.Region
45  source.StoreRT = self.StoreRt
46  source.StoreT0 = self.StoreT0
47  source.T0Offset = self.T0Offset
48  source.DriftTimeOffsetsVsR = self.DriftTimeOffsetsVsR
49  source.TimeSlewingApplied = self.TimeSlewingApplied
50  source.BFieldCorrectionApplied = self.BFieldCorrectionApplied
51  if hasattr(self, "ConnectionString"):
52  source.ConnectionString = self.ConnectionString
53  else:
54  source.ConnectionString = "oracle://ATLAS_MUON/" + source.UserName
55  return source
56 
57  def GetTime(self, reader_cursor):
58  reader_cursor.execute("select LOWTIME from " + self.__working_schemata[self.SiteName] + ".MDT_HEAD where head_id=:hid", {'hid': self.HeadID})
59  lowtime, =reader_cursor.fetchone()
60  return lowtime
61 
62 
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.StoreT0
StoreT0
Definition: CalibrationSourceConfig.py:26
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.HeadID
HeadID
Definition: CalibrationSourceConfig.py:23
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.TimeSlewingApplied
TimeSlewingApplied
Definition: CalibrationSourceConfig.py:31
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.BFieldCorrectionApplied
BFieldCorrectionApplied
Definition: CalibrationSourceConfig.py:32
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig
Definition: CalibrationSourceConfig.py:10
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.Region
Region
Definition: CalibrationSourceConfig.py:24
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.UserName
UserName
Definition: CalibrationSourceConfig.py:21
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.DriftTimeOffsetsVsR
DriftTimeOffsetsVsR
Definition: CalibrationSourceConfig.py:28
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.StoreRt
StoreRt
Definition: CalibrationSourceConfig.py:25
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.GetTime
def GetTime(self, reader_cursor)
Definition: CalibrationSourceConfig.py:57
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.GenCalibrationSource
def GenCalibrationSource(self, reader_passwd)
Definition: CalibrationSourceConfig.py:34
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.__working_schemata
dictionary __working_schemata
Definition: CalibrationSourceConfig.py:12
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.T0Offset
T0Offset
Definition: CalibrationSourceConfig.py:27
str
Definition: BTagTrackIpAccessor.cxx:11
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.SiteName
SiteName
Definition: CalibrationSourceConfig.py:22
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.__init__
def __init__(self, site_name, head_id, region="", store_rt=True, store_t0=True)
Definition: CalibrationSourceConfig.py:14
CalibrationSourceConfig.MuonCalib__CalibrationSourceConfig.__name
__name
Definition: CalibrationSourceConfig.py:29