ATLAS Offline Software
Functions | Variables
TileCalibBlobPython_writePedFromASCII Namespace Reference

Functions

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

Variables

 log
 
 db
 
 tag
 
 file
 
 run
 
 comment
 

Function Documentation

◆ fillPed()

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

Definition at line 24 of file TileCalibBlobPython_writePedFromASCII.py.

24 def fillPed(filePed, tag, comment, since,
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

Variable Documentation

◆ comment

TileCalibBlobPython_writePedFromASCII.comment

Definition at line 118 of file TileCalibBlobPython_writePedFromASCII.py.

◆ db

TileCalibBlobPython_writePedFromASCII.db

Definition at line 114 of file TileCalibBlobPython_writePedFromASCII.py.

◆ file

TileCalibBlobPython_writePedFromASCII.file

Definition at line 116 of file TileCalibBlobPython_writePedFromASCII.py.

◆ log

TileCalibBlobPython_writePedFromASCII.log

Definition at line 18 of file TileCalibBlobPython_writePedFromASCII.py.

◆ run

TileCalibBlobPython_writePedFromASCII.run

Definition at line 117 of file TileCalibBlobPython_writePedFromASCII.py.

◆ tag

TileCalibBlobPython_writePedFromASCII.tag

Definition at line 115 of file TileCalibBlobPython_writePedFromASCII.py.

TileCalibUtils::getMaxDrawer
static unsigned int getMaxDrawer(unsigned int ros)
Returns the maximal channel number for a given drawer.
Definition: TileCalibUtils.cxx:136
TileCalibBlobPython_writePedFromASCII.fillPed
def fillPed(filePed, tag, comment, since, until=(TileCalibTools.MAXRUN, TileCalibTools.MAXLBK))
Definition: TileCalibBlobPython_writePedFromASCII.py:24
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
min
#define min(a, b)
Definition: cfImp.cxx:40
readCCLHist.float
float
Definition: readCCLHist.py:83
TileCalibUtils::getFullTag
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.
Definition: TileCalibUtils.cxx:33