CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
lumiQueryAPI Namespace Reference

Classes

class  ParametersObject
 ==============temporarilly here======### More...
 

Functions

def allfills
 
def allruns
 ==============real api=====### More...
 
def beamIntensityForRun
 
def calculateEffective
 
def calculateTotalRecorded
 
def calibratedDetailForRunLimitresult
 
def deliveredLumiForRange
 
def deliveredLumiForRun
 
def dumpData
 
def dumpOverview
 
def dumpPerLSLumi
 
def dumpRecordedLumi
 
def filterDeadtable
 
def flatten
 
def getDeadfractions
 
def hltAllpathByrun
 
def hltBypathByrun
 
def hlttrgMappingByrun
 
def lsBylsLumi
 
def lslengthsec
 
def lumidetailAllalgosByrun
 
def lumidetailByrunByAlgo
 
def lumisumByrun
 
def lumisummaryByrun
 
def lumisummarytrgbitzeroByrun
 
def mergeXingLumi
 
def printDeliveredLumi
 
def printOverviewData
 
def printPerLSLumi
 
def printRecordedLumi
 
def recordedLumiForRange
 
def recordedLumiForRun
 
def runsByfillrange
 
def runsByTimerange
 
def runsummaryByrun
 
def setupSession
 
def splitlistToRangeString
 
def trgAllbitsByrun
 
def trgbitzeroByrun
 
def trgBybitnameByrun
 
def validation
 
def xingLuminosityForRun
 

Variables

tuple allfills = allfills(q)
 
tuple allruns = allruns(schema,requireLumisummary=True,requireTrg=True,requireHlt=True)
 
string connectstr = 'oracle://cms_orcoff_prod/cms_lumi_prod'
 
tuple msg = coral.MessageStream('')
 
tuple q = schema.newQuery()
 
tuple schema = session.nominalSchema()
 
tuple session = svc.connect(connectstr,accessMode=coral.access_ReadOnly)
 
tuple svc = coral.ConnectionService()
 

Function Documentation

def lumiQueryAPI.allfills (   queryHandle,
  filtercrazy = True 
)
select distinct fillnum from cmsrunsummary
there are crazy fill numbers. we assume they are not valid runs

Definition at line 1041 of file lumiQueryAPI.py.

def lumiQueryAPI.allruns (   schemaHandle,
  requireRunsummary = True,
  requireLumisummary = False,
  requireTrg = False,
  requireHlt = False 
)

==============real api=====###

find all runs in the DB. By default requires cmsrunsummary table contain the run. The condition can be loosed in situation where db loading failed on certain data portions.

Definition at line 923 of file lumiQueryAPI.py.

def lumiQueryAPI.beamIntensityForRun (   query,
  parameters,
  runnum 
)
select CMSBXINDEXBLOB,BEAMINTENSITYBLOB_1,BEAMINTENSITYBLOB_2 from LUMISUMMARY where runnum=146315 and LUMIVERSION='0001'

output : result {startorbit: [(bxidx,beam1intensity,beam2intensity)]}

Definition at line 1469 of file lumiQueryAPI.py.

def lumiQueryAPI.calculateEffective (   trgtable,
  totalrecorded 
)
input: trgtable{hltpath:[l1seed, hltprescale, l1prescale]}, totalrecorded (float)
output:{hltpath, recorded}

Definition at line 445 of file lumiQueryAPI.py.

def lumiQueryAPI.calculateTotalRecorded (   deadtable)
input: {lsnum:[deadtime, instlumi, bit_0, norbits,prescale]}
output: recordedLumi

Definition at line 410 of file lumiQueryAPI.py.

def lumiQueryAPI.calibratedDetailForRunLimitresult (   query,
  parameters,
  runnum,
  algoname = 'OCC1',
  finecorrection = None 
)
select 
s.cmslsnum,d.bxlumivalue,d.bxlumierror,d.bxlumiquality,d.algoname from LUMIDETAIL d,LUMISUMMARY s where s.runnum=133885 and d.algoname='OCC1' and s.lumisummary_id=d.lumisummary_id order by s.startorbit,s.cmslsnum
result={(startorbit,cmslsnum):[(index,lumivalue,lumierr),]}

Definition at line 1536 of file lumiQueryAPI.py.

def lumiQueryAPI.deliveredLumiForRange (   dbsession,
  parameters,
  inputRange,
  finecorrections = None 
)
Takes either single run as a string or dictionary of run ranges

Definition at line 82 of file lumiQueryAPI.py.

def lumiQueryAPI.deliveredLumiForRun (   dbsession,
  parameters,
  runnum,
  finecorrections = None 
)
select sum (INSTLUMI), count (INSTLUMI) from lumisummary where runnum = 124025 and lumiversion = '0001';
select INSTLUMI,NUMORBIT  from lumisummary where runnum = 124025 and lumiversion = '0001'
query result unit E27cm^-2 (= 1 / mb)

optional corrections=None/(constfactor,afterglowfactor,nonlinearfactor)

Definition at line 158 of file lumiQueryAPI.py.

def lumiQueryAPI.dumpData (   lumidata,
  filename 
)
input params: lumidata [{'fieldname':value}]
              filename csvname

Definition at line 401 of file lumiQueryAPI.py.

def lumiQueryAPI.dumpOverview (   delivered,
  recorded,
  hltpath = '' 
)

Definition at line 751 of file lumiQueryAPI.py.

def lumiQueryAPI.dumpPerLSLumi (   lumidata)

Definition at line 514 of file lumiQueryAPI.py.

def lumiQueryAPI.dumpRecordedLumi (   lumidata,
  hltpath = '' 
)

Definition at line 641 of file lumiQueryAPI.py.

def lumiQueryAPI.filterDeadtable (   inTable,
  lslist 
)

Definition at line 383 of file lumiQueryAPI.py.

def lumiQueryAPI.flatten (   obj)
Given nested lists or tuples, returns a single flattened list

Definition at line 864 of file lumiQueryAPI.py.

def lumiQueryAPI.getDeadfractions (   deadtable)
inputtable: {lsnum:[deadtime, instlumi, bit_0, norbits,bit_0_prescale]}
output: {lsnum:deadfraction}

Definition at line 460 of file lumiQueryAPI.py.

def lumiQueryAPI.hltAllpathByrun (   queryHandle,
  runnum 
)
select cmslsnum,inputcount,acceptcount,prescale,pathname from hlt where runnum=:runnum
this can be changed to blob query later
output: {cmslsnum:{pathname:[inputcount,acceptcount,prescale]}}

Definition at line 1429 of file lumiQueryAPI.py.

def lumiQueryAPI.hltBypathByrun (   queryHandle,
  runnum,
  hltpath 
)
select cmslsnum,inputcount,acceptcount,prescale from hlt where runnum=:runnum and pathname=:pathname
output: {cmslsnum:[inputcount,acceptcount,prescale]}

Definition at line 1396 of file lumiQueryAPI.py.

def lumiQueryAPI.hlttrgMappingByrun (   queryHandle,
  runnum 
)
select m.hltpathname,m.l1seed from cmsrunsummary r,trghltmap m where r.runnum=:runnum and m.hltkey=r.hltkey
output: {hltpath:l1seed}

Definition at line 1678 of file lumiQueryAPI.py.

def lumiQueryAPI.lsBylsLumi (   deadtable)
input: {lsnum:[deadtime, instlumi, bit_0, norbits,prescale...]}
output: {lsnum:[instlumi, recordedlumi...]}

Definition at line 60 of file lumiQueryAPI.py.

def lumiQueryAPI.lslengthsec (   numorbit,
  numbx 
)

Definition at line 55 of file lumiQueryAPI.py.

def lumiQueryAPI.lumidetailAllalgosByrun (   queryHandle,
  runnum 
)
select s.cmslsnum,d.bxlumivalue,d.bxlumierror,d.bxlumiquality,d.algoname,s.startorbit from LUMIDETAIL d,LUMISUMMARY s where s.runnum=:runnumber and s.lumisummary_id=d.lumisummary_id order by s.startorbit,d.algoname
output: {algoname:{cmslsnum:[bxlumivalue,bxlumierror,bxlumiquality,startorbit]}}

Definition at line 1634 of file lumiQueryAPI.py.

def lumiQueryAPI.lumidetailByrunByAlgo (   queryHandle,
  runnum,
  algoname = 'OCC1' 
)
select s.cmslsnum,d.bxlumivalue,d.bxlumierror,d.bxlumiquality,s.startorbit from LUMIDETAIL d,LUMISUMMARY s where s.runnum=:runnum and d.algoname=:algoname and s.lumisummary_id=d.lumisummary_id order by s.startorbit
output: [[cmslsnum,bxlumivalue,bxlumierror,bxlumiquality,startorbit]]
since the output is ordered by time, it has to be in seq list format

Definition at line 1596 of file lumiQueryAPI.py.

def lumiQueryAPI.lumisumByrun (   queryHandle,
  runnum,
  lumiversion,
  beamstatus = None,
  beamenergy = None,
  beamenergyfluctuation = 0.09,
  finecorrections = None 
)
beamenergy unit : GeV
beamenergyfluctuation : fraction allowed to fluctuate around beamenergy value
select instlumi from lumisummary where runnum=:runnum and lumiversion=:lumiversion
output: float sum(instlumi)
Note: the output is the raw result, need to apply LS length in time(sec)

Definition at line 1160 of file lumiQueryAPI.py.

def lumiQueryAPI.lumisummaryByrun (   queryHandle,
  runnum,
  lumiversion,
  beamstatus = None,
  beamenergy = None,
  beamenergyfluctuation = 0.09,
  finecorrections = None 
)
one can impose beamstatus, beamenergy selections at the SQL query level or process them later from the general result
select cmslsnum,instlumi,numorbit,startorbit,beamstatus,beamenery from lumisummary where runnum=:runnum and lumiversion=:lumiversion order by startorbit;
output: [[cmslsnum,instlumi,numorbit,startorbit,beamstatus,beamenergy,cmsalive]]
Note: the non-cmsalive LS are included in the result

Definition at line 1101 of file lumiQueryAPI.py.

def lumiQueryAPI.lumisummarytrgbitzeroByrun (   queryHandle,
  runnum,
  lumiversion,
  beamstatus = None,
  beamenergy = None,
  beamenergyfluctuation = 0.09,
  finecorrections = None 
)
select l.cmslsnum,l.instlumi,l.numorbit,l.startorbit,l.beamstatus,l.beamenery,t.trgcount,t.deadtime,t.bitname,t.prescale from trg t,lumisummary l where t.bitnum=:bitnum and l.runnum=:runnum and l.lumiversion=:lumiversion and l.runnum=t.runnum and t.cmslsnum=l.cmslsnum; 
Everything you ever need to know about bitzero and avg luminosity. Since we do not know if joint query is better of sperate, support both.
output: {cmslsnum:[instlumi,numorbit,startorbit,beamstatus,beamenergy,bitzerocount,deadtime,bitname,prescale]}
Note: only cmsalive LS are included in the result. Therefore, this function cannot be used for calculating delivered!

Definition at line 1242 of file lumiQueryAPI.py.

def lumiQueryAPI.mergeXingLumi (   triplet,
  xingLumiDict 
)
Given general xing information and a xingLumiDict, the xing
luminosity information is merged with the general information

Definition at line 875 of file lumiQueryAPI.py.

def lumiQueryAPI.printDeliveredLumi (   lumidata,
  mode 
)

Definition at line 395 of file lumiQueryAPI.py.

def lumiQueryAPI.printOverviewData (   delivered,
  recorded,
  hltpath = '' 
)

Definition at line 682 of file lumiQueryAPI.py.

def lumiQueryAPI.printPerLSLumi (   lumidata,
  isVerbose = False 
)
input lumidata  [['runnumber', 'trgtable{}', 'deadtable{}']]
deadtable {lsnum:[deadtime, instlumi, bit_0, norbits,prescale]}

Definition at line 475 of file lumiQueryAPI.py.

def lumiQueryAPI.printRecordedLumi (   lumidata,
  isVerbose = False,
  hltpath = '' 
)

Definition at line 532 of file lumiQueryAPI.py.

def lumiQueryAPI.recordedLumiForRange (   dbsession,
  parameters,
  inputRange,
  finecorrections = None 
)
Takes either single run as a string or dictionary of run ranges

Definition at line 99 of file lumiQueryAPI.py.

def lumiQueryAPI.recordedLumiForRun (   dbsession,
  parameters,
  runnum,
  lslist = None,
  finecorrections = None 
)
lslist = [] means take none in the db
lslist = None means to take all in the db
output: ['runnumber', 'trgtable{}', 'deadtable{}']

Definition at line 216 of file lumiQueryAPI.py.

def lumiQueryAPI.runsByfillrange (   queryHandle,
  minFill,
  maxFill 
)
find all runs in the fill range inclusive
select runnum,fillnum from cmsrunsummary where fillnum>=:minFill and fillnum<=:maxFill
output: fillDict={fillnum:[runlist]}

Definition at line 1704 of file lumiQueryAPI.py.

def lumiQueryAPI.runsByTimerange (   queryHandle,
  minTime,
  maxTime 
)
find all runs in the time range inclusive
the selected run must have started after minTime and finished by maxTime
select runnum,to_char(startTime),to_char(stopTime) from cmsrunsummary where startTime>=timestamp(minTime) and stopTime<=timestamp(maxTime);
input: minTime,maxTime in python obj datetime.datetime
output: {runnum:[starttime,stoptime]} return in python obj datetime.datetime

Definition at line 1734 of file lumiQueryAPI.py.

def lumiQueryAPI.runsummaryByrun (   queryHandle,
  runnum 
)
select fillnum,sequence,hltkey,to_char(starttime),to_char(stoptime) from cmsrunsummary where runnum=:runnum
output: [fillnum,sequence,hltkey,starttime,stoptime]

Definition at line 1065 of file lumiQueryAPI.py.

def lumiQueryAPI.setupSession (   connectString,
  siteconfpath,
  parameters,
  debug = False 
)
returns database session

Definition at line 887 of file lumiQueryAPI.py.

def lumiQueryAPI.splitlistToRangeString (   inPut)

Definition at line 429 of file lumiQueryAPI.py.

def lumiQueryAPI.trgAllbitsByrun (   queryHandle,
  runnum 
)
all you ever want to know about trigger
select cmslsnum,trgcount,deadtime,bitnum,bitname,prescale from trg where runnum=:runnum order by  bitnum,cmslsnum
this can be changed to blob query later
output: {cmslsnum:{bitname:[bitnum,trgcount,deadtime,prescale]}}

Definition at line 1350 of file lumiQueryAPI.py.

def lumiQueryAPI.trgbitzeroByrun (   queryHandle,
  runnum 
)
select cmslsnum,trgcount,deadtime,bitname,prescale from trg where runnum=:runnum and bitnum=0;
output: {cmslsnum:[trgcount,deadtime,bitname,prescale]}

Definition at line 1206 of file lumiQueryAPI.py.

def lumiQueryAPI.trgBybitnameByrun (   queryHandle,
  runnum,
  bitname 
)
select cmslsnum,trgcount,deadtime,bitnum,prescale from trg where runnum=:runnum and bitname=:bitname;
output: {cmslsnum:[trgcount,deadtime,bitnum,prescale]}

Definition at line 1314 of file lumiQueryAPI.py.

def lumiQueryAPI.validation (   queryHandle,
  run = None,
  cmsls = None 
)
retrieve validation data per run or all
input: run. if not run, retrive all; if cmslsnum selection list pesent, filter out unselected result
output: {run:[[cmslsnum,status,comment]]}

Definition at line 996 of file lumiQueryAPI.py.

def lumiQueryAPI.xingLuminosityForRun (   dbsession,
  runnum,
  parameters,
  lumiXingDict = {},
  maxLumiSection = None,
  finecorrections = None 
)
Given a run number and a minimum xing luminosity value,
returns a dictionary (keyed by (run, lumi section)) where the
value is a list of tuples of (xingID, xingLum).

- For all xing luminosities, simply set minLumValue to 0.

- If you want one dictionary for several runs, pass it in to
  "lumiXingDict"

select 
s.cmslsnum, d.bxlumivalue, d.bxlumierror, d.bxlumiquality, d.algoname from LUMIDETAIL d, LUMISUMMARY s where s.runnum = 133885 and d.algoname = 'OCC1' and s.lumisummary_id = d.lumisummary_id order by s.startorbit, s.cmslsnum

Definition at line 775 of file lumiQueryAPI.py.

Variable Documentation

tuple lumiQueryAPI.allfills = allfills(q)

Definition at line 1840 of file lumiQueryAPI.py.

tuple lumiQueryAPI.allruns = allruns(schema,requireLumisummary=True,requireTrg=True,requireHlt=True)

Definition at line 1782 of file lumiQueryAPI.py.

string lumiQueryAPI.connectstr = 'oracle://cms_orcoff_prod/cms_lumi_prod'

Definition at line 1776 of file lumiQueryAPI.py.

tuple lumiQueryAPI.msg = coral.MessageStream('')

Definition at line 1771 of file lumiQueryAPI.py.

tuple lumiQueryAPI.q = schema.newQuery()

Definition at line 1839 of file lumiQueryAPI.py.

Referenced by hcaldqm::utilities.aveTS_v10(), PhysicsTools::AtomicId.build(), TwoBodyDecayModel.curvilinearToCartesianJacobian(), FWEveDigitSetScalableMarkerGL.DirectDraw(), EEQuadrant(), GammaFunctionGenerator.gammaFrac(), lumi::idDealer.generateNextIDForTable(), lumi::idDealer.getIDforTable(), pftools::CaloEllipse.getTheta(), L1MuGMTSortRankUnit.getVeryLowQualityLevel(), FastHelix.helixStateAtVertex(), SeedFromConsecutiveHitsStraightLineCreator.initialKinematic(), JacobianCartesianToLocal.JacobianCartesianToLocal(), JacobianLocalToCartesian.JacobianLocalToCartesian(), reco::TrackProbabilityTagInfo.jetProbability(), TemplatedJetProbabilityComputer< Container, Base >.jetProbability(), match(), NtpProducer< C >.NtpProducer(), edm::Guid.operator=(), edm::Guid.operator==(), trigger::TriggerObject.particle(), CastorNominalCoderTemplate.process(), HcalNominalCoderTemplate.process(), NtpProducer< C >.produce(), L3MuonCandidateProducerFromMuons.produce(), L2MuonCandidateProducer.produce(), ME0MuonConverter.produce(), SusyPostProcessor.QuantilePlots(), RealQuadEquation.RealQuadEquation(), CustomPDGParser.s_charge(), cond::persistency::GLOBAL_TAG::Table.select(), cond::persistency::GLOBAL_TAG_MAP::Table.select(), AlgoMuon.setQ(), CSCCorrelatedLCTDigi.setQuality(), pat::HardEventHypothesis.setQuality(), GenEventInfoProduct.setScales(), L1MuGMTSortRankUnit.sort_rank(), L1MuGMTLFSortRankPtQLUT.SpecificLookup(), L1MuGMTLFMergeRankPtQLUT.SpecificLookup(), L1MuGMTLFMergeRankEtaQLUT.SpecificLookup(), L1MuGMTLFSortRankEtaQLUT.SpecificLookup(), L1MuGMTLFMergeRankEtaQLUT.SpecificLookup_flag(), L1MuGMTLFSortRankEtaQLUT.SpecificLookup_rank_etaq(), L1MuGMTLFMergeRankEtaQLUT.SpecificLookup_rank_etaq(), L1MuGMTLFSortRankPtQLUT.SpecificLookup_rank_ptq(), L1MuGMTLFMergeRankPtQLUT.SpecificLookup_rank_ptq(), L1MuGMTLFSortRankEtaQLUT.SpecificLookup_vlq(), PhysicsTools.split(), FastHelix.straightLineStateAtVertex(), L1MuGMTLFSortRankPtQLUT.TheLookupFunction(), L1MuGMTLFMergeRankEtaQLUT.TheLookupFunction(), reco::InverseCrosstalkMatrix.unfold(), and SiStripClusterInfo.variance().

tuple lumiQueryAPI.schema = session.nominalSchema()

Definition at line 1781 of file lumiQueryAPI.py.

tuple lumiQueryAPI.session = svc.connect(connectstr,accessMode=coral.access_ReadOnly)

Definition at line 1777 of file lumiQueryAPI.py.

tuple lumiQueryAPI.svc = coral.ConnectionService()

Definition at line 1775 of file lumiQueryAPI.py.