ATLAS Offline Software
Loading...
Searching...
No Matches
TileCalibBlobPython_badChannelExample.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_badChannelExample.py
6# Nils Gollub <nils.gollub@cern.ch>, 2007-12-19
7
8import os
9from TileCalibBlobPython import TileCalibTools
10from TileCalibBlobPython import TileCalibDefaultWriter
11from TileCalibBlobPython import TileBchTools
12from TileCalibBlobObjs.Classes import TileBchPrbs, TileBchDecoder
13
14#=======================================================
15#=== create bad channel manager
16#=======================================================
17mgr = TileBchTools.TileBchMgr()
18import logging
19mgr.setLogLvl(logging.INFO)
20
21#============================================================
22#=== recreate DB and initialize with default (no bad channels)
23#============================================================
24folder = "/TILE/OFL02/STATUS/ADC"
25db = TileCalibTools.openDb('SQLITE', 'CONDBR2', 'UPDATE')
26tag = "TileOfl02StatusAdc-RUN2-UPD4-08"
27#=== check if status folder exist, otherwise create
28if not db.existsFolder(folder):
29 defaultWriter = TileCalibDefaultWriter.TileCalibDefaultWriter(db)
30 defaultWriter.writeBadChannels(tag)
31
32#=======================================================
33#=== initialize with current db, (MAXRUN,MAXLBK) is default
34#=======================================================
35mgr.initialize(db, folder, tag, (191714,0))
36mgr.listBadAdcs()
37
38#=======================================================
39#=== update from file
40#=== (can be found in offline/TileCalorimter/TileConditions/share))
41#=======================================================
42#mgr.updateFromFile("Tile2007.bch")
43
44#=======================================================
45#=== add some more problems
46#=======================================================
47prbs = [TileBchPrbs.LargeHfNoise, TileBchPrbs.NoCis]
48mgr.setAdcProblems(4,63,14,1,prbs)
49mgr.addAdcProblem( 4,63,14,1,TileBchPrbs.StuckBit )
50mgr.addAdcProblem( 4,63,14,1,TileBchPrbs.NoHV )
51mgr.addAdcProblem( 4,63,14,1,TileBchPrbs.NoCis )
52
53mgr.setAdcProblems(1,0,14,1,prbs)
54mgr.addAdcProblem( 1,0,14,1,TileBchPrbs.StuckBit )
55mgr.addAdcProblem( 1,0,14,1,TileBchPrbs.NoHV )
56mgr.addAdcProblem( 1,0,14,1,TileBchPrbs.NoCis )
57#=======================================================
58#=== remove some problems
59#=======================================================
60mgr.delAdcProblem( 4,62,13,1,TileBchPrbs.AdcDead )
61mgr.delAdcProblem( 4,62,14,1,TileBchPrbs.StuckBit )
62
63
64#=======================================================
65#=== print bad channels
66#=======================================================
67mgr.listBadAdcs()
68
69#=======================================================
70#=== commit changes
71#=======================================================
72author = os.getlogin()
73comment = "testing bad channels in LBA01, EBC64"
74since= (222222 , 0)
75mgr.commitToDb(db, folder, tag, TileBchDecoder.BitPat_ofl01, author, comment, since)
76db.closeDatabase()