ATLAS Offline Software
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 
9 from TileCalibBlobPython import TileCalibTools
10 from TileCalibBlobPython import TileBchTools
11 from TileCalibBlobObjs.Classes import TileBchPrbs, TileBchDecoder
12 
13 from TileCalibBlobPython.TileCalibLogger import getLogger
14 log = getLogger("writeBch")
15 import logging
16 log.setLevel(logging.DEBUG)
17 
18 
19 #===================================================================
20 #====================== FILL DB BELOW ==============================
21 #===================================================================
22 db = TileCalibTools.openDb('SQLITE', 'COMP200', 'UPDATE')
23 
24 #=== ADC status folder
25 folder = TileCalibTools.getTilePrefix(ofl=False)+"STATUS/ADC"
26 
27 #=== no tag for online folder
28 folderTag = ""
29 
30 #=== create bad channel manager
31 mgr = TileBchTools.TileBchMgr()
32 mgr.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 
44 log.info("Initializing with online bad channels at time=%s", (99000,0))
45 mgr.initialize(db, folder, folderTag, (99000,0))
46 
47 #=== Delete all online bad channels
48 for 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 
55 emptyChannelLongBarrel = (30, 31, 43)
56 emptyChannelExtendedBarrel = (18, 19, 24, 25, 26, 27, 28, 29, 33, 34, 42, 43, 44, 45, 46, 47)
57 emptyChannelSpecialExtendedBarrel = (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
61 for 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)
65 mgr.addAdcProblem(1, 17, 38, 0, TileBchPrbs.IgnoredInHlt)
66 for 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)
70 mgr.addAdcProblem(1, 56, 21, 0, TileBchPrbs.IgnoredInHlt)
71 mgr.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)
78 mgr.addAdcProblem(2, 14, 19, 0, TileBchPrbs.IgnoredInHlt)
79 mgr.addAdcProblem(2, 14, 19, 1, TileBchPrbs.IgnoredInHlt)
80 for 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)
84 mgr.addAdcProblem(2, 23, 42, 0, TileBchPrbs.IgnoredInHlt)
85 mgr.addAdcProblem(2, 23, 42, 1, TileBchPrbs.IgnoredInHlt)
86 mgr.addAdcProblem(2, 26, 46, 0, TileBchPrbs.IgnoredInHlt)
87 mgr.addAdcProblem(2, 46, 44, 0, TileBchPrbs.IgnoredInHlt)
88 for 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
95 mgr.addAdcProblem(3, 24, 15, 0, TileBchPrbs.IgnoredInHlt)
96 mgr.addAdcProblem(3, 24, 15, 1, TileBchPrbs.IgnoredInHlt)
97 for 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 
102 mgr.addAdcProblem(3, 54, 14, 0, TileBchPrbs.IgnoredInHlt)
103 mgr.addAdcProblem(3, 54, 14, 1, TileBchPrbs.IgnoredInHlt)
104 
105 # EBC
106 mgr.addAdcProblem(4, 8, 0, 0, TileBchPrbs.IgnoredInHlt)
107 mgr.addAdcProblem(4, 8, 0, 1, TileBchPrbs.IgnoredInHlt)
108 mgr.addAdcProblem(4, 12, 6, 0, TileBchPrbs.IgnoredInHlt)
109 mgr.addAdcProblem(4, 12, 7, 0, TileBchPrbs.IgnoredInHlt)
110 mgr.addAdcProblem(4, 12, 8, 0, TileBchPrbs.IgnoredInHlt)
111 mgr.addAdcProblem(4, 17, 4, 0, TileBchPrbs.IgnoredInHlt)
112 mgr.addAdcProblem(4, 17, 4, 1, TileBchPrbs.IgnoredInHlt)
113 mgr.addAdcProblem(4, 33, 0, 1, TileBchPrbs.IgnoredInHlt)
114 mgr.addAdcProblem(4, 36, 40, 0, TileBchPrbs.IgnoredInHlt)
115 mgr.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)
121 mgr.addAdcProblem(4, 47, 35, 0, TileBchPrbs.IgnoredInHlt)
122 mgr.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
130 log.info("bad channels after update")
131 mgr.listBadAdcs()
132 
133 #=== commit changes
134 mgr.commitToDb(db, folder, folderTag, TileBchDecoder.BitPat_onl01, "lfiorini", "writing online bch 2008-07-11", (76480,0))
135 
136 #=== close DB
137 db.closeDatabase()
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.CaloCondLogger.getLogger
def getLogger(name="CaloCond")
Definition: CaloCondLogger.py:16