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