Commit d91b0ab7 authored by Andrea Petrucci's avatar Andrea Petrucci
Browse files

references #251: first working version

parent 6d72909b
......@@ -20,6 +20,8 @@
#include "toolbox/mem/MemoryPoolFactory.h"
#include "toolbox/mem/Pool.h"
#include "toolbox/net/URN.h"
#include "toolbox/task/TimerListener.h"
#include "toolbox/task/TimerEvent.h"
#include "toolbox/task/Action.h"
#include "toolbox/task/WorkLoop.h"
#include "toolbox/task/WorkLoopFactory.h"
......@@ -57,7 +59,7 @@ namespace evb {
*/
template<class Configuration,class StateMachine>
class EvBApplication :
public xdaq::Application, public xgi::framework::UIManager, public xdata::ActionListener, public toolbox::ActionListener
public xdaq::Application, public xgi::framework::UIManager, public xdata::ActionListener, public toolbox::ActionListener,public toolbox::task::TimerListener
{
public:
......@@ -92,6 +94,8 @@ namespace evb {
void initialize();
virtual void timeExpired (toolbox::task::TimerEvent& e)= 0;
virtual void do_appendApplicationInfoSpaceItems(InfoSpaceItems&) = 0;
virtual void do_appendMonitoringInfoSpaceItems(InfoSpaceItems&) = 0;
virtual void do_updateMonitoringInfo() = 0;
......@@ -163,7 +167,6 @@ namespace evb {
////////////////////////////////////////////////////////////////////////////////
// Implementation follows //
////////////////////////////////////////////////////////////////////////////////
template<class Configuration,class StateMachine>
evb::EvBApplication<Configuration,StateMachine>::EvBApplication
(
......
......@@ -8,6 +8,7 @@
#include <string>
#include <utility>
#include <vector>
#include <map>
#include "toolbox/task/TimerListener.h"
......@@ -83,6 +84,8 @@ namespace evb {
};
using DipTopics = std::vector<DipTopic>;
DipTopics dipTopics_;
std::map<std::string,int> dipTopicsMap_;
xdata::UnsignedInteger32 dipBridgeRegisterTimeout_;
MetaData::Luminosity lastLuminosity_;
......@@ -98,7 +101,7 @@ namespace evb {
mutable std::mutex dcsMutex_;
std::string maskedDipTopics_;
const uint64_t numeratorNanosDIPTime_ = (1LL<<32)/1000000;
//const uint64_t numeratorNanosDIPTime_ = (1LL<<32)/1000000;
};
using MetaDataRetrieverDIPBridgePtr = std::shared_ptr<MetaDataRetrieverDIPBridge>;
......
......@@ -32,9 +32,9 @@ evb::EVM::EVM(xdaq::ApplicationStub* app) :
void evb::EVM::timeExpired (toolbox::task::TimerEvent& e) {
std::cout<< "Called evb::EVM::timeExpired "<< e.type()<<std::endl;
xdata::String dipNodes = this->configuration_->dipNodes;
xdata::String maskedDipTopics = this->configuration_->maskedDipTopics;
evb::readoutunit::MetaDataRetrieverDIPBridgePtr dipRetriver = this->input_.get()->getMetaDataRetrieverDIPBridgePtr();
dipRetriver->registerToDipBridge(dipNodes);
dipRetriver->registerToDipBridge(maskedDipTopics);
}
......
......@@ -40,34 +40,63 @@ evb::readoutunit::MetaDataRetrieverDIPBridge::MetaDataRetrieverDIPBridge(
// Attention: DCS HV values have to come first and in the order of the HV bits
// defined in DataFormats::OnlineMetaData::DCSRecord::Partition in CMSSW
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_ECAL/CMS_ECAL_BP/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_ECAL/CMS_ECAL_BP/state"]= 0;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_ECAL/CMS_ECAL_BM/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_ECAL/CMS_ECAL_BM/state"]= 1;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_ECAL/CMS_ECAL_EP/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_ECAL/CMS_ECAL_EP/state"]= 2;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_ECAL/CMS_ECAL_EM/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_ECAL/CMS_ECAL_EM/state"]= 3;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HEHBa/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HEHBa/state"]= 4;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HEHBb/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HEHBb/state"]= 5;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HEHBc/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HEHBc/state"]= 6;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HF/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HF/state"]= 7;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HO/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_HO/state"]= 8;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_RPC/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_RPC/state"]= 9;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_DT/CMS_DT_DT0/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_DT/CMS_DT_DT0/state"]= 10;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_DT/CMS_DT_DTP/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_DT/CMS_DT_DTP/state"]= 11;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_DT/CMS_DT_DTM/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_DT/CMS_DT_DTM/state"]= 12;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_CSC/CMS_CSCP/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_CSC/CMS_CSCP/state"]= 13;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_CSC/CMS_CSCM/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_CSC/CMS_CSCM/state"]= 14;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_CASTOR/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_CASTOR/state"]= 15;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_HCAL/CMS_HCAL_ZDC/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_HCAL/CMS_HCAL_ZDC/state"]= 16;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TIB_TID/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TIB_TID/state"]= 17;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TOB/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TOB/state"]= 18;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TECP/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TECP/state"]= 19;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TECM/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_TRACKER/CMS_TRACKER_TECM/state"]= 20;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_PIXEL/CMS_PIXEL_BPIX/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_PIXEL/CMS_PIXEL_BPIX/state"]= 21;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_PIXEL/CMS_PIXEL_FPIX/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_PIXEL/CMS_PIXEL_FPIX/state"]= 22;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_ECAL/CMS_ECAL_ESP/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_ECAL/CMS_ECAL_ESP/state"]= 23;
dipTopics_.push_back( DipTopic("dip/CMS/DCS/CMS_ECAL/CMS_ECAL_ESM/state",unavailable) );
dipTopicsMap_["dip/CMS/DCS/CMS_ECAL/CMS_ECAL_ESM/state"]= 24;
dipTopics_.push_back( DipTopic("dip/CMS/MCS/Current",unavailable) );
dipTopicsMap_["dip/CMS/MCS/Current"]= 25;
dipTopics_.push_back( DipTopic("dip/CMS/BRIL/Luminosity",unavailable) );
dipTopicsMap_["dip/CMS/BRIL/Luminosity"]= 26;
dipTopics_.push_back( DipTopic("dip/CMS/Tracker/BeamSpot",unavailable) );
dipTopicsMap_["dip/CMS/Tracker/BeamSpot"]= 27;
dipTopics_.push_back( DipTopic("dip/CMS/CTPPS/detectorFSM",unavailable) );
dipTopicsMap_["dip/CMS/CTPPS/detectorFSM"]= 28;
b2in::nub::deferredbind(this->getOwnerApplication(),this, &evb::readoutunit::MetaDataRetrieverDIPBridge::handleMessage);
dipBridgeSubscriptions_ = false;
......@@ -252,7 +281,15 @@ void evb::readoutunit::MetaDataRetrieverDIPBridge::handleMessage(toolbox::mem::R
xdata::Serializable* p;
p = table.getValueAt(0, "DipTimestamp");
xdata::Integer64 timeStampNanos = dynamic_cast<xdata::Integer64*>(p)->value_;
uint64_t dipTime = static_cast<uint64_t>((timeStampNanos * numeratorNanosDIPTime_) >> 32);
std::cout << "time in nanoseconds=" <<timeStampNanos<<std::endl;
uint64_t dipTime = static_cast<uint64_t>(timeStampNanos / 1000000UL);
std::map<std::string,int> ::iterator it;
it = dipTopicsMap_.find(topicName);
if(it != dipTopicsMap_.end()) {
dipTopics_[it->second].second = okay;
}
if ( topicName == "dip/CMS/BRIL/Luminosity" )
{
std::lock_guard<std::mutex> guard(luminosityMutex_);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment