diff --git a/DataQuality/dqm_algorithms/dqm_algorithms/BinThreshold.h b/DataQuality/dqm_algorithms/dqm_algorithms/BinThreshold.h index 789d2f713ec1bec3cea90e3b64bf131d84de9ece..abfb0125f0c7437d16ca5e3e045927b8999a721c 100644 --- a/DataQuality/dqm_algorithms/dqm_algorithms/BinThreshold.h +++ b/DataQuality/dqm_algorithms/dqm_algorithms/BinThreshold.h @@ -25,7 +25,7 @@ namespace dqm_algorithms bool CompareBinThreshold( const std::string & objname, double bincontent, double threshold ); using dqm_core::Algorithm::printDescription; void printDescription(std::ostream& out); - + void parseVetoList(const std::string& input, std::vector<int>& rows, std::vector<int>& columns, std::vector<std::vector<int>>& bins); private: std::string m_name; }; diff --git a/DataQuality/dqm_algorithms/src/BinThreshold.cxx b/DataQuality/dqm_algorithms/src/BinThreshold.cxx index 11422f7f111f1ef06c415c1237ed1222b5f46767..53a4b3dd7a046a855975a88fe8c64c4e00537137 100644 --- a/DataQuality/dqm_algorithms/src/BinThreshold.cxx +++ b/DataQuality/dqm_algorithms/src/BinThreshold.cxx @@ -66,6 +66,21 @@ dqm_algorithms::BinThreshold::execute( const std::string & name, const double minstat = dqm_algorithms::tools::GetFirstFromMap( "MinStat", config.getParameters(), -1); const bool publish = (bool) dqm_algorithms::tools::GetFirstFromMap( "PublishBins", config.getParameters(), 0); const int maxpublish = (int) dqm_algorithms::tools::GetFirstFromMap( "MaxPublish", config.getParameters(), 20); + const int xmax = (int) dqm_algorithms::tools::GetFirstFromMap( "xMax", config.getParameters(), -1); + const int xmin = (int) dqm_algorithms::tools::GetFirstFromMap( "xMin", config.getParameters(), -1); + const int ymax = (int) dqm_algorithms::tools::GetFirstFromMap( "yMax", config.getParameters(), -1); + const int ymin = (int) dqm_algorithms::tools::GetFirstFromMap( "yMin", config.getParameters(), -1); + + std::string ignoreBins = dqm_algorithms::tools::GetFirstFromMap("IgnoreBins", config.getGenericParameters(), "-1"); //The format is a list of int pairs, separated with : and split by comas. The symbol * can be used to indicate rows or columns. Ex: "2:3,5:*,*:7" + + std::vector<int> hotColumns, hotRows; + std::vector<std::vector<int>> hotBins; + + parseVetoList(ignoreBins, hotRows, hotColumns, hotBins); + + bool vetoHotRows = false; if (hotRows.size() > 0) vetoHotRows = true; + bool vetoHotBins = false; if (hotBins.size() > 0) vetoHotBins = true; + bool vetoHotColumns = false; if (hotColumns.size() > 0) vetoHotColumns = true; if (histogram->GetEntries() < minstat ) { dqm_core::Result *result = new dqm_core::Result(dqm_core::Result::Undefined); @@ -123,8 +138,40 @@ dqm_algorithms::BinThreshold::execute( const std::string & name, result->tags_["Effective_BinThreshold"] = bin_threshold; } + //bools for skiping threshold comparison of vetoed rows, columns and bins + bool skipColumn = false; + bool skipRow = false; + bool skipBin = false; + for ( int i = range[0]; i <= range[1]; ++i ) { + skipColumn = false; + for (int column : hotColumns){ + if (vetoHotColumns && ( column == i || skipColumn == true)) skipColumn = true; + } + //Skip column if it is in list of vetoed columns + if (skipColumn) continue; + //Skip bin threshold comparison if xmax!=-1 and i>xmax + if (xmax!=-1 && i>xmax) continue; + //Skip bin threshold comparison if xmin!=-1 and i<xmin + if (xmin!=-1 && i<xmin) continue; + for ( int j = range[2]; j <= range[3]; ++j ) { + skipRow = false; skipBin = false; + for (int row : hotRows){ + if (vetoHotRows && ( row == j || skipRow == true)) skipRow = true; + } + for (const auto& pair : hotBins){ + if (vetoHotBins && ( (pair[0] == i && pair[1] == j) || skipBin == true)) skipBin = true; + } + //Skip Bin if it is in list of vetoed bins + if (skipBin) continue; + //Skip Row if it is in list of vetoed rows + if (skipRow) continue; + //Skip bin threshold comparison if ymax!=-1 and j>ymax + if (ymax!=-1 && j>ymax) continue; + //Skip bin threshold comparison if ymin!=-1 and j<ymin + if (ymin!=-1 && j<ymin) continue; + double content= histogram -> GetBinContent(i,j); if ( CompareBinThreshold(m_name, content, bin_threshold )) { ++count; @@ -188,6 +235,29 @@ dqm_algorithms::BinThreshold::CompareBinThreshold(const std::string & type, doub return 0; } +void dqm_algorithms::BinThreshold::parseVetoList(const std::string& input, std::vector<int>& rows, std::vector<int>& columns, std::vector<std::vector<int>>& bins) { + + std::string inputNoQuotes; + for (char c : input) if (c != '"') inputNoQuotes += c; + + std::stringstream ss(inputNoQuotes); + std::string token; + + while (std::getline(ss, token, ',')) { + std::stringstream pairStream(token); + std::string first, second; + + if (std::getline(pairStream, first, ':') && std::getline(pairStream, second, ':')) { + if (first == "*") { + rows.push_back(std::stoi(second)); + } else if (second == "*") { + columns.push_back(std::stoi(first)); + } else { + bins.push_back({std::stoi(first), std::stoi(second)}); + } + } + } +} void dqm_algorithms::BinThreshold::printDescription(std::ostream& out) @@ -206,7 +276,7 @@ dqm_algorithms::BinThreshold::printDescription(std::ostream& out) out<<"Optional Parameter: xmax: maximum x range"<<std::endl; out<<"Optional Parameter: ymin: minimum y range"<<std::endl; out<<"Optional Parameter: ymax: maximum y range\n"<<std::endl; - + out<<"Optional Parameter: ignoreBins: list of bins to ignore in the threshold comparison (x,y) in a string, separated by comas and semicolons. Ex: 1:3,6:7. It also allows to pass rows and columns like *:4 and *:4 respectively \n"<<std::endl; } diff --git a/Trigger/TrigT1/L1Topo/L1TopoOnlineMonitoring/python/L1TopoOnlineMonitoringConfig.py b/Trigger/TrigT1/L1Topo/L1TopoOnlineMonitoring/python/L1TopoOnlineMonitoringConfig.py index b7525e123a015e2467710a46cdb06c7b6d8cb087..bbff37ecabc0f7fe8366d7d9aff32e03a8311c9c 100644 --- a/Trigger/TrigT1/L1Topo/L1TopoOnlineMonitoring/python/L1TopoOnlineMonitoringConfig.py +++ b/Trigger/TrigT1/L1Topo/L1TopoOnlineMonitoring/python/L1TopoOnlineMonitoringConfig.py @@ -36,12 +36,17 @@ def getL1TopoLabels(flags,connectors = {0: 'LegacyTopo0', 1: 'LegacyTopo1'}, bma else: for topo_trigline in topo_triglines_dict: topo_trigline_name = topo_trigline['name'] + topo_trigline_name= topo_trigline_name.replace("TOPO_","") bit_id = topo_trigline['startbit'] fpga_id = topo_trigline['fpga'] clock_id = topo_trigline['clock'] topo_trigline_index = 64*connector_id + 32*fpga_id + 2*bit_id + clock_id topo_trigline_labels[topo_trigline_index] = topo_trigline_name + for i in range(len(topo_trigline_labels)): + if ( topo_trigline_labels[i] == ""): + topo_trigline_labels[i] = "-- Unassigned Item --" + return topo_trigline_labels def getMultiplicityLabels(flags,topoModule): @@ -53,6 +58,8 @@ def getMultiplicityLabels(flags,topoModule): topo_trigline_name = topo_trigline['name'] bit_id = topo_trigline['startbit'] topo_trigline_labels[bit_id] = topo_trigline_name + if ( topo_trigline_labels[bit_id].find("SPARE") >= 0): + topo_trigline_labels[bit_id] = "-- Unassigned Item --" return topo_trigline_labels @@ -69,7 +76,7 @@ def getL1TopoPhase1OnlineMonitor(flags, name='L1TopoOnlineMonitor', doSimMon=Tru doComp = doComp, doMultComp = doMultComp, forceCTPasHdw=forceCtp, - MultiplicityVetoList=["ZeroBiasC","ZeroBiasB"], + MultiplicityVetoList=["ZeroBiasA","ZeroBiasB"], AlgorithmVetoList =["jXE40delay"]) if logLevel : alg.OutputLevel=logLevel alg.MonTool = GenericMonitoringTool(flags, 'MonTool') @@ -87,14 +94,19 @@ def getL1TopoPhase1DQMonitor(flags, name='L1TopoDQMonitor', doSimMon=True, doHwM doHwMonCTP = doHwMonCtp, doComp = doComp, doMultComp = doMultComp, - forceCTPasHdw=forceCtp, MultiplicityVetoList=["ZeroBiasA","ZeroBiasB"], - AlgorithmVetoList =["jXE40delay"]) + AlgorithmVetoList =["jXE40delay"], + forceCTPasHdw=forceCtp) #Define the Monitoring plots for L1Calo DQ helper.defineDQAlgorithm("L1TopoMismatchRate", - hanConfig={"libname":"libdqm_summaries.so","name":"Bins_GreaterThan_Threshold","BinThreshold":"0.1"}, # counts bins with value>0.9 - thresholdConfig={"NBins":[0,1]}, # warn if any high rate, error if more than 10 bins anywhere. + hanConfig={"libname":"libdqm_summaries.so","name":"Bins_GreaterThan_Threshold","BinThreshold":"0.001","PublishBins":"1"}, # counts bins with value>0.001 + thresholdConfig={"NBins":[0,1]}, # warn if any high rate, error if more than 1 bin anywhere. + ) + + helper.defineDQAlgorithm("L1TopoMismatchCountVerticalRange", + hanConfig={"libname":"libdqm_summaries.so","name":"Bins_GreaterThan_Threshold","BinThreshold":"0.001","PublishBins":"1","yMax":"2"}, #,"IgnoreBins":"\"25:1,26:2,*:25,*:58,500:*\""}, # counts bins with value>0.001 for Bins in Y between 0 and 1. + thresholdConfig={"NBins":[0,1]}, # warn if any high rate, error if more than 1 bin anywhere. ) #Multiplicity mismatches between Sim and Hdw @@ -130,7 +142,7 @@ def getL1TopoPhase1DQMonitor(flags, name='L1TopoDQMonitor', doSimMon=True, doHwM helper.defineHistogram(name, fillGroup="L1TopoDQ_mismatches", paths=['Expert/Sim/detail/L1Topo/Multiplicities'], - hanConfig={"description":"Agreements and Mismatches between L1Topo Simulation and Hdw per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry","display":"SetPalette(55)"}, + hanConfig={"algorithm":"L1TopoMismatchCountVerticalRange","description":"Agreements and Mismatches between L1Topo Simulation and Hdw per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry","display":"SetPalette(55)"}, type='TH2D', title=title, xbins=len(xlabels), ybins=3, xlabels=xlabels,ylabels=ylabels, @@ -169,7 +181,7 @@ def getL1TopoPhase1DQMonitor(flags, name='L1TopoDQMonitor', doSimMon=True, doHwM helper.defineHistogram(name, fillGroup="L1TopoDQ_mismatches", paths=['Expert/Sim/detail/L1Topo/Algos'], - hanConfig={"description":"Agreements and Mismatches between L1Topo Simulation and Hardware per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry","display":"SetPalette(55)"}, + hanConfig={"algorithm":"L1TopoMismatchCountVerticalRange","description":"Agreements and Mismatches between L1Topo Simulation and Hardware per L1Topo Item (x-axis). The upper row should be filled (Sim and Hdw agrees), while the lower two rows shouldn't have any entry","display":"SetPalette(55)"}, type='TH2F', title=title,xbins=32,ybins=3, #weight=f'Phase1TopoWeight_{topo[0]}',