def DBparser(): output = request.get_json() outputdto = output["dto"] rs = outputdto["DBlist"] outputlist = DBParser.DBParser(rs) outputdto["DBparsinglist"] = outputlist outputdto["DBlist"] = "" return output
def __init__(self): # type: () -> None self.parser = DBParser() # The lists all have the same number of elements, e.g.: len(self.lumi_data[trg][run]) == len(self.pu_data[trg][run]) self.ls_data = {} # {'name': { run_number: [LS] } } self.rate_data = {} # {'name': { run_number: { LS: raw_rates } } } self.ps_data = {} # {'name': { run_number: { LS: prescale } } } self.pu_data = {} # {'name': { run_number: { LS: PU } } } self.lumi_data = {} # {'name': { run_number: { LS: iLumi } } } self.det_data = {} # {'name': { run_number: { LS: detecotr_ready } } } self.bw_data = {} # {'name': { run_number: { LS: bandwidth } } } self.size_data = {} # {'name': { run_number: { LS: size } } } self.lumi_info = {} # {run_number: [ (LS,ilum,psi,phys,cms_ready) ] } self.bunch_map = {} # {run_number: nBunches } self.hlt_triggers = [] # List of specific HLT triggers we want to get rates for, if empty --> get all HLT rates self.l1_triggers = [] # List of specific L1 triggers we want to get rates for, if empty --> get all L1 rates self.runs_used = [] self.runs_skipped = [] self.name_list = [] # List of all named objects for which we have data, e.g. triggers, datasets, streams, etc... self.psi_filter = [] self.type_map = {} # Maps each object name to a type: trigger, dataset, stream, or L1A # NOTE: Still need to handle the case where if two objects share the same name, but diff type # NOTE2: This approach should be fine, since DataParser owns the nameing, will need to be careful self.ls_veto = {} # {run_number:[LS list]} - LS to ignore self.name_veto = [] # List of paths/objects to remove from consideration self.use_prescaled_rate = False # If true, then rates are not un-prescaled self.use_cross_section = False # If true, then divide the rate by inst. lumi (only for L1 and HLT trigger data) self.normalize_bunches = True # Normalize by the number of colliding bunches self.correct_for_DT = True self.convert_output = True # Flag to convert data from { LS: data } to [ data ], used in the data getters self.l1_rate_cut = 10e6 # Ignore L1 rates above this threshold self.max_deadtime = 10. self.min_ls = -1 self.max_ls = 9999999 self.use_L1_triggers = False # Gets L1 rates self.use_HLT_triggers = False # Gets HLT rates self.use_streams = False # Gets stream rates self.use_datasets = False # Gets dataset rates self.use_L1A_rate = False # Gets the L1A rates self.use_ps_mask = False # Collects data only for LS in the specified prescale indices self.use_best_lumi = True # Uses best luminosity as determined by BRIL self.use_PLTZ_lumi = False # Uses luminosity reading from PLTZ self.use_HF_lumi = False # Uses luminosity reading from HF self.verbose = True
def __init__(self): # type: () -> None self.parser = DBParser() self.rate_monitor = RateMonitor() self.do_cron_job = False # Set the default state for the rate_monitor and plotter to produce plots for triggers self.rate_monitor.object_list = [] #self.set_plotter_fits = False self.rate_monitor.plotter.set_plotter_fits = False self.rate_monitor.plotter.compare_fits = False self.rate_monitor.use_fills = False self.rate_monitor.use_pileup = True self.rate_monitor.use_lumi = False self.rate_monitor.make_fits = False self.rate_monitor.update_online_fits = False self.rate_monitor.data_parser.normalize_bunches = True self.rate_monitor.data_parser.use_prescaled_rate = False self.rate_monitor.data_parser.use_cross_section = False self.rate_monitor.data_parser.use_L1_triggers = True self.rate_monitor.data_parser.use_HLT_triggers = True self.rate_monitor.data_parser.use_streams = False self.rate_monitor.data_parser.use_datasets = False self.rate_monitor.data_parser.use_L1A_rate = False self.rate_monitor.fitter.use_best_fit = False self.rate_monitor.plotter.color_by_fill = False # Determines how to color the plots self.rate_monitor.plotter.use_fit = False self.rate_monitor.plotter.use_multi_fit = False self.rate_monitor.plotter.show_errors = False self.rate_monitor.plotter.show_eq = False self.rate_monitor.plotter.save_png = True self.rate_monitor.plotter.save_root_file = True self.rate_monitor.plotter.show_fit_runs = False self.rate_monitor.plotter.root_file_name = "rate_plots.root" self.rate_monitor.plotter.label_Y = "pre-deadtime unprescaled rate / num colliding bx [Hz]" self.rate_monitor.plotter.name_X = "< PU >" self.rate_monitor.plotter.units_X = "" self.rate_monitor.plotter.ls_options['show_bad_ls'] = False self.rate_monitor.plotter.ls_options['rm_bad_beams'] = False self.rate_monitor.plotter.ls_options['rm_bad_det'] = False
from DBParser import * dbparser = DBParser() recentRunsFill = dbparser.getRecentRuns() lastFill = str(recentRunsFill[1]) print lastFill runList = [] for item in recentRunsFill[0]: runList.append(str(item)) print " ".join(runList)
def __init__(self): # Suppress root warnings ROOT.gErrorIgnoreLevel = 7000 # Fits and fit files self.fitFile = "Fits/2016/FOG.pkl" # The fit file, can contain both HLT and L1 triggers #self.fitFile = "../HLT_Fit_Run275911-276244_Tot12_fit.pkl" # self.fitFile = ""#fits__273013-273017/HLT_Fit_Run273013-273017_Tot12_fit.pkl" # The fit file, can contain both HLT and L1 triggers self.InputFitHLT = None # The fit information for the HLT triggers self.InputFitL1 = None # The fit information for the L1 triggers # DBParser self.parser = DBParser() # A database parser # Rates self.HLTRates = None # HLT rates self.L1Rates = None # L1 rates self.Rates = None # Combined L1 and HLT rates self.deadTimeData = {} # initializing deadTime dict # Run control self.lastRunNumber = -2 # The run number during the last segment self.runNumber = -1 # The number of the current run self.numBunches = [-1, -1] # Number of [target, colliding] bunches # Running over a previouly done run self.assignedNum = False # If true, we look at the assigned run, not the latest run self.LSRange = [] # If we want to only look at a range of LS from the run ##self.simulate = False # Simulate running through and monitoring a previous run # Lumisection control self.lastLS = 1 # The last LS that was processed last segment self.currentLS = 1 # The latest LS written to the DB self.slidingLS = -1 # The number of LS to average over, use -1 for no sliding LS self.useLSRange = False # Only look at LS in a certain range # Mode self.triggerMode = None # The trigger mode self.mode = None # Mode: cosmics, circulate, physics # Columns header self.displayRawRates = False # display raw rates, to display prescaled rates, set = True self.pileUp = True # derive expected rate as a function of the pileUp, and not the luminosity # Triggers self.cosmics_triggerList = "monitorlist_COSMICS.list" #default list used when in cosmics mode self.collisions_triggerList = "monitorlist_COLLISIONS.list" #default list used when in collision mode self.triggerList = "" # A list of all the L1 and HLT triggers we want to monitor self.userSpecTrigList = False # User specified trigger list self.usableHLTTriggers = [] # HLT Triggers active during the run that we have fits for (and are in the HLT trigger list if it exists) self.otherHLTTriggers = [] # HLT Triggers active during the run that are not usable triggers self.usableL1Triggers = [] # L1 Triggers active during the run that have fits for (and are in the L1 trigger list if it exists) self.otherL1Triggers = [] # L1 Triggers active during that run that are not usable triggers self.redoTList = True # Whether we need to update the trigger lists self.useAll = False # If true, we will print out the rates for all the HLT triggers self.useL1 = False # If true, we will print out the rates for all the L1 triggers self.totalHLTTriggers = 0 # The total number of HLT Triggers on the menu this run self.totalL1Triggers = 0 # The total number of L1 Triggers on the menu this run self.fullL1HLTMenu = [] self.ignoreStrings = ["Calibration","L1Tech","BPTX","Bptx"] # Restrictions self.removeZeros = False # If true, we don't show triggers that have zero rate # Trigger behavior self.percAccept = 50.0 # The acceptence for % diff self.devAccept = 5 # The acceptance for deviation self.badRates = {} # A dictionary: [ trigger name ] { num consecutive bad , whether the trigger was bad last time we checked, rate, expected, dev } self.recordAllBadTriggers = {} # A dictionary: [ trigger name ] < total times the trigger was bad > self.maxCBR = 3 # The maximum consecutive db queries a trigger is allowed to deviate from prediction by specified amount before it's printed out self.displayBadRates = -1 # The number of bad rates we should show in the summary. We use -1 for all self.usePerDiff = False # Whether we should identify bad triggers by perc diff or deviatoin self.sortRates = True # Whether we should sort triggers by their rates self.maxHLTRate = 500 # The maximum prescaled rate we allow an HLT Trigger to have self.maxL1Rate = 30000 # The maximum prescaled rate we allow an L1 Trigger to have # Other options self.quiet = False # Prints fewer messages in this mode self.noColors = False # Special formatting for if we want to dump the table to a file self.sendMailAlerts_static = True # Whether we should send alert mails self.sendMailAlerts_dynamic = self.sendMailAlerts_static self.sendAudioAlerts = False # Whether we should send audio warning messages in the control room (CAUTION) self.isUpdating = True # flag to determine whether or not we're receiving new LS self.showStreams = False # Whether we should print stream information self.showPDs = False # Whether we should print pd information self.totalStreams = 0 # The total number of streams self.maxStreamRate = 1000000 # The maximum rate we allow a "good" stream to have self.maxPDRate = 250 # The maximum rate we allow a "good" pd to have self.lumi_ave = "NONE" self.pu_ave = "NONE" self.deadTimeCorrection = True # correct the rates for dead time self.scale_sleeptime = 2.0 # Scales the length of time to wait before sending another query (1.0 = 60sec, 2.0 = 120sec, etc)