ATLAS Offline Software
Loading...
Searching...
No Matches
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
8from TileCalibBlobPython import TileCalibTools
9from TileCalibBlobObjs.Classes import TileCalibUtils
10
11
12#=== specify which time to read
13folder = "/TILE/OFL02/NOISE/SAMPLE"
14pointInTime = (999999999,0) # (run number, luminosity block number)
15globalTag = "UPD4"
16
17#=== open the database
18db = TileCalibTools.openDbConn('COOLOFL_TILE/CONDBR2')
19
20#=== resolve folder tag from global tag
21folderTag = 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
27blobReader = TileCalibTools.TileBlobReader(db,folder,folderTag)
28
29#=== write out the comment associated to current values in DB
30comment = blobReader.getComment(pointInTime)
31print("Comment: \"%s\"" % comment)
32
33#=== Loop over the whole detector
34#--- including default drawers with ros = [0,...,19]
35for 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
57db.closeDatabase()
void print(char *figname, TCanvas *c1)
static unsigned int max_gain()
Python compatibility function.
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
static unsigned int max_chan()
Python compatibility function.
static unsigned int max_ros()
Python compatibility function.
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.