ATLAS Offline Software
TileCalibBlobPython_writeBchFromASCII.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 
8 from TileCalibBlobPython import TileCalibTools
9 from TileCalibBlobPython import TileBchTools
10 from TileCalibBlobObjs.Classes import TileBchDecoder
11 import os
12 
13 from TileCalibBlobPython.TileCalibLogger import getLogger
14 log = getLogger("writeBch")
15 import logging
16 log.setLevel(logging.DEBUG)
17 
18 
19 #
20 #_______________________________________________________________________________
21 def fillBadChannels(db ,tag, bchFile,
22  since, until=(TileCalibTools.MAXRUN,TileCalibTools.MAXLBK)):
23 
24  #=== ADC status folder (write to ONLINE from M7 onwards!)
25 
26  folder="/TILE/OFL02/STATUS/ADC"
27  #=== create bad channel manager
28  mgr = TileBchTools.TileBchMgr()
29  mgr.setLogLvl(logging.DEBUG)
30 
31  #=== always initialize with no bad channels
32  log.info("Initializing with no bad channels at tag=%s and time=%s", tag,(0,0))
33  mgr.initialize(db, folder, tag, since)
34 
35  #=== update from file
36  log.info("Updating from file %s", bchFile)
37  mgr.updateFromFile(bchFile)
38 
39  #=== add definition for TileBchStatus::isBad from online side
40  #mgr.addAdcProblem(0, 1, 0,0, TileBchPrbs.IgnoredInDsp)
41  #mgr.addAdcProblem(0, 1, 0,1, TileBchPrbs.IgnoredInDsp)
42 
43  #=== print bad channels
44  log.info("bad channels after update")
45  mgr.listBadAdcs()
46 
47  #=== commit changes
48  #--- to ONLINE folder, i.e. tag="" and using onl01 bit pattern
49 
50  mgr.commitToDb(db, folder, tag, TileBchDecoder.BitPat_ofl01, os.getlogin(), bchFile, since, until)
51 
52 
53 
54 #===================================================================
55 #====================== FILL DB BELOW ==============================
56 #===================================================================
57 db = TileCalibTools.openDb('SQLITE', 'CONDBR2', 'UPDATE')
58 
59 tag = "TileOfl02StatusAdc-RUN2-UPD4-08"
60 
61 
62 
63 #=== M4
64 #fillBadChannels(db,tag,
65 # "/afs/cern.ch/user/n/ngollub/links/blob-13.X.0-nightly/TileCalorimeter/TileConditions/share/TileM4.bch",
66 # (20000,0))
67 #=== M5
68 #fillBadChannels(db,tag,
69 # "/afs/cern.ch/user/n/ngollub/links/blob-13.X.0-nightly/TileCalorimeter/TileConditions/share/TileM5.bch",
70 # (28000,0))
71 #=== M6
72 #fillBadChannels(db,tag,
73 # "/afs/cern.ch/user/n/ngollub/links/blob-13.X.0-nightly/TileCalorimeter/TileConditions/share/TileM6.bch",
74 # (40000,0))
75 
76 #=== M_Calo after M6 week (20080331-20080404)
77 #fillBadChannels(db,tag,
78 # "/afs/cern.ch/user/n/ngollub/links/blob-13.X.0-nightly/TileCalorimeter/TileConditions/share/TileM6Calo.bch",
79 # (52249,0))
80 
81 #=== M_Calo after M6 week (20080331-20080404) update 01
82 #fillBadChannels(db,tag,
83 # "/afs/cern.ch/user/n/ngollub/links/blob-13.X.0-nightly/TileCalorimeter/TileConditions/share/TileM6Calo01.bch",
84 # (52681,0))
85 
86 #=== M7
87 
90 fillBadChannels(db,tag,
91 
92  "chanlists_to_db.txt",
93  (1,0))
94 
95 
96 #=== close DB
97 db.closeDatabase()
TileCalibBlobPython_writeBchFromASCII.fillBadChannels
def fillBadChannels(db, tag, bchFile, since, until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK))
Definition: TileCalibBlobPython_writeBchFromASCII.py:21
python.CaloCondLogger.getLogger
def getLogger(name="CaloCond")
Definition: CaloCondLogger.py:16