diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/CMakeLists.txt b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/CMakeLists.txt deleted file mode 100644 index b14ef1d6437339781884efd4cb18245fa4ce6191..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -# $Id: CMakeLists.txt 773582 2016-09-16 12:12:10Z smh $ -################################################################################ -# Package: HLTRates2COOL -################################################################################ - -# Declare the package name: -atlas_subdir( HLTRates2COOL ) - -# External dependencies: -find_package( Boost COMPONENTS program_options system ) -find_package( COOL COMPONENTS CoolKernel CoolApplication ) -find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) -find_package( ROOT COMPONENTS Core Hist ) -find_package( tdaq COMPONENTS cmdline rc_CmdLine rc_ItemCtrl oh ohroot owl omnithread omniORB4 is ) -find_package( tdaq-common COMPONENTS ers ) -find_package( TBB ) - -# Component(s) in the package: -atlas_add_library( HLTRates2COOL - HLTRates2COOL/*.h src/*.cxx - PUBLIC_HEADERS HLTRates2COOL - INCLUDE_DIRS ${COOL_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - ${TDAQ-COMMON_INCLUDE_DIRS} ${TDAQ_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} - ${TDAQ_LIBRARIES} - PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES} ) - -atlas_add_executable( HLTCountsArchiver - src/test/HLTCountsArchiver.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} - ${TDAQ_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} - ${TDAQ_LIBRARIES} HLTRates2COOL ) - -atlas_add_executable( testHLTtoCOOL - src/test/testHLTtoCOOL.cxx - LINK_LIBRARIES HLTRates2COOL ) - -atlas_add_executable( HLTRatesFromCOOL - src/test/HLTRatesFromCOOL.cxx - INCLUDE_DIRS ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} HLTRates2COOL ) diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCoolFolderSpec.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCoolFolderSpec.h deleted file mode 100644 index 368114328d85d07cc23eaadc7073aa8e75b4bad2..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCoolFolderSpec.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HLTRATES2COOL_HLTCOOLFOLDERSPEC -#define HLTRATES2COOL_HLTCOOLFOLDERSPEC - -#include "HLTRates2COOL/HLTCounter.h" - -#include <iostream> - -#include "CoolKernel/DatabaseId.h" -#include "CoolKernel/Exception.h" -#include "CoolKernel/IDatabaseSvc.h" -#include "CoolKernel/IDatabase.h" -#include "CoolKernel/Record.h" -#include "CoolKernel/RecordSpecification.h" - -/**@brief Definition of the COOL folder structure for the trigger configuration data*/ - -namespace hltca { - class HLTCoolFolderSpec - { - public: - - /**@brief creates the folder structure in the COOL database - * - * @param db COOL database - * - * @returns pointer to the folder structure - */ - static cool::IFolderSetPtr createFolderStructure(cool::IDatabasePtr db); - - /**@brief prints the folder structure that is in the COOL database - * - * @param db COOL database - * - * @param o output stream - * - * @returns pointer to the folder - */ - static void printFolderStructure(cool::IDatabasePtr db, std::ostream & o); - - - /**@brief get a handle to the HLT Rates folder in the COOL db - * - * @param db COOL database - * - * @returns pointer to the folder - */ - // static cool::IFolderPtr getHLTRatesFolder(cool::IDatabasePtr db); - - static cool::IFolderPtr getL2CountersFolder(cool::IDatabasePtr db); - - static cool::IFolderPtr getEFCountersFolder(cool::IDatabasePtr db); - - static cool::Record createHLTCountersPayload(unsigned char format, const std::vector<hltca::HLTCounter>& counters, hltca::HLTCounter::TriggerLevel level); - - static void readHLTCountersPayload(const cool::IRecord & payload, std::vector<hltca::HLTCounter>& counters, hltca::HLTCounter::TriggerLevel level); - - private: - - /**@brief default constructor*/ - HLTCoolFolderSpec(){}; - - /**@brief copy constructor*/ - HLTCoolFolderSpec(const HLTCoolFolderSpec &) {}; - - static cool::RecordSpecification getHLTCountersFolderSpecification(); - - static void pack(unsigned char format, const std::vector<hltca::HLTCounter>& counters, cool::Blob64k& blob, hltca::HLTCounter::TriggerLevel level); - static void unpack(unsigned char format, const cool::Blob64k& blob, std::vector<hltca::HLTCounter>& counters, hltca::HLTCounter::TriggerLevel level); - - }; -} - -#endif diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountCoolWriter.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountCoolWriter.h deleted file mode 100644 index bcca70279e2865ca244b7ff8448ab117839c2d4a..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountCoolWriter.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -*-c++-*- -#ifndef HLTRATES2COOL_HLTTOCOOLWRITER -#define HLTRATES2COOL_HLTTOCOOLWRITER - -#include "HLTRates2COOL/HLTCounter.h" - -#include "CoolKernel/DatabaseId.h" -#include "CoolKernel/Exception.h" -#include "CoolKernel/IDatabaseSvc.h" -#include "CoolKernel/IDatabase.h" - -#include <string> -#include <iostream> - -namespace hltca { - class HLTCountCoolWriter { - public: - - /**@brief constructor - * - * @param dbId database connection string - * - * @param o output stream for all messages (defaults to cout) - */ - HLTCountCoolWriter(const std::string& dbId, std::ostream & o = std::cout) : - m_dbId(cool::DatabaseId(dbId)), - m_ostream(o) - {}; - - /**@brief destructor*/ - ~HLTCountCoolWriter(){}; - - - /**@brief Create a new schema in the COOL database*/ - void createSchema(bool print=false); - - /**@brief Prints the schema in the COOL database - * - * @param o output stream - */ - void printSchema(); - - /**@brief Enables the buffered writing of the counter folders*/ - void setupStorageBuffers(); - - /**@brief Enables the buffered writing of the counter folders*/ - void flushStorageBuffers(); - - void writeHLTCountersPayload(unsigned int runNumber, - unsigned int lumiblockNumber, - const std::vector<HLTCounter>& counters, - HLTCounter::TriggerLevel level = HLTCounter::BOTH); - - - void writeHLTCountersPayload( cool::ValidityKey since, - cool::ValidityKey until, - const std::vector<HLTCounter>& counters, - HLTCounter::TriggerLevel level = HLTCounter::BOTH); - - bool readHLTCountersPayload(unsigned int runNumber, - unsigned int lumiblockNumber, - std::vector< HLTCounter>& counters, - HLTCounter::TriggerLevel level); - - - - /**@brief open COOL db connection - * @param readOnly if @c true the db is opened in readonly mode - */ - cool::IDatabasePtr openDb( bool readOnly = true ); - - /**@brief check if db is open - */ - bool dbIsOpen(); - - /**@brief delete the COOL database*/ - void dropDb(); - - /**@brief close the COOL database*/ - //void closeDb(cool::IDatabasePtr& db); - void closeDb(); // to be used - - private: - - /**@brief get COOL db service - */ - cool::IDatabaseSvc& databaseService(); - - /**@brief create a new COOL database*/ - cool::IDatabasePtr createDb(); - - /**@brief create a new COOL database with prior deletion of the old one*/ - cool::IDatabasePtr recreateDb(); - - // data members - // DB connection string: oracle://<server>;schema=<acc_name>;dbname=<db_name>;user=<acc_name>;password=<pwd> - cool::DatabaseId m_dbId; //< db connection string - cool::IDatabasePtr m_dbPtr; //< COOL database pointer - - std::ostream & m_ostream; //< output stream for all messages - - void rangeInfo(const std::string& content, cool::ValidityKey since, cool::ValidityKey until); - - /**@brief Create a new schema in the COOL database with prior deletion of the old one*/ - void recreateSchema(){}; - - }; - -} - -#endif diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountOHReceiver.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountOHReceiver.h deleted file mode 100644 index df95c2e4aa60e5b060034e4434b501ceefd53a46..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountOHReceiver.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// Dear emacs, this is -*-c++-*- -#ifndef hltca_HLTCountOHReceiver -#define hltca_HLTCountOHReceiver - -// This macro interferes with some tdaq headers: -#undef PACKAGE_VERSION - -#include "HLTRates2COOL/HLTCounter.h" - -#include <iostream> -#include <vector> - -#include <owl/regexp.h> - -// OH include files -#include <oh/OHRootReceiver.h> -#include <oh/OHSubscriber.h> - -#include "TH2.h" - - -ERS_DECLARE_ISSUE( hltca, - HLTCountReceivingIssue, - "HLTCountOHReceiver: " << explanation, - ((const char*) explanation) - ) - - -namespace hltca { - - class HLTCountOHReceiver : public OHRootReceiver { - public: - - HLTCountOHReceiver(); - - using OHRootReceiver::receive; - - void receive( OHRootHistogram & h); - - void receive( std::vector<OHRootHistogram*> & ) - { - std::cout << "receive( std::vector<OHRootHistogram*> & ) notification has been received" << std::endl; - } - - int last_LB() const; - - const std::vector<hltca::HLTCounter>& hltCounters(int lumiblock, hltca::HLTCounter::TriggerLevel level); - - void ClearStorage(); - - private: - - struct Content { - Content(): h(0), valid(true), filled(false), sum(0) {} - ~Content() {delete h;} - TH2I * h; - std::vector<HLTCounter> counters; - bool valid; // true: content of h agrees with content of counters - bool filled; // true after the first histogram for is received - int sum; - }; - - void updateInternalStore(const OHRootHistogram & h); - - void CopyHistContent(const TH2& src, TH2& dest); - - void SetChainCounterBins(TAxis *axis, int level); - - void updateHLTCounters(Content& c, HLTCounter::TriggerLevel level); - - std::vector<Content> m_countStore[2]; // one store for each level - std::vector<int> m_chainCounters[2]; // bin index for chain_counter - - - }; //end class HLTCountOHReceiver - -} - -#endif diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCounter.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCounter.h deleted file mode 100644 index d80be010819a993bb527875c2564e815e29fa499..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCounter.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -*-c++-*- -#ifndef HLTRATES2COOL_HLTCOUNTER -#define HLTRATES2COOL_HLTCOUNTER - -#include <string> -#include <iostream> - -namespace hltca { - class HLTCounter; -} - -class TAxis; -class TH2; - -namespace hltca { - std::ostream & operator<<(std::ostream &, const HLTCounter &); - - class HLTCounter - { - public: - - enum TriggerLevel { UNKNOWN=0, BOTH=1, L2=2, EF=3 }; - - HLTCounter( unsigned int chainCounter, - unsigned int input, - unsigned int afterPrescale, - unsigned int raw, - unsigned int total, - TriggerLevel lvl): - m_chainCounter(chainCounter), - m_input(input), - m_afterPS(afterPrescale), - m_raw(raw), - m_total(total), - m_lvl(lvl) - {}; - - HLTCounter( unsigned int chainCounter, - TriggerLevel lvl): - m_chainCounter(chainCounter), - m_input(0), - m_afterPS(0), - m_raw(0), - m_total(0), - m_lvl(lvl) - {}; - - - unsigned int input() const { return m_input; } - unsigned int chain_counter() const { return m_chainCounter; } - unsigned int after_prescale() const { return m_afterPS; } - unsigned int raw() const { return m_raw; } - unsigned int total() const { return m_total; } - TriggerLevel trlevel() const { return m_lvl; } - std::string level() const { - switch (m_lvl) { - case L2: return "L2"; break; - case EF: return "EF"; break; - case BOTH: return "BOTH"; break; - case UNKNOWN: return "UNKNOWN"; break; - } - return ""; - } - - void setContent(const TH2* h, int binx); - - static bool hasBinsSet(); - static bool setBins(TAxis * axis); - - private: - unsigned int m_chainCounter; - unsigned int m_input; - unsigned int m_afterPS; - unsigned int m_raw; - unsigned int m_total; - TriggerLevel m_lvl; - - static int s_inputbin; - static int s_afterPSbin; - static int s_rawbin; - static int s_totalbin; - - friend std::ostream & operator<<(std::ostream &, const HLTCounter &); - - }; -} - -#endif diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountsArchiverRCApp.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountsArchiverRCApp.h deleted file mode 100644 index d53abd45e0670d00abe22eb28298c9eb3285e77b..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/HLTCountsArchiverRCApp.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/* - -* @file HLTCountsArchiverRCApp.h -* @author Joerg Stelzer -* $Author: stelzer $ -* $Revision: 1.1 $ -* $Date: 2010-02-05 $ -* -* @brief the class for writing HLT trigger counts to COOL online -*/ - -#ifndef hltca_HLTCountsArchiverRCApp -#define hltca_HLTCountsArchiverRCApp - -// This macro interferes with some tdaq headers: -#undef PACKAGE_VERSION - -#include <string> - -#include "HLTRates2COOL/JobConfig.h" -#include "RunControl/Common/Controllable.h" -#include "HLTRates2COOL/HLTCountCoolWriter.h" - -#include "ipc/core.h" - -namespace hltca { - class HLTCountsArchiverRCApp; - class HLTCountOHReceiver; - class JobConfig; -} - -class IPCPartition; -class OHSubscriber; - -class hltca::HLTCountsArchiverRCApp : public daq::rc::Controllable { -public: - /** - * Constructor. Only the parameter name is required (this is the named published in IPC.) - */ - HLTCountsArchiverRCApp(JobConfig& conf, IPCPartition* part, hltca::HLTCountOHReceiver * rec); - virtual ~HLTCountsArchiverRCApp() noexcept; - - virtual void prepareForRun(const daq::rc::TransitionCmd&); - virtual void stopArchiving(const daq::rc::TransitionCmd&); - - hltca::JobConfig& conf() { return m_jobConfig; } - -private: - - void writeToCool(); // writes the objects held by the receiver to cool - - bool getRunNumberFromIS(); - - hltca::JobConfig m_jobConfig; // object to hold different job configuration parameters - hltca::HLTCountCoolWriter m_coolWriter; // the class that does the writing to COOL - IPCPartition* m_IPCPartition; // the ipc partition object - hltca::HLTCountOHReceiver* m_receiver; - -}; - -#endif diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/JobConfig.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/JobConfig.h deleted file mode 100644 index 31a4504adac21cebbdf61c21830a95d1acecca3e..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/HLTRates2COOL/JobConfig.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef hltca_JobConfig -#define hltca_JobConfig - -#include <iostream> - -namespace hltca { - class JobConfig; - std::ostream& operator<<( std::ostream& os, const JobConfig& event ); - - class JobConfig { - friend std::ostream& operator<<( std::ostream& os, const JobConfig& event ); - public: - JobConfig(); - ~JobConfig(); - - std::string& PartitionName() { return m_partitionName; } - std::string& CoolDb() { return m_coolDb; } - std::string& ISServer() { return m_ISServer; } - std::string& Provider(const std::string& lvl) { return m_provider[lvl=="L2"?0:1]; } - std::string& Histogram(const std::string& lvl) { return m_histogram[lvl=="L2"?0:1]; } - uint32_t& CurrentRunNumber() { return m_currentRunNumber; } - bool& COOLconnStat() { return m_COOLconnStat; } - - private: - std::string m_partitionName; - std::string m_coolDb; - std::string m_ISServer; - std::string m_provider[2]; - std::string m_histogram[2]; - uint32_t m_currentRunNumber; - bool m_COOLconnStat; - }; -} -#endif diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/doc/README b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/doc/README deleted file mode 100644 index 8500634775ac2596fef4f7532012bbcc7aefe952..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/doc/README +++ /dev/null @@ -1,77 +0,0 @@ -## How to source tdaq-02-00-03 -source /afs/cern.ch/atlas/project/tdaq/cmt/bin/cmtsetup.sh tdaq-02-00-03 i686-slc4-gcc34-opt -#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/afs/cern.ch/atlas/offline/external/LCGCMT/LCGCMT_53f/InstallArea/i686-slc4-gcc34-opt/lib -export LD_LIBRARY_PATH=/afs/cern.ch/atlas/software/builds/AtlasTrigger/15.5.3/InstallArea/i686-slc4-gcc34-opt/lib:$LD_LIBRARY_PATH - -#Set the TDAQ partition name: -export TDAQ_PARTITION=DQMD - -#Set the configuration file: -export TDAQ_DB_DATA=/afs/cern.ch/atlas/project/tdaq/cmt/tdaq-02-00-02/installed/share/data/dqmf/examples/DQM_test_partition.data.xml - -#Start DQM partition: -setup_daq $TDAQ_PARTITION - - - -## need additional file project.cmt -why?? -cd users/risler -mkdir cmt -echo "use tdaq-02-00-03" > cmt/project.cmt - -## compile ... -cd HLTtoCOOL/cmt -cmt config -. ./setup.sh -gmake - - -## testHLTtoCOOl - - -## writeHLTtoCOOL - source code writeHLTtoCOOl.cxx and MyReceiver.cxx - -## publish_test_histo - source code publish_test_histo2.cpp - read histos from debughist.root and publish them to OH, for different lumi blocks - -start infrastructure: - - ipc_server & - ipc_server -p MyTestPartition & - - is_server -p MyTestPartition -n MyTest2 & - is_server -p MyTestPartition -n Histogramming & - is_server -p MyTestPartition -n LumiBlock & - -publish histos : - -../i686-slc4-gcc34-dbg/publish_test_histo -L EF -d 2 - -## receive_test_histo - source code receive_test_histo.cpp - receive the published histos : -../i686-slc4-gcc34-dbg/receive_test_histo -p MyTestPartition -s Histogramming - -## publish_test_data - source code publish_test_data.cpp - publish L1 info IS_LB with increased counters TBP, TAP, TAV and turns for different lumi Blocks on server MyTest - is_server -p MyTestPartition -n MyTest & - -## publish_test_runnr - source code publish_test_runnr.cpp - publish CTP info LB_CTP_<runnr>_<LBnr> (containing only 1 attribute, runnumber) -## receive_test_runnr - source code receive_test_runnr2.cpp - receive LB_CTP.* info and retreive the runnumber -## receive_test_keys - source code receive_test_keys.cpp - -## create info - source code create_info.cpp - - -## browse test database file -## https://twiki.cern.ch/twiki/bin/view/Atlas/AtlCoolConsole -AtlCoolConsole.py 'sqlite://;schema=testhltcounters.db;dbname=CONFTEST' diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCoolFolderSpec.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCoolFolderSpec.cxx deleted file mode 100644 index c117bf27e3b1737ee2fe3474c2f8186c20908970..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCoolFolderSpec.cxx +++ /dev/null @@ -1,240 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// -// specification of the COOL folder format -// author: Joerg Stelzer stelzer@cern.ch -// author: Karsten Koenecke karsten.koenecke@cern.ch - -#include "HLTRates2COOL/HLTCoolFolderSpec.h" -#include "HLTRates2COOL/HLTCounter.h" -#include "HLTRates2COOL/HLTCountCoolWriter.h" - -#include <sstream> -#include <iostream> -#include <iomanip> -#include <string> -#include <iterator> -#include <functional> -#include <algorithm> - -#include "CoralBase/Attribute.h" -#include "CoralBase/AttributeList.h" -#include "CoralBase/Blob.h" - -#include "CoolKernel/FolderVersioning.h" -#include "CoolKernel/FolderSpecification.h" -#include "CoolKernel/IFolder.h" -#include "CoolKernel/StorageType.h" -#include "CoolKernel/Record.h" - - - -// ------------------------------------------------------------ -// createLvl1MenuFolderSpecification -// ------------------------------------------------------------ -cool::RecordSpecification -hltca::HLTCoolFolderSpec::getHLTCountersFolderSpecification() -{ - cool::RecordSpecification spec; - spec.extend( "Format", cool::StorageType::UChar ); - spec.extend( "Data" , cool::StorageType::Blob64k ); - return spec; -} - - -cool::IFolderPtr -hltca::HLTCoolFolderSpec::getL2CountersFolder(cool::IDatabasePtr db) -{ - return db->getFolder( "/TRIGGER/LUMI/LVL2COUNTERS"); -} - - -cool::IFolderPtr -hltca::HLTCoolFolderSpec::getEFCountersFolder(cool::IDatabasePtr db) -{ - return db->getFolder( "/TRIGGER/LUMI/EFCOUNTERS"); -} - - - - - -// ------------------------------------------------------------ -// createFolderStructure() -// ------------------------------------------------------------ -cool::IFolderSetPtr -hltca::HLTCoolFolderSpec::createFolderStructure(cool::IDatabasePtr db) -{ - - //std::string singleChannelDesc = "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"40774348\" /></addrHeader><typeName>AthenaAttributeList</typeName>"; - std::string multiChannelDesc = "<timeStamp>run-lumi</timeStamp><addrHeader><address_header service_type=\"71\" clid=\"1238547719\" /></addrHeader><typeName>CondAttrListCollection</typeName>"; - - cool::IFolderSetPtr topFolder; - if( !db->existsFolderSet( "/TRIGGER" ) ) { - topFolder = db->createFolderSet( "/TRIGGER" ); - } - - if( !db->existsFolderSet( "/TRIGGER/LUMI" ) ) { - db->createFolderSet( "/TRIGGER/LUMI" ); - } - - if( !db->existsFolder( "/TRIGGER/LUMI/EFCOUNTERS" ) ) { - cool::IFolderPtr ptr = db->createFolder( "/TRIGGER/LUMI/EFCOUNTERS", cool::FolderSpecification(getHLTCountersFolderSpecification())); - ptr->setDescription(multiChannelDesc); - } - - if( !db->existsFolder( "/TRIGGER/LUMI/LVL2COUNTERS" ) ) { - cool::IFolderPtr ptr = db->createFolder( "/TRIGGER/LUMI/LVL2COUNTERS", cool::FolderSpecification(getHLTCountersFolderSpecification())); - ptr->setDescription(multiChannelDesc); - } - - return topFolder; -} - - -// ------------------------------------------------------------ -// printFolderStructure(cool::IDatabasePtr db) -// ------------------------------------------------------------ -void -hltca::HLTCoolFolderSpec::printFolderStructure(cool::IDatabasePtr db, std::ostream & o) -{ - - std::vector<std::string> nodes = db->listAllNodes(); - - std::vector<std::string>::const_iterator fIt = nodes.begin(); - for(;fIt != nodes.end();fIt++) { - bool isFolderSet = db->existsFolderSet(*fIt); - o << " " << *fIt; - if(isFolderSet) { - o << "/" << std::endl; - } - else { - cool::IFolderPtr folder = db->getFolder(*fIt); - bool isMultiVersion = (folder->versioningMode() == cool::FolderVersioning::MULTI_VERSION); - // const cool::IRecord & att = folder->folderAttributes(); - // att.print(o); - const cool::IRecordSpecification & rspec = folder->payloadSpecification(); - - - o << " (" << (isMultiVersion?"Multiversion":"Singleversion") << ")" << std::endl; - - o.setf(std::ios::left); - for(uint i=0;i<rspec.size(); i++) - { - o << " " << std::setw(30) << rspec[i].name() << " (" << rspec[i].storageType().name() << ")" << std::endl; - } - } // End if(isFolderSet)/else - - } - return; -} - - - -cool::Record -hltca::HLTCoolFolderSpec::createHLTCountersPayload(unsigned char format, const std::vector<hltca::HLTCounter>& counters, hltca::HLTCounter::TriggerLevel level) -{ - - cool::Record payload = getHLTCountersFolderSpecification(); - - // fill the payload - payload["Format"].setValue<cool::UChar>(format); - cool::Blob64k blob; - - // pack the counters - pack(format, counters, blob, level); - - payload["Data"].setValue<cool::Blob64k>(blob); - - - return payload; -} - -void -hltca::HLTCoolFolderSpec::readHLTCountersPayload(const cool::IRecord & payload, - std::vector<hltca::HLTCounter>& counters, - hltca::HLTCounter::TriggerLevel level) -{ - - unsigned char packingFormat = payload["Format"].data<cool::UChar>(); - cool::Blob64k blob = payload["Data"].data<cool::Blob64k>(); - unpack(packingFormat, blob, counters, level); -} - - -namespace { - struct levelfilter { - typedef hltca::HLTCounter first_argument_type; - typedef hltca::HLTCounter::TriggerLevel second_argument_type; - typedef bool result_type; - bool operator()(const hltca::HLTCounter& x, const hltca::HLTCounter::TriggerLevel& level) const { - return x.trlevel()==level; - } - }; -} - -void -hltca::HLTCoolFolderSpec::pack(unsigned char format, - const std::vector<hltca::HLTCounter>& counters, - cool::Blob64k& blob, - hltca::HLTCounter::TriggerLevel level) -{ - - int n_lvl = std::count_if(counters.begin(), counters.end(), std::bind2nd(levelfilter(),level)); - - std::cout << "Found " << n_lvl << " entries for level " << level << std::endl; - - if(format==1) { - - const unsigned int NData = 5; - - // required space - blob.resize( NData * sizeof(unsigned int) * n_lvl ); // NData unsigned integers per chain in this level - - // starting point - unsigned int* p = static_cast<unsigned int*>(blob.startingAddress()); - - levelfilter lf; - for (std::vector<HLTCounter>::const_iterator c = counters.begin(); c != counters.end(); c++ ) { - - if (! lf(*c,level)) continue; - *(p++) = (*c).chain_counter(); - *(p++) = (*c).input(); - *(p++) = (*c).after_prescale(); - *(p++) = (*c).raw(); - *(p++) = (*c).total(); - } - } -} - -void -hltca::HLTCoolFolderSpec::unpack(unsigned char format, - const cool::Blob64k& blob, - std::vector<hltca::HLTCounter>& counters, - hltca::HLTCounter::TriggerLevel level) -{ - - std::cout << "format " << (unsigned int)format << std::endl; - std::cout << "blob size " << blob.size() << std::endl; - - - // don't clear the counters vector, new HLTCounters will be appended - if(format==1) { - - const unsigned int NData = 5; - - int n_lvl = blob.size() / ( NData * sizeof(unsigned int) ); // 4 unsigned integers per chain in this level - const unsigned int* p = static_cast<const unsigned int*>(blob.startingAddress()); - - for(int i=0; i<n_lvl; i++) { - unsigned int chain_counter = *(p++); - unsigned int input = *(p++); - unsigned int after_prescale = *(p++); - unsigned int raw = *(p++); - unsigned int total = *(p++); - counters.push_back(HLTCounter(chain_counter, input, after_prescale, raw, total, level)); - } - } -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountCoolWriter.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountCoolWriter.cxx deleted file mode 100644 index 8294d2fb9fe5f12669ed94ccd6a4affd24808cea..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountCoolWriter.cxx +++ /dev/null @@ -1,408 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <stdexcept> - -#include "HLTRates2COOL/HLTCountCoolWriter.h" -#include "HLTRates2COOL/HLTCoolFolderSpec.h" -#include "HLTRates2COOL/HLTCounter.h" - -#include "CoolApplication/Application.h" -#include "CoolKernel/ValidityKey.h" -#include "CoolKernel/IFolder.h" -#include "CoolKernel/Exception.h" -#include "CoolKernel/IObject.h" -#include "CoolKernel/IObjectIterator.h" -#include "CoolKernel/IDatabaseSvc.h" -#include "CoralKernel/Context.h" - -#include "RelationalAccess/ConnectionService.h" -#include "RelationalAccess/IConnectionService.h" -#include "RelationalAccess/IConnectionServiceConfiguration.h" -#include "RelationalAccess/ILookupService.h" -#include "RelationalAccess/IAuthenticationService.h" -#include "RelationalAccess/IAuthenticationCredentials.h" -#include "RelationalAccess/IDatabaseServiceDescription.h" -#include "RelationalAccess/IDatabaseServiceSet.h" - -void -hltca::HLTCountCoolWriter::createSchema(bool print) { - - bool needToOpen = !dbIsOpen(); - - if(needToOpen) { - try { - openDb(false); - } - catch(cool::DatabaseDoesNotExist& e) { - m_ostream << "*** : " << e.what() << std::endl; - m_ostream << "Will create a new database: " << m_dbId << std::endl; - createDb(); - openDb(false); - } - catch(cool::Exception& e) { - m_ostream << "*** COOL exception caught: " << e.what() << std::endl; - m_ostream << "Coudn't create a new schema: " << m_dbId << std::endl; - throw; - } - } // End if(needToOpen) - - try { - m_ostream << "Creating schema '" << m_dbId << "'" << std::endl; - HLTCoolFolderSpec::createFolderStructure(m_dbPtr); - if(print) printSchema(); - } - catch(cool::Exception& e) { - m_ostream << "*** COOL exception caught: " << e.what() << std::endl; - m_ostream << "Coudn't create a new schema: " << m_dbId << std::endl; - throw; - } - if(needToOpen) { - closeDb(); - } - - return; -} - - - -//------------------------------------------------------------ -// printSchema(ostream &) -// ------------------------------------------------------------ -void -hltca::HLTCountCoolWriter::printSchema() { - - bool needToOpen = !dbIsOpen(); - - bool readonly = true; - if(needToOpen) openDb(readonly); - - HLTCoolFolderSpec::printFolderStructure(m_dbPtr, m_ostream); - - if(needToOpen) closeDb(); - - return; -} - - -//------------------------------------------------------------ -// dbIsOpen() -// ------------------------------------------------------------ -bool -hltca::HLTCountCoolWriter::dbIsOpen() { - return m_dbPtr.use_count()>0 && m_dbPtr->isOpen(); -} - - - - -cool::IDatabaseSvc& -hltca::HLTCountCoolWriter::databaseService() -{ - static cool::Application app; - return app.databaseService(); -} - -// ------------------------------------------------------------ -// dropDb() -// ------------------------------------------------------------ -void -hltca::HLTCountCoolWriter::dropDb() -{ -// m_ostream << "Dropping database '" << m_dbId << "'" << std::endl; -// try -// { -// cool::IDatabaseSvc& dbSvc = databaseService(); -// dbSvc.dropDatabase( m_dbId ); // do nothing if the database does not exist -// } - -// catch(std::exception& e) -// { -// m_ostream << "*** COOL exception caught: " << e.what() << std::endl; -// m_ostream << "Couldn't drop conditions database: " << m_dbId << std::endl; -// } - - return; -} - - -// ------------------------------------------------------------ -// openDb(bool readOnly) -// ------------------------------------------------------------ -cool::IDatabasePtr -hltca::HLTCountCoolWriter::openDb( bool readOnly ) -{ - if(dbIsOpen()) - return m_dbPtr; - - cool::IDatabaseSvc& dbSvc = databaseService(); - - try { - m_ostream << "Opening database '" << m_dbId << "'" << std::endl; - m_dbPtr = dbSvc.openDatabase( m_dbId, readOnly ); // If the database does not exist, an exception is thrown - return m_dbPtr; - } - catch(cool::DatabaseDoesNotExist& e) { - if(readOnly) { - m_ostream << "Database '" << m_dbId << "' does not exist" << std::endl; - throw; - } - else { - m_ostream << "Database '" << m_dbId << "' does not exist, try to create it" << std::endl; - m_dbPtr = dbSvc.createDatabase( m_dbId ); - m_ostream << "Created DB" << std::endl; - return m_dbPtr; - } - } - catch(cool::Exception& e) { - m_ostream << "*** COOL exception caught: " << e.what() << std::endl; - m_ostream << "Couldn't open database " << m_dbId << std::endl; - throw; - } -} - - - - -// ------------------------------------------------------------ -// closeDb() -// ------------------------------------------------------------ -void -hltca::HLTCountCoolWriter::closeDb() -{ - if(dbIsOpen()) { - try { - m_ostream << "Closing database '" << m_dbId << std::endl; - m_dbPtr->closeDatabase(); - } - catch(std::exception& e) { - m_ostream << "*** COOL exception caught: " << e.what() << std::endl - << "Couldn't close conditions database: " << m_dbId << std::endl; - } - } - return; -} - - - -//------------------------------------------------------------ -// createDb() -// ------------------------------------------------------------ -cool::IDatabasePtr -hltca::HLTCountCoolWriter::createDb() -{ - m_ostream << "Creating database '" << m_dbId << "'" << std::endl; - try - { - cool::IDatabaseSvc& dbSvc = databaseService(); - m_dbPtr = dbSvc.createDatabase( m_dbId ); - } - catch(std::exception& e) - { - m_ostream << "*** COOL exception caught: " << e.what() << std::endl; - m_ostream << "Coudn't create a new conditions database: " << m_dbId << std::endl; - throw; - } - - return m_dbPtr; -} - - - -void -hltca::HLTCountCoolWriter::rangeInfo(const std::string& content, - cool::ValidityKey since, - cool::ValidityKey until) -{ - - if(since==cool::ValidityKeyMin && until==cool::ValidityKeyMax) { - std::cout << "Writing " << content - << " for infinite range [0,oo]" - << std::endl; - return; - } - - unsigned long long lb[2]; - unsigned long long run[2]; - - lb[0] = since & 0xFFFFFFFF; - lb[1] = until & 0xFFFFFFFF; - - run[0] = since>>32; - run[0] &= 0x7FFFFFFF; - run[1] = until>>32; - run[1] &= 0x7FFFFFFF; - - if(lb[0]==0 && lb[1]==0) { - unsigned int first = run[0]; - unsigned int last = run[1]-1; - if(first==last) { - std::cout << "IOV Info: writing " << content - << " for run " << first - << std::endl; - } else { - std::cout << "IOV Info: writing " << content - << " for run range [" << first << "," << last << "]" - << std::endl; - } - } - else { - if(run[0]==run[1]) { - if(lb[0]==lb[1]-1) { - std::cout << "IOV Info: writing " << content - << " for run " << run[0] - << " and LB " << lb[0] - << std::endl; - } else { - std::cout << "IOV Info: writing " << content - << " for run " << run[0] - << " and LB range [" << lb[0] << "," << lb[1]-1 << "]" - << std::endl; - } - } else { - std::cout << "IOV Info: writing " << content - << " for range [" << run[0] << "/" - << lb[0] << "," << run[1] << "/" << lb[1] << "[" - << std::endl; - } - } -} - -void -hltca::HLTCountCoolWriter::writeHLTCountersPayload(unsigned int runNumber, - unsigned int lumiblockNumber, - const std::vector< HLTCounter>& counters, - HLTCounter::TriggerLevel level) -{ - bool infiniteRange = (runNumber & 0x80000000) != 0; // highest bin==1 indicates infinite run range to be set (would not give valid iov anyway) - cool::ValidityKey since(runNumber); - cool::ValidityKey until(runNumber); - if(infiniteRange) { - since = cool::ValidityKeyMin; - until = cool::ValidityKeyMax; - } else { - since <<= 32; - until <<= 32; - since += lumiblockNumber; - until += lumiblockNumber+1; - } - - bool needToOpen = !dbIsOpen(); - if(needToOpen) openDb(false); - HLTCoolFolderSpec::createFolderStructure(m_dbPtr); // just in case it doesn't exist - writeHLTCountersPayload( since, until, counters, level ); - if(needToOpen) closeDb(); -} - - -void -hltca::HLTCountCoolWriter::writeHLTCountersPayload( cool::ValidityKey since, - cool::ValidityKey until, - const std::vector<HLTCounter>& counters, - HLTCounter::TriggerLevel level) -{ - - bool needToOpen = !dbIsOpen(); - if(needToOpen) openDb(false); - - // writing configuration keys and prescales - try { - - unsigned char packingFormat(1); - - if(level==HLTCounter::L2 || level==HLTCounter::BOTH) { - rangeInfo("L2 counts", since, until); - cool::IFolderPtr l2CountersFolder = HLTCoolFolderSpec::getL2CountersFolder(m_dbPtr); - cool::Record l2payload = HLTCoolFolderSpec::createHLTCountersPayload( packingFormat, counters, HLTCounter::L2); - l2CountersFolder->storeObject(since, until, l2payload, 0); - } - - if(level==HLTCounter::EF || level==HLTCounter::BOTH) { - rangeInfo("EF counts", since, until); - cool::IFolderPtr efCountersFolder = HLTCoolFolderSpec::getEFCountersFolder(m_dbPtr); - cool::Record efpayload = HLTCoolFolderSpec::createHLTCountersPayload( packingFormat, counters, HLTCounter::EF); - efCountersFolder->storeObject(since, until, efpayload, 0); - } - - } - catch( cool::Exception & e) { - m_ostream << "Caught cool::Exception: " << e.what() << std::endl; - if(counters.size()>0) { - m_ostream << "Failed to write "<<(*counters.begin()).level()<<" counters to COOL" << std::endl; - } else { - m_ostream << "Failed to write "<<(*counters.begin()).level()<<" counters to COOL" << std::endl; - } - throw; - } - catch(std::exception & e) { - m_ostream << "Caught std::exception: " << e.what() << std::endl; - m_ostream << "Failed to write counters to COOL" << std::endl; - throw; - } - - if(needToOpen) closeDb(); -} - - -bool -hltca::HLTCountCoolWriter::readHLTCountersPayload(unsigned int runNumber, - unsigned int lumiblockNumber, - std::vector< HLTCounter>& counters, - HLTCounter::TriggerLevel level) -{ - - counters.clear(); - - cool::ValidityKey pointInTime(runNumber); - pointInTime <<= 32; - pointInTime += lumiblockNumber; - - bool needToOpen = !dbIsOpen(); - if(needToOpen) openDb(true); - - // writing configuration keys and prescales - try { - - cool::IFolderPtr f; - if(level==HLTCounter::L2) { - f = HLTCoolFolderSpec::getL2CountersFolder(m_dbPtr); - } else if(level==HLTCounter::EF) { - f = HLTCoolFolderSpec::getEFCountersFolder(m_dbPtr); - } else { - return false; - } - - cool::IObjectPtr o = f->findObject( pointInTime, 0); - const cool::IRecord& payload = o->payload(); - HLTCoolFolderSpec::readHLTCountersPayload(payload, counters, level); - - } - catch( cool::Exception & e) { - m_ostream << "Caught cool::Exception: " << e.what() << std::endl; - m_ostream << "Failed to read counters from COOL" << std::endl; - throw; - } - catch(std::exception & e) { - m_ostream << "Caught std::exception: " << e.what() << std::endl; - m_ostream << "Failed to read counters to COOL" << std::endl; - throw; - } - - if(needToOpen) closeDb(); - return true; -} - - - -void -hltca::HLTCountCoolWriter::setupStorageBuffers() { - HLTCoolFolderSpec::getL2CountersFolder(m_dbPtr)->setupStorageBuffer(); - HLTCoolFolderSpec::getEFCountersFolder(m_dbPtr)->setupStorageBuffer(); -} - -void -hltca::HLTCountCoolWriter::flushStorageBuffers() { - HLTCoolFolderSpec::getL2CountersFolder(m_dbPtr)->flushStorageBuffer(); - HLTCoolFolderSpec::getEFCountersFolder(m_dbPtr)->flushStorageBuffer(); -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountOHReceiver.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountOHReceiver.cxx deleted file mode 100644 index 7b0cc98e53a4dc89fc3463f8847258528137d677..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountOHReceiver.cxx +++ /dev/null @@ -1,182 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - - -#include "HLTRates2COOL/HLTCounter.h" -#include "HLTRates2COOL/HLTCountOHReceiver.h" -#include "HLTRates2COOL/HLTCountCoolWriter.h" - -#include "CoolKernel/DatabaseId.h" -#include "CoolKernel/Exception.h" -#include "CoolKernel/IDatabaseSvc.h" -#include "CoolKernel/IDatabase.h" -#include "CoolKernel/IFolder.h" -#include "CoolKernel/IObject.h" - -#include <ipc/core.h> - -#include <owl/regexp.h> -// OH include files -#include <oh/OHRootReceiver.h> -#include <oh/OHSubscriber.h> -//IS -#include <is/infoT.h> -#include <is/infodictionary.h> -#include <is/infoiterator.h> -#include <is/infodynany.h> - -#include "TH2I.h" - -using namespace std; - -//todo need run number!!! - -hltca::HLTCountOHReceiver::HLTCountOHReceiver() -{ - // 6000 is the current maximum of LB's in one run - m_countStore[0].resize(6000); - m_countStore[1].resize(6000); -} - - -void -hltca::HLTCountOHReceiver::receive( OHRootHistogram & h) { - //ERS_LOG( std::endl << "Receive histogram '" << h.getObject()->GetName() << "' with tag '" << h.tag << "'"); - if(h.tag<=0) { - // ERROR - } else { - updateInternalStore(h); - } -} - - - -void -hltca::HLTCountOHReceiver::updateInternalStore(const OHRootHistogram & h) { - - // ERS_LOG (std::endl - // << " name : " << h.histogram->GetName() << std::endl - // << " title : " << h.histogram->GetTitle() << std::endl - // << " tag/lb: " << h.tag); - - // get the trigger level - unsigned int level = 0; - std::string histoname(h.histogram->GetName()); - if( histoname.find("TrigSteer_EF") != std::string::npos) { - level=1; - } else if( histoname.find("TrigSteer_L2") == std::string::npos) { - hltca::HLTCountReceivingIssue issue(ERS_HERE,std::string("Did not find TrigSteer_L2/EF in the name of the histogram: ")+histoname, "Test"); - ers::warning(issue); - return; - } - - // store the histogram ( - // - first time: clone - // - second time: update, if statistic increased - unsigned int lb = (unsigned int)h.tag; - TH2I* hist2d = (TH2I*)h.histogram.get(); - Stat_t hsum = hist2d->GetSum(); - std::cout << " " << (level==0?"L2":"EF") << " sum for lb " << lb << " : " << hsum << std::endl; - - Content& content = m_countStore[level][lb]; - if(content.h==0) { - std::string newname(Form("SignatureAcceptance_%s_%i_store", (level==0?"L2":"EF"), lb)); - content.h = (TH2I*) h.histogram->Clone(newname.c_str()); - content.h->SetDirectory(0); - content.filled= true; - content.valid = false; - } else { - if( hsum > content.h->GetSum() ) { - CopyHistContent(*hist2d,*content.h); - content.valid = false; - } else if (hsum < content.h->GetSum()) { - // this just means that some notes have already moved farther ahead and are starting to delete this lumiblock - } else { - // No changes - } - } - - // for the first histos some initialization has to be done - if(!HLTCounter::hasBinsSet()) - HLTCounter::setBins(h.histogram->GetYaxis()); - - if(m_chainCounters[level].size()==0) { - SetChainCounterBins(h.histogram->GetXaxis(),level); - } - -} - -void -hltca::HLTCountOHReceiver::SetChainCounterBins(TAxis *axis, int level) { - int n(axis->GetLast()); - m_chainCounters[level].resize(n+1,0); - for(int i=1; i<=n; ++i) { - const char * p(axis->GetBinLabel(i)); // label has the form "<ChainName>_ChCo_<chaincounter>" - if(*p!='L' and *p!='E') continue; - const char * u(p); - while(*++p!='\0') if(*p=='_') u=p; - int cc = atoi(++u); - m_chainCounters[level][i] = cc; - } -} - -void -hltca::HLTCountOHReceiver::CopyHistContent(const TH2& src, TH2& dest) { - if(src.GetNbinsX()!=dest.GetNbinsX()) { - hltca::HLTCountReceivingIssue issue(ERS_HERE, "Updated histogram has different number of bins in X, will not use it"); - ers::error(issue); - return; - } - if(src.GetNbinsY()!=dest.GetNbinsY()) { - hltca::HLTCountReceivingIssue issue(ERS_HERE, "Updated histogram has different number of bins in Y, will not use it"); - ers::error(issue); - return; - } - for(Int_t x=src.GetNbinsX()+1; x>=0; --x) - for(Int_t y=src.GetNbinsY()+1; y>=0; --y) - dest.SetBinContent(x,y,src.GetBinContent(x,y)); -} - - -// accessor to the store -const vector<hltca::HLTCounter>& -hltca::HLTCountOHReceiver::hltCounters(int lumiblock, HLTCounter::TriggerLevel level) { - int levelIndex = (level==HLTCounter::L2)?0:1; - Content& c = m_countStore[levelIndex][lumiblock]; - updateHLTCounters(c, level); - std::cout << "After updating LB " << lumiblock << " (level " << ((level==HLTCounter::L2)?"2":"3") << "): " << c.sum << std::endl; - return c.counters; -} - -void -hltca::HLTCountOHReceiver::updateHLTCounters(Content& c, HLTCounter::TriggerLevel level) { - if(!c.filled || c.valid) return; // either not filled or already up-to-date - int levelIndex = (level==HLTCounter::L2)?0:1; - c.counters.clear(); - for(int binx = 1; binx <= c.h->GetNbinsX(); binx++) { - int chain_counter = m_chainCounters[levelIndex][binx]; - if(chain_counter==0) continue; // groups and streams - c.counters.push_back(HLTCounter(chain_counter,level)); - c.counters.back().setContent(c.h, binx); - } - c.sum=c.h->GetSum(); - c.valid=true; -} - -void -hltca::HLTCountOHReceiver::ClearStorage() { - for(int i=0; i<2; ++i) { - m_countStore[i].clear(); - m_chainCounters[i].clear(); - m_countStore[i].resize(6000); - } -} - -int -hltca::HLTCountOHReceiver::last_LB() const { - int testlb = m_countStore[0].size()-1; - while(testlb>=0 && !m_countStore[0][testlb].filled) testlb--; - return testlb; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCounter.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCounter.cxx deleted file mode 100644 index bdaec7df2e6f4e2639cc0a9154b49a66279bf112..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCounter.cxx +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "HLTRates2COOL/HLTCounter.h" - -#include "TAxis.h" -#include "TH2.h" - -int hltca::HLTCounter::s_inputbin = 0; -int hltca::HLTCounter::s_afterPSbin = 0; -int hltca::HLTCounter::s_rawbin = 0; -int hltca::HLTCounter::s_totalbin = 0; - -bool -hltca::HLTCounter::hasBinsSet() { - return s_inputbin != 0; -} - -bool -hltca::HLTCounter::setBins(TAxis * axis) { - int lastbin = axis->GetLast(); - s_inputbin = axis->FindBin("input"); - s_afterPSbin = axis->FindBin("!PS rate"); - s_rawbin = axis->FindBin("raw rate"); - s_totalbin = axis->FindBin("total rate"); - if(s_inputbin>lastbin) { - // ERROR - return false; - } - if(s_afterPSbin>lastbin) { - // ERROR - return false; - } - if(s_rawbin>lastbin) { - // ERROR - return false; - } - if(s_totalbin>lastbin) { - // ERROR - return false; - } - return true; -} - -namespace { - int round_to_int(double v) { - return int(v+0.5); - } -} - -void -hltca::HLTCounter::setContent(const TH2* h, int binx) { - m_input = round_to_int(h->GetBinContent(binx, s_inputbin)); - m_afterPS = round_to_int(h->GetBinContent(binx, s_afterPSbin)); - m_raw = round_to_int(h->GetBinContent(binx, s_rawbin)); - m_total = round_to_int(h->GetBinContent(binx, s_totalbin)); -} - -std::ostream & hltca::operator<<(std::ostream & o, const hltca::HLTCounter & c) { - o << c.level() << " " << c.chain_counter() - << ": inp=" << c.input() - << ", aps=" << c.after_prescale() - << ", raw=" << c.raw() - << ", tot=" << c.total(); - return o; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountsArchiverRCApp.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountsArchiverRCApp.cxx deleted file mode 100644 index be7a57d526228d2b4223c9210dcf5ebfa2602ed1..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/HLTCountsArchiverRCApp.cxx +++ /dev/null @@ -1,131 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "CoolKernel/Exception.h" -#include "HLTRates2COOL/HLTCountsArchiverRCApp.h" -#include "HLTRates2COOL/HLTCountOHReceiver.h" -#include "HLTRates2COOL/HLTCounter.h" - -#include "ipc/partition.h" - -#include <oh/OHSubscriber.h> - -#include "rc/RunParams.h" - - -hltca::HLTCountsArchiverRCApp::HLTCountsArchiverRCApp(JobConfig& config, IPCPartition* part, hltca::HLTCountOHReceiver * rec) : - Controllable(), - m_jobConfig(config), - m_coolWriter(config.CoolDb()), - m_IPCPartition(part), - m_receiver(rec) -{} - -hltca::HLTCountsArchiverRCApp::~HLTCountsArchiverRCApp() noexcept -{} - - -void -hltca::HLTCountsArchiverRCApp::prepareForRun(const daq::rc::TransitionCmd&) { - std::cout << "HLTCountsArchiverRCApp::prepareForRun: CLEAR RECEIVER" << std::endl; - m_receiver->ClearStorage(); -} - -void -hltca::HLTCountsArchiverRCApp::stopArchiving(const daq::rc::TransitionCmd&) { - std::cout << "HLTCountsArchiverRCApp::stopArchiving: WRITE COOL" << std::endl; - writeToCool(); -} - - -void -hltca::HLTCountsArchiverRCApp::writeToCool() { - - int lastlb = m_receiver->last_LB(); - - if(lastlb<=0) return; // n_lb<0 -> no LB written, n_lb==0 -> LB0 writter (also not good) - - if(!getRunNumberFromIS()) return; - - bool needToOpen = !m_coolWriter.dbIsOpen(); - bool readOnly = false; - if(needToOpen) m_coolWriter.openDb(readOnly); - - try{ - m_coolWriter.createSchema(); - } catch(...) { - // just in case - } - - try { - - unsigned int n_lb = (unsigned int)lastlb; - - // enable buffered writing - m_coolWriter.setupStorageBuffers(); - - // loop over all lumiblocks - for(unsigned int lb = 1; lb <= n_lb; ++lb) { - - // loop over both levels - for(int tl=0; tl<2; ++tl ) { - HLTCounter::TriggerLevel level = tl==0?HLTCounter::L2:HLTCounter::EF; - - // get the data from the receiver by LB and trigger level - const std::vector<hltca::HLTCounter>& hltCounters = m_receiver->hltCounters(lb, level); - - // // example printout for LB 2 and L2 - // if(lb==2 && level==HLTCounter::L2) { - // for(std::vector<hltca::HLTCounter>::const_iterator it = hltCounters.begin(); - // it != hltCounters.end(); it++) { - // const HLTCounter & hltc = *it; - // std::cout << hltc << std::endl; - // } - // } - - // write to COOL (note that buffering is switched on, so writing happens only at the end) - m_coolWriter.writeHLTCountersPayload(conf().CurrentRunNumber(), lb, hltCounters, level); - } - } - - m_coolWriter.flushStorageBuffers(); - - } - catch(const cool::Exception& ex) { - std::cerr << "cool::exception: Could not write to COOL: " << ex.what() << std::endl; - return; - } - catch(const std::exception& ex) { - std::cerr << "std::exception: Could not write to COOL: " << ex.what() << std::endl; - return; - } - - if(needToOpen) m_coolWriter.closeDb(); - - return; - -} - -bool -hltca::HLTCountsArchiverRCApp::getRunNumberFromIS() { - ISInfoDictionary dict(*m_IPCPartition); - - if ( !dict.contains("RunParams.SOR_RunParams") ) { - std::cerr << "RunParams.SOR_RunParams doesn't exist" << std::endl; - return false; - } - - RunParams sor; - dict.getValue( "RunParams.SOR_RunParams", sor ); - - // https://svnweb.cern.ch/trac/atlastdaq/browser/DAQ/online/is/trunk/is/infodictionary.h - - conf().CurrentRunNumber() = sor.run_number; - - ERS_INFO("Received new run number: " << conf().CurrentRunNumber()); - - return true; -} - diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/JobConfig.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/JobConfig.cxx deleted file mode 100644 index d8fab4d76ec57a995bb609a49bc40cb5120be047..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/JobConfig.cxx +++ /dev/null @@ -1,30 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include "HLTRates2COOL/JobConfig.h" - -hltca::JobConfig::JobConfig() : - m_partitionName(""), - m_coolDb(""), - m_ISServer(""), - m_currentRunNumber(0), - m_COOLconnStat(false) -{} - -hltca::JobConfig::~JobConfig() {} - - -std::ostream& hltca::operator<<(std::ostream& os, const hltca::JobConfig& c) { - os << "Job configuration:" << std::endl - << " Partition : " << c.m_partitionName << std::endl - << " COOL connection : " << c.m_coolDb << std::endl - << " Current run number : " << c.m_currentRunNumber << std::endl - << " COOL connection status: " << (c.m_COOLconnStat?"connected":"disconnected") << std::endl - << " IS Server : " << c.m_ISServer << std::endl - << " OH Provider L2 : " << c.m_provider[0] << std::endl - << " Histogram L2 : " << c.m_histogram[0] << std::endl - << " OH Provider L2 : " << c.m_provider[1] << std::endl - << " Histogram L2 : " << c.m_histogram[1] << std::endl; - return os; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/HLTCountsArchiver.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/HLTCountsArchiver.cxx deleted file mode 100644 index 3d79b6c2f93d5b8e0146b472807ec32466a82ad5..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/HLTCountsArchiver.cxx +++ /dev/null @@ -1,160 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -#include <iostream> - -#include <boost/program_options.hpp> - -#include "HLTRates2COOL/HLTCountsArchiverRCApp.h" - - -#include "ipc/core.h" - -#include "ers/ers.h" -//#include "cmdl/cmdargs.h" - -#include <string> -#include "RunControl/Common/CmdLineParser.h" -#include "RunControl/Common/Exceptions.h" -#include "RunControl/ItemCtrl/ItemCtrl.h" - -#include <owl/regexp.h> - - -#include "HLTRates2COOL/JobConfig.h" -#include "HLTRates2COOL/HLTCountOHReceiver.h" - -// OH include files -// #include <oh/OHRootReceiver.h> -// #include <oh/OHSubscriber.h> -// #include "HLTRates2COOL/HLTCountOHReceiver.h" - -ERS_DECLARE_ISSUE (HLTCountsArchiver, ExitNow, "FATAL ERROR: ", ) - -using namespace std; -using namespace daq; - -namespace po = boost::program_options; - -int main( int argc, char ** argv ) -{ - - try { - IPCCore::init(argc,argv); - } - catch(daq::ipc::CannotInitialize& e) { - ers::fatal(e); - abort(); - } - catch(daq::ipc::AlreadyInitialized& e) { - ers::warning(e); - } - - - // *** - // define commandline parameters - // *** - - po::options_description desc("Application that writes the HLT trigger counts for each LB to COOL"); - desc.add_options() - ("cooldb,d", boost::program_options::value<std::string>(), "COOL db connection tech://schema=;dbname=\nsqlite://;schema=trigconf.db;dbname=TRIGCONF") - ("server", boost::program_options::value<std::string>(), "IS server name (default 'HistogrammingHLT')") - ("l2provider", boost::program_options::value<std::string>(), "OH provider name (default 'Top-LVL2-L2-Segment-1-Gatherer')") - ("l2hist", boost::program_options::value<std::string>(), "histogram name pattern (default '/LB/EXPERT/TrigSteer_L2/SignatureAcceptance')") - ("efprovider", boost::program_options::value<std::string>(), "OH provider name (default 'Top-EF-EBEF-Segment')") - ("efhist", boost::program_options::value<std::string>(), "histogram name pattern (default '/LB/EXPERT/TrigSteer_EF/SignatureAcceptance')"); - - - // *** - // Get commandline parameters - // *** - rc::CmdLineParser cmdParser(argc, argv, true); - - po::variables_map vm; - po::store(boost::program_options::parse_command_line(argc,argv,desc), vm); - po::notify(vm); - - hltca::JobConfig conf; - - // *** - // define job defaults - // *** - - conf.PartitionName() = cmdParser.partitionName(); - conf.CoolDb() = "sqlite://;schema=testhltcounters.db;dbname=COMP200"; - conf.ISServer() = "HistogrammingHLT"; - conf.Provider("L2") = "Top-LVL2-L2-Segment-1-Gatherer"; - conf.Histogram("L2") = "/LB/EXPERT/TrigSteer_L2/SignatureAcceptance"; - conf.Provider("EF") = "Top-EF-EBEF-Segment"; - conf.Histogram("EF") = "/LB/EXPERT/TrigSteer_EF/SignatureAcceptance"; - - - /**** - * set job configuration from command line parameters - */ - if(vm.count("cooldb")) conf.CoolDb() = vm["cooldb"].as<std::string>(); - if(vm.count("server")) conf.ISServer() = vm["server"].as<std::string>(); - if(vm.count("l2provider")) conf.Provider("L2") = vm["l2provider"].as<std::string>(); - if(vm.count("l2hist")) conf.Histogram("L2") = vm["l2hist"].as<std::string>(); - if(vm.count("efprovider")) conf.Provider("EF") = vm["efprovider"].as<std::string>(); - if(vm.count("efhist")) conf.Histogram("EF") = vm["efhist"].as<std::string>(); - - - std::cout << conf << std::endl; - - // *** - // get partition object - // *** - - IPCPartition *partition = new IPCPartition(conf.PartitionName()); - - // *** - // create the receiver and subscribe it to the desired histogram updates - // *** - - hltca::HLTCountOHReceiver * receiver = new hltca::HLTCountOHReceiver(); - - bool serialise_callbacks = true; // avoid receiving of multiple histogramms at the same time - OHSubscriber ohhs( *partition, conf.ISServer(), *receiver, serialise_callbacks ); - bool value_callback = true; // false==event_callback (calls receiver.objectChanged) - OWLRegexp provl2(conf.Provider("L2")); - OWLRegexp histl2(conf.Histogram("L2")); - ohhs.subscribe( provl2, histl2, value_callback ); // last value: subscribe for receiving histogram values (default off) - OWLRegexp provef(conf.Provider("EF")); - OWLRegexp histef(conf.Histogram("EF")); - ohhs.subscribe( provef, histef, value_callback ); // last value: subscribe for receiving histogram values (default off) - - - // *** - // run the RC application - // *** - try { - rc::ItemCtrl itemCtrl(cmdParser, - shared_ptr<rc::Controllable>(new hltca::HLTCountsArchiverRCApp(conf, partition, receiver))); - itemCtrl.init(); - itemCtrl.run(); - } - catch(daq::rc::CmdLineHelp& ex) { - cout << desc << endl; - cout << ex.message() << endl; - } - catch (const std::exception &ex) { - HLTCountsArchiver::ExitNow issue(ERS_HERE, ex); - ers::fatal(issue); - } - catch (...) { - HLTCountsArchiver::ExitNow issue(ERS_HERE, "unknown exception caught"); - ers::fatal(issue); - } - - delete receiver; - delete partition; - - std::exit (EXIT_SUCCESS); - - - - -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/HLTRatesFromCOOL.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/HLTRatesFromCOOL.cxx deleted file mode 100644 index 8423b289a227ee02372a3379d703e039c212df0c..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/HLTRatesFromCOOL.cxx +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -#include <iostream> -#include <vector> - -#include <boost/program_options.hpp> - -#include "HLTRates2COOL/HLTCountCoolWriter.h" -#include "HLTRates2COOL/HLTCounter.h" - -int main( int argc, char ** argv ) -{ - //cool connection - - unsigned int run_number = 0; - unsigned int lb_number = 2; - - boost::program_options::options_description desc("Application that writes the HLT trigger counts for each LB to COOL"); - desc.add_options() - ("help,h", "print usage and exit") - ("cooldb,d", boost::program_options::value<std::string>(), "COOL db connection ( default \"COOL_TRIGGER\")") - ("triggerpattern,t", boost::program_options::value<std::string>(), "application name") - ("run,r", boost::program_options::value<unsigned int>(&run_number)->default_value(0), "run (required)") -// ("lb,l", boost::program_options::value<unsigned int>(&lb_number), "lb") - ; - - - // *** - // Get commandline parameters - // *** - - boost::program_options::variables_map vm; - boost::program_options::store(boost::program_options::parse_command_line(argc,argv,desc), vm); - boost::program_options::notify(vm); - - if(vm.count("help")) { - std::cout << desc << std::endl; - return EXIT_SUCCESS; - } - - - std::string triggerpattern( "" ); - std::string coolConnection( "COOLONL_TRIGGER/COMP200" ); - // or "sqlite://;schema=trigconf.db;dbname=COMP200" - - if(vm.count("cooldb")) coolConnection = vm["cooldb"].as<std::string>(); - if(vm.count("triggerpattern")) triggerpattern = vm["triggerpattern"].as<std::string>(); -// if(vm.count("run")) run_number = vm["run"].as<unsigned int>(); -// if(vm.count("lb")) lb_number = vm["lb"].as<unsigned int>(); - - if(run_number == 0) { - std::cout << "run number required!" << std::endl << desc << std::endl; - return EXIT_SUCCESS; - } - - - - hltca::HLTCountCoolWriter coolWriter(coolConnection); - - std::vector<hltca::HLTCounter> counters; - - coolWriter.readHLTCountersPayload(run_number,lb_number,counters,hltca::HLTCounter::L2); - - for(std::vector<hltca::HLTCounter>::iterator it = counters.begin(); - it != counters.end(); it++) { - if (it->input()<=0) continue; - std::cout << *it << std::endl; - } - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/testHLTtoCOOL.cxx b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/testHLTtoCOOL.cxx deleted file mode 100644 index 1aa6a2e1088fcc3a97af802f1bc2d215be27a7ea..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/src/test/testHLTtoCOOL.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -#include <iostream> -#include <vector> - -#include "HLTRates2COOL/HLTCountCoolWriter.h" -#include "HLTRates2COOL/HLTCounter.h" - -int main() -{ - //cool connection - - std::string coolConnection="sqlite://;schema=testhltcounters.db;dbname=COMP200"; - - std::cout << "Creating coolWriter("<<coolConnection<<")" << std::endl; - hltca::HLTCountCoolWriter coolWriter(coolConnection); - - bool print=true; - coolWriter.createSchema(print); - - - std::vector<hltca::HLTCounter> counters; - - std::cout << std::endl << "Test writing ! " << std::endl; - - for(unsigned int i=1; i<20; i++) { - counters.push_back( hltca::HLTCounter(i,(10*i),i,(2*i),(3*i),hltca::HLTCounter::L2) ); - counters.push_back( hltca::HLTCounter(i,(10*i+3),i,(2*i),(3*i),hltca::HLTCounter::EF) ); - } - - coolWriter.writeHLTCountersPayload((unsigned int)100,(unsigned int)1,counters); - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/IS_LB.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/IS_LB.h deleted file mode 100644 index 87942f13627159ee25a94a38d0a8126ac12e7409..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/IS_LB.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef IS_LB_H -#define IS_LB_H - -#include <is/info.h> - -#include <string> -#include <vector> -#include <iostream> - -#include <ctime> - -using std::cout; -using std::endl; - -/** - * IS class to contain luminosity block information from the CTPCORE - * - * @author generated by the IS tool - * @version 07/08/07 - */ - -class IS_LB : public ISInfo { -public: - - /** - * Run number - */ - unsigned long runnumber; - - /** - * Luminosity block number - */ - unsigned short LBN; - - /** - * 0: IS entry not yet completed: still waiting for final update 1: IS entry complete for this luminosity block - */ - bool Completed; - - /** - * Starttime (second) human readable - */ - std::string Starttime; - - /** - * Starttime (second) - */ - unsigned long Starttime_sec; - - /** - * Starttime (nanosecond) - */ - unsigned long Starttime_ns; - - /** - * Stoptime (second) human readable - */ - std::string Stoptime; - - /** - * Stoptime (second) - */ - unsigned long Stoptime_sec; - - /** - * Stoptime (nanosecond) - */ - unsigned long Stoptime_ns; - - /** - * First L1ID seen by CTP - */ - unsigned long Start_L1ID; - - /** - * Last L1ID seen by CTP - */ - unsigned long Stop_L1ID; - - /** - * Number of L1A - */ - unsigned long L1A_counter; - - /** - * Number of LHC turns corresponding to the L1A counter - */ - unsigned long L1A_turns; - - /** - * Overflow bit for the L1A counter. True means: an overflow has occurred at least once for this counter False means: ok - */ - bool L1A_overflow; - - /** - * Mask of the 256 trigger items: true=enabled, false=disabled - */ - std::vector<bool> TriggerMask; - - /** - * Values of the 256 pre-scale division factors (24-bit) - */ - std::vector<unsigned long> Prescale_dividers; - - /** - * Array of 176 pattern-in-time counter values (31-bit) - */ - std::vector<unsigned long> PIT_counters; - - /** - * Array of 256 trigger-before-prescale counter values (31-bit) - */ - std::vector<unsigned long> TBP_counters; - - /** - * Array of 256 trigger-after-prescale counter values (31-bit) - */ - std::vector<unsigned long> TAP_counters; - - /** - * Array of 256 trigger-after-veto counter values (31-bit) - */ - std::vector<unsigned long> TAV_counters; - - /** - * 176 overflow bits for the PIT counters. True means: an overflow has occurred at least once for this counter False means: ok - */ - std::vector<bool> PIT_overflows; - - /** - * 256 overflow bits for the TBP counters. True means: an overflow has occurred at least once for this counter False means: ok - */ - std::vector<bool> TBP_overflows; - - /** - * 256 overflow bits for the TAP counters. True means: an overflow has occurred at least once for this counter False means: ok - */ - std::vector<bool> TAP_overflows; - - /** - * 256 overflow bits for the TAV counters. True means: an overflow has occurred at least once for this counter False means: ok - */ - std::vector<bool> TAV_overflows; - - /** - * Number of LHC turns corresponding to the set of PIT_counter values - */ - unsigned long PIT_turns; - - /** - * Number of LHC turns corresponding to the set of TBP_counter values - */ - unsigned long TBP_turns; - - /** - * Number of LHC turns corresponding to the set of TAP_counter values - */ - unsigned long TAP_turns; - - /** - * Number of LHC turns corresponding to the set of TAV_counter values - */ - unsigned long TAV_turns; - - - static const ISType & type() { - static const ISType type_ = IS_LB( ).ISInfo::type(); - return type_; - } - - IS_LB() - : ISInfo( "IS_LB" ) - { - initialize(); - } - - IS_LB( const std::string & type ) - : ISInfo( type ) - { - initialize(); - } - - ~IS_LB() - { -// <<BeginUserCode>> - -// <<EndUserCode>> - } - - void initialize() - { - LBN = 0; - Completed = 0; - PIT_overflows.resize( 1 ); - PIT_overflows[0] = 0; - TBP_overflows.resize( 1 ); - TBP_overflows[0] = 0; - TAP_overflows.resize( 1 ); - TAP_overflows[0] = 0; - TAV_overflows.resize( 1 ); - TAV_overflows[0] = 0; - - -// <<BeginUserCode>> - TBP_counters.reserve(256); - TAP_counters.reserve(256); - TAV_counters.reserve(256); - - for (int ii=0;ii<256;ii++) - { - int ihelp = 0; //ii * 256; - TBP_counters.push_back( ihelp ); - TAP_counters.push_back( ihelp ); - TAV_counters.push_back( ihelp ); - } - - Starttime_sec = std::time(0); - Stoptime_sec = std::time(0) + 2; - - L1A_counter = rand()%20; -// <<EndUserCode>> - } - - -// <<BeginUserCode>> - - void increase_counters(int factor) - { - cout << "LB: " << LBN << endl; - - cout<<" for testing increase TBP, TAP, TAV counters and turns by adding "<<factor<<endl; - - for (int ii=0;ii<256;ii++) - { - TBP_counters[ii] += factor + rand()%40; - TAP_counters[ii] += factor/2 + rand()%40; - TAV_counters[ii] += factor/4 + rand()%40; - } - - L1A_counter = rand()%75000; - - Starttime_sec = std::time(0); - Stoptime_sec = std::time(0) + 2; - cout << " TIME: start - stop: " << Starttime_sec << " - " << Stoptime_sec << endl; - } - - void setLB( int pLB ) - { - LBN = pLB; - } - -protected: - - void publishGuts( ISostream & out ) - { - out << runnumber << LBN << Completed << Starttime << Starttime_sec << Starttime_ns; - out << Stoptime << Stoptime_sec << Stoptime_ns << Start_L1ID << Stop_L1ID << L1A_counter; - out << L1A_turns << L1A_overflow << TriggerMask << Prescale_dividers << PIT_counters; - out << TBP_counters << TAP_counters << TAV_counters << PIT_overflows << TBP_overflows; - out << TAP_overflows << TAV_overflows << PIT_turns << TBP_turns << TAP_turns << TAV_turns; - } - - void refreshGuts( ISistream & in ) - { - in >> runnumber >> LBN >> Completed >> Starttime >> Starttime_sec >> Starttime_ns; - in >> Stoptime >> Stoptime_sec >> Stoptime_ns >> Start_L1ID >> Stop_L1ID >> L1A_counter; - in >> L1A_turns >> L1A_overflow >> TriggerMask >> Prescale_dividers >> PIT_counters; - in >> TBP_counters >> TAP_counters >> TAV_counters >> PIT_overflows >> TBP_overflows; - in >> TAP_overflows >> TAV_overflows >> PIT_turns >> TBP_turns >> TAP_turns >> TAV_turns; - } - -// <<EndUserCode>> -}; - -// <<BeginUserCode>> - -// <<EndUserCode>> -#endif // IS_LB_H diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/MyInfo.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/MyInfo.h deleted file mode 100644 index 4e7e0dbc2072e91eb748e1672a85fcef5b86d85d..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/MyInfo.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <is/info.h> -#include <vector> - - -class MyInfo: public ISInfo{ - public: - std::vector<float> float_a_; - std::vector<int> int_a_; - - - static const ISType & type() { - static const ISType type_ = MyInfo( ).ISInfo::type(); - return type_; - } - - MyInfo( ) - : ISInfo( "MyInfo" ) - { - initialize(); - } - - ~MyInfo(){ - } - - protected: - - - MyInfo( const std::string & type ) - : ISInfo( type ) - { - initialize(); - } - - void publishGuts( ISostream & out ){ - out << float_a_<<int_a_; - } - - void refreshGuts( ISistream & in ){ - in >> float_a_>>int_a_; - - } - - private: - void initialize() - { - - - float_a_.resize( 6 ); - float_a_[0] = .0; - float_a_[1] = .1; - float_a_[2] = .2; - float_a_[3] = .3; - float_a_[4] = .4; - float_a_[5] = .5; - - - - int_a_.resize( 6 ); - int_a_[0] = 1; - int_a_[1] = 2; - int_a_[2] = 3; - int_a_[3] = 4; - int_a_[4] = 5; - int_a_[5] = 6; - - } - -}; diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/TestRunNumber.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/TestRunNumber.h deleted file mode 100644 index 1b4cfe8990f2f9ca3314edc599b7049e6bedfc2c..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/TestRunNumber.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - - -#include <is/namedinfo.h> -#include <string> -#include <ostream> -#include <iostream> -#include <vector> -using namespace std; - -class TestRunNumber : public ISNamedInfo { - public: - unsigned int runnr; - std::string name; - static const ISType & type() { - static const ISType type_ = TestRunNumber( IPCPartition(), "" ).ISInfo::type(); - return type_; - } - - virtual std::ostream & print( std::ostream & out ) const { - ISNamedInfo::print( out ); - out << "runnr: " << runnr << " //Runnr " << std::endl; - return out; - } - - TestRunNumber( const IPCPartition & partition, const std::string & name ) - : ISNamedInfo( partition, name, "RunNumber" ) - { - initialize(); - } - - ~TestRunNumber(){ - - // <<BeginUserCode>> - - // <<EndUserCode>> - } - - - protected: - TestRunNumber( const IPCPartition & partition, const std::string & name, const std::string & type ) - : ISNamedInfo( partition, name, type ) - { - initialize(); - } - - void publishGuts( ISostream & out ){ - std::cout<<" hello from publishGuts "<<endl; - out << name << runnr <<endl; - } - - void refreshGuts( ISistream & in ){ - cout<<" hello from refreshGuts "<<endl; - in >> name >> runnr ; - - } - - - private: - void initialize() - { - this -> name = "Defaulname"; - runnr=99999; - - // <<BeginUserCode>> - - // <<EndUserCode>> - } - - - // <<BeginUserCode>> - - // <<EndUserCode>> -}; -/* -inline std::ostream & operator<<( std::ostream & out, const TestRunNumber & info ) { - info.print( out ); - return out; -} -*/ diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/TestRunNumber2.h b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/TestRunNumber2.h deleted file mode 100644 index feda61d1e909d5467054b6762c307921b987b54d..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/TestRunNumber2.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TESTRUNNUMBER2_H -#define TESTRUNNUMBER2_H - -#include <is/info.h> -#include <is/namedinfo.h> - -#include <string> -#include <vector> -#include <iostream> - -#include <ctime> - -using std::cout; -using std::endl; - -/** - * IS class to contain luminosity block information from the CTPCORE - * - * @author generated by the IS tool - * @version 07/08/07 - */ - -class TestRunNumber2 : public ISNamedInfo { -public: - - /** - * Run number - */ - unsigned int runnumber; - std::string name; - - static const ISType & type() { - static const ISType type_ = TestRunNumber2( IPCPartition(), "" ).ISInfo::type(); - return type_; - } - - TestRunNumber2 ( const IPCPartition & partition, const std::string & name ) - : ISNamedInfo( partition, name, "TestRunNumber2" ) - { - initialize(); - } - - - - ~TestRunNumber2() - { - // <<BeginUserCode>> - - // <<EndUserCode>> - } - - void initialize() - { - -// <<EndUserCode>> - } - - - -protected: - TestRunNumber2( const IPCPartition & partition, const std::string & name, const std::string & type ) - : ISNamedInfo( partition, name, type ) - { - initialize(); - } - - void publishGuts( ISostream & out ) - { - out << runnumber << name; - - } - - void refreshGuts( ISistream & in ) - { - in >> runnumber >> name; - } - - // <<EndUserCode>> -}; - -// <<BeginUserCode>> - -// <<EndUserCode>> -#endif // TESTRUNNUMBER2_H diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/create_info.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/create_info.cpp deleted file mode 100644 index 8e883a39ed2f89bfb648a5b5b09396282f7a01de..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/create_info.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -//////////////////////////////////////////////////////////////////////// -// create_info.cc -// -// Test application for the IS library -// -// Sergei Kolos, January 2002 -// -// description: -// Test the functionality of the ISNamedInfo class -// -//////////////////////////////////////////////////////////////////////// - -#include <iostream> - -#include <ers/ers.h> -#include <cmdl/cmdargs.h> -#include <ipc/core.h> - -#include <is/PersonNamed.h> -#include <is/EmployeeNamed.h> -#include <is/infodynany.h> -//#include "TestRunNumber.h" -//#include "IS_LB.h" -#include "TestRunNumber2.h" - - -void print_dynany( std::ostream & out, const ISInfoDynAny & any ) -{ - for ( size_t i = 0; i < any.getAttributesNumber(); ++i ) - { - if ( any.isAttributeArray( i ) ) - { - switch ( any.getAttributeType( i ) ) - { - case ISType::Boolean : { std::vector<bool> value = any.getAttributeValue<std::vector<bool> >( i ); out << value << " "; break; } - case ISType::S8 : { std::vector<char> value = any.getAttributeValue<std::vector<char> >( i ); out << value << " "; break; } - case ISType::U8 : { std::vector<unsigned char> value = any.getAttributeValue<std::vector<unsigned char> >( i ); out << value << " "; break; } - case ISType::S16 : { std::vector<short> value = any.getAttributeValue<std::vector<short> >( i ); out << value << " "; break; } - case ISType::U16 : { std::vector<unsigned short> value = any.getAttributeValue<std::vector<unsigned short> >( i ); out << value << " "; break; } - case ISType::S32 : { std::vector<int> value = any.getAttributeValue<std::vector<int> >( i ); out << value << " "; break; } - case ISType::U32 : { std::vector<unsigned int> value = any.getAttributeValue<std::vector<unsigned int> >( i ); out << value << " "; break; } - case ISType::S64 : { std::vector<int64_t> value = any.getAttributeValue<std::vector<int64_t> >( i ); out << value << " "; break; } - case ISType::U64 : { std::vector<uint64_t> value = any.getAttributeValue<std::vector<uint64_t> >( i ); out << value << " "; break; } - case ISType::Float : { std::vector<float> value = any.getAttributeValue<std::vector<float> >( i ); out << value << " "; break; } - case ISType::Double : { std::vector<double> value = any.getAttributeValue<std::vector<double> >( i ); out << value << " "; break; } - case ISType::String : { std::vector<std::string> value = any.getAttributeValue<std::vector<std::string> >( i ); out << value << " "; break; } - case ISType::Date : { std::vector<OWLDate> value = any.getAttributeValue<std::vector<OWLDate> >( i ); out << value << " "; break; } - case ISType::Time : { std::vector<OWLTime> value = any.getAttributeValue<std::vector<OWLTime> >( i ); out << value << " "; break; } - case ISType::InfoObject : { std::vector<ISInfoDynAny> value = any.getAttributeValue<std::vector<ISInfoDynAny> >( i ); - for( size_t j = 0; j < value.size(); ++j ) print_dynany( out, value[j] ); break; } - default : ERS_ASSERT( false ); //must not happen - } - } - else - { - switch ( any.getAttributeType( i ) ) - { - case ISType::Boolean : { bool value = any.getAttributeValue<bool>( i ); out << value << " "; break; } - case ISType::S8 : { char value = any.getAttributeValue<char>( i ); out << value << " "; break; } - case ISType::U8 : { unsigned char value = any.getAttributeValue<unsigned char>( i ); out << value << " "; break; } - case ISType::S16 : { short value = any.getAttributeValue<short>( i ); out << value << " "; break; } - case ISType::U16 : { unsigned short value = any.getAttributeValue<unsigned short>( i ); out << value << " "; break; } - case ISType::S32 : { int value = any.getAttributeValue<int>( i ); out << value << " "; break; } - case ISType::U32 : { unsigned int value = any.getAttributeValue<unsigned int>( i ); out << value << " "; break; } - case ISType::S64 : { int64_t value = any.getAttributeValue<int64_t>( i ); out << value << " "; break; } - case ISType::U64 : { uint64_t value = any.getAttributeValue<uint64_t>( i ); out << value << " "; break; } - case ISType::Float : { float value = any.getAttributeValue<float>( i ); out << value << " "; break; } - case ISType::Double : { double value = any.getAttributeValue<double>( i ); out << value << " "; break; } - case ISType::String : { std::string value = any.getAttributeValue<std::string>( i ); out << value << " "; break; } - case ISType::Date : { OWLDate value = any.getAttributeValue<OWLDate>( i ); out << value << " "; break; } - case ISType::Time : { OWLTime value = any.getAttributeValue<OWLTime>( i ); out << value << " "; break; } - case ISType::InfoObject : { ISInfoDynAny value = any.getAttributeValue<ISInfoDynAny>( i ); print_dynany( out, value ); break; } - default : ERS_ASSERT( false ); //must not happen - } - } - } - out << std::endl; -} - -void set_values( const ISInfoDynAny & any ) -{ - for ( size_t i = 0; i < any.getAttributesNumber(); ++i ) - { - if ( any.isAttributeArray( i ) ) - { - switch ( any.getAttributeType( i ) ) - { - case ISType::Boolean : { any.setAttributeValue<std::vector<bool> >( i, std::vector<bool>() ); break; } - case ISType::S8 : { any.setAttributeValue<std::vector<char> >( i, std::vector<char>()); break; } - case ISType::U8 : { any.setAttributeValue<std::vector<unsigned char> >( i, std::vector<unsigned char>()); break; } - case ISType::S16 : { any.setAttributeValue<std::vector<short> >( i, std::vector<short>()); break; } - case ISType::U16 : { any.setAttributeValue<std::vector<unsigned short> >( i, std::vector<unsigned short>()); break; } - case ISType::S32 : { any.setAttributeValue<std::vector<int> >( i, std::vector<int>()); break; } - case ISType::U32 : { any.setAttributeValue<std::vector<unsigned int> >( i, std::vector<unsigned int>()); break; } - case ISType::S64 : { any.setAttributeValue<std::vector<int64_t> >( i, std::vector<int64_t>()); break; } - case ISType::U64 : { any.setAttributeValue<std::vector<uint64_t> >( i, std::vector<uint64_t>()); break; } - case ISType::Float : { any.setAttributeValue<std::vector<float> >( i, std::vector<float>()); break; } - case ISType::Double : { any.setAttributeValue<std::vector<double> >( i, std::vector<double>()); break; } - case ISType::String : { any.setAttributeValue<std::vector<std::string> >( i, std::vector<std::string>()); break; } - case ISType::Date : { any.setAttributeValue<std::vector<OWLDate> >( i, std::vector<OWLDate>() ); break; } - case ISType::Time : { any.setAttributeValue<std::vector<OWLTime> >( i, std::vector<OWLTime>() ); break; } - case ISType::InfoObject : { std::vector<ISInfoDynAny> value = any.getAttributeValue<std::vector<ISInfoDynAny> >( i ); - for( size_t j = 0; j < value.size(); ++j ) set_values( value[j] ); - any.setAttributeValue<std::vector<ISInfoDynAny> >( i, value ); - break; } - default : ERS_ASSERT( false ); //must not happen - } - } - else - { - switch ( any.getAttributeType( i ) ) - { - case ISType::Boolean : { any.setAttributeValue<bool>( i, true ); break; } - case ISType::S8 : { any.setAttributeValue<char>( i, i ); break; } - case ISType::U8 : { any.setAttributeValue<unsigned char>( i, i ); break; } - case ISType::S16 : { any.setAttributeValue<short>( i, i ); break; } - case ISType::U16 : { any.setAttributeValue<unsigned short>( i, i ); break; } - case ISType::S32 : { any.setAttributeValue<int>( i, i ); break; } - case ISType::U32 : { any.setAttributeValue<unsigned int>( i, i ); break; } - case ISType::S64 : { any.setAttributeValue<int64_t>( i, i ); break; } - case ISType::U64 : { any.setAttributeValue<uint64_t>( i, i ); break; } - case ISType::Float : { any.setAttributeValue<float>( i, i ); break; } - case ISType::Double : { any.setAttributeValue<double>( i, i ); break; } - case ISType::String : { any.setAttributeValue<std::string>( i, "TEST SET VALUE" ); break; } - case ISType::Date : { any.setAttributeValue<OWLDate>( i, OWLDate() ); break; } - case ISType::Time : { any.setAttributeValue<OWLTime>( i, OWLTime() ); break; } - case ISType::InfoObject : { ISInfoDynAny tmp( any.getAttributeValue<ISInfoDynAny >( i ).type() ); - set_values( tmp ); any.setAttributeValue<ISInfoDynAny >( i, tmp ); break; } - default : ERS_ASSERT( false ); //must not happen - } - } - } -} - -int main(int argc, char ** argv) -{ - try { - IPCCore::init( argc, argv ); - } - catch( daq::ipc::Exception & ex ) { - is::fatal( ex ); - } - - // Declare arguments - CmdArgStr partition_name('p', "partition", "partition-name", "partition to work in."); - CmdArgStr person_name('P', "names", "name", "name of information to create.", CmdArg::isREQ); - CmdArgStr employee_name('E', "names", "name", "name of information to create.", CmdArg::isREQ); - CmdArgStr server_name('n', "server", "server-name", "server to work with.",CmdArg::isREQ); - - // Declare command object and its argument-iterator - CmdLine cmd(*argv, &partition_name, &server_name, &person_name, &employee_name, NULL); - CmdArgvIter arg_iter(--argc, ++argv); - - cmd.description("This program implements fanctionality tests for the Information Service.\n" - "It creates, updates and deletes information objects."); - - // Parse arguments - cmd.parse(arg_iter); - - IPCPartition p(partition_name); - - std::string name2(server_name); - name2 += ".RunParams"; - TestRunNumber2 rr(p,name2); - rr.runnumber=12345; - rr.name="run_number"; - - try - { - ISInfoDictionary id( p ); - rr.checkin("hello"); - std::cout << "Checkin successfull " << std::endl; - - // - ISInfoDynAny ida1; - id.getValue( name2, ida1 ); - std::cout << "getValue for the " << name2 << " successfull " << std::endl << ida1 << std::endl; - - } - - catch( daq::is::Exception & ex ) - { - is::fatal( ex ); - } - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/debughist.root b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/debughist.root deleted file mode 100644 index 7af852c0934f89c87e479f10921a58e44726e9f4..0000000000000000000000000000000000000000 Binary files a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/debughist.root and /dev/null differ diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_data.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_data.cpp deleted file mode 100644 index 389535a3834cc8cbde13280246239d53858f19cf..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_data.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file publish_test_data.cpp - * @author Andrzej Dworak andrzej.dworak@cern.ch - * @date 13/08/2007 - * @brief Dummy data ganarator. Publishing through IS. - */ - -#include <iostream.h> -#include <ipc/core.h> - -#include "is/infoany.h" -#include <is/infoT.h> -#include <is/infodictionary.h> -#include <is/infoiterator.h> -#include <is/inforeceiver.h> -#include <is/serveriterator.h> -#include <ipc/partition.h> -#include "is/infodocument.h" - -#include "MyInfo.h" -#include "IS_LB.h" - -using namespace std; -int main( int argc, char ** argv ) -{ - - string testPartition = "MyTestPartition"; - string subscription = "MyTest.LB_"; - - - cout << "Publishing data for new IS_LB 2007/08/27" << endl; - IPCCore::init( argc, argv ); - - IPCPartition partition( testPartition ); - - ISInfoDictionary dict( partition ); - - char pubname[100]; - - - IS_LB lvl1info; - ISInfo *ptrlvl1; - ptrlvl1= & lvl1info; - - for ( int lb=0; lb<1000000; lb++ ) - { - - lvl1info.setLB( lb ); - - cout << "LB: " << lb << endl; - - try - { - sprintf( pubname, "%s%d", subscription.c_str(), lb ); - dict.insert( pubname , * ptrlvl1 ); - cout << " published lvl1 example " << pubname << endl; - } - catch(...) - { - sprintf( pubname, "%s%d", subscription.c_str(), lb ); - dict.update( pubname , * ptrlvl1 ); - cout<<" lvl1 example was already published, update it!" << pubname << endl; - } - - int updateTimes = random()%10 + 1; - for(int i=0;i<updateTimes;i++) - { - cout << endl << "loopp update no. " << i << endl; - - //update is_lb info - lvl1info.increase_counters( 10 ); - - sprintf( pubname, "%s%d", subscription.c_str(), lb ); - dict.update( pubname , * ptrlvl1, true ); - cout << " update lvl1 example " << pubname << endl; - - sleep( 2 ); - } - } - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_histo.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_histo.cpp deleted file mode 100644 index 02f6214b1460add0ca624fb88fe33e03361f5414..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_histo.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file publish_test_data.cpp - * @author Andrzej Dworak andrzej.dworak@cern.ch - * @date 13/08/2007 - * @brief Dummy data ganarator. Publishing through IS. - */ - -#include <iostream.h> -#include <ipc/core.h> - - -//#include "is/infoany.h" -//#include <is/infoT.h> -//#include <is/infodictionary.h> -//#include <is/infoiterator.h> -//#include <is/inforeceiver.h> -//#include <is/serveriterator.h> -#include <ipc/partition.h> -//#include "is/infodocument.h" - -#include <TH1F.h> -#include <oh/OHRootProvider.h> -#include <oh/OHRootReceiver.h> - -#include <map> - - -using namespace std; -int main( int argc, char ** argv ) -{ - - string testPartition = "MyTestPartition"; - string server_name = "Histogramming"; - string provider_name= "MyTest"; - string histogram_name ="testhisto"; - - IPCCore::init( argc, argv ); - IPCPartition partition( testPartition ); - OHRootProvider * provider = 0; - try - { - provider = new OHRootProvider( partition, server_name, provider_name ); - } - catch( daq::oh::Exception & ex ) - { - ers::fatal( ex ); - return 1; - } - - - TH1 * histo = 0; - histo =new TH1F("testhisto","testhisto",100,0.,2.); - - // create DrawOption annotation if wanted - std::vector< std::pair<std::string,std::string> > ann; - //if (drawoption.isNULL()) - ann=oh::util::EmptyAnnotation; - //else { - //ann.resize(1); - //ann[0].first="DrawOption"; - //ann[0].second=drawoption; - // } - - int n_publish=0; - for ( int lb=0; lb<1000; lb++ ) - { - n_publish++; - try - { - histo->Fill((float) lb); - std::string name;std::string tmpstring; - tmpstring=Form(histogram_name.c_str()); tmpstring += "_%i"; - name=Form(tmpstring.c_str(),lb); - cout<<" name ? "<<name<<endl; - provider -> publish( *histo, name, n_publish, ann ); - cout << n_publish<<" published histo example " << name << endl; - } - catch(...) - { - cout<<" could not publish histogram! "<<endl; - } - - int updateTimes = random()%10 + 1; - for(int i=0;i<updateTimes;i++) - { - - cout << endl << "loop update no. " << i << endl; - try{ - histo->Fill((float)lb); - n_publish++; - std::string name;std::string tmpstring; - tmpstring=Form(histogram_name.c_str()); tmpstring += "_%i"; - name=Form(tmpstring.c_str(),lb); - cout<<" name ? "<<name<<endl; - provider -> publish( *histo, name, n_publish, ann ); - cout << n_publish<<" published histo example " << name << endl; - } - catch(...) - { - cout<<" could not publish histogram! "<<endl; - } - sleep( 5 ); - } - } - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_histo2.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_histo2.cpp deleted file mode 100644 index 66afc26316131f7d75199eae58b703b1c6687c89..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_histo2.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream> -using namespace std; - -// ROOT include files -#include "TH2.h" -#include "TH3.h" -#include "TProfile.h" -#include "TProfile2D.h" -#include "TKey.h" -#include "TFile.h" -#include "TCanvas.h" -#include "TRandom.h" -#include "TApplication.h" - -#include <cmdl/cmdargs.h> -#include <ipc/core.h> -#include <owl/timer.h> - -// OH include files -#include <oh/OHRootProvider.h> -#include <oh/OHRootReceiver.h> - - - -#include <is/infoT.h> -#include <is/infodictionary.h> - - -int main( int argc, char ** argv ) -{ - - IPCCore::init( argc, argv ); - //TApplication theApp("App", 0, 0); - // - // Get command line arguments - CmdArgStr partition_name( 'p', "partition", "partition_name", - "Partition name"); - CmdArgStr server_name( 's', "server", "server_name", - "OH (IS) Server name"); - CmdArgStr provider_name( 'n', "provider", "provider_name", - "Histogram provider name"); - CmdArgStr histogram_name( 'h', "histogram", "histogram_name", - "Histogram type name"); - CmdArgStr provider_name2( "n2", "provider", "provider_name2", - "Histogram provider name 2"); - CmdArgStr histogram_name2( "h2", "histogram", "histogram_name2", - "Histogram type name 2"); - CmdArgStr level_name( 'L', "level_name", "level_name", "level EF, L2 or L2EF"); - CmdArgInt n_sleep('d',"delay","n_sleep","delay between publishing ",1); - - CmdLine cmd( *argv, &partition_name, &server_name, &provider_name,&histogram_name,&level_name,&n_sleep,0); - - CmdArgvIter arg_iter( --argc, ++argv ); - cmd.description( "OH histogram publisher utility" ); - cmd.parse( arg_iter ); - - - if( partition_name.isNULL( ) ) partition_name = "MyTestPartition"; - if( server_name.isNULL( ) ) server_name = "Histogramming"; - if( provider_name.isNULL( ) ) provider_name = "Top-EF-EBEF-Segment"; - //if( histogram_name.isNULL( ) ) histogram_name = "/EXPERT/TrigSteer_EF/signatureAcceptance"; - if( histogram_name.isNULL( ) ) histogram_name = "signatureAcceptance"; - - if( provider_name2.isNULL( ) ) provider_name2 = "Top-LVL2-L2-Segment"; - //if( histogram_name2.isNULL( ) ) histogram_name2 = "/EXPERT/TrigSteer_L2/signatureAcceptance"; - if( histogram_name2.isNULL( ) ) histogram_name2 = "signatureAcceptance"; - int delay=(int)n_sleep; if(delay<1)delay=1; - if( level_name.isNULL() )level_name="EF"; - - std::string level((const char*)level_name); - cout<<"publish_test_histo (delay "<<delay<<") to Partition "<<partition_name<<" server "<<server_name<<" level "<<level_name<<endl; - if(level.find("L2") != std::string::npos ) - cout<<" for level L2 use provider "<<provider_name2<<" and histogram "<<histogram_name2<<endl; - if(level.find("EF") != std::string::npos ) - cout<<" for level EF use provider "<<provider_name<<" and histogram "<<histogram_name<<endl; - - int tag = -1; - int bins_number = 10; - - - // - // Create a ROOT provider - IPCPartition p( partition_name ); - - - //publish run number - - ISInfoDictionary dict( p ); - - char pubname[100]; - ISInfoInt runNr(123456); - int lb=1; - cout << " new example runnr " << runNr <<" lb="<<lb<< endl; - try { - sprintf( pubname, "%s.LB_CTP_%d_%d","LumiBlock",(int)runNr,lb); - dict.insert( pubname , runNr ); - } - catch(...){ - sprintf( pubname, "%s.LB_CTP_%d_%d","LumiBlock", (int) runNr, lb); - dict.update( pubname , runNr ); - } - - - OHRootProvider * provider = 0; - OHRootProvider * provider2 = 0; - cout<<" create OHRootProvider "<<endl; - - try - { - if(level.find("EF") != std::string::npos ) provider = new OHRootProvider( p, (const char*)server_name, (const char*)provider_name ); - } - catch( daq::oh::Exception & ex ) - { - ers::fatal( ex ); - return 1; - } - try - { - if(level.find("L2") != std::string::npos ) provider2 = new OHRootProvider( p, (const char*)server_name, (const char*)provider_name2 ); - } - catch( daq::oh::Exception & ex ) - { - ers::fatal( ex ); - return 1; - } - - cout<<" create histo ! "<<endl; - //TH1 * histo = 0; - //histo=new TH1F((const char*)histogram_name,(const char*)histogram_name,bins_number,0.,1.); - - TH1 *histo2d=0; - histo2d=new TH2I((const char*)histogram_name,(const char*)histogram_name,bins_number,0,3,bins_number,0,3); - TH1 *histo2dL2=0; - histo2dL2=new TH2I((const char*)histogram_name2,(const char*)histogram_name2,bins_number,0,3,bins_number,0,3); - - //get histo from file - TFile *f=new TFile("debughist.root"); - TH2I *histodebug=(TH2I*)f->Get("debughist"); - TH2I *histodebugL2=(TH2I*)histodebug->Clone("debughistL2"); - - histo2d=histodebug; - histo2dL2=histodebugL2; - - // create DrawOption annotation if wanted - std::vector< std::pair<std::string,std::string> > ann; - ann=oh::util::EmptyAnnotation; - - int n_publish=0; - for ( int ilb=0; ilb<1000; ilb++ ) - { - int jump=random()%6-2; - int lb=ilb;//+jump; - if(lb==10)lb=3; - - char new_histo_name[150]; - //sprintf(new_histo_name,"/EXPERT/TrigSteer_EF/signatureAcceptance_%i",lb); - sprintf(new_histo_name,"signatureAcceptance_%i",lb); - char new_histo_name2[150]; - //sprintf(new_histo_name2,"/EXPERT/TrigSteer_L2/signatureAcceptance_%i",lb); - sprintf(new_histo_name2,"signatureAcceptance_%i",lb); - - cout<<"new LB publish "<<lb<<" --> histo "<<new_histo_name<<"/"<<new_histo_name2<<endl; - histo2d->SetName(new_histo_name); - histo2dL2->SetName(new_histo_name2); - - histo2dL2->SetTitle("Raw acceptance of signatures in L2 for Run Summary"); - - for(int ix=1;ix<histo2d->GetNbinsX();ix++){ - for(int iy=1;iy<histo2d->GetNbinsY();iy++){ - int cc=histo2d->GetBinContent(ix,iy); - if(cc>0){cc++;} - histo2d->SetBinContent(ix,iy,cc); - histo2dL2->SetBinContent(ix,iy,cc); - } - } - - int updateTimes = random()%4 + 1; - for(int i=0;i<updateTimes;i++) - { - histo2d->Fill(1,1); - try - { if(level.find("EF") != std::string::npos ){ - n_publish++; - provider -> publish( *histo2d, (const char*)new_histo_name, tag, ann ); - std::cout <<n_publish<< ". publish successfully " <<new_histo_name<<" (EF) "<< std::endl; - } - } - catch( daq::oh::Exception & ex ) - { - ers::error ( ex ); - return 1; - } - try - { - if(level.find("L2") != std::string::npos ){ - n_publish++; - provider2 -> publish( *histo2dL2, (const char*)new_histo_name2, tag, ann ); - std::cout <<n_publish<< ". publish successfully " <<new_histo_name<<" (L2) "<< std::endl; - } - } - catch( daq::oh::Exception & ex ) - { - ers::error ( ex ); - return 1; - } - - sleep(delay); - } - } - - delete histo2d; - delete histo2dL2; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_runnr.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_runnr.cpp deleted file mode 100644 index 66781f014cc60d4f0efa66e8ee0965653c5e1223..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/publish_test_runnr.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file publish_test_data.cpp - * @author Andrzej Dworak andrzej.dworak@cern.ch - * @date 13/08/2007 - * @brief Dummy data ganarator. Publishing through IS. - */ - -#include <iostream.h> -#include <ipc/core.h> - -#include "is/infoany.h" -#include <is/infoT.h> -#include <is/infodictionary.h> -#include <is/infoiterator.h> -#include <is/inforeceiver.h> -#include <is/serveriterator.h> -#include <ipc/partition.h> -#include "is/infodocument.h" - - -using namespace std; -int main( int argc, char ** argv ) -{ - - string testPartition = "MyTestPartition"; - string subscription0 = "MyTest2.LB_"; - - - cout << "Publishing data for new IS_LB 2007/08/27" << endl; - IPCCore::init( argc, argv ); - - IPCPartition partition( testPartition ); - ISInfoDictionary dict( partition ); - - char pubname[100]; - int npublish=0; - - for ( int irun=102; irun<110; irun++ ) - { - ISInfoInt runNr(irun); - for(int lb=0;lb<100;lb++){ - - cout << " new example runnr " << runNr <<" lb="<<lb<< endl; - - try { - sprintf( pubname, "MyTest2.LB_CTP_%d_%d", irun, lb); - dict.insert( pubname , runNr ); - } - catch(...){ - sprintf( pubname, "MyTest2.LB_CTP_%d_%d", irun, lb); - dict.update( pubname , runNr ); - } - npublish++; - sleep(3); - } - } - - //test with ISInfoDynAny - // IsInfoDynAny ??? - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_histo.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_histo.cpp deleted file mode 100644 index 3da504a8dc39e8d58a3e1099b49be279dcf95e7b..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_histo.cpp +++ /dev/null @@ -1,269 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/** - * @file publish_test_data.cpp - * @author Andrzej Dworak andrzej.dworak@cern.ch - * @date 13/08/2007 - * @brief Dummy data ganarator. Publishing through IS. - */ - - -#include <iostream> -using namespace std; - -#include <cmdl/cmdargs.h> -#include <ipc/core.h> -#include <owl/regexp.h> - -// OH include files -#include <TH2I.h> -#include <oh/OHRootReceiver.h> -#include <oh/OHSubscriber.h> - - - -using namespace std; -class MyReceiver : public OHRootReceiver { -public: - MyReceiver( int cnt ) - : counter_( 0 ), - output_counter_( cnt ), - maxlbdist_(10), - lbnumbers_(0), - lbdone_(0) - - { ; } - - void receive( OHRootHistogram & h) - { - - //if h is not 2D histo : return - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << ". notification has been received and "; - std::string histoname=(std::string) h.histogram->GetName(); - std::cout<<" histogram "<<histoname<<std::endl; - - //get LB number and store - string::size_type loc = histoname.find_first_not_of( "testhisto_", 0 ); - int LB=atoi(histoname.substr(loc).c_str()); - if(lbdone_.size()>0){ - lbdone_.sort(); - std::list<int>::iterator iter=lbdone_.begin(); - int oldlb=*iter; - while( LB >= *iter ){ - if( LB==*iter ){cout<<" this LB was done already! und nun ?? "<<endl;} - oldlb=*iter; iter++; - } - } - - //store LB number in sorted, unique list lbnumbers_ - unsigned int oldsize=lbnumbers_.size(); - lbnumbers_.push_back(LB); - lbnumbers_.sort();lbnumbers_.unique(); - - TH2I *hlb=new TH2I; - hlb=(TH2I*) h.histogram->Clone(); - lbhistos_.push_back(hlb); - - //this LB number not there before --> - if(lbnumbers_.size() > oldsize){ - //debug print statement - cout<<"new LB block, LBnumbers: "<<endl; - for(std::list<int>::iterator iter = lbnumbers_.begin(); iter != lbnumbers_.end(); iter++ ) - { - cout << *iter <<", "; - } - std::cout<<std::endl; - } - - - //if oldest LB more than maxlbdist_ ago : write out counters for first LB in lbnumbers_ and drop it from the list - while (lbnumbers_.size() >= maxlbdist_ ) - { - int lbout=lbnumbers_.front(); - - std::cout<<" call unpackHisto for LB ! "<<lbout<<endl; - int index=getHistoIndex(lbout); - unpackHisto(index); - std::cout<<" return from unpackHisto ! "<<index<<endl; - - lbhistos_.erase(lbhistos_.begin()+index); - lbdone_.push_back(lbout); - lbnumbers_.pop_front(); - - } - } - - return; - } - - void unpackHisto(int index) - { - - cout<<"now unpack histo "<<lbhistos_[index]->GetName()<<endl; - //unpack 2D histo for number of events - - //write counters to COOL - cout<<" and eventually write to COOL ! "<<endl; - return; - } - - int getHistoIndex(int LB) - { - //get histo for this lumiblock LB - char histogramname[50]; - sprintf(histogramname,"testhisto_%i",LB); - cout<<" get histo "<<histogramname<<" from vector of histos "<<endl; - - int index=0; - std::vector<TH1*>::iterator iter = lbhistos_.begin(); - while(iter != lbhistos_.end() && strcmp(histogramname,(const char*)(*iter)->GetName()) !=0 ){ - iter++;index++; - } - return index; - } - - void receive( vector<OHRootHistogram*> & ) - { - - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << " notifications have been received" << std::endl; - } - } - - void histogramChanged( const std::string & , const OWLTime & , OHReceiver::Reason ) - { - - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << " notifications have been received" << std::endl; - } - } - - void receive( OHRootGraph & ) - { - - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << " notifications have been received" << std::endl; - } - } - - void receive( vector<OHRootGraph*> & ) - { - - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << " notifications have been received" << std::endl; - } - } - - void receive( OHRootGraph2D & ) - { - - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << " notifications have been received" << std::endl; - } - } - - void receive( vector<OHRootGraph2D*> & ) - { - - if ( ++counter_%output_counter_ == 0 ) - { - std::cout << counter_ << " notifications have been received" << std::endl; - } - } - - void setMax(unsigned int max) - { - maxlbdist_ = max; - } - - - - - -private: - - int counter_; - int output_counter_; - unsigned int maxlbdist_; - std::list<int> lbnumbers_; - std::list<int> lbdone_; - std::vector<TH1*>lbhistos_; -}; - - -int main( int argc, char ** argv ) -{ - - IPCCore::init( argc, argv ); - - // - // Get parameters from the command line - // - CmdArgStr partition_name( 'p', "partition", "partition_name", - "Partition name", CmdArg::isREQ ); - CmdArgStr server_name( 's', "server", "server_name", - "OH (IS) Server name", CmdArg::isREQ ); - CmdArgStr provider_name( 'n', "provider", "provider_name", - "Histogram provider name" ); - CmdArgStr histogram_name( 'h', "histogram", "histogram_name", - "Histogram type name" ); - //CmdArgInt iters('i', "iters", "iterations", "number of iterations to report"); - // CmdArgBool value ('v', "value", "subscribe for receiving histogram values (default off)."); - - - CmdLine cmd( *argv, &partition_name, &server_name, - &provider_name, &histogram_name, 0 ); - - - //string partition_name = "MyTestPartition"; - //string server_name = "Histogramming"; - //string provider_name= ".*"; - //string histogram_name =".*"; - - int iters = 1; - bool value = true;//false; - - CmdArgvIter arg_iter( --argc, ++argv ); - cmd.description( "OH Histogram display utility" ); - cmd.parse(arg_iter); - - - - if( provider_name.isNULL( ) ) provider_name = ".*"; - if( histogram_name.isNULL( ) ) histogram_name = ".*"; - - try - { - MyReceiver receiver( iters ); - receiver.setMax(4); - - IPCPartition p( partition_name ); - OHSubscriber ohhs( p, (const char *)server_name, receiver, false ); - OWLRegexp provider(provider_name); - OWLRegexp histogram(histogram_name); - ohhs.subscribe( provider, histogram, value ); - - IPCServer server; - - std::cout << "OH test receiver for the \"" << provider_name << ":" << histogram_name << - "\" has been started in the \"" << partition_name << "\" partition" << std::endl; - - server.run(); - } - catch ( daq::oh::Exception & ex ) - { - ers::fatal( ex ); - return 1; - } - - return 0; -} diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_keys.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_keys.cpp deleted file mode 100644 index 711b0f9a6fdf6b7b6e13453acc4b696bde3ce7b7..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_keys.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream.h> -#include <ostream.h> - - -#include <is/infoany.h> -#include <is/infoT.h> -#include <is/infodictionary.h> -#include <is/infoiterator.h> -#include <is/inforeceiver.h> -#include <is/serveriterator.h> -#include <ipc/partition.h> -#include <is/infodocument.h> - -#include <cmdl/cmdargs.h> -#include <ipc/core.h> -#include <owl/timer.h> - - -int getRunNumber(std::string partition_name,std::string server,std::string crit){ - - int superMasterKey=-99; - int l1MasterKey=-99; - int l1PrescaleKey=-99; - - try{ - IPCPartition partition( partition_name ); - ISInfoDictionary dict(partition); - ISInfoIterator ii( partition, server,ISCriteria( crit)); - - - while( ii() ) - { - - ISInfoAny isa; - ii.value( isa ); - int attr_number=isa.countAttributes(); - for (int i = 0; i < attr_number; i++ ) { - switch ( isa.getAttributeType() ){ - case ISType::U32: - if ( isa.isAttributeArray() ) - { - std::vector<unsigned long> value; - isa >> value; - - //for ( size_t ii = 0; ii < value.size(); ii++){ - // std::cout <<" attribute loop "<<i<<" attribute array loop "<<ii<<" : "<< value[ii] << " "; - //} - } - else - { - int value; - isa >> value; - std::cout <<" attribute loop "<<i<<" value "<< value;//<<" name ? "<<isa.name(); - if(i==0)superMasterKey=value; - if(i==1)l1MasterKey=value; - if(i==2)l1PrescaleKey=value; - } - std::cout << std::endl; - - break; - //default: - //std::cout<<" Attribute Type is not what I want "<<isa.getAttributeType()<<std::endl; - } - } - } - cout<<"return from here...superMasterKey "<<superMasterKey<<endl; - return superMasterKey; - }catch(...){ - cout<<" could not receive TrigConfKeys ! "<<endl; - return superMasterKey; - } -} - -using namespace std; -int main( int argc, char ** argv ){ - - IPCCore::init( argc, argv ); - - // Get command line arguments - CmdArgStr partition_name( 'p', "partition", "partition_name", - "Partition name"); - CmdArgStr server_name( 's', "server", "server_name", - "OH (IS) Server name"); - CmdArgStr is_criteria( 'c', "criteria","is_criteria", "ISCriteria "); - CmdLine cmd( *argv, &partition_name, &server_name, &is_criteria, 0); - - CmdArgvIter arg_iter( --argc, ++argv ); - cmd.description( "OH histogram publisher utility" ); - cmd.parse( arg_iter ); - - - //partition MyTestPartition - //server_name MyTest2.LB_CTP - - if( partition_name.isNULL( ) ) partition_name = "MyTestPartition"; - if( server_name.isNULL( ) ) server_name = "MyTest2.LB_CTP"; - if( is_criteria.isNULL( ) ) is_criteria = "TrigConfKeys.*"; - cout<<" try to find TrigConfKeys in "<<partition_name<<" "<<server_name<<endl; - std::string testPartition((const char*) partition_name); - std::string server((const char*) server_name); - std::string crit((const char*) is_criteria); - int runnr=getRunNumber(testPartition,server,crit); - cout<<" returned ! "<<runnr<<endl; - return 0; -} - - diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_runnr.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_runnr.cpp deleted file mode 100644 index 894d2301fa20c46570347a5ad0bee658a1b5d986..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_runnr.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream.h> -#include <ostream.h> - - -#include "is/infoany.h" -#include <is/infoT.h> -#include <is/infodictionary.h> -#include <is/infoiterator.h> -#include <is/inforeceiver.h> -#include <is/serveriterator.h> -#include <ipc/partition.h> -#include <is/infodocument.h> - -#include <cmdl/cmdargs.h> -#include <ipc/core.h> -#include <owl/timer.h> - - -int getRunNumber(std::string partition_name,std::string server){ - - try{ - IPCPartition partition( partition_name ); - ISInfoDictionary dict(partition); - - - ISInfoInt runnumber; - - ISInfoIterator ii( partition, server,ISCriteria( ".*" )); - - - int run=-99; - while( ii() ) - { - - ISInfoAny isa; - ii.value( isa ); - - - std::string object_name(ii.name()); - std::string::size_type loc = object_name.find( "LB_CTP_", 0 ); - std::string helpstr=object_name.substr(loc+7).c_str(); - std::string::size_type loc2= helpstr.find("_",0); - int irun=atoi(helpstr.substr(0,loc2).c_str()); - run = irun > run ? irun : run; - - } - cout<<"highest published runnumber "<<run<<endl; - return run; - }catch(...){ - cout<<" could not receive runnumber ! "<<endl; - return -99; - } -} -using namespace std; -int main( int argc, char ** argv ){ - - IPCCore::init( argc, argv ); - - // Get command line arguments - CmdArgStr partition_name( 'p', "partition", "partition_name", - "Partition name"); - CmdArgStr server_name( 's', "server", "server_name", - "OH (IS) Server name"); - - CmdLine cmd( *argv, &partition_name, &server_name, 0); - - CmdArgvIter arg_iter( --argc, ++argv ); - cmd.description( "OH histogram publisher utility" ); - cmd.parse( arg_iter ); - - - //partition MyTestPartition - //server_name MyTest2.LB_CTP - - if( partition_name.isNULL( ) ) partition_name = "MyTestPartition"; - if( server_name.isNULL( ) ) server_name = "MyTest2.LB_CTP"; - - cout<<" get latest Run Number published to "<<partition_name<<" "<<server_name<<endl; - std::string testPartition((const char*) partition_name); - std::string server((const char*) server_name); - - int runnr=getRunNumber(testPartition,server); - return 0; -} - - diff --git a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_runnr2.cpp b/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_runnr2.cpp deleted file mode 100644 index e36b24e7df3b2a5800eb57d2cdb01ddfb92b4e97..0000000000000000000000000000000000000000 --- a/HLT/Trigger/TrigMonitoring/HLTRates2COOL/testpublish/receive_test_runnr2.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#include <iostream.h> -#include <ostream.h> - - - -#include <is/infoany.h> -#include <is/infoT.h> -#include <is/infodictionary.h> -#include <is/infoiterator.h> -#include <is/inforeceiver.h> -#include <is/serveriterator.h> -#include <ipc/partition.h> -#include <is/infodocument.h> -#include <is/infodynany.h> - -#include <cmdl/cmdargs.h> -#include <ipc/core.h> -#include <owl/timer.h> - -int getRunNumber2(std::string partition_name,std::string server){ - int run=-99; - std::cout<<" try to getRunNumber2 from "<<partition_name<<"."<<server<<"."<<" by looking for attribute with name run_number "<<std::endl; - try{ - - IPCPartition partition( partition_name ); - ISInfoDictionary dict(partition); - ISInfoDynAny ida2; - std::string name = server; - name += ".RunParams"; - - dict.getValue( name, ida2 ); - ISInfoDocument::Attribute helpme= ida2.getAttributeDescription(partition,"run_number"); - run = (int) ida2.getAttributeValue<unsigned int>( partition,"run_number"); - cout<<" found attribute "<<helpme.description()<<" name "<<helpme.name()<<" value ?"<<run<<endl; - - }catch(...){ - run=-99; - } - return run; -} - -int getRunNumber(std::string partition_name,std::string server,std::string crit){ - - std::cout<<" try to get run number from "<<partition_name<<"."<<server<<"."<<crit<<" by using the first attribute "<<std::endl; - try{ - - IPCPartition partition( partition_name ); - ISInfoDictionary dict(partition); - - - ISInfoInt runnumber; - - ISInfoIterator ii( partition, server,ISCriteria( crit)); - - - int run=-99; - while( ii() ) - { - - ISInfoAny isa; - ii.value( isa ); - - int attr_number=isa.countAttributes(); - - for (int i = 0; i < attr_number; i++ ) { - switch ( isa.getAttributeType() ){ - case ISType::U32: - if ( isa.isAttributeArray() ) - { - std::vector<unsigned long> value; - isa >> value; - //for ( size_t ii = 0; ii < value.size(); ii++){} - } - else - { - int value; - isa >> value; - //std::cout <<" attribute loop "<<i<<" value "<< value;//<<" name ? "<<isa.name(); - if(i==0)run=value; - } - //std::cout << std::endl; - - break; - //default: - //std::cout<<" Attribute Type is not what I want "<<isa.getAttributeType()<<std::endl; - } - } - } - std::cout<<" return from here...with runnr "<<run<<std::endl; - return run; - }catch(...){ - std::cout<<" could not receive runnumber ! "<<std::endl; - return -99; - } -} -using namespace std; -int main( int argc, char ** argv ){ - - IPCCore::init( argc, argv ); - - // Get command line arguments - CmdArgStr partition_name( 'p', "partition", "partition_name", - "Partition name"); - CmdArgStr server_name( 's', "server", "server_name", - "OH (IS) Server name"); - CmdArgStr is_criteria( 'c', "criteria","is_criteria", "ISCriteria "); - CmdArgStr method('m',"method","method","Method"); - - CmdLine cmd( *argv, &partition_name, &server_name, &is_criteria, &method, 0); - - - CmdArgvIter arg_iter( --argc, ++argv ); - cmd.description( "OH histogram publisher utility" ); - cmd.parse( arg_iter ); - - - //partition MyTestPartition - //server_name MyTest2.LB_CTP - - if( partition_name.isNULL( ) ) partition_name = "MyTestPartition"; - if( server_name.isNULL( ) ) server_name = "RunParams"; - if( is_criteria.isNULL( ) ) is_criteria = "RunParams*"; - if(method.isNULL() ) method="1"; - int runNumberMethod = atoi(method); - - cout<<"try to find runnumber in "<<partition_name<<" "<<server_name<<" "<<is_criteria<<endl; - std::string testPartition((const char*) partition_name); - std::string server((const char*) server_name); - std::string crit((const char*) is_criteria); - int runnr=runNumberMethod ==1 ? getRunNumber(testPartition,server,crit) : getRunNumber2(testPartition,server); - cout<<"returned Run number "<<runnr<<endl; - return 0; -} - -