CMS 3D CMS Logo

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