ATLAS Offline Software
Loading...
Searching...
No Matches
TileCalibBlobPython_writePedFromASCII Namespace Reference

Functions

 fillPed (filePed, tag, comment, since, until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK))

Variables

 log = getLogger("writeNoise")
 db = TileCalibTools.openDb('SQLITE', 'OFLP200', 'UPDATE')
str tag = "TwoGauss-19"
str file = "TileDefault.ped"
int run = 222222
str comment = "Intial tag with 2G noise for RUN2, all modules are identical, 2014-07-11"

Function Documentation

◆ fillPed()

TileCalibBlobPython_writePedFromASCII.fillPed ( filePed,
tag,
comment,
since,
until = (TileCalibTools.MAXRUN, TileCalibTools.MAXLBK) )

Definition at line 24 of file TileCalibBlobPython_writePedFromASCII.py.

25 until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK)):
26
27 #=== construct folder path
28 folder = TileCalibTools.getTilePrefix(True,True)+"NOISE/SAMPLE"
29
30 #=== get full folder tag
31 folderTag = TileCalibUtils.getFullTag(folder, tag)
32
33 #=== create default (ADC counts)
34 pedDef = [30.,50.]
35 loGainDef = 0.8
36 hiGainDef = 1.6
37 defaultLo = cppyy.gbl.std.vector('float')()
38 defaultLo.push_back(pedDef[0]) # pedestal mean value
39 defaultLo.push_back(loGainDef) # pedestal rms
40 defaultLo.push_back(0.0) # pedestal low frequency noise
41 defaultLo.push_back(loGainDef) # pedestal HFN1
42 defaultLo.push_back(0.0) # pedestal HFN2
43 defaultLo.push_back(0.0) # pedestal HFN2/HFN1 ratio
44 defaultHi = cppyy.gbl.std.vector('float')()
45 defaultHi.push_back(pedDef[1]) # pedestal mean value
46 defaultHi.push_back(hiGainDef) # pedestal rms
47 defaultHi.push_back(0.0) # pedestal low frequency noise
48 defaultHi.push_back(hiGainDef) # pedestal HFN1
49 defaultHi.push_back(0.0) # pedestal HFN2
50 defaultHi.push_back(0.0) # pedestal HFN2/HFN1 ratio
51 defVec = cppyy.gbl.std.vector('std::vector<float>')()
52 defVec.push_back(defaultLo)
53 defVec.push_back(defaultHi)
54
55 #=====================================================
56 #=== fill
57 #=====================================================
58 writer = TileCalibTools.TileBlobWriter(db,folder,'Flt')
59 writer.setComment(os.getlogin(),comment)
60 parser = TileCalibTools.TileASCIIParser2(filePed,"")
61 #=== loop over whole detector
62 for ros in range(0,5):
63 #for mod in range(64):
64 for mod in range(0, min(64,TileCalibUtils.getMaxDrawer(ros))):
65 #=== need to invalidate previous blob in DB when reading from ASCII file
66 writer.zeroBlob(ros,mod)
67 #=== init drawer with defaults for first entry
68 calibDrawer = writer.getDrawer(ros,mod)
69 if not calibDrawer.getNObjs():
70 log.info("Initializing drawer %i/%2i\t%i", ros,mod,calibDrawer.getNObjs())
71 calibDrawer.init(defVec,48,0)
72 for chn in range(48):
73 #=== loop over gains
74 for adc in range(2):
75 calibDrawer.setData(chn,adc,0,pedDef[adc]+(chn+1)/48.)
76 values = parser.getData(ros,mod,chn,adc)
77 if not len(values):
78 log.warning("%i/%2i/%2i/%i: No value found in file", ros,mod,chn,adc)
79 values = parser.getData(0,ros*4,chn,adc)
80 if not len(values):
81 log.warning("No default per partition available")
82 values = parser.getData(0,0,chn,adc)
83 if not len(values):
84 log.warning("No global default available - give up")
85 continue
86 else:
87 log.warning("Using global default")
88 else:
89 log.warning("Using default per partition")
90 #=== the order of columns in the ASCII file is different to the order in DB
91 lvl = float(values[0]) # pedestal level
92 hfn = float(values[1]) # high frequency noise
93 lfn = float(values[2]) # low frequency noise
94 hfn1= float(values[3]) # hfn1
95 hfn2= float(values[4]) # hfn2
96 norm= float(values[5]) # hfn2/hfn1
97 log.debug("%i/%2i/%2i/%i: pedLvl=%f\thfn=%f\tlfn=%f\thfn1=%f\thfn2=%f\tnorm=%f", ros,mod,chn,adc, lvl,hfn,lfn,hfn1,hfn2,norm)
98 calibDrawer.setData(chn,adc,0,lvl)
99 calibDrawer.setData(chn,adc,1,hfn)
100 calibDrawer.setData(chn,adc,2,lfn)
101 calibDrawer.setData(chn,adc,3,hfn1)
102 calibDrawer.setData(chn,adc,4,hfn2)
103 calibDrawer.setData(chn,adc,5,norm)
104 #=== register in DB
105 writer.register(since, until, folderTag)
106
107
108
109#===================================================================
110#====================== FILL DB BELOW ==============================
111#===================================================================
112
113#=== open the database
#define min(a, b)
Definition cfImp.cxx:40
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
static std::string getFullTag(const std::string &folder, const std::string &tag)
Returns the full tag string, composed of camelized folder name and tag part.

Variable Documentation

◆ comment

str TileCalibBlobPython_writePedFromASCII.comment = "Intial tag with 2G noise for RUN2, all modules are identical, 2014-07-11"

Definition at line 118 of file TileCalibBlobPython_writePedFromASCII.py.

◆ db

TileCalibBlobPython_writePedFromASCII.db = TileCalibTools.openDb('SQLITE', 'OFLP200', 'UPDATE')

Definition at line 114 of file TileCalibBlobPython_writePedFromASCII.py.

◆ file

str TileCalibBlobPython_writePedFromASCII.file = "TileDefault.ped"

Definition at line 116 of file TileCalibBlobPython_writePedFromASCII.py.

◆ log

TileCalibBlobPython_writePedFromASCII.log = getLogger("writeNoise")

Definition at line 18 of file TileCalibBlobPython_writePedFromASCII.py.

◆ run

int TileCalibBlobPython_writePedFromASCII.run = 222222

Definition at line 117 of file TileCalibBlobPython_writePedFromASCII.py.

◆ tag

str TileCalibBlobPython_writePedFromASCII.tag = "TwoGauss-19"

Definition at line 115 of file TileCalibBlobPython_writePedFromASCII.py.