CMS 3D CMS Logo

Classes | Functions | Variables
dumpWBM Namespace Reference

Classes

class  constants
 

Functions

def bitzeroForRun (dbsession, c, runnum)
 
def deadcountForRun (dbsession, c, runnum)
 
def main ()
 

Variables

 VERSION
 

Function Documentation

def dumpWBM.bitzeroForRun (   dbsession,
  c,
  runnum 
)
  select LUMISEGMENTNR,GTALGOCOUNTS from CMS_WBM.LEVEL1_TRIGGER_ALGO_CONDITIONS where RUNNUMBER=:runnumber and BIT=0 order by LUMISEGMENTNR

Definition at line 17 of file dumpWBM.py.

References data, createfilelist.int, GetRecoTauVFromDQM_MC_cff.next, and str.

Referenced by main().

17 def bitzeroForRun(dbsession,c,runnum):
18  '''
19  select LUMISEGMENTNR,GTALGOCOUNTS from CMS_WBM.LEVEL1_TRIGGER_ALGO_CONDITIONS where RUNNUMBER=:runnumber and BIT=0 order by LUMISEGMENTNR
20  '''
21  result={}
22  try:
23  dbsession.transaction().start(True)
24  schema=dbsession.schema(c.wbmschema)
25  if not schema:
26  raise Exception('cannot connect to schema'+c.wbmschema)
27  if not schema.existsTable(c.algotable):
28  raise Exception('non-existing view'+c.algotable)
29 
30  query=schema.newQuery()
31  algoBindVarList=coral.AttributeList()
32  algoBindVarList.extend("runnumber","unsigned int")
33  algoBindVarList.extend("bitnumber","unsigned int")
34  algoBindVarList["runnumber"].setData(int(runnum))
35  algoBindVarList["bitnumber"].setData(int(0))
36  query.addToTableList(c.algotable)
37  query.addToOutputList("LUMISEGMENTNR","lsnr")
38  query.addToOutputList('GTALGOCOUNTS','bitcount')
39  query.setCondition('RUNNUMBER=:runnumber AND BIT=:bitnumber',algoBindVarList)
40  query.addToOrderList('LUMISEGMENTNR')
41 
42  bitzeroOutput=coral.AttributeList()
43  bitzeroOutput.extend("lsnr","unsigned int")
44  bitzeroOutput.extend('bitcount','unsigned int')
45 
46  query.defineOutput(bitzeroOutput)
47  cursor=query.execute()
48  while next(cursor):
49  cmslsnum=cursor.currentRow()['lsnr'].data()
50  bitcount=cursor.currentRow()['bitcount'].data()
51  result[cmslsnum]=bitcount
52  del query
53  dbsession.transaction().commit()
54  return result
55  except Exception as e:
56  print str(e)
57  dbsession.transaction().rollback()
58  del dbsession
59 
Definition: start.py:1
def bitzeroForRun(dbsession, c, runnum)
Definition: dumpWBM.py:17
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
#define str(s)
def dumpWBM.deadcountForRun (   dbsession,
  c,
  runnum 
)
select DEADTIMEBEAMACTIVE from cms_wbm.LEVEL1_TRIGGER_CONDITIONS where RUNNUMBER=133881 order by LUMISEGMENTNR

Definition at line 60 of file dumpWBM.py.

References data, createfilelist.int, GetRecoTauVFromDQM_MC_cff.next, and str.

Referenced by main().

60 def deadcountForRun(dbsession,c,runnum):
61  '''
62  select DEADTIMEBEAMACTIVE from cms_wbm.LEVEL1_TRIGGER_CONDITIONS where RUNNUMBER=133881 order by LUMISEGMENTNR
63  '''
64  result={}
65  try:
66  dbsession.transaction().start(True)
67  schema=dbsession.schema(c.wbmschema)
68  if not schema:
69  raise Exception('cannot connect to schema '+c.wbmschema)
70  if not schema.existsTable(c.deadtable):
71  raise Exception('non-existing table '+c.deadtable)
72 
73  deadOutput=coral.AttributeList()
74  deadOutput.extend("lsnr","unsigned int")
75  deadOutput.extend("deadcount","unsigned long long")
76 
77  deadBindVarList=coral.AttributeList()
78  deadBindVarList.extend("RUNNUMBER","unsigned int")
79  deadBindVarList["RUNNUMBER"].setData(int(runnum))
80 
81  query=schema.newQuery()
82  query.addToTableList(c.deadtable)
83  query.addToOutputList('LUMISEGMENTNR','lsnr')
84  query.addToOutputList('DEADTIMEBEAMACTIVE','deadcount')
85  query.setCondition('RUNNUMBER=:runnumber',deadBindVarList)
86  query.addToOrderList('LUMISEGMENTNR')
87  query.defineOutput(deadOutput)
88 
89  cursor=query.execute()
90  while next(cursor):
91  cmslsnum=cursor.currentRow()['lsnr'].data()
92  deadcount=cursor.currentRow()['deadcount'].data()
93  result[cmslsnum]=deadcount
94  #print 'deadcount',deadcount
95  del query
96  dbsession.transaction().commit()
97  return result
98  except Exception as e:
99  print str(e)
100  dbsession.transaction().rollback()
101  del dbsession
102 
Definition: start.py:1
def deadcountForRun(dbsession, c, runnum)
Definition: dumpWBM.py:60
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
#define str(s)
def dumpWBM.main ( )

Definition at line 103 of file dumpWBM.py.

References bitzeroForRun(), deadcountForRun(), objects.autophobj.float, and createfilelist.int.

103 def main():
104  c=constants()
105  parser = argparse.ArgumentParser(prog=os.path.basename(sys.argv[0]),description="Dump trigger info in wbm")
106  parser.add_argument('-c',dest='connect',action='store',required=True,help='connect string to trigger DB(required)')
107  parser.add_argument('-P',dest='authpath',action='store',required=True,help='path to authentication file')
108  parser.add_argument('-r',dest='runnumber',action='store',required=True,help='run number')
109  parser.add_argument('action',choices=['deadtime','deadfraction'],help='dump deadfraction')
110  parser.add_argument('--debug',dest='debug',action='store_true',help='debug')
111  args=parser.parse_args()
112  runnumber=args.runnumber
113  c.wbmdb=args.connect
114  if args.authpath and len(args.authpath)!=0:
115  os.environ['CORAL_AUTH_PATH']=args.authpath
116  #print 'authpath ',args.authpath
117  svc=coral.ConnectionService()
118  #print 'about to access ',c.wbmdb
119  session=svc.connect(c.wbmdb,accessMode=coral.access_ReadOnly)
120  session.typeConverter().setCppTypeForSqlType("unsigned int","NUMBER(10)")
121  session.typeConverter().setCppTypeForSqlType("unsigned long long","NUMBER(20)")
122  if args.debug:
123  msg=coral.MessageStream('')
124  msg.setMsgVerbosity(coral.message_Level_Debug)
125 
126  if args.action == 'deadtime':
127  deadresult=deadcountForRun(session,c,runnumber)
128  if deadresult and len(deadresult)!=0:
129  print 'run',runnumber
130  print 'ls deadcount'
131  for cmsls,deadcount in deadresult.items():
132  print cmsls,deadcount
133  else:
134  print 'no deadtime found for run ',runnumber
135 
136  if args.action == 'deadfraction':
137  deadresult=deadcountForRun(session,c,runnumber)
138  bitzeroresult=bitzeroForRun(session,c,runnumber)
139  print 'run',runnumber
140  print 'ls deadfraction'
141  if deadresult and len(deadresult)!=0:
142  #print 'run',runnumber
143  #print 'ls deadfraction'
144  for cmsls,deadcount in deadresult.items():
145  bitzero=bitzeroresult[cmsls]
146  bitzero_prescale=1.0
147  if int(runnumber)>=146315:
148  bitzero_prescale=17.0
149  if bitzero==0:
150  print cmsls,'no beam'
151  else:
152  print cmsls,'%.5f'%float(float(deadcount)/(float(bitzero)*bitzero_prescale))
153  else:
154  print 'no deadtime found for run ',runnumber
155  del session
156  del svc
157 
def main()
Definition: dumpWBM.py:103
def bitzeroForRun(dbsession, c, runnum)
Definition: dumpWBM.py:17
def deadcountForRun(dbsession, c, runnum)
Definition: dumpWBM.py:60

Variable Documentation

dumpWBM.VERSION

Definition at line 2 of file dumpWBM.py.