3 def copyfunc(indb, outdb, func_iov, func_output, runends):
6 outdb = output database
7 func_iov = function that takes a DB connection and returns some IOVs
8 (includes folder/channel selection and any filtering)
9 func_output = takes IOVs and writes them to the output DB connection
13 iovs =
filter(
lambda x: not(x.until.lumi-x.since.lumi == 0), iovs)
14 print(
'There are %d IOVs to process' % len(iovs))
17 for i, iov
in enumerate(iovs):
18 func_output(outdb, iov)
24 if iov.since.run
not in runends:
25 print(
'Missing run', iov.since.run,
'from EOR_Params')
28 [iov.intersect(runends[iov.since.run])
29 for iov
in iovs
if iov.since.run
in runends])
32 from DQUtils.db
import fetch_iovs
34 with_channel=
False, what=[])
36 for iov
in eor_params:
37 runends[iov.since.run] = iov
41 from DQUtils.db
import fetch_iovs
42 def dq_code_filter_internals(indb):
43 folder = indb.getFolder(foldername)
44 iovs =
fetch_iovs(folder, channels=[channel], tag=tag)
45 iovs = [iov
for iov
in iovs
if iov.Code
in codes]
47 return dq_code_filter_internals
50 def defect_output_internals(outdb, iov):
52 db.insert(channel, iov.since, iov.until,
53 (iov.Comment
if 'Comment' in dir(iov)
else 'Automatic'),
55 return defect_output_internals
58 from DQUtils.db
import fetch_iovs
59 folder = indb.getFolder(
'/TDAQ/RunCtrl/DataTakingMode')
62 return filter(
None, [iov
for iov
in iovs
if iov.ReadyForPhysics == 0])
64 if __name__ ==
'__main__':
65 from DQUtils.db
import Databases
66 from DQDefects
import DefectsDB
69 (
'ATLTOR', [-1],
'GLOBAL_TOROID_OFF'),
70 (
'ATLTOR', [1],
'GLOBAL_TOROID_RAMPING'),
71 (
'ATLSOL', [-1],
'GLOBAL_SOLENOID_OFF'),
72 (
'ATLSOL', [1],
'GLOBAL_SOLENOID_RAMPING'),
73 (
'PIX0', [-1],
'PIXEL_LAYER0_DISABLED'),
74 (
'PIXB', [-1],
'PIXEL_BARREL_DISABLED'),
75 (
'PIXEA', [-1],
'PIXEL_ENDCAPS_DISABLED'),
76 (
'PIXEC', [-1],
'PIXEL_ENDCAPS_DISABLED'),
77 (
'PIX0', [-1, 0, 1, 2],
'PIXEL_LAYER0_2010NONGREEN'),
78 (
'PIXB', [-1, 0, 1, 2],
'PIXEL_BARREL_2010NONGREEN'),
79 (
'PIXEA', [-1, 0, 1, 2],
'PIXEL_ENDCAPA_2010NONGREEN'),
80 (
'PIXEC', [-1, 0, 1, 2],
'PIXEL_ENDCAPC_2010NONGREEN'),
81 (
'SCTB', [-1],
'SCT_GLOBAL_DISABLED'),
82 (
'SCTEA', [-1],
'SCT_GLOBAL_DISABLED'),
83 (
'SCTEC', [-1],
'SCT_GLOBAL_DISABLED'),
84 (
'SCTB', [-1, 0, 1, 2],
'SCT_SCTB_2010NONGREEN'),
85 (
'SCTEA', [-1, 0, 1, 2],
'SCT_SCTEA_2010NONGREEN'),
86 (
'SCTEC', [-1, 0, 1, 2],
'SCT_SCTEC_2010NONGREEN'),
87 (
'TRTTR', [-1, 0, 1, 2],
'TRT_TRTTR_2010NONGREEN'),
88 (
'ATLGL', [1],
'GLOBAL_NOTCONSIDERED'),
89 (
'RCOPS', [-1, 0, 1, 2],
'GLOBAL_RCOPS_2010NONGREEN'),
90 (
'TILBA', [-1],
'TILE_LBA_DISABLED'),
91 (
'TILBC', [-1],
'TILE_LBC_DISABLED'),
92 (
'TIEBA', [-1],
'TILE_EBA_DISABLED'),
93 (
'TIEBC', [-1],
'TILE_EBC_DISABLED'),
94 (
'TILBA', [-1,0,1,2],
'TILE_LBA_2010NONGREEN'),
95 (
'TILBC', [-1,0,1,2],
'TILE_LBC_2010NONGREEN'),
96 (
'TIEBA', [-1,0,1,2],
'TILE_EBA_2010NONGREEN'),
97 (
'TIEBC', [-1,0,1,2],
'TILE_EBC_2010NONGREEN'),
98 (
'ALFA', [-1],
'ALFA_DISABLED'),
99 (
'MBTSA', [-1],
'MBTS_A_DISABLED'),
100 (
'MBTSC', [-1],
'MBTS_C_DISABLED'),
101 (
'LCDA', [-1,0,1,2],
'LCD_LCDA_2010NONGREEN'),
102 (
'LCDC', [-1,0,1,2],
'LCD_LCDC_2010NONGREEN'),
103 (
'LUMI', [-1,0,1,2],
'LUMI_LUMI_2010NONGREEN'),
104 (
'LUMIONL', [-1,0,1,2],
'LUMI_LUMIONL_2010NONGREEN'),
105 (
'IDBS', [1],
'ID_BS_2010RED'),
106 (
'IDBS', [2],
'ID_BS_2010YELLOW'),
107 (
'IDVX', [-1,0,1,2],
'ID_VX_2010NONGREEN'),
108 (
'IDGL', [-1,0,1,2],
'ID_GL_2010NONGREEN'),
109 (
'IDAL', [-1,0,1,2],
'ID_AL_2010NONGREEN'),
110 (
'L1CTP', [1],
'TRIG_L1_CTP_CLOCK'),
111 (
'EIDCR', [-1,0,1,2],
'EGAMMA_EIDCR_2010NONGREEN'),
112 (
'EMBA', [-1,0,1,2],
'LAR_EMBA_2010NONGREEN'),
113 (
'EMBC', [-1,0,1,2],
'LAR_EMBC_2010NONGREEN'),
114 (
'EMECA', [-1,0,1,2],
'LAR_EMECA_2010NONGREEN'),
115 (
'EMECC', [-1,0,1,2],
'LAR_EMECC_2010NONGREEN'),
116 (
'HECA', [-1,0,1,2],
'LAR_HECA_2010NONGREEN'),
117 (
'HECC', [-1,0,1,2],
'LAR_HECC_2010NONGREEN'),
118 (
'FCALA', [-1,0,1,2],
'LAR_FCALA_2010NONGREEN'),
119 (
'FCALC', [-1,0,1,2],
'LAR_FCALC_2010NONGREEN'),
120 (
'MDTBA', [-1,0,1,2],
'MS_MDT_BA_2010NONGREEN'),
121 (
'MDTBC', [-1,0,1,2],
'MS_MDT_BC_2010NONGREEN'),
122 (
'MDTEA', [-1,0,1,2],
'MS_MDT_EA_2010NONGREEN'),
123 (
'MDTEC', [-1,0,1,2],
'MS_MDT_EC_2010NONGREEN'),
124 (
'RPCBA', [-1,0,1,2],
'MS_RPC_BA_2010NONGREEN'),
125 (
'RPCBC', [-1,0,1,2],
'MS_RPC_BC_2010NONGREEN'),
126 (
'CSCEA', [-1,0,1,2],
'MS_CSC_EA_2010NONGREEN'),
127 (
'CSCEC', [-1,0,1,2],
'MS_CSC_EC_2010NONGREEN'),
128 (
'TGCEA', [-1,0,1,2],
'MS_TGC_EA_2010NONGREEN'),
129 (
'TGCEC', [-1,0,1,2],
'MS_TGC_EC_2010NONGREEN'),
130 (
'ZDC', [-1,0,1,2],
'ZDC_2010NONGREEN'),
131 (
'TRTB', [-1,0,1,2],
'TRT_TRTB_2010NONGREEN'),
132 (
'TRTEA', [-1,0,1,2],
'TRT_TRTEA_2010NONGREEN'),
133 (
'TRTEC', [-1,0,1,2],
'TRT_TRTEC_2010NONGREEN'),
134 (
'L1CAL', [-1,0,1,2],
'TRIG_L1_CAL_2010NONGREEN'),
135 (
'TRBJT', [-1,0,1,2],
'TRIG_HLT_BJT_2010NONGREEN'),
136 (
'TRBPH', [-1,0,1,2],
'TRIG_HLT_BPH_2010NONGREEN'),
137 (
'TRCAL', [-1,0,1,2],
'TRIG_HLT_CAL_2010NONGREEN'),
138 (
'TRELE', [-1,0,1,2],
'TRIG_HLT_ELE_2010NONGREEN'),
139 (
'TRGAM', [-1,0,1,2],
'TRIG_HLT_GAM_2010NONGREEN'),
140 (
'TRIDT', [-1,0,1,2],
'TRIG_HLT_IDT_2010NONGREEN'),
141 (
'TRJET', [-1,0,1,2],
'TRIG_HLT_JET_2010NONGREEN'),
142 (
'TRMBI', [-1,0,1,2],
'TRIG_HLT_MBI_2010NONGREEN'),
143 (
'TRMET', [-1,0,1,2],
'TRIG_HLT_MET_2010NONGREEN'),
144 (
'TRMUO', [-1,0,1,2],
'TRIG_HLT_MUO_2010NONGREEN'),
145 (
'TRTAU', [-1,0,1,2],
'TRIG_HLT_TAU_2010NONGREEN'),
146 (
'TRCOS', [-1,0,1,2],
'TRIG_HLT_COS_2010NONGREEN'),
147 (
'TAUB', [-1,0,1,2],
'TAU_B_2010NONGREEN'),
148 (
'TAUCR', [-1,0,1,2],
'TAU_CR_2010NONGREEN'),
149 (
'TAUE', [-1,0,1,2],
'TAU_E_2010NONGREEN'),
150 (
'BTGLIFE', [-1,0,1,2],
'BTAG_BTGLIFE_2010NONGREEN'),
151 (
'BTGSOFTE', [-1,0,1,2],
'BTAG_BTGSOFTE_2010NONGREEN'),
152 (
'BTGSOFTM', [-1,0,1,2],
'BTAG_BTGSOFTM_2010NONGREEN'),
153 (
'MMUIDVX', [-1,0,1,2],
'MCP_MMUIDVX_2010NONGREEN'),
157 outdb = DefectsDB(
'defectstest.db/COMP200', read_only=
False)
158 with outdb.storage_buffer:
161 copyfunc(Databases.get_instance(
'COOLOFL_GLOBAL/COMP200'),
164 'DetStatusLBSUMM-repro05-01', trip[0], trip[1]),
166 copyfunc(Databases.get_instance(
'COOLOFL_GLOBAL/COMP200'),
169 'DetStatusLBSUMM-pass1-analysis-2010J-01', trip[0], trip[1]),
173 copyfunc(Databases.get_instance(
'COOLONL_TDAQ/COMP200'),
175 atlas_notready_filter,