CMS 3D CMS Logo

generateDummyData.py
Go to the documentation of this file.
1 from builtins import range
2 import array,coral
3 from RecoLuminosity.LumiDB import CommonUtil
4 def lumiSummary(schema,nlumils):
5  '''
6  input:
7  output: [datasource,{lumilsnum:[cmslsnum,instlumi,instlumierror,instlumiquality,beamstatus,beamenergy,numorbit,startorbit,cmsbxindexblob,beamintensityblob_1,beamintensitublob_2,bxlumivalue_occ1,bxlumierror_occ1,bxlumiquality_occ1,bxlumivalue_occ2,bxlumierror_occ2,bxlumiquality_occ2,bxlumivalue_et,bxlumierror_et,bxlumiquality_et]}]
8  '''
9  o=['file:fake.root']
10  perlsdata={}
11  for lumilsnum in range(1,nlumils+1):
12  cmslsnum=0
13  if lumilsnum<100:
14  cmslsnum=lumilsnum
15  instlumi=2.37
16  instlumierror=0.56
17  instlumiquality=2
18  beamstatus='STABLE BEAMS'
19  beamenergy=3.5e03
20  numorbit=12345
21  startorbit=numorbit*lumilsnum
22  if cmslsnum==0:
23  cmsbxindex=None
24  beam1intensity=None
25  beam2intensity=None
26  else:
27  cmsbxindex=array.array('I')
28  beam1intensity=array.array('f')
29  beam2intensity=array.array('f')
30  for idx in range(1,3565):
31  cmsbxindex.append(idx)
32  beam1intensity.append(1.5e09)
33  beam2intensity.append(5.5e09)
34  cmsbxindexBlob=CommonUtil.packArraytoBlob(cmsbxindex)
35  beam1intensityBlob=CommonUtil.packArraytoBlob(beam1intensity)
36  beam2intensityBlob=CommonUtil.packArraytoBlob(beam2intensity)
37  bxlumivalue=array.array('f')
38  bxlumierror=array.array('f')
39  bxlumiquality=array.array('I')
40  for idx in range(1,3565):
41  bxlumivalue.append(2.3)
42  bxlumierror.append(0.4)
43  bxlumiquality.append(2)
44  bxlumivalueBlob=CommonUtil.packArraytoBlob(bxlumivalue)
45  bxlumierrorBlob=CommonUtil.packArraytoBlob(bxlumierror)
46  bxlumiqualityBlob=CommonUtil.packArraytoBlob(bxlumiquality)
47  if lumilsnum not in perlsdata:
48  perlsdata[lumilsnum]=[]
49  perlsdata[lumilsnum].extend([cmslsnum,instlumi,instlumierror,instlumiquality,beamstatus,beamenergy,numorbit,startorbit,cmsbxindexBlob,beam1intensityBlob,beam2intensityBlob,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob])
50  o.append(perlsdata)
51  return o
52 #def lumiDetail(schema,nlumils):
53 # '''
54 # input:
55 # output:[(algoname,{lumilsnum:[cmslsnum,bxlumivalue,bxlumierror,bxlumiquality]})]
56 # '''
57 # o=[]
58 # algos=['OCC1','OCC2','ET']
59 # for algoname in algos:
60 # perlsdata={}
61 # for lumilsnum in range(1,nlumils+1):
62 # cmslsnum=0
63 # cmsalive=0
64 # if lumilsnum<100:
65 # cmslsnum=lumilsnum
66 # bxlumivalue=array.array('f')
67 # bxlumierror=array.array('f')
68 # bxlumiquality=array.array('I')
69 # for idx in range(1,3565):
70 # bxlumivalue.append(2.3)
71 # bxlumierror.append(0.4)
72 # bxlumiquality.append(2)
73 # bxlumivalueBlob=CommonUtil.packArraytoBlob(bxlumivalue)
74 # bxlumierrorBlob=CommonUtil.packArraytoBlob(bxlumierror)
75 # bxlumiqualityBlob=CommonUtil.packArraytoBlob(bxlumiquality)
76 # if not perlsdata.has_key(lumilsnum):
77 # perlsdata[lumilsnum]=[]
78 # perlsdata[lumilsnum].extend([cmslsnum,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob])
79 # o.append((algoname,perlsdata))
80 # return o
81 def trg(schema,nls):
82  '''
83  input:
84  output: [datasource,bitzeroname,bitnameclob,{cmslsnum:[deadtime,bitzerocount,bitzeroprescale,trgcountBlob,trgprescaleBlob]}]
85  '''
86  o=['oracle://cms_orcon_prod/cms_gtmon','L1_ZeroBias']
87  bitnameclob='L1_ZeroBias,False,L1_SingleHfBitCountsRing1_1,L1_SingleHfBitCountsRing2_1,L1_SingleMu15,L1SingleJet,Jura'
88  o.append(bitnameclob)
89  perlsdata={}
90  for cmslsnum in range(1,nls+1):
91  deadtime=99+cmslsnum
92  bitzerocount=897865
93  bitzeroprescale=17
94  trgcounts=array.array('I')
95  prescalecounts=array.array('I')
96  for i in range(1,192):
97  trgcounts.append(778899+i)
98  prescalecounts.append(17)
99  trgcountsBlob=CommonUtil.packArraytoBlob(trgcounts)
100  prescalecountsBlob=CommonUtil.packArraytoBlob(prescalecounts)
101  if cmslsnum not in perlsdata:
102  perlsdata[cmslsnum]=[]
103  perlsdata[cmslsnum].extend([deadtime,bitzerocount,bitzeroprescale,trgcountsBlob,prescalecountsBlob])
104  o.append(perlsdata)
105  return o
106 def hlt(schema,nls):
107  '''
108  input:
109  output: [datasource,pathnameclob,{cmslsnum:[inputcountBlob,acceptcountBlob,prescaleBlob]}]
110  '''
111  o=['oracle://cms_orcon_prod/cms_runinfo']
112  pathnameclob='HLT_PixelTracks_Multiplicity70,HLT_PixelTracks_Multiplicity85,HLT_PixelTracks_Multiplicity100,HLT_GlobalRunHPDNoise,HLT_TechTrigHCALNoise'
113  o.append(pathnameclob)
114  perlsdata={}
115  for cmslsnum in range(1,nls+1):
116  inputcounts=array.array('I')
117  acceptcounts=array.array('I')
118  prescalecounts=array.array('I')
119  for i in range(1,201):
120  inputcounts.append(6677889 )
121  acceptcounts.append(3344565)
122  prescalecounts.append(17)
123  inputcountsBlob=CommonUtil.packArraytoBlob(inputcounts)
124  acceptcountsBlob=CommonUtil.packArraytoBlob(acceptcounts)
125  prescalecountsBlob=CommonUtil.packArraytoBlob(prescalecounts)
126  if cmslsnum not in perlsdata:
127  perlsdata[cmslsnum]=[]
128  perlsdata[cmslsnum].extend([inputcountsBlob,acceptcountsBlob,prescalecountsBlob])
129  o.append(perlsdata)
130  return o
131 def hlttrgmap(schema):
132  '''
133  input:
134  output:[hltkey,{hltpahtname:l1seed}]
135  '''
136  o=['/cdaq/physics/firstCollisions10/v2.0/HLT_7TeV/V5']
137  hlttrgmap={}
138  hlttrgmap['HLT_L1Tech_BSC_halo']='4'
139  hlttrgmap['HLT_PixelTracks_Multiplicity70']='L1_ETT60'
140  hlttrgmap['HLT_PixelTracks_Multiplicity85']='L1_ETT60'
141  hlttrgmap['HLT_PixelTracks_Multiplicity100']='L1_ETT100'
142  hlttrgmap['HLT_GlobalRunHPDNoise']="L1_SingleJet10U_NotBptxOR"
143  hlttrgmap['HLT_TechTrigHCALNoise']="11 OR 12"
144  o.append(hlttrgmap)
145  return o
146 def runsummary(schema,amodetag,egev):
147  '''
148  input:
149  output:[l1key,amodetag,egev,hltkey,fillnum,sequence,starttime,stoptime]
150  '''
151  o=['collisioncollision','PROTPHYS',3500,'/cdaq/physics/firstCollisions10/v2.0/HLT_7TeV/V5',1005,'GLOBAL-RUN']
152  starttime=coral.TimeStamp(2010,11,1,0,0,0,0)
153  stoptime=coral.TimeStamp(2010,11,1,11,0,0,0)
154  o.append(starttime)
155  o.append(stoptime)
156  return o
157 
158 if __name__ == "__main__":
159  pass
def runsummary(schema, amodetag, egev)
def trg(schema, nls)
def lumiSummary(schema, nlumils)
def hlt(schema, nls)
def packArraytoBlob(iarray)
Definition: CommonUtil.py:222