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

In This Package:

Public Types | Public Member Functions | Private Attributes
DybChannelQuality Class Reference

This class is like a view into the cache but it owns the cache. More...

#include <DybChannelQualitySvc.h>

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

List of all members.

Public Types

typedef std::vector
< DayaBay::FeeChannelId
ChannelSet_t

Public Member Functions

 DybChannelQuality (DybChanQualCache *cdc, std::vector< Dyb::ChannelOverride > &chor, float delta_hv=15, bool usehv=false, bool usenoisy=false)
virtual ~DybChannelQuality ()
DybChanQualCachecache ()
virtual bool good (DayaBay::FeeChannelId chid) const
 Return a nominal judgment that channel is good to use or not.
virtual float hvRequested (DayaBay::FeeChannelId chid) const
 Return the requested HV setting.
virtual float hvMeasured (DayaBay::FeeChannelId chid) const
 Return the measured HV setting.
virtual float noise (DayaBay::FeeChannelId chid) const
 Return the noise level of the channel.
virtual
IChannelQuality::ChannelSet_t 
channels () const
 Return all known channel IDs.
virtual int goodDqCp (DayaBay::FeeChannelId chid) const

Private Attributes

DybChanQualCachem_cdc
float m_deltaHV
bool m_useHV
bool m_useNoisy
std::vector< Dyb::ChannelOverridem_chor

Detailed Description

This class is like a view into the cache but it owns the cache.

Definition at line 120 of file DybChannelQualitySvc.h.


Constructor & Destructor Documentation

DybChannelQuality::DybChannelQuality ( DybChanQualCache cdc,
std::vector< Dyb::ChannelOverride > &  chor,
float  delta_hv = 15,
bool  usehv = false,
bool  usenoisy = false 
)

Definition at line 374 of file DybChannelQualitySvc.cc.

    : m_cdc(cdc)
    , m_deltaHV(delta_hv)
    , m_useHV(usehv)
    , m_useNoisy(usenoisy)
    , m_chor(chor)
{
    
}
DybChannelQuality::~DybChannelQuality ( ) [virtual]

Definition at line 386 of file DybChannelQualitySvc.cc.

{
    delete m_cdc;
    m_cdc = 0;
}

Member Function Documentation

DybChanQualCache& DybChannelQuality::cache ( ) [inline]

Definition at line 131 of file DybChannelQualitySvc.h.

{ return *m_cdc; }
bool DybChannelQuality::good ( DayaBay::FeeChannelId  chid) const [virtual]

Return a nominal judgment that channel is good to use or not.

Implements IChannelQuality.

Definition at line 392 of file DybChannelQualitySvc.cc.

{
    size_t nchors = m_chor.size();
    if (nchors) {
        //cerr << "Looking for " << chid.asString() << " out of  " << nchors << endl;
        for (size_t ind=0; ind < nchors; ++ind) {
            const Dyb::ChannelOverride& chor = m_chor[ind];
            if (chor.channel != chid) {
                //cerr << "\twrong channel != " << chor.channel.asString() << endl;
                continue;
            }
            if (!m_cdc->covers(chor.start, chor.stop)) {
                //cerr << "\tdoes not cover " << chor.start.AsString() << " -- " << chor.stop.AsString() << endl;
                continue;
            }
            //cerr << "\tgot it, qual = " << chor.good << endl;
            return chor.good;
        }
    }
    else {
        //cerr << "No overrides " << chid.asString() << endl;
    }

    if (m_useHV) {
        float requested = hvRequested(chid);
        if (requested < m_deltaHV) {
            return false;
        }

        float measured = hvMeasured(chid);
        if (measured < m_deltaHV) {
            return false;
        }

        if (fabs(requested-measured) > m_deltaHV) {
            return false;
        }
    }

    if (m_useNoisy) {
        if (noise(chid) > Dyb::noisy_channel_cut) {
            return false;
        }
    }

    // Return bad if channel is bad or not found (-1).  If not found
    // something is really wrong!  We should really assert that it's
    // not negative but the desired strategy from the calib group is
    // to fail towards acceptance.  So the impossible is merely
    // considered bad here.
    if (goodDqCp(chid) <= 0) {
        return false;
    }

    // Hurrah!
    return true;
}
float DybChannelQuality::hvRequested ( DayaBay::FeeChannelId  chid) const [virtual]

Return the requested HV setting.

Implements IChannelQuality.

Definition at line 458 of file DybChannelQualitySvc.cc.

{
    return m_cdc->setted_hv()[chid];
}
float DybChannelQuality::hvMeasured ( DayaBay::FeeChannelId  chid) const [virtual]

Return the measured HV setting.

Implements IChannelQuality.

Definition at line 463 of file DybChannelQualitySvc.cc.

{
    return m_cdc->getted_hv()[chid];
}
float DybChannelQuality::noise ( DayaBay::FeeChannelId  chid) const [virtual]

Return the noise level of the channel.

Implements IChannelQuality.

Definition at line 468 of file DybChannelQualitySvc.cc.

{
    DybChanQualCache::HvValMap_t& n = m_cdc->noise();
        
    DybChanQualCache::HvValMap_t::iterator it = n.find(chid);
    if (it == n.end()) { return 0.0; } // no noise is good noise
    return it->second;
}
IChannelQuality::ChannelSet_t DybChannelQuality::channels ( ) const [virtual]

Return all known channel IDs.

Implements IChannelQuality.

Definition at line 480 of file DybChannelQualitySvc.cc.

{
    IChannelQuality::ChannelSet_t ret;

    DybChanQualCache::DqCpMap_t& cqmap = m_cdc->channel_quality();
    DybChanQualCache::DqCpMap_t::iterator it, done = cqmap.end();

    for (it=cqmap.begin(); it != done; ++it) {
        ret.push_back(it->first);
    }
    return ret;
}
int DybChannelQuality::goodDqCp ( DayaBay::FeeChannelId  chid) const [virtual]

Implements IChannelQuality.

Definition at line 450 of file DybChannelQualitySvc.cc.

{
    DybChanQualCache::DqCpMap_t& dqcp = m_cdc->channel_quality();
    DybChanQualCache::DqCpMap_t::iterator it = dqcp.find(chid);
    if (it == dqcp.end()) { return -1; }
    return it->second;
}

Member Data Documentation

Definition at line 154 of file DybChannelQualitySvc.h.

Definition at line 155 of file DybChannelQualitySvc.h.

Definition at line 156 of file DybChannelQualitySvc.h.

Definition at line 156 of file DybChannelQualitySvc.h.

Definition at line 157 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