queryNevtsPerRun.txt
-- N evts per run, where N is the numerator at the end of the last line
select floor(bi.blueFillNumber) as fill,
sum(ts.numberOfEvents/ds.numberOfFiles) as gdEvtPerFile,
ds.numberOfFiles,
sum(dt.numberOfEvents*ts.numberOfEvents/ds.numberOfEvents) as gdInFile,
dt.file, rd.glbSetupName
--
--
from daqFileTag as dt
left join l0TriggerSet as ts on ts.runNumber=dt.run
left join runDescriptor as rd on rd.runNumber=dt.run
left join daqSummary as ds on ds.runNumber=dt.run
left join beamInfo as bi on bi.runNumber=dt.run
left join detectorSet as de on de.runNumber=dt.run
left join runStatus as rs on rs.runNumber=dt.run
left join magField as mf on mf.runNumber=dt.run
--
--
-- where (bi.blueFillNumber=3458 or bi.blueFillNumber=3459)
where rd.runNumber>6083000
and ds.numberOfFiles>1
and de.detectorID=0
and mf.scaleFactor!=0
-- USING pp-minbias triggers to identify nevents/file
and (ts.name='ppMinBias' or
ts.name='bemc-ht1-mb' or ts.name='bemc-ht2-mb' or
ts.name='bemc-jp1-mb' or ts.name='bemc-jp2-mb' or
ts.name='eemc-ht1-mb' or ts.name='eemc-ht2-mb' or
ts.name='eemc-jp1-mb-a' or ts.name='eemc-jp2-mb-a' or
ts.name='upsilon' or ts.name='Jpsi')
-- and rs.shiftLeaderStatus=0
and rs.shiftLeaderStatus<=0
and bi.entryTag=0
-- USE DAQ100 filestreams
and ((dt.fileStream between 101 and 104) or (dt.fileStream between 201 and 204))
-- and dt.file like 'st_physics_6%'
-- USE these trigger setups
and (rd.glbSetupName='ppProduction' or rd.glbSetupName='ppProductionMinBias')
--
--
group by dt.file
having (@t4:=sum(dt.numberOfEvents*ts.numberOfEvents/ds.numberOfEvents))>60
and (@t3:=mod(avg(dt.filesequence+(10*dt.fileStream)),(@t2:=floor(sum(ts.numberOfEvents)/10000.0)+1)))=0
;