00001 import array,coral
00002 from RecoLuminosity.LumiDB import CommonUtil
00003 def lumiSummary(schema,nlumils):
00004 '''
00005 input:
00006 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]}]
00007 '''
00008 o=['file:fake.root']
00009 perlsdata={}
00010 for lumilsnum in range(1,nlumils+1):
00011 cmslsnum=0
00012 if lumilsnum<100:
00013 cmslsnum=lumilsnum
00014 instlumi=2.37
00015 instlumierror=0.56
00016 instlumiquality=2
00017 beamstatus='STABLE BEAMS'
00018 beamenergy=3.5e03
00019 numorbit=12345
00020 startorbit=numorbit*lumilsnum
00021 if cmslsnum==0:
00022 cmsbxindex=None
00023 beam1intensity=None
00024 beam2intensity=None
00025 else:
00026 cmsbxindex=array.array('I')
00027 beam1intensity=array.array('f')
00028 beam2intensity=array.array('f')
00029 for idx in range(1,3565):
00030 cmsbxindex.append(idx)
00031 beam1intensity.append(1.5e09)
00032 beam2intensity.append(5.5e09)
00033 cmsbxindexBlob=CommonUtil.packArraytoBlob(cmsbxindex)
00034 beam1intensityBlob=CommonUtil.packArraytoBlob(beam1intensity)
00035 beam2intensityBlob=CommonUtil.packArraytoBlob(beam2intensity)
00036 bxlumivalue=array.array('f')
00037 bxlumierror=array.array('f')
00038 bxlumiquality=array.array('I')
00039 for idx in range(1,3565):
00040 bxlumivalue.append(2.3)
00041 bxlumierror.append(0.4)
00042 bxlumiquality.append(2)
00043 bxlumivalueBlob=CommonUtil.packArraytoBlob(bxlumivalue)
00044 bxlumierrorBlob=CommonUtil.packArraytoBlob(bxlumierror)
00045 bxlumiqualityBlob=CommonUtil.packArraytoBlob(bxlumiquality)
00046 if not perlsdata.has_key(lumilsnum):
00047 perlsdata[lumilsnum]=[]
00048 perlsdata[lumilsnum].extend([cmslsnum,instlumi,instlumierror,instlumiquality,beamstatus,beamenergy,numorbit,startorbit,cmsbxindexBlob,beam1intensityBlob,beam2intensityBlob,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob,bxlumivalueBlob,bxlumierrorBlob,bxlumiqualityBlob])
00049 o.append(perlsdata)
00050 return o
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 def trg(schema,nls):
00081 '''
00082 input:
00083 output: [datasource,bitzeroname,bitnameclob,{cmslsnum:[deadtime,bitzerocount,bitzeroprescale,trgcountBlob,trgprescaleBlob]}]
00084 '''
00085 o=['oracle://cms_orcon_prod/cms_gtmon','L1_ZeroBias']
00086 bitnameclob='L1_ZeroBias,False,L1_SingleHfBitCountsRing1_1,L1_SingleHfBitCountsRing2_1,L1_SingleMu15,L1SingleJet,Jura'
00087 o.append(bitnameclob)
00088 perlsdata={}
00089 for cmslsnum in range(1,nls+1):
00090 deadtime=99+cmslsnum
00091 bitzerocount=897865
00092 bitzeroprescale=17
00093 trgcounts=array.array('I')
00094 prescalecounts=array.array('I')
00095 for i in range(1,192):
00096 trgcounts.append(778899+i)
00097 prescalecounts.append(17)
00098 trgcountsBlob=CommonUtil.packArraytoBlob(trgcounts)
00099 prescalecountsBlob=CommonUtil.packArraytoBlob(prescalecounts)
00100 if not perlsdata.has_key(cmslsnum):
00101 perlsdata[cmslsnum]=[]
00102 perlsdata[cmslsnum].extend([deadtime,bitzerocount,bitzeroprescale,trgcountsBlob,prescalecountsBlob])
00103 o.append(perlsdata)
00104 return o
00105 def hlt(schema,nls):
00106 '''
00107 input:
00108 output: [datasource,pathnameclob,{cmslsnum:[inputcountBlob,acceptcountBlob,prescaleBlob]}]
00109 '''
00110 o=['oracle://cms_orcon_prod/cms_runinfo']
00111 pathnameclob='HLT_PixelTracks_Multiplicity70,HLT_PixelTracks_Multiplicity85,HLT_PixelTracks_Multiplicity100,HLT_GlobalRunHPDNoise,HLT_TechTrigHCALNoise'
00112 o.append(pathnameclob)
00113 perlsdata={}
00114 for cmslsnum in range(1,nls+1):
00115 inputcounts=array.array('I')
00116 acceptcounts=array.array('I')
00117 prescalecounts=array.array('I')
00118 for i in range(1,201):
00119 inputcounts.append(6677889 )
00120 acceptcounts.append(3344565)
00121 prescalecounts.append(17)
00122 inputcountsBlob=CommonUtil.packArraytoBlob(inputcounts)
00123 acceptcountsBlob=CommonUtil.packArraytoBlob(acceptcounts)
00124 prescalecountsBlob=CommonUtil.packArraytoBlob(prescalecounts)
00125 if not perlsdata.has_key(cmslsnum):
00126 perlsdata[cmslsnum]=[]
00127 perlsdata[cmslsnum].extend([inputcountsBlob,acceptcountsBlob,prescalecountsBlob])
00128 o.append(perlsdata)
00129 return o
00130 def hlttrgmap(schema):
00131 '''
00132 input:
00133 output:[hltkey,{hltpahtname:l1seed}]
00134 '''
00135 o=['/cdaq/physics/firstCollisions10/v2.0/HLT_7TeV/V5']
00136 hlttrgmap={}
00137 hlttrgmap['HLT_L1Tech_BSC_halo']='4'
00138 hlttrgmap['HLT_PixelTracks_Multiplicity70']='L1_ETT60'
00139 hlttrgmap['HLT_PixelTracks_Multiplicity85']='L1_ETT60'
00140 hlttrgmap['HLT_PixelTracks_Multiplicity100']='L1_ETT100'
00141 hlttrgmap['HLT_GlobalRunHPDNoise']="L1_SingleJet10U_NotBptxOR"
00142 hlttrgmap['HLT_TechTrigHCALNoise']="11 OR 12"
00143 o.append(hlttrgmap)
00144 return o
00145 def runsummary(schema,amodetag,egev):
00146 '''
00147 input:
00148 output:[l1key,amodetag,egev,hltkey,fillnum,sequence,starttime,stoptime]
00149 '''
00150 o=['collisioncollision','PROTPHYS',3500,'/cdaq/physics/firstCollisions10/v2.0/HLT_7TeV/V5',1005,'GLOBAL-RUN']
00151 starttime=coral.TimeStamp(2010,11,1,0,0,0,0)
00152 stoptime=coral.TimeStamp(2010,11,1,11,0,0,0)
00153 o.append(starttime)
00154 o.append(stoptime)
00155 return o
00156
00157 if __name__ == "__main__":
00158 pass