def __init__(self, name, condition=None, channel=0, resDictKey=''): super(BFieldCondition, self).__init__( name, dbfolderkey='COOLOFL_DCS::/EXT/DCS/MAGNETS/SENSORDATA', channelKeys=[(channel, resDictKey, 'value')]) if condition: self.cutRange = GetRanges(condition)
def __init__(self, name, events=None): self.events = events super(EventSelector, self).__init__(name=name, dbfolderkey='oracle::SFO-based', channelKeys=[(0, '#Events', 'EFEvents')]) if events: self.cutRange = GetRanges(events)
def __init__(self, name, condition=[], channel=0, addArg=''): ck = [(1, 'lhc:fillnumber', 'FillNumber'), (1, 'lhc:stablebeams', 'StableBeams'), (1, 'lhc:beamenergy', 'BeamEnergyGeV')] if addArg == 'all': ck += [(1, 'lhc:beammode', 'BeamMode')] elif addArg == 'min': ck = [(1, 'lhc:stablebeams', 'StableBeams')] super(LHCCondition, self).__init__(name=name, dbfolderkey='COOLOFL_DCS::/LHC/DCS/FILLSTATE', channelKeys=ck) # define arguments (after initialising base class!) self.lhc = {} for c in condition: # format: 'fillnumber 891' or 'stablebeams 1', etc lhcargs = c.split() if len(lhcargs) == 2: key = 'lhc:' + lhcargs[0].strip().lower() # does it exist? if not key in self.ResultKey(): print 'ERROR: unknown LHC variable "%s"' % key sys.exit(1) cond = lhcargs[1].strip() if cond: try: isnum = float(cond[0]) self.lhc[key] = GetRanges(cond) except ValueError: self.lhc[key] = [[cond]] pass else: print 'ERROR: unknown condition format for LHC: "%s" -> need two arguments separated by blank' % lhcargs sys.exit(1)
def __init__(self, name, events=None): self.events = events self.showAllevents = False super(AllEventsSelector, self).__init__( name=name, dbfolderkey='COOLONL_TDAQ::/TDAQ/RunCtrl/EventCounters', channelKeys=[(0, '#Events (incl. calib.)', 'EFEvents'), (0, '#Events (streamed)', 'RecordedEvents'), (0, '#L2A', 'L2Events')]) if events: self.cutRange = GetRanges(events)
def select(self): start = time() runlist = [] folder = coolDbConn.GetDBConn( schema="COOLONL_TRIGGER", db=Selector.condDB()).getFolder('/TRIGGER/LUMI/LBTIME') print('SELOUT Checking for runs in time range "%s"' % self.timelist, end='') sys.stdout.flush() ranges = GetRanges(self.timelist, maxval=long(time() * 1E09)) currentRun = None for rr in ranges: objs = folder.browseObjects(rr[0], rr[1] + 86400000000000, cool.ChannelSelection(0)) while objs.goToNext(): obj = objs.currentRef() payload = obj.payload() runNr = int(payload['Run']) if runNr == 0: continue # mistakenly runnr=0 was stored if runNr > 1 << 30: # there is a problem with runs between # usetimes 2009-04-14:00:00:00 2009-04-16:13:00:00 # there the runnumbers are off the chart (> 1<<30) continue if not currentRun or runNr != currentRun.runNr: if currentRun: currentRun.eor = currentEOR runlist.append(currentRun) currentRun = Run(runNr) currentRun.sor = obj.since() lbNr = int(payload['LumiBlock']) currentRun.lbtimes.extend([(0, 0)] * (lbNr - len(currentRun.lbtimes))) currentRun.lbtimes[lbNr - 1] = (obj.since(), obj.until()) currentRun.lastlb = lbNr currentEOR = obj.until() if currentRun: currentRun.eor = currentEOR runlist.append(currentRun) runlist.sort() duration = time() - start print(" ==> %i runs selected (%g sec)" % (len(runlist), duration)) return runlist
def __init__(self, name, bs=None, args=""): self.bs = bs args = args.split() # defaults folder = 'COOLOFL_INDET::/Indet/Beampos' # self.condtag = 'IndetBeampos-ES1-UPD2' self.condtag = 'IndetBeampos-ES1-UPD2-02' # new default tag (operational since rel 17, run 188902, 7 Sep) self.isOffline = True if args: # more information: online and/or COOL tag # check if online if args[0].lower().startswith('onl'): # online format: "online MyTag" or "online" self.isOffline = False folder = 'COOLONL_INDET::/Indet/Onl/Beampos' self.condtag = 'IndetBeamposOnl-HLT-UPD1-001-00' # default tag if len(args) > 1: if args[1] == 'live': self.condtag = 'IndetBeamposOnl-LiveMon-001-00' else: self.condtag = args[1] else: # assume second entry is COOL tag self.condtag = args[0] super(BeamspotSelector, self).__init__(name=name, dbfolderkey=folder, channelKeys=[ (0, 'bs:Status', 'status'), (0, 'bs:Pos-X', ('posX', 'posXErr')), (0, 'bs:Pos-Y', ('posY', 'posYErr')), (0, 'bs:Pos-Z', ('posZ', 'posZErr')), (0, 'bs:Sig-X', ('sigmaX', 'sigmaXErr')), (0, 'bs:Sig-Y', ('sigmaY', 'sigmaYErr')), (0, 'bs:Sig-Z', ('sigmaZ', 'sigmaZErr')), (0, 'bs:Sig-XY', ('sigmaXY', 'sigmaXYErr')), (0, 'bs:Tilt-X', ('tiltX', 'tiltXErr')), (0, 'bs:Tilt-Y', ('tiltY', 'tiltYErr')) ]) if bs: self.cutRange = GetRanges(bs)
def __init__(self, name, lumi=None): name, tag = (name.split(None, 1) + [""])[:2] channel, condtag = self.__interpretTag(tag) self._dbfolderkey = 'COOLOFL_TRIGGER::/TRIGGER/OFLLUMI/LBLESTOFL' if condtag: self._dbfolderkey += "#" + condtag self._channelKeys = [(channel, 'ofllumi:%i:%s' % (channel, condtag), 'LBAvInstLumi')] super(LuminositySelector, self).__init__(name=name, dbfolderkey=self._dbfolderkey, channelKeys=self._channelKeys) if lumi: self.cutRange = GetRanges(lumi) self.applySelection = True
def __init__(self, name, runlist): super(RunTimeSelector, self).__init__(name) if not runlist: runlist = ['-'] runlist = ','.join(runlist).split(',') runlist = [rr for rr in runlist if not rr.startswith('last')] self.runranges = GetRanges(','.join(runlist))
def setSelectRelease(self, release): self.release = release if self.release: self.relCutRange = GetRanges(','.join(self.release), intRepFnc=self.relStringToInt) self.applySelection = True
def setSelectSMK(self, smks): self.trigkeys = smks if self.trigkeys: self.smkCutRange = GetRanges(self.trigkeys) self.applySelection = True