ATLAS Offline Software
Loading...
Searching...
No Matches
TileCalibBlobPython_writeBchOnlM8.py
Go to the documentation of this file.
1#!/bin/env python
2
3# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
4#
5# TileCalibBlobPython_writeBchOnlM8.py
6# Lukas Pribyl <lukas.pribyl@cern.ch>, 2008-07-14
7# Luca Fiorini <fiorini@ifae.es>
8
9from TileCalibBlobPython import TileCalibTools
10from TileCalibBlobPython import TileBchTools
11from TileCalibBlobObjs.Classes import TileBchPrbs, TileBchDecoder
12
13from TileCalibBlobPython.TileCalibLogger import getLogger
14log = getLogger("writeBch")
15import logging
16log.setLevel(logging.DEBUG)
17
18
19#===================================================================
20#====================== FILL DB BELOW ==============================
21#===================================================================
22db = TileCalibTools.openDb('SQLITE', 'COMP200', 'UPDATE')
23
24#=== ADC status folder
25folder = TileCalibTools.getTilePrefix(ofl=False)+"STATUS/ADC"
26
27#=== no tag for online folder
28folderTag = ""
29
30#=== create bad channel manager
31mgr = TileBchTools.TileBchMgr()
32mgr.setLogLvl(logging.DEBUG)
33
34#=== NOTE: the tileSqlite copy from Oracle db must be prepared to contain only IOV
35#=== for runs, that have not been taken yet. Do it as follows (with -getonline and -truncate):
36#=== AtlCoolCopy.exe "COOLONL_TILE/COMP200" "sqlite://;schema=tileSqlite.db;dbname=COMP200" \
37#=== -create -copytaglock -getonline -truncate -folder /TILE/ONL01/STATUS/ADC
38
39#=== Initialize with a status of bad channels at a given run.
40#=== It is not possible to use runnumber = 0 (all channels are good), as it can not be
41#=== contained in the tileSqlite.db - runnumber already taken would block the merge with db
42#=== as this is a single-version folder
43
44log.info("Initializing with online bad channels at time=%s", (99000,0))
45mgr.initialize(db, folder, folderTag, (99000,0))
46
47#=== Delete all online bad channels
48for p in range(1,5):
49 for d in range(0,64):
50 for i in range(0, 48):
51 mgr.delAdcProblem(p, d, i, 0, TileBchPrbs.IgnoredInHlt)
52 mgr.delAdcProblem(p, d, i, 1, TileBchPrbs.IgnoredInHlt)
53
54
55emptyChannelLongBarrel = (30, 31, 43)
56emptyChannelExtendedBarrel = (18, 19, 24, 25, 26, 27, 28, 29, 33, 34, 42, 43, 44, 45, 46, 47)
57emptyChannelSpecialExtendedBarrel = (0, 1, 2, 3, 24, 25, 26, 27, 28, 29, 33, 34, 42, 43, 44, 45, 46, 47)
58
59#=== Add Online masked channels
60# LBA
61for i in range(30, 36):
62 if i not in emptyChannelLongBarrel: # LBA11 DMU10-11
63 mgr.addAdcProblem(1, 10, i, 0, TileBchPrbs.IgnoredInHlt)
64 mgr.addAdcProblem(1, 10, i, 1, TileBchPrbs.IgnoredInHlt)
65mgr.addAdcProblem(1, 17, 38, 0, TileBchPrbs.IgnoredInHlt)
66for i in range(0, 48):
67 if i not in emptyChannelLongBarrel:
68 mgr.addAdcProblem(1, 52, i, 0, TileBchPrbs.IgnoredInHlt)
69 mgr.addAdcProblem(1, 52, i, 1, TileBchPrbs.IgnoredInHlt)
70mgr.addAdcProblem(1, 56, 21, 0, TileBchPrbs.IgnoredInHlt)
71mgr.addAdcProblem(1, 56, 21, 1, TileBchPrbs.IgnoredInHlt)
72
73# LBC
74# We don't mask this case yet, as it doesn't pose reconstruction problems
75#for i in range(30, 36):
76# if i not in emptyChannelLongBarrel:
77# mgr.addAdcProblem(2, 2, i, 1, TileBchPrbs.DataCorruption)
78mgr.addAdcProblem(2, 14, 19, 0, TileBchPrbs.IgnoredInHlt)
79mgr.addAdcProblem(2, 14, 19, 1, TileBchPrbs.IgnoredInHlt)
80for i in range(42, 48):
81 if i not in emptyChannelLongBarrel:
82 mgr.addAdcProblem(2, 19, i, 0, TileBchPrbs.IgnoredInHlt)
83 mgr.addAdcProblem(2, 19, i, 1, TileBchPrbs.IgnoredInHlt)
84mgr.addAdcProblem(2, 23, 42, 0, TileBchPrbs.IgnoredInHlt)
85mgr.addAdcProblem(2, 23, 42, 1, TileBchPrbs.IgnoredInHlt)
86mgr.addAdcProblem(2, 26, 46, 0, TileBchPrbs.IgnoredInHlt)
87mgr.addAdcProblem(2, 46, 44, 0, TileBchPrbs.IgnoredInHlt)
88for i in range(15, 18):
89 if i not in emptyChannelLongBarrel:
90 mgr.addAdcProblem(2, 63, i, 0, TileBchPrbs.IgnoredInHlt)
91 mgr.addAdcProblem(2, 63, i, 1, TileBchPrbs.IgnoredInHlt)
92
93
94# EBA
95mgr.addAdcProblem(3, 24, 15, 0, TileBchPrbs.IgnoredInHlt)
96mgr.addAdcProblem(3, 24, 15, 1, TileBchPrbs.IgnoredInHlt)
97for i in range(21, 24):
98 if i not in emptyChannelExtendedBarrel:
99 mgr.addAdcProblem(3, 43, i, 0, TileBchPrbs.IgnoredInHlt)
100 mgr.addAdcProblem(3, 43, i, 1, TileBchPrbs.IgnoredInHlt)
101
102mgr.addAdcProblem(3, 54, 14, 0, TileBchPrbs.IgnoredInHlt)
103mgr.addAdcProblem(3, 54, 14, 1, TileBchPrbs.IgnoredInHlt)
104
105# EBC
106mgr.addAdcProblem(4, 8, 0, 0, TileBchPrbs.IgnoredInHlt)
107mgr.addAdcProblem(4, 8, 0, 1, TileBchPrbs.IgnoredInHlt)
108mgr.addAdcProblem(4, 12, 6, 0, TileBchPrbs.IgnoredInHlt)
109mgr.addAdcProblem(4, 12, 7, 0, TileBchPrbs.IgnoredInHlt)
110mgr.addAdcProblem(4, 12, 8, 0, TileBchPrbs.IgnoredInHlt)
111mgr.addAdcProblem(4, 17, 4, 0, TileBchPrbs.IgnoredInHlt)
112mgr.addAdcProblem(4, 17, 4, 1, TileBchPrbs.IgnoredInHlt)
113mgr.addAdcProblem(4, 33, 0, 1, TileBchPrbs.IgnoredInHlt)
114mgr.addAdcProblem(4, 36, 40, 0, TileBchPrbs.IgnoredInHlt)
115mgr.addAdcProblem(4, 36, 40, 1, TileBchPrbs.IgnoredInHlt)
116#DataCorrption is not enough to justify the masking
117#for i in range(0, 48):
118# if i not in emptyChannelExtendedBarrel:
119# mgr.addAdcProblem(4, 41, i, 0, TileBchPrbs.DataCorruption)
120# mgr.addAdcProblem(4, 41, i, 1, TileBchPrbs.DataCorruption)
121mgr.addAdcProblem(4, 47, 35, 0, TileBchPrbs.IgnoredInHlt)
122mgr.addAdcProblem(4, 47, 35, 1, TileBchPrbs.IgnoredInHlt)
123#DataCorrption is not enough to justify the masking
124#for i in range(30, 33):
125# if i not in emptyChannelExtendedBarrel:
126# mgr.addAdcProblem(4, 62, i, 0, TileBchPrbs.DataCorruption)
127# mgr.addAdcProblem(4, 62, i, 1, TileBchPrbs.DataCorruption)
128
129#=== print bad channels
130log.info("bad channels after update")
131mgr.listBadAdcs()
132
133#=== commit changes
134mgr.commitToDb(db, folder, folderTag, TileBchDecoder.BitPat_onl01, "lfiorini", "writing online bch 2008-07-11", (76480,0))
135
136#=== close DB
137db.closeDatabase()