ATLAS Offline Software
Example_ReadSampleNoise.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 # Example_ReadSampleNoise.py
6 # Nils Gollub <nils.gollub@cern.ch>, 2008-06-16
7 
8 from TileCalibBlobPython import TileCalibTools
9 from TileCalibBlobObjs.Classes import TileCalibUtils
10 
11 
12 #=== specify which time to read
13 folder = "/TILE/OFL02/NOISE/SAMPLE"
14 pointInTime = (999999999,0) # (run number, luminosity block number)
15 globalTag = "UPD4"
16 
17 #=== open the database
18 db = TileCalibTools.openDbConn('COOLOFL_TILE/CONDBR2')
19 
20 #=== resolve folder tag from global tag
21 folderTag = TileCalibTools.getFolderTag(db, folder, globalTag)
22 #--- or the folderTag can be specified like this:
23 #folderTag = TileCalibUtils.getFullTag(folder, "COM-00")
24 
25 
26 #=== get a blob reader
27 blobReader = TileCalibTools.TileBlobReader(db,folder,folderTag)
28 
29 #=== write out the comment associated to current values in DB
30 comment = blobReader.getComment(pointInTime)
31 print("Comment: \"%s\"" % comment)
32 
33 #=== Loop over the whole detector
34 #--- including default drawers with ros = [0,...,19]
35 for ros in range(TileCalibUtils.max_ros()):
36  for mod in range(TileCalibUtils.getMaxDrawer(ros)):
37 
38  #=== get the TileCalibDrawerFlt correcponding to module
39  drawer = blobReader.getDrawer(ros,mod,pointInTime)
40 
41  #=== loop over all the channels
42  for chn in range(TileCalibUtils.max_chan()):
43  for adc in range(TileCalibUtils.max_gain()):
44 
45  ped = drawer.getData(chn,adc, 0)
46  hfn = drawer.getData(chn,adc, 1)
47 
48  #=== currently lfn is not filled, but should be in the future
49  lfn = 0.
50  if drawer.getObjSizeUint32() > 2:
51  lfn = drawer.getData(chn,adc, 2)
52 
53  print("%s, channel=%2i, gain=%i -> ped=%5.4f\thfn=%5.4f\tlfn=%5.4f"
54  %(TileCalibUtils.getDrawerString(ros,mod),chn,adc,ped,hfn,lfn) )
55 
56 #=== close the database connection
57 db.closeDatabase()
TileCalibUtils::max_ros
static unsigned int max_ros()
Python compatibility function.
Definition: TileCalibUtils.h:106
TileCalibUtils::getMaxDrawer
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
Definition: TileCalibUtils.cxx:136
TileCalibUtils::max_gain
static unsigned int max_gain()
Python compatibility function.
Definition: TileCalibUtils.h:114
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
TileCalibUtils::getDrawerString
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
Definition: TileCalibUtils.cxx:145
TileCalibUtils::max_chan
static unsigned int max_chan()
Python compatibility function.
Definition: TileCalibUtils.h:112
dbg::print
void print(std::FILE *stream, std::format_string< Args... > fmt, Args &&... args)
Definition: SGImplSvc.cxx:70