diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonControl.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonControl.cxx index 28c0c20809b29f9501258cad0b16daa04fbae633..d25d24301424d10a97e43ae87d4ffebf581b72cc 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonControl.cxx +++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonControl.cxx @@ -160,8 +160,8 @@ namespace TrigCostRootAnalysis { if (!Config::config().getConfKeyNameFromString(varName, confVar)) { doNotInstantiateTest = true; - const std::string varNameError = "varName not recognised : " + varName; - Error("AutoMonControl::parseTestXml", varNameError.c_str()); + Error("AutoMonControl::parseTestXml", "varName not recognised : %s", + varName.c_str()); } if (varOpt == "call" || varOpt == "Call") { @@ -173,8 +173,7 @@ namespace TrigCostRootAnalysis { } else if (varOpt == "period" || varOpt == "Period") { confVarOpts = kSavePerPeriod; } else { - const std::string varOptError = "Unkown Variable Option, please use Call, Event, EventFraction or Period"; - Error("AutoMonControl::parseTestXml", varOptError.c_str()); + Error("AutoMonControl::parseTestXml","Unkown Variable Option, please use Call, Event, EventFraction or Period"); doNotInstantiateTest = true; } @@ -189,8 +188,7 @@ namespace TrigCostRootAnalysis { } AutoMonTest test = AutoMonTest(testName, confVar, confVarOpts, fracArg, &m_test_results); - const std::string testInfoString = "Making Test " + testName; - Info("AutoMonControl::parseTestXml", testInfoString.c_str()); + Info("AutoMonControl::parseTestXml", "Making Test %s", testName.c_str()); if (advise == "") { if (warn == "") { @@ -203,11 +201,9 @@ namespace TrigCostRootAnalysis { } bankTest(test); } else { - const std::string errorString = "Error when making test, XML parsing failed. Name (if able to retrieve) : " + - testName; - const std::string infoString = "Continuing without adding Test"; - Error("AutoMonControl::parseTestXml", errorString.c_str()); - Info("infoString", infoString.c_str()); + Error("AutoMonControl::parseTestXml", "Error when making test, XML parsing failed. Name (if able to retrieve) : %s", + testName.c_str()); + Info("infoString", "Continuing without adding Test"); } testNode = xml->GetNext(testNode); //iterate to next test node diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonExam.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonExam.cxx index e937d9f4c0baae285c6bb683ce0295d27bd09adc..a411497078d5316146357f95addf73a496302936 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonExam.cxx +++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonExam.cxx @@ -80,13 +80,13 @@ namespace TrigCostRootAnalysis { } else { const std::string rangeError = "Unable to find/use range : " + m_range; const std::string infoString = "Exam " + m_exam_name + " will run over zero counters!"; - Error("AutoMonExam::retrieveCounterCollection", rangeError.c_str()); - Info("AutoMonExam::retrieveCounterCollection", infoString.c_str()); + Error("AutoMonExam::retrieveCounterCollection", "%s", rangeError.c_str()); + Info("AutoMonExam::retrieveCounterCollection", "%s", infoString.c_str()); } for (auto iter = m_all_counters_in_monitor->begin(); iter != m_all_counters_in_monitor->end(); ++iter) { const std::string counterString = "Counter in monitor : " + (iter->second)->getName(); - Info("AutoMonExam::retrieveCounterCollection", counterString.c_str()); + Info("AutoMonExam::retrieveCounterCollection", "%s", counterString.c_str()); } printTests(); } // end retrieveCounterCollection @@ -115,10 +115,10 @@ namespace TrigCostRootAnalysis { void AutoMonExam::printTests() { const std::string header = "Printing tests found in exam : " + m_exam_name + '\n'; - Info("AutoMonExam::printTests", header.c_str()); + Info("AutoMonExam::printTests", "%s", header.c_str()); for (auto test_iter = m_test_list.begin(); test_iter != m_test_list.end(); ++test_iter) { const std::string testString = "Test : " + (*test_iter)->getTestName() + '\n'; - Info("AutoMonExam::printTests", testString.c_str()); + Info("AutoMonExam::printTests", "%s", testString.c_str()); (*test_iter)->printThresholds(std::cout); }//end for loop over test list } //end printTests @@ -156,7 +156,7 @@ namespace TrigCostRootAnalysis { } else { std::string errorMSG = "AutoMonExam >> Counter with name: " + (*iter) + " specified but not found in Counter Map"; - Error("AutoMonExam::setupSpecify", errorMSG.c_str()); + Error("AutoMonExam::setupSpecify", "%s", errorMSG.c_str()); } }//end forloop over m_specify_list } //end if no counters specified @@ -175,7 +175,7 @@ namespace TrigCostRootAnalysis { } else { const std::string errorMSG = "AutoMonExam >> Counter with name " + (*iter) + "requested to be excluded - not found in Counter Map"; - Error("AutoMonExam::setupExclude", errorMSG.c_str()); + Error("AutoMonExam::setupExclude", "%s", errorMSG.c_str()); } } //end forloop over m_exclude_list }//end setupExclude() @@ -202,16 +202,16 @@ namespace TrigCostRootAnalysis { void AutoMonExam::printCountersToExam() const { const std::string header = "Counters to Examine are :"; - Info("AutoMonExam::printCountersToExam", header.c_str()); + Info("AutoMonExam::printCountersToExam", "%s", header.c_str()); int i = 1; for (auto counter_iter = m_counters_to_exam.begin(); counter_iter != m_counters_to_exam.end(); ++counter_iter) { const std::string counterInfo = "Counter " + std::to_string(i) + " to examine: " + (counter_iter->second)->getName(); - Info("AutoMonExam::printCountersToExam", counterInfo.c_str()); + Info("AutoMonExam::printCountersToExam", "%s", counterInfo.c_str()); ++i; } const std::string footer = "---------------Finished List "; - Info("AutoMonExam::printCountersToExam", footer.c_str()); + Info("AutoMonExam::printCountersToExam", "%s", footer.c_str()); } //end printCountersToExam /** @@ -221,12 +221,12 @@ namespace TrigCostRootAnalysis { void AutoMonExam::runExam() { const std::string header = "Running exam : " + m_exam_name; - Info("AutoMonExam::runExam", header.c_str()); + Info("AutoMonExam::runExam", "%s", header.c_str()); for (auto test_iter = m_test_list.begin(); test_iter != m_test_list.end(); ++test_iter) { const std::string testInfo = "Running Test : " + (*test_iter)->getTestName(); - Info("AutoMonExam::runExam", testInfo.c_str()); + Info("AutoMonExam::runExam", "%s", testInfo.c_str()); (*test_iter)->runTest(m_counters_to_exam); } //end for loop over test list } //end runExam -}//namespace TrigCostRootAnalysis \ No newline at end of file +}//namespace TrigCostRootAnalysis diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonResult.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonResult.cxx index ed8eb3b5ae17ceb997e2d3e7b2483a6477020f13..829b5b9c0d67e0122767ff518ad048f40530a17a 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonResult.cxx +++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonResult.cxx @@ -48,7 +48,7 @@ namespace TrigCostRootAnalysis { void AutoMonResult::saveOutput() const { const std::string output = Config::config().getStr(kOutputDirectory) + "/AutoMonResult.json"; - Info("AutoMonResult::saveOutput", ("Outputting AutoMonResult to " + output).c_str()); + Info("AutoMonResult::saveOutput", "Outputting AutoMonResult to %s", output.c_str()); std::ofstream fout(output.c_str()); JsonExport json; @@ -119,7 +119,7 @@ namespace TrigCostRootAnalysis { (list_iter->second)->getVarOption())); const std::string outputString = alertLevel + " " + testName + " " + counterName + " " + MonitorName + " " + range + " " + " " + value + " " + upOrDown + " " + threshold; - Info("AutoMonResult::printList", outputString.c_str()); + Info("AutoMonResult::printList", "%s", outputString.c_str()); }// end of loop over list } // end printList diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonTest.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonTest.cxx index 99dbf26435beea29fad7ad9a84b5e7f08591f81a..791916fc88fb0d83fc9ca8667f25bce5d82b527b 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonTest.cxx +++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/AutoMonTest.cxx @@ -21,7 +21,6 @@ namespace TrigCostRootAnalysis { bool doFractional, AutoMonResult* result) : m_Varname(Varname), m_variable_option(VarOpt), - m_total_result(0.0), m_doFractional(doFractional), m_test_name(TestName), m_result(result) { @@ -65,7 +64,7 @@ namespace TrigCostRootAnalysis { } else { std::string errorMSG = "Counter " + counter->getName() + " does not have a variable with requested ConfKey or VariableOption"; - Error("AutoMonTest::applyThresholds", errorMSG.c_str()); + Error("AutoMonTest::applyThresholds", "%s", errorMSG.c_str()); return; } @@ -196,4 +195,4 @@ namespace TrigCostRootAnalysis { return "UNKNOWN"; }//end switch }//end getResultString -} //namespace TrigCostRootAnalysis \ No newline at end of file +} //namespace TrigCostRootAnalysis diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/DataVariable.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/DataVariable.cxx index ea41b664da6a3d85b25a607e692c4e02e28e4471..a805e2993172f4e577b56738d0a54a35720aff1e 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/DataVariable.cxx +++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/DataVariable.cxx @@ -335,7 +335,9 @@ namespace TrigCostRootAnalysis { data->m_sumw2 += (value * weight * weight); if (data->m_hist == 0 && data->m_histoTitle != 0) makeHist(data); if (data->m_hist != 0) { +#ifdef MTHREAD static std::mutex mutex; +#endif MUTEX_ON data->m_hist->Fill(value, weight); MUTEX_OFF @@ -384,7 +386,9 @@ namespace TrigCostRootAnalysis { Float_t effectiveWeight = 0; if (!isZero(data->m_bufferVal)) effectiveWeight = data->m_bufferValW / data->m_bufferVal; //TODO what if m_bufferVal is zero? Could still have a large weight we want on the histogram? +#ifdef MTHREAD static std::mutex mutex; +#endif MUTEX_ON data->m_hist->Fill(data->m_bufferVal, effectiveWeight); //TODO double check MUTEX_OFF @@ -422,7 +426,9 @@ namespace TrigCostRootAnalysis { //TODO what if m_bufferVal is zero? Could still have a large weight we want on the histogram? //NOTE We assume here that the demoninator is weighted hence take the weighted numerator too. //If this is ever not the case, may want to put a flag in +#ifdef MTHREAD static std::mutex mutex; +#endif MUTEX_ON data->m_hist->Fill(data->m_bufferValW / data->m_denominator, effectiveWeight); //TODO check, do we divide // effW by denom? @@ -448,7 +454,9 @@ namespace TrigCostRootAnalysis { * @param data Pointer to data struct. */ void DataVariable::makeHist(Data* data) { +#ifdef MTHREAD static std::mutex mutex; +#endif MUTEX_ON std::string name; CounterBase* holdingCounter = m_parentDataStore->getParent(); diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/Root/RatesChainItem.cxx b/Trigger/TrigCost/TrigCostRootAnalysis/Root/RatesChainItem.cxx index fec2e48721af9deca4b14074d85588af6cf178e6..f2ba8657c291e75f578e50d3742e7ceba98e3004 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/Root/RatesChainItem.cxx +++ b/Trigger/TrigCost/TrigCostRootAnalysis/Root/RatesChainItem.cxx @@ -34,7 +34,6 @@ namespace TrigCostRootAnalysis { m_PSWeight(1. / m_PS), // Reciprocal of the prescale - this is the basic weight quantity for this ChainItem m_PSReduced(1.), m_PSReducedWeight(1.), - m_PSExpress(PSExpress), m_PSExpressWeight(1. / PSExpress), m_extraEfficiency(1.), m_R(++s_chainCount), diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonExam.h b/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonExam.h index 4047b870c3d93c86a8be6707d80d6ba48cc4c800..1916ff544f7d77a4c11a691b521528c13409478d 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonExam.h +++ b/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonExam.h @@ -57,8 +57,7 @@ namespace TrigCostRootAnalysis { CounterMap_t* m_all_counters_in_monitor; std::vector<double> m_results; - double m_collection_total; }; }// namespace TrigCostRootAnalysis -#endif //TrigCostRootAnalysis_AutoMonExam_H \ No newline at end of file +#endif //TrigCostRootAnalysis_AutoMonExam_H diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonTest.h b/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonTest.h index 19553be6f89a32658bb8ad0651eed8c7cf25c6c2..90a62a697d6a6b74d65699c2f6de08bf877d2297 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonTest.h +++ b/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/AutoMonTest.h @@ -64,7 +64,6 @@ namespace TrigCostRootAnalysis { private: ConfKey_t m_Varname; VariableOption_t m_variable_option; - Float_t m_total_result; bool m_doFractional; const std::string m_test_name; AutoMonResult* m_result; @@ -73,4 +72,4 @@ namespace TrigCostRootAnalysis { }; }//namespace TrigCostRootAnalysis -#endif //TrigCostRootAnalysis_AutoMonTest_H \ No newline at end of file +#endif //TrigCostRootAnalysis_AutoMonTest_H diff --git a/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/RatesChainItem.h b/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/RatesChainItem.h index c8d978fb777d35d3165589eeb6f59b616224a35c..f7af57d3b0409fd9b2503b52ddceffe06655b077 100644 --- a/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/RatesChainItem.h +++ b/Trigger/TrigCost/TrigCostRootAnalysis/TrigCostRootAnalysis/RatesChainItem.h @@ -87,9 +87,8 @@ namespace TrigCostRootAnalysis { Double_t m_PSWeight; //!< The equivalent PS weight, = 1/PS Double_t m_PSReduced; //!< prescaled with any coherent part factored out Double_t m_PSReducedWeight; //!< = 1/PSReduced - Double_t m_PSExpress; //!< Express stream prescale - Double_t m_PSExpressWeight; //!< 1/Express stream presca;e - Double_t m_extraEfficiency; //<! Extra factor which can be supplied to scale the rate of this triggeer + Double_t m_PSExpressWeight; //!< 1/Express stream prescale + Double_t m_extraEfficiency; //<! Extra factor which can be supplied to scale the rate of this trigger TRandom3 m_R; //!< Random number generator for when applying the PS directly. UInt_t m_ID; //!< ID number, sequential, used for random seed static UInt_t s_chainCount; //!< Static counter of how many RatesChainItems have been made, used as random seed.