/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
DybChannelQualitySvc Class Reference

Implement IChannelQualitySvc. More...

#include <DybChannelQualitySvc.h>

Inheritance diagram for DybChannelQualitySvc:
Inheritance graph
[legend]
Collaboration diagram for DybChannelQualitySvc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DybChannelQualitySvc (const std::string &name, ISvcLocator *svc)
virtual ~DybChannelQualitySvc ()
virtual StatusCode initialize ()
const IChannelQualitychannelQuality (const ServiceMode &sm)
StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Types

typedef std::map< ServiceMode,
DybChannelQuality * > 
CacheMap_t

Private Member Functions

const IChannelQualityget (const ServiceMode &sm)
void clearChannel (const ServiceMode &timeless_sm)

Private Attributes

CacheMap_t m_cache
ServiceMode m_lastSM
bool m_useHV
 Property: UseHV, default is false.
bool m_useNoisy
 Property: UseNoisy, default is false.
std::vector< std::string > m_chor_strings
 Property: ChannelOverride, default is empty.
std::vector< Dyb::ChannelOverridem_chor

Detailed Description

Implement IChannelQualitySvc.

This uses tables AdWpHvMap, AdWpHvSetting, DcsAdWpHv and FIXME: the forth one.

bv@bnl.gov Wed Aug 8 16:19:46 2012

Definition at line 162 of file DybChannelQualitySvc.h.


Member Typedef Documentation

Definition at line 194 of file DybChannelQualitySvc.h.


Constructor & Destructor Documentation

DybChannelQualitySvc::DybChannelQualitySvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 497 of file DybChannelQualitySvc.cc.

    : Service(name,svc)
    , m_lastSM()
{
    declareProperty("UseHV", m_useHV=false,"Consider HV tables");
    declareProperty("UseNoisy", m_useNoisy=false,"Consider hard coded noisy channels");

    declareProperty("ChannelOverride", m_chor_strings,
                    "List of channel override strings.");

}
DybChannelQualitySvc::~DybChannelQualitySvc ( ) [virtual]

Definition at line 510 of file DybChannelQualitySvc.cc.

{
}

Member Function Documentation

StatusCode DybChannelQualitySvc::initialize ( ) [virtual]

Definition at line 514 of file DybChannelQualitySvc.cc.

{
    StatusCode sc = this->Service::initialize();
    if( sc.isFailure() ) return sc;

    size_t nchor = m_chor_strings.size();
    //cerr << "DybChannelQualitySvc::initialize() with #chor = " << nchor << endl;
    for (size_t ind=0; ind<nchor; ++ind) {
        string chor = m_chor_strings[ind];
        m_chor.push_back(Dyb::ChannelOverride(chor));
        //cerr << "\tchor: " << chor << endl;
    }
    return StatusCode::SUCCESS;
}
const IChannelQuality * DybChannelQualitySvc::channelQuality ( const ServiceMode sm) [virtual]

Implements IChannelQualitySvc.

Definition at line 554 of file DybChannelQualitySvc.cc.

{
    // First to trivial tests in case users is lazy and re-calls us

    if (sm.context() == m_lastSM.context() && sm.task() == m_lastSM.task()) {
        //cerr << "Clean on ServiceMode value" << endl;
        return this->get(sm);
    }
    m_lastSM = sm;


    // Fresh SM, got to dig deeper

    //cerr << "Checking cache based on " << sm.context().AsString("E") << endl;

    Context ctx = sm.context();
    ctx.SetTimeStamp(TimeStamp::GetBOT());
    ServiceMode timeless_sm(ctx,sm.task());

    // Get, and make if needed, the DCQ for the given SM, neglecting
    // the time.
    DybChannelQuality* dcq = 0;
    CacheMap_t::iterator it = m_cache.find(timeless_sm);

    try {

        if (it == m_cache.end()) {  // first time to see this SM
            DybChanQualCache* dcq_cache = new DybChanQualCache(sm, m_useHV, m_useNoisy);
                                // full SM here!
            dcq = new DybChannelQuality(dcq_cache, m_chor, 15.0, m_useHV, m_useNoisy);
            m_cache[timeless_sm] = dcq;
            //cerr << "New cache based on " << sm.context().AsString("E") << endl;
        }
        else {                  // been there, done that
            dcq = it->second;
            bool upped = dcq->cache().update(sm.context().GetTimeStamp());
            if (upped) {
                //cerr << "Updated cache based on " << sm.context().AsString("E") << endl;
            }

        }

    }
    catch (const GaudiException& ge) {
        //cerr << "Exception during update: " << ge << " at " << sm.context().AsString("E") << endl;
        this->clearChannel(timeless_sm);
        dcq = 0;
        return 0;
    }

    if (dcq && dcq->cache().empty()) {
        //cerr << "Got ChannelQuality but it is empty: at " << sm.context().AsString("E") << endl;
        this->clearChannel(timeless_sm);
        dcq = 0;
        return 0;
    }

    return dcq;
}
StatusCode DybChannelQualitySvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
)

Definition at line 614 of file DybChannelQualitySvc.cc.

{
    StatusCode sc = StatusCode::FAILURE;
    if (ppvInterface) {
        *ppvInterface = 0;
    
        if (IChannelQualitySvc::interfaceID().versionMatch(riid)) {
            *ppvInterface = static_cast<IChannelQualitySvc*>(this);
            sc = StatusCode::SUCCESS;
            addRef();
        }
        else sc = Service::queryInterface( riid, ppvInterface );    
    }
    return sc;
}
const IChannelQuality * DybChannelQualitySvc::get ( const ServiceMode sm) [private]

Definition at line 529 of file DybChannelQualitySvc.cc.

{
    ServiceMode timeless(Context(sm.context().GetSite(), 
                                 sm.context().GetSimFlag(),
                                 TimeStamp(0,0),
                                 sm.context().GetDetId()),
                         sm.task());
    CacheMap_t::iterator it = m_cache.find(timeless);
    if (it == m_cache.end()) {
        return 0;
    }
    return it->second;
}
void DybChannelQualitySvc::clearChannel ( const ServiceMode timeless_sm) [private]

Definition at line 543 of file DybChannelQualitySvc.cc.

{
    CacheMap_t::iterator it = m_cache.find(timeless_sm);
    if (it == m_cache.end()) {
        return;                 // can't clear what we don't have
    }

    delete it->second;
    m_cache.erase(it);
}

Member Data Documentation

Definition at line 195 of file DybChannelQualitySvc.h.

Definition at line 198 of file DybChannelQualitySvc.h.

Property: UseHV, default is false.

If true then consult the HV database tables and include the result in the good() method. If false, always consider HV good.

Definition at line 203 of file DybChannelQualitySvc.h.

Property: UseNoisy, default is false.

If true then consult the hard-coded noisy channels and include the result in the good() method. If false, noisy channel information ignored and always considered good.

Definition at line 209 of file DybChannelQualitySvc.h.

std::vector<std::string> DybChannelQualitySvc::m_chor_strings [private]

Property: ChannelOverride, default is empty.

A list of channel quality overrides. Each override is a string in the form of a colon-separated list of: <quality>:<FeeChannelId>:<STARTTIME>:<STOPTIME>

<quality> is a string either "good" or "bad"

<FeeChannelId>: is the fully packed data integer of the FEE channel ID in decimal

STARTTIME: is the unix time stamp integer indicating the start of the validity of the <quality>. 0 indicates the beginning of time (BoT)

STOPTIME: is the unix time stamp integer indicating the end of the validity of the <quality>. 0 indicates the end of time (EoT)

Definition at line 229 of file DybChannelQualitySvc.h.

Definition at line 230 of file DybChannelQualitySvc.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:00:00 for DybMetaDataSvc by doxygen 1.7.4